Posts

Showing posts from September, 2010

java - Android application launching from console -

is possible make console android app using android api? application must hidden in package manager. can give me examples? in c++/java. do mean want console in android can type in java commands? if so, no answer. android not have option use reflection. , reflection needed create virtual machine can execute commands.

ios - A big tableview from SQL with filter - what's the most efficient way? -

i've been trying sqlite tableviews, iam struggling find way work data - , don't seem find references online either. have database of postal codes (4582 rows) , need join other tables make proper use of it. iam not sure how properly, creating objects of rows take ages on device, , application becomes slow , unresponsive. at first thought instantiate 50-100 objects , load more scroll, backfire when try filter down list, or perhaps not? user able search row , text in table, not postal codes. any ideas, tips or examples on go here? use fmdatabse. use following link this http://www.icodeblog.com/2011/11/04/simple-sqlite-database-interaction-using-fmdb/ http://www.highoncoding.com/articles/836_persisting_ios_application_data_in_sqlite_database_using_fmdb.aspx

dynamic - Casting a C# DynamicObject to an arbitrary type -

i trying write nice consumer api convention-based config binder in c#. configmanager.getsection(...) returns object, want return dynamic object, when cast required type invokes mapper. is there way in c#4+ create dynamic class can handle invocation upon having explicit cast applied it? e.g. myconfig config = (myconfig)configurationmanager.getsection("some/section"); in case, dynamic object configurationmanager invoked cast perform config magic (i have solved bit) yes, dynamicobject has override-able tryconvert . when dynamicobject subclass cast (or implicitly converted assignment) tryconvert invoked, , can dynamic details invocation binder parameter before returning result. the binder.type property provides type object must converted. example, statement (string)sampleobject in c# (ctype(sampleobject, type) in visual basic), sampleobject instance of class derived dynamicobject class, binder.type returns string type. binder.explicit prope

objective c - Subclassing UIView with IBOutlets -

i've been trying long time add iboutlets uiview. well, seems impossible. created class called "recesscell". file's owner's class "recesscell" , view object's class recesscell. created outlet called "betweenperiods" , seems work. then, tried show custom view in uiscrollview inside uitableviewcell: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { recesscell *cell = [tableview dequeuereusablecellwithidentifier:@"recess"]; if(cell == nil) cell = (recesscell *)[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"recess"]; uiscrollview *scrollview = [[uiscrollview alloc] initwithframe:cgrectmake(0, 1, 320, 50)]; scrollview.showshorizontalscrollindicator = no; scrollview.bounces = no; scrollview.pagingenabled = yes; scrollview.contentsize = cgsizemake(640, 50); [scrollview addsubview:[[[nsbundle mainbu

What is .Net Unicode Encoding's equivalent in Objective-C? -

what equivalent in objective-c of .net's system.text.encoding.unicode ? have tried: nsunicodestringencoding nsutf8stringencoding nsutf16stringencoding none of above converted text correctly. according http://msdn.microsoft.com/de-de/library/system.text.encoding.unicode.aspx , system.text.encoding.unicode little-endian utf-16 encoding. equivalent nsstring encoding nsutf16littleendianstringencoding . nsutf16stringencoding almost same, prepends unicode byte-order marker (bom) ff fe data. (and strictly speaking, not documented nsutf16stringencoding uses little-endian, explicit nsutf16littleendianstringencoding should used anyway.)

c# - json.net deserialize string to class -

i created json file on server im using send data c# program through json.net deserialize. im im getting null object exception, can please show me how create classes. class here using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using newtonsoft.json; namespace windowsformsapplication4 { public partial class form1 : form { public form1() { initializecomponent(); load(); } public void load() { label1.text = "state:\nloading..."; try { products pd = new products(); using (var webclient = new system.net.webclient()) { // download json url var json = webclient.downloadstring(url); // parse json.net products convert = jsonconvert.deserializeobject<products>(json) products;

Difference: Mongoose populate and Embedded document -

what ideal situation use mongoose populate , embedded document, why choose 1 on other? advantages , disadvantages. thanks! the answer depends! depends on use case , way system is. there couple of resources give insight on that. here 1 stackoverflow answer: mongodb relationships: embed or reference? there complete book, containing several use cases , discussing on same topic. may find read: http://www.amazon.com/mongodb-applied-design-patterns-copeland/dp/1449340040/ it contains several use cases of social networking site, cms, ecommerce, online gaming etc.

asp.net mvc - After a change to the default routing map my actionlinks stopped working -

i made change routing map following now: routes.maproute( name: "default", url: "{controller}/{action}/{id}/{title}", defaults: new { controller = "home", action = "index", id = urlparameter.optional, title = urlparameter.optional } ); and actionlinks not working anymore: @html.actionlink("category", "categorylist", "category") when click on actionlink nothing happens url stays same http://localhost:62394/ page reloads. weird and when check html looks this: <a href="">category</a> any kind of or tips appreciate alot! note: if remove title routing works... it's because you've got 2 optional parameters routing engine doesn't know 1 map third parameter to. feels title going used specific route rather generic one. if that's case, why not create specific route , remove generic fallback route? s

playframework 2.0 - Upgraded to SecureSocial 2.0.12 and now sessions are not being persisted -

i using securesocial 2.0.7, , i’d implemented userserviceplugin, , users log in. stop , restart server (or recompile or whatever), , users remain logged in. since upgrading 2.0.12, login session not persistent across server restarts. i’ve added debug logging every method in userserviceplugin . user being saved @ login. however, when server restarts, , attempt access page previously-logged-in user, see in logs: [info] play - database [default] connected @ jdbc:postgresql://localhost/xxxxxx [info] application - [securesocial] loaded templates plugin: sec.securesocialviews [info] play - starting application default akka system. [info] application - [securesocial] loaded user service: class sec.loginuserservice [info] application - [securesocial] loaded password hasher bcrypt [info] application - [securesocial] loaded identity provider: userpass [info] play - application started (dev) [debug] application - [securesocial] calling deleteexpiredtokens() [debug] application - delete

ruby on rails - Render collection using a partial giving "undefined method for nil:NilClass" -

i'm trying render collection of projects using project partial i'm getting following error: undefined method `customer' nil:nilclass extracted source (around line #1): 1: <p><%= company_name(@project) %><p> the stacktrace is: app/helpers/projects_helper.rb:4:in `company_name' app/views/projects/_summary.html.erb:1:in app/views/customers/index.html.erb:11:in so, index checks projects start with: <% if @projects.any? %> <%= render :partial => "projects/summary", :collection => @projects %> <% end %> my partial (_summary.html.erb) simply: <p><%= company_name(@project) %><p> <p><%= summary_description(@project) %><p> and projectshelper company_name method is def company_name(project) if project.customer.business_name.blank? ...do stuff... if following via rails console, works fine: projects.first.customer.business_name.blank? i'm confused because t

python - What is the performance impact of non-unique indexes in pandas? -

from pandas documentation, i've gathered unique-valued indices make operations efficient, , non-unique indices tolerated. from outside, doesn't non-unique indices taken advantage of in way. example, following ix query slow enough seems scanning entire dataframe in [23]: import numpy np in [24]: import pandas pd in [25]: x = np.random.randint(0, 10**7, 10**7) in [26]: df1 = pd.dataframe({'x':x}) in [27]: df2 = df1.set_index('x', drop=false) in [28]: %timeit df2.ix[0] 1 loops, best of 3: 402 ms per loop in [29]: %timeit df1.ix[0] 10000 loops, best of 3: 123 per loop (i realize 2 ix queries don't return same thing -- it's example calls ix on non-unique index appear slower) is there way coax pandas using faster lookup methods binary search on non-unique and/or sorted indices? when index unique, pandas use hashtable map key value o(1). when index non-unique , sorted, pandas use binary search o(logn), when index random ordered pandas ne

MFC - Adding event handler for dialog button -

i have cview class , dialog in it, , want data dialog object once user clicks on "accept" button, have added event button , handler in cview class, done through visual studio 2010 menus, haven't screwed code. cview clas: begin_message_map(csurface3dview, cview) on_bn_clicked(id_range_ok, &csurface3dview::onbnclickedrangeok) end_message_map() ... void csurface3dview::onbnclickedrangeok() { //things need } the thing is, doesn't call onbnclickedrangeok() function when ok button clicked. i call function cview class dialog class, can't use instance parent class because need include header , causes circular inclusion, can solved declaring cview class in dialog header without including it, methods can't accesed. maybe it's not possible put message handle dialog button outside dialog class? how run function in cview class when dialog button pressed? edit: well it's solved now, used sendmessage(hwnd, message ,...) method of cdialog

Is is possible to use Dreamweaver to create Typescript? -

is possible use dreamweaver create typescript? either editor or in fashion compile? i don't think able full typescript experience in dreamweaver. beauty of tools visual studio or web storm can design-time support, compilation-time checking , compilation javascript built in. i can't find documentation 2 major things need bring typescript support dreamweaver: language support extensibility (a language definition of kind) running external application on save (to run compiler) you enough language support running compiler manually (probably adding command batch file) - cannot find information on how add language dreamweaver.

About Erlang function, especially the function's identifier -

i have question erlang function. see code in erlang shell: 1> f1 = fun() -> timer:sleep(1000) end. #fun<erl_eval.20.111823515> 2> f2 = fun() -> io:format("hello world~n", []) end. #fun<erl_eval.20.111823515> f1 , f2 different, why both having identifier #fun<erl_eval.20.111823515> ? , these magic numbers mean? there paragraph in erts manual , says: when interpreting data process, helpful know anonymous function objects (funs) given name constructed name of function in created, , number (starting 0) indicating number of fun within function. i can not catch meaning of paragraph, can please explain it? don't read meaning names of anonymous functions. can safely out of name of module in created. can try counting funs in module find 1 wouldn't bother. that being said, there reason why both of funs have same name. expressions entered in shell not compiled evaluated interpreter in module erl_eval . module has 1 f

html - Jquery Toggle visibility button -

im trying make button should make 1 element hiding (display: none;) , 1 visible , vice versa. here example of sort of thing ive got: example at moment when clicking 'technical details' changes display: none; display: block; on element. need make element under hidden when 1 shown... here code im using... function toggle() { var ele = document.getelementbyid("toggletext"); var text = document.getelementbyid("displaytext"); if(ele.style.display == "block") { ele.style.display = "none"; text.innerhtml = "technical details"; } else { ele.style.display = "block"; text.innerhtml = "product information"; } } hope makes sense , in advance... why don't wrap 2 different text html elements in span , give them , links class called "toggleprdctandtech". set default hidden ones display:none; can toggle them in function this function toggleelements(){ $(".t

c# - How do I show, then hide the AppBar after a page loads? -

after page visible user, want topappbar show second or two, set isopen false close appbar. in essence want briefly show user functionality hiding in topappbar. i'm not sure place code or how implement timer in xaml/c#. thank help! nevermind, figured out, call function in loadstate: private async void delayedappbarhide() { await task.delay(1000); this.topappbar.isopen = true; await task.delay(3000); this.topappbar.isopen = false; }

AWS PHP sdk -- selected services -

i use parts of aws php sdk ( https://github.com/aws/aws-sdk-php ). however, whole set pretty heavy-- lots of files , functionality don't need. need work s3 objects, don't need ec2, dynamodb etc. stuff. is possible selectively build sdk eliminate unnecessary stuff? or can remove elements don't need? thanks ideas. while agree ryan, here other information might helpful specific use case. the sdk additionally shipped zip archive (starting version 2.3.2), includes third-party dependencies in psr-0 compatible directory structure. technically pull out need there. if want s3, need aws\common , aws\s3 namespaces sdk source. however, you'll need of guzzle , symfony event dispatcher. safely remove doctrine, monolog, , psr components though since optional.

JavaScript atob operation using PHP -

i know if possible decrypt javascript encrypted text (which encrypted using javascript's btoa function), using php. have @ base64_decode() . javascripts btoa() encodes string using base64 . php functions base64_encode() , base64_decode() .

php - Function doesn't move image but returns info correctly -

i'm tryin upload 2 images seems move_uploaded_file() doesn't move file, no errors have been generated. // upload image function upload_image($tmp,$name) { $ext = explode('.',$name); if (preg_match('~(jpeg|jpg|gif|png)$~i', $name)) { $ext = end($ext); $name = substr(md5(rand()), 0, 10).'.' . $ext; $upload_dir = '/music/uploads/' . $name; echo $tmp; move_uploaded_file($tmp,'/home/shadne/public_html'.$upload_dir); return $upload_dir; } else { throw new errorexception('file type not allowed'); } } file/folder permission 0777, used images/new before using /uploads edit 1 code handles uploading , checkin <?php require_once '../config.php'; require 'includes/functions.php'; if (!empty($_files['artist_profile_image'])) { $profile_image_name = $_files['artist_profile_image']['name']; $profile_image_tmp = $_files['arti

java 7 - dpkg error when installing JDK7 on Ubuntu12.04 -

error message terminal: download done. sha256sum mismatch jdk-7u3-linux-i586.tar.gz oracle jdk 7 not installed. dpkg: error processing oracle-java7-installer (--configure): subprocess installed post-installation script returned error exit status 1 errors encountered while processing: oracle-java7-installer install steps: sudo add-apt-repository ppa:eugenesan/java sudo apt-get update sudo apt-get install oracle-java7-installer could give me suggestions how solve problem? from ubuntu documentation on java : a note (hopefully temporary) eugene san ppa attempting use , having issues: of time of entry, eugenesan/java ppa broken. ... cleanup failed ppa installation mentioned in above link. i've installed using procedure described here: ask ubuntu: how install oracle java jdk 7?

vim - Running gvim from MSYS --- how to avoid/change MSYS enviroment variables? -

when run gvim msys, things go wrong during initialization. namely, gvim can't find initialization files in ' c:\documents , settings\username\vimfiles . [specifically, gvim reports error e117: unknown function: pathogen#infect during initialization, never found autoload\pathogen.vim . doing :scriptnames confirms none of setup files vimfiles\ run.] i think i've debugged why goes wrong. when start msys, msys shell inherits windows enviroment variables, changes of them it's custom values. c:\documents , settings\username value of $home in windows, msys sets c:/msys/user name . , of course, vim uses $home find right initialization files. i notice set shell? has changed shell=c:/msys/bin/sh instead of shell=c:\windows\system32\cmd.exe , hope isn't important fixing initialization problem. i need run gvim normal windows environment variables. @ least need able manually override few important ones $home specify (i.e., i'm not concerned windo

python - functools.partial on class method -

i'm trying define class methods using more generic class method follows: class rgb(object): def __init__(self, red, blue, green): super(rgb, self).__init__() self._red = red self._blue = blue self._green = green def _color(self, type): return getattr(self, type) red = functools.partial(_color, type='_red') blue = functools.partial(_color, type='_blue') green = functools.partial(_color, type='_green') but when attempt invoke of methods get: rgb = rgb(100, 192, 240) print rgb.red() typeerror: _color() takes 2 arguments (1 given) i guess self not passed _color since rgb.red(rgb) works. you creating partials on function , not method. functools.partial() objects not descriptors, not add self argument , cannot act methods themselves. can only wrap bound methods or functions, don't work @ unbound methods. documented : partial objects function objects in callable, weak

maven - Error trying to adding arbitrary classpath in Manifest.mf -

i have code add classpath: <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <version>2.4</version> <configuration> <archive> <manifest> <adddefaultimplementationentries>true</adddefaultimplementationentries> <addclasspath>true</addclasspath> <mainclass>apuestaya</mainclass> </manifest> <manifestentries> <class-path>../lib/jcalendar.jar ../lib/eclipselink.jar ../lib/libforms-1.3.0.jar ../lib/imagenes.jar ../lib/driverpersistencia.jar ../lib/javax.persistence_2.0.3.v201010191057.jar</class-path> </manifestentries> </archive> </configuration> </plugin> but got in manifest.mf: manifest-version: 1.0 im

Will GDK (Glass NDK?) Support OpenGL ES? -

does know, google glass support opengl es? if 1.1? 2? webgl? i sure have done using gdk (gndk?) when released there plans make possible? yes supports opengles (same of android 4.0.4 release) - i've side loaded , tested opengles open source game 7 wonders minor modifications (removed ads) , performs well.

Ruby on Rails create a dynamic asset -

i'm making small gem me out further development creates small javascript function based on database resutls. piece of javascript must added page somehow i'm not sure of best way of doing it. do assets pipeline have magic code can add javascript/css code somehow? checked docs found nada yet. in gemfile: place js file in vendor/assets/javascripts in application add file app/assets/javascripts/application.js lines: #= require your_js_file_name if have dynamic pieses of code add extension .erb js file example: your_js_file_name.js.erb

Android artifacts, Action bar -

Image
i have no idea why there arifacts on actionbar. looks that: application style defined in manifest: android:style/theme.holo in activity: actionbar ab = getactionbar(); ab.setdisplayshowhomeenabled(false); ab.setdisplayshowtitleenabled(false); how fix that. you need set background actionbar: actionbar actionbar = getactionbar(); actionbar.setbackgrounddrawable(getresources().getdrawable(android.r.drawable.screen_background_dark)); that did me;

image - Copying files with python -

i'm relatively new python, , part of way through "learning python hard way," have question. so, i've read, if want make copy of text file, can open , read contents variable, write variable different file. i've tested out images, , seems work. there downsides method of copying i'll run later, , there file types won't work for? thank much! you should use shutil.copyfile() or shutil.copyfileobj() instead, efficiently , correctly using buffer. not particularly hard, shutil.copyfileobj() implemented as: def copyfileobj(fsrc, fdst, length=16*1024): """copy data file-like object fsrc file-like object fdst""" while 1: buf = fsrc.read(length) if not buf: break fdst.write(buf) this makes sure memory isn't filled big file, reading file in chunks instead. also, .read() not guaranteed return of data of file, end not copying of data if don't loop until .read()

mysql - Staying in the same Shell session with Python -

i building python script automatically create , arrange new django projects. what i'm doing is; create virtualenv activate virtualenv source my_app/bin/activate pip install toolname (multiple times) django startproject django startapp (multiple times) mkdir `dirs (making template dirs, assets, etc.) open ./my_app/my_app/settings.py , edit inners (based on script's input) open ./my_app/my_app/urls.py , edit (unlock) admin portion create default admin.py , urls.py files apps auto-download latest javascript libraries, images etc. now issue want python's shell ( os.system('source my_app/bin/activate') ) keep it's session, enter virtual environment , can pip install python script. now when do; os.system('virtualenv ' + virtualenv_name) os.system('source ' + ve_path + 'bin/activate') os.system('which python') it still tells me it's in /bin/python should in /path/to/my_app/bin/python . does know i

Building with Lombok's @Slf4j and Eclipse: Cannot find symbol log -

i have lombok plugin in eclipse , enabled annotation processing in eclipse under java compiler, still unable recognize log statements when use @slf4j annotation. do have make other settings? you have install lombok eclipse. see this answer on how or check if lombok installed correctly. full disclosure: 1 of project lombok developers.

PHP OpenSSL - openssl_private_encrypt crashes webpage -

this has been reported @ bugs.php.net . if replace libeay32.dll , ssleay32.dll in xampp/apache/bin same files in xampp/php/ works cannot use ssl i need use ssl, has been able resolve this? i using openssl library in php (5.4.7) on xampp (1.8.1) encryption, decryption, etc. using ssl on localhost. i able create private-public key pair using openssl_pkey_new() method , generate certificate well. but when try access root certificate (create using above function) webpage crashes : $root_private_key = openssl_get_privatekey(file_get_contents($path), $pass); echo "key: " . $root_private_key; // key: resource id #11 openssl_private_encrypt($plaintext, $encrypted_data, $root_private_key); i tried using phpseclib library same thing. i have tried set ini_set('max_execution_time', 0); i checked php log , empty , found following in apache logs : [mpm_winnt:notice] [pid 3312:tid 484] ah00428: parent: child process exited status 3221225477 -- resta

javascript - Typescript specific methods for saving data online? -

i'm thinking using typescript create online app, , require saving of data online. what options in regards that? is there specific using typescript makes easier or harder? ideally use service parse.com save data, can typescript connected parse or have rely upon plain js? typescript runs wherever javascript runs. your options same javascript. typescript compiles down javascript. , designed superset of javascript javascript valid typescript long have variables declared , types mentioned. optional static typing + easier syntax makes developing in typescript easier. static typing makes refactoring , intellisense more reliable. having easier syntax classes / modules means more structure code better. yes can use parse.com typescript the recommended way create declaration file describing javascript code. in beginning can simple as: declare var parse:any; i wrote guidance on matter here : http://basarat.github.io/typescriptdeepdive/#/declarations

c# - Setting up WCF TCP service in a web application -

Image
i've been battling days, literally going through hundred articles giving partial guidelines on how set wcf tcp based service in web application. if can me, make question complete guideline. current status the net.tcp connection works on development machine. works locally after being deployed windows server 2008 r2. however, doesn't work remotely, though it's possible telnet port 808 on server remotely. scroll bottom of question details. please if can. i create new question detail , update question answer if result out of it. code i created serverhubservice.svc following content: namespace manage.signalr { [servicecontract] public class serverhubservice { [operationcontract] public void updateserverstatus(string serverstatus) { // } } } configuration of application hosting service following online tutorial, added following web.config (i tried many different variations). web.config of web applic

ios - uitableview re-order won't work, source always equal to destination -

i have tableview won't reorder. looks moverowatindexpath never called sourceindexpath different destinationindexpath. when pull row, bounces starting location if row didn't support movement. i tried implementing "canmove/canedit/propose" methods return yes, observe same behavior. what's going on? - (void) tableview:(uitableview *)tableview moverowatindexpath:(nsindexpath *)sourceindexpath toindexpath:(nsindexpath *)destinationindexpath { nslog(@"%d -> %d", [sourceindexpath row], [destinationindexpath row]); if ([sourceindexpath row] == [destinationindexpath row]) { return; } mydomain *domain = [self getobject]; [domain.stuff exchangeobjectatindex:(nsuinteger) [sourceindexpath row] withobjectatindex:(nsuinteger) [destinationindexpath row]]; } i'm using iiviewdeckcontroller, cancels panning in views. when setting viewdeckcontroller, this: self.panningcancelstouchesinview = no;

xpath - php find xml node thanks to isset variable form url -

i have single.php page want load individual post. to have links in index.php allows load single.php page : <a href="single.php?blog_no=12">post 12</a> <a href="single.php?blog_no=11">post 11</a> <a href="single.php?blog_no=10">post 10</a> i variable in url in single.php page , want find (and display), in xml file, element correspond variable: <?php if(isset($_get["blog_no"])) { $i = $_get["blog_no"]; $elements = new simplexmlelement('data.xml', null, true); $query = $elements->xpath(" /elements/element[@id='$i'] "); foreach($query $element) { echo $elements->element['size']; echo $elements->element['category']; echo $elements->element->title; } ?> here example of xml file: <elements> <element id="12" size="square" category="portfolio"> <tag tag="pr

treeview - How can I make the expand/collapse triangles bigger? -

kendo ui treeview triangles tiny users. want make them bigger. if icons want make bigger, can try creating 2 images desired size , define following styles: #grid .k-hierarchy-cell > .k-icon.k-plus { background-image: url('/images/plus.png'); background-position: 0 0; width: 32px; height: 32px; } #grid .k-hierarchy-cell > .k-icon.k-minus { background-image: url('/images/minus.png'); background-position: 0 0; width: 32px; height: 32px; } here create image , saved in /images/plus.png expanding details , size 32x32 pixels , saved in /images/minus.png collapsing it. with css selector i'm limiting scope grid id grid .

javascript not displaying output when content loaded via jquery -

i have login page runs script third-party site so: <span id="siteseal"> <script src="https://seal.starfieldtech.com/getseal?sealid=myspecialid"></script> </span> everything hunky dory. performs javascript , displays image. i moved separate file, , including in original page using $('#mydivid').load('/mypath/footer.html'); the entire footer displayed, , in chrome developer tools can see request made starfieldtech , javascript response returned, image never displayed. the getseal script pretty simple, looking like: <!-- dosomething(); function dosomething() { // setup bunch of vars document.write('<img src="blah" onclick="dostuffonclick();"/>'); } function dostuffonclick() { // other stuff on click. } // --> if create own script looks similar above replaces whole page output of script , shows intended starfield image. i have no clue problem , hope g

Retrieving the Interlanguage links from an exported Wikipedia article? -

i used retrieve interlanguage links exported wikipedia article parsing export regular expressions. in phase 1 of wikidata project these links have been moved separate page on wikidata. for example article ore mountains has no language links anymore in export. language links on q4198 . how can export language links? you encouraged use wikidata api : http://wikidata.org/w/api.php for your case, use props=labels . url self explicative : http://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&titles=ore%20mountains&languages=cs|de|es|fr|it|pl|pt|ru&props=labels&format=xml

android - ActionBarSherlock with custom titlebar - weight distribution no working -

i'm trying implement custom title bar actionbarsherlock. title bar should have 2 buttons in left , right edges, , textview in center. textview should occupy space between 2 buttons. i've tried setting layout_weight, reason had no effect @ all. this custom layout have in res/layout <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <button android:id="@+id/btn_left" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1" android:text="left" /> <textview android:id="@+id/header" android:layout_width="0dip" android:layout_height="match_parent" android:gravity="center_horizontal&

android - Conflict between project and facebook sdk -

i have added facebook sdk on project in android studio. works fine, there conflict between project sources , facebook.. "loading" message , close icon (x black button) showing wrong, , more strange appearing project resources. and more strange, project getting string in "x" positon.. example: <string name="string_teste_01">test 01</string> <string name="string_teste_02">test 02</string> in case, "loading" message showing "test 02".. if put 1 more string this: <string name="string_teste_01">test 01</string> <string name="string_teste_03">test 03</string> <string name="string_teste_02">test 02</string> the "loading" message show "test 03" the same occurs close icon. [ "loading" exaple talking ] http://i.stack.imgur.com/750trl.png i'm assuming you're not using same names fac

sdk - "NVENC Feature not available for current license key type" error from nvEncoder sample -

when try run nvencoder sample application included in nv encode sdk 2.0 , fails open encode session. here output: c:\users\timothy\downloads\nvenc_2.0_pkg\samples\nvencodeapp>1080p_heavyhand_3se c.bat c:\users\timothy\downloads\nvenc_2.0_pkg\samples\nvencodeapp>nvencoder -infile=. .\yuv\1080p\heavyhandidiot.3sec.yuv -outfile=heavyhandidiot.3sec.264 -width=1920 -height=1080 -bitrate=6000000 > nvencode configuration parameters encoder[0] > gpu device id = 0 > input file = ..\yuv\1080p\heavyhandidiot.3sec.yuv > output file = heavyhandidiot.3sec.264 > frames [000--01] = 0 frames > multi-view codec = no > width,height = [1920,1080] > video output codec = 4 - h.264 codec > average bitrate = 6000000 (bps/sec) > peak bitrate = 24000000 (bps/sec) > buffersize = 3000000 > rate control mode = 2 - cbr (constant bitrate) >

pdf generation - Splice 2 PDF pages into one with Python -

i'm trying write novel , trying print out own book prototypes. i have pdf of book. want merge pages can print double-sided, fold in half, , staple boss. the problem need solve how splice 2 pages left , right side. looked @ pypdf2 , mergepage function, superimposes 1 page onto another. new generated page twice width of original pages, 1 page superimposed on left, , 1 page superimposed on right. thank time in looking @ this! turns adobe's reader has "booklet" option in printing options. worked out nicely.

ios - Is using too many static variables in Objective-C a bad practice? -

will usage of static variables expose them danger of being modifiable anywhere ?(in context of objective-c). if yes, can suggest best alternatives using shared variables across classes ? is using many static variables in objective-c bad practice? yes. of course, "too many" has not been quantified , subjective. really, global/static variables thing -- convenient introduce , difficult debug , eliminate. rare case design. i've found life far easier without them. will usage of static variables expose them danger of being modifiable anywhere? (in context of objective-c). it depends on declared , how used. if pass reference part of program, modifiable 'anywhere'. examples: if place them 1 file can "see" variable (e.g. in .m file following includes), succeeding implementation may use (unless pass reference outside world). if declare variable inside function, shared among each translation , copied each translation in c/objc (but

ios - How to Insert Core Data Record Related to Another? -

currently have 2 entities in model; module , level. have 1 many relationship e.g. level can have lot of modules. how can can insert data related 1 can module has specific year. need when delete module deletes year. module<<---->level if add objects separately works fine, add last line of code application crashes says entity module not key value coding compliant key level_number name of relationship on module side. nsmanagedobject *newmodule; newmodule = [nsentitydescription insertnewobjectforentityforname:@"module" inmanagedobjectcontext:context]; [newmodule setvalue:textmodueltitle.text forkey:@"name"]; [newmodule setvalue:value forkey:@"credit"]; nsmanagedobject *newlevel; newlevel = [nsentitydescription insertnewobjectforentityforname:@"level" inmanagedobjectcontext:context]; [newlevel setvalue:year forkey:@"value"]; [[newmodule mut

c - Segmentation fault on calling function more then once -

running function more once cause segmentation fault , cannot figure out why. im not looking alternative ways split string. splitx continue splitting x ammount of delimiters (be '|' or '\0') , return x or number of substrings make. i should note have restarted coding in c after 3 years of easy javascript , php missing obvious. int splitx(char **array, char *string, int x) { int y; int z; int index = 0; int windex = 0; for(y = 0; y < x; y++) { z = index; while(string[index] != '\0' && string[index] != '|') { index++; } char **tempptr = realloc(array, (y+1)*sizeof(char *)); if(tempptr == null) { free(array); return -3; } array = tempptr; array[y] = malloc(sizeof(char) * (index - z + 1)); windex = 0; for(; z < index; z++) { array[y][windex] = string[z]; windex++; }

Trapezoidal Numerical Integration in MATLAB without using a FOR loop? -

i'm following numerical methods course , made small matlab script compute integrals using trapezoidal method. script uses loop , friend told me i'm doing wrong if use loop in matlab. there way convert script matlab-friendly one? %number of points use n = 4; %integration interval = 0; b = 0.5; %width of integration segments h = (b-a) / n; f = exp(a); = 1:n-1 f = f + 2*exp(a+i*h); end f = f + exp(b); f = h/2*f vectorization important speed , clarity, using built-in functions whenever possible. matlab has built in function trapezoidal numerical integration called trapz . here example. x = 0:.125:.5 y = exp(x) f = trapz(x,y)

plugins - Google Chrome plug in to read saved cookies -

i'm new google chrome plug in development. have learnt how develop basic plug in. problem i'm trying make plug in can read saved cookies of particular website visit. for instance, user visits www.facebook.com, after login click on our plug-in icon , drop down window appear , show cookies saved facebook. here want ask how read cookies of site visiting? possible sort cookies respect site visit? if yes? can provide me reference of how done? there cookies api allows chrome extensions access browser's cookies, without having send http requests obtain cookies. more references this thread might helpful.

How to add "Drag to install!"/Install Icon in eclipse market place? -

Image
i have 2 eclipse plugins on marketplace: http://marketplace.eclipse.org/content/pextools http://marketplace.eclipse.org/node/508788 not able add "install" icon, project there plugin . https://marketplace.eclipse.org/content/subclipse googling did not help. please guide... well, after little bit of toying around, got it. its not obvious @ first glance , wish people @ marketplace make note of this. these steps: after logging in , going project, click on edit tab. go feature ids section , enter feature id. you can figure out feature id going through this link after save, "install" button appear. make sure test out!

python - remove a specific column in numpy -

>>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) >>> arr array([[ 1, 2, 3, 4], [ 5, 6, 7, 8], [ 9, 10, 11, 12]]) i deleting 3rd column >>> np.hstack(((np.delete(arr, np.s_[2:], 1)),(np.delete(arr, np.s_[:3],1)))) array([[ 1, 2, 4], [ 5, 6, 8], [ 9, 10, 12]]) are there better way ? please consider novice question. if ever want delete more 1 columns, pass indices of columns want deleted list, this: >>> = np.arange(12).reshape(3,4) >>> array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]]) >>> np.delete(a, [1,3], axis=1) array([[ 0, 2], [ 4, 6], [ 8, 10]])

android - How do I add a TextView to another activity -

suppose have 2 activities namely addview , seeview . in seeview , there button take me addview activity. in addview activity, enter text shown on seeview textview . then, clicking button on addview , taken seeview added textview addview displayed. how do programmatically? views neved transferred between activities, want pass text. should use startactivityforresult() , onactivityresult() methods of activity: public class seeview extends activity { public static final int req_code_add_view; private textview textviewwithtext; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.layout_of_see_view); //this textview defined in xml: /res/layout/layout_of_see_view.xml //make sure id "@+id/text_view_with_text" textviewwithtext=(textview) findviewbyid(r.id.text_view_with_text); findviewbyid(r.id.button).setonclicklistener(new

ios - Page Curl on UIScrollView inside the UIWebview -

i amazed ibook pagecurl, , thought add feature books application, here information how project built, project divided 2 levels, top layer uiwebview loads local web content each page, inside uiwebview there built-in uiscrollview behaves normal scrollview paging feature on, , loading new page according rotation left or right side catching delegate scrollviewdidenddecelerating: im woundering how add pagecurl animation build-in scrollview, or how can change code support pagecurl animation, found lot of open source projects on internet demonstrates pagecurl feature buy issue uses pageviewcontroller means if should use means allocating view controllers webview inside means lot of memory usage , less user experience quality. im woundering how change uiscrollview paging pagecurl feature. here allocation code of webview , scrollview inside webcontent_ = [[uiwebviewex alloc] initwithframe:self.bounds]; [webcontent_ setautoresizingmask:uiviewautoresizingflexibleheight | uiviewautores

android - What does the error "Unable to load metadata for game" means in Google Play Game Service? -

a couple of days ago google announced google play game services. cool of course, started integrating game. i think did every step correctly able sign in google+ account, it's not working. developer console says game ready testing. i following message in logcat: 05-19 10:20:30.538: e/volley(27130): [1704] il.a: unexpected response code 400 https://www.googleapis.com/games/v1whitelisted/applications?language=nl_nl&platformtype=android 05-19 10:20:30.538: e/gameagent(27130): unable retrieve 1p application 123456789012-123abcdefghijklmnop456qrst789uvw network 05-19 10:20:30.618: e/checkgameplayacl(13964): unable load metadata game i have set 2 test accounts inside game service configuration. both give same result. what error "unable load metadata game" means? there wrong configuration? or applicationid not correct? i think app id incorrect. try again 123456789012 (removing -123abcdefghijklmnop456qrst789uvw)

c# 4.0 - How to Convert Emgu.Cv.Image<Gray,byte> to System.Image -

i new emgu cv , wondering if let me know how change emgu.cv.image system.image?if there need further explanation, let me know , it.the language using c#. you can use toimage() method system.drawing.bitmap (which derived class of system.drawing.image ), this // create emgu image of 400x200 filled blue color image<bgr, byte> img = new image<bgr, byte>(400, 200, new bgr(255, 0, 0)); // copy .net image system.drawing.image pmyimage = img.tobitmap(); is mean?

c# - can I have a nested lambda expression stored in a Dictionary? -

i'd parse string lambda expression in c#, example, parse "lt 5" x => x < 5 can use argument of enumerable.where : static void main(string[] args) { enumerable .range(0,10) .select(x => (double)x) .where(parse("lt 5")) .tolist() .foreach(system.console.writeline); } private const list<tuple<list<string>, func<double, func<double, bool>>>> operationlist = new dictionary<string, func<double, func<double, bool>>>() { { "lt <", val => ( x => x < val ) } , { "le <=", val => ( x => x <= val ) } , { "eq = ==" , val => ( x => x == val ) } , { "ne != <>", val => ( x => x != val ) } , { "ge >=", val => ( x => x >= val ) } , { "gt >", val => ( x => x > val ) } } .select(kv => new tupl

c - Using glib and gtk+ to control ftdi device over USB -

i developing simple application in c gtk+2.0 gui, on linux of course, application designed control device connected on usb port , using ftdi driver emulate rs232 asynchronious protocol on usb port. i wanted create event driven control, signals in gtk used detect when button clicked et cetera. found glib library this, have read in documentation seems clear. know must use functions g_io_add_watch() add event detected, can define functions "triggered" event , example "g_io_in" means triggered when there output device. cannot find usefull examples on web. the other thing is, not understand how use gtk+2.0 , glib @ once, because both have own program loops detect events (gtk_main() gtk+2.0 , gmainloop in glib). i greatfull if share interesting examples, links, tutorials et cetera. maybe need know more specific vocabulary, because cannot find usefull on web solve problem. thanks! gtk+ uses glib, , main loop not exception. means gtk+ loop gmainloop , he

Android Html5/java app: mosync gallery upload & send email -

im trying customize mosync photo gallery sample can find here , here . this html/java app wich take snaphot , upload taken picture web server via php file ( in case file upload.php) everythings works fine me add email field , ask user type email adress field before uploading. send out email picture attached want on server side (php) after upload complete. i have tried add mail function (with pre defined sendto adress , link picture) upload.php file , works can't return status message on device telling user upload complete.this ennoying user don't know if process completed i'm blocking on different steps: 1: how recuperate email adress typed user , passing upload.php 2: how add uploaded picture attachement , send user 3: how keep status message being displayed on device? is here have encounter same questions? have experience sample mosync app? thanks help below upload.php file used: <?php ini_set("display_errors", "1"); ini_set(&qu