Posts

Showing posts from July, 2014

Parse Android - getCurrentUser() objectId is null after twitter login -

i'm using parsetwitterutils.login(..) logging in user through twitter. when callback function called parseuser.getcurrentuser().getobjectid() null. if user logged in twitter shouldn't current user object id assuming have user saved on server same username , twitter authdata ? parsetwitterutils.login(this, new logincallback() { @override public void done(parseuser parseuser, parseexception ex) { parseuser user = parseuser.getcurrentuser(); string objectid = user.getobjectid(); //objectid null string loggedinobjectid = parseuser.getobjectid(); //loggedinobjectid null } }); also, ex null. meaning query executed successfully. i found problem. if specify consumer key in parse settings under settings -> user authentication settings, , use different twitter app, parse won't throw errors return parseuser empty content. make sure leave consumer key field blank or use proper key.

javascript - Angular's $q.reject() vs deferred.reject() -

i'm trying handle on angular $q service , related objects , apis. when @ objects in console see: var deferred = $q.defer() ...(and console inspection)... $q: object {defer: function, reject: function, when: function, all: function} deferred: object {resolve: function, reject: function, notify: function, promise: object} deferred.promise: object {then: function, catch: function, finally: function} it raises few questions: what's difference between $q.reject() , deferred.reject() ? when use each? what's relationship between errorfn in deferred.promise.then(successfn, errorfn) , catchfn in deferred.promise.catch(catchfn) ? if have bunch of nested promises , error occurs, outermost catch() function called? if 1 of nested promises has catch function defined? catch prevent outermost catch executing? thanks. 1) $q.reject() shortcut create deferred , reject immediately; use in errorfn if can't handle error. 2) nothing, promise.catch(errorfn

sql - Nested json jbuilder for photo feed having n+1 major issues -

i having performance issues on 1 of api views ran bullet gem , found major n+1 issues view. the api being consumed format has remain identical. bullet n+1 output: localhost:3000/api/v1/games/1/game_feed n+1 query detected completedquest => [:comments] add finder: :include => [:comments] n+1 query method call stack /app/views/api/v1/games/game_feed.json.jbuilder:3:in block in _b3b681b668d1c2a5691a5b3f7c15bb8e' /app/views/api/v1/games/game_feed.json.jbuilder:1:in _b3b681b668d1c2a5691a5b3f7c15bb8e' but don't know how accomplish fix. here relevant parts. view: json.game_feed(@game_photos) |f| json.extract! f, :id, :user_id, :username, :image_url_original, :comments_count, :likes_count json.comments f.comments |comment| json.(comment, :username, :comment) end json.likes f.likes |like| json.(like, :id, :user_id, :username) end end controller: @game_photos = completedquest.game_photos(@game.id) model: def self.ga

java - Loading classes that extend another class from jars in directory -

what want , let's have folder , , directory, , lets created jar has class in there extending "apple". how check jars in folder andn check have class extending apple, add each , every 1 of classes extending apple list? use have use reflection api this. first list of classes loaded class loader , of reflection api can check if class extends apple or not. hope helps

php - laravel4 where can I find the testcases? -

i looking @ github laravel4 source code. didn't find tests framework code! laravel not open source project? how can commit patch without testing it? so question is: find tests laravel framework? what looking @ is: https://github.com/laravel/laravel that framework bootstrap provide can clone project down , start using laravel predefined structure , files. in there, not see core laravel code @ because laravel comes composer package , loaded after running composer commands. the framework code in project titled laravel framework (kernel) resides at https://github.com/laravel/framework . in there see 3 folders, src , tests amongst them.

javascript - AngularJS - Why using anonymous controller in directive? -

this source of information: "the controlleras option enables set controller alias, allowing publish our controller under name , giving scope access controlleras name. step allows reference controller inside view , allows need inject $scope. this option may seem trivial, in gives lot of power in how can use , create anonymous controllers in our routers , directives. power allows create dynamic objects controllers isolated , easy test. for instance, can create anonymous controller in directive so:" var myapp = angular.module("myapp",[]); myapp.directive('mydirective', function(){ return{ restrict: 'a', template: '<h4> {{mycontroller.msg}} </h4>', controlleras: 'mycontroller', controller: function(){ this.msg = "hello world"; } }; }); what functionality of anonymous controllers? equivalent code without controlleras like: var myapp = angular.module("myapp&qu

javascript - Ways to circumvent the same-origin policy -

the same origin policy i wanted make community wiki regarding html/js same-origin policies searching topic. 1 of searched-for topics on , there no consolidated wiki here go :) the same origin policy prevents document or script loaded 1 origin getting or setting properties of document origin. policy dates way netscape navigator 2.0. what of favorite ways go around same-origin policies? please keep examples verbose , preferably link sources. the document.domain method method type: iframe . note iframe method sets value of document.domain suffix of current domain. if so, shorter domain used subsequent origin checks. example, assume script in document @ http://store.company.com/dir/other.html executes following statement: document.domain = "company.com"; after statement executes, page pass origin check http://company.com/dir/page.html . however, same reasoning, company.com not set document.domain othercompany.com . with method,

spring - Add image in pdf using itext -

i'am creating spring mvc web application.my image in folder webapp/resources/img/logo.png of mvc application.how load image folder pdf. i tried code.but trowing java.io.filenotfoundexception. string imageurl = "webapp/resources/img/logo.png" logo = image.getinstance(imageurl); enhanced find example how it: document document = new document(); pdfwriter.getinstance(document, new fileoutputstream("c:\\test.pdf")); document.open(); image img = image.getinstance(classloader.getsystemresource("attention-icon.jpg")); img.scaleabsolute(10, 10); phrase phrase = new phrase(); phrase.add(new chunk(img, 0,0)); document.add(new paragraph(phrase)); document.close(); i think case file "webapp/resources/img/logo.png" relativ. try create file object check location: file logo = new file("webapp/resources/img/logo.png"); if(! logo.exists()){ log.warn("file " + logo.getname() + " not exists"); }

How to pakage Unity3d app for Facebook review when use prime[31] plugin? -

when use prime[31] plugin,i can't run app in simulator. , cannot call [dllimport ("__internal”)] function in simulator.how should package app facebook review? error log: undefined symbols architecture i386: "_objc_class_$_p31", referenced from: objc-class-ref in facebookmanager.o objc-class-ref in facebookbinding.o objc-class-ref in sharingbinding.o objc-class-ref in twitterbinding.o (maybe meant: _objc_class_$_p31unity) "_objc_class_$_twittermanager", referenced from: objc-class-ref in twitterbinding.o "alg::compression::lzma::decode(alg::compression::lzma::compressprefix, void*, unsigned long, unsigned char const*, char const*, unsigned long)", referenced from: pfx::asm::lzma::uncompress(unsigned char*, unsigned long, unsigned char const*, unsigned long) in libiphone-lib.a(asmlzma.o) ld: symbol(s) not found architecture i386 clang: error: linker command failed exit code 1 (use -v see invocati

tomcat - Application context being loaded twice - Spring Boot -

i have simple setup. maven project 3 modules : core/webapp/model. i'm using spring boot gear application. in webapp, have simple class webappconfig follows: @configuration @enableautoconfiguration @componentscan(excludefilters = @componentscan.filter(configuration.class)) public class webappconfig { public static void main(string[] args) { springapplication app = new springapplication(webappconfig.class); app.setadditionalprofiles("dev"); app.run(args); } } and few classes in core/model module. container-application point : public class abcdxml extends springbootservletinitializer { @override protected springapplicationbuilder configure(springapplicationbuilder application) { return application.sources(webappconfig.class); } } and no web.xml! model's pom has following spring boot related dependency : <dependency> <groupid>org.springframework.boot</groupid> <artifactid>

webclient - How to get header value in UploadStringCompletedEventHandler method ASP.NET (Web API Service using HttpClient) -

in windows phone 8 app, create webclient object , initiate uploadstringasync. , create webclientlogin.uploadstringcompleted using uploadstringcompletedeventhandler. webclient webclientlogin = new webclient(); webclientlogin.headers["content-type"] = "application/json"; webclientlogin.uploadstringcompleted += new uploadstringcompletedeventhandler(webclientuploadstringcompleted); webclientlogin.uploadstringasync(new uri(url + "login"), "post", stockiestdata); here stockiestdata encoded using encoding.utf8 i response well. private void webclientuploadstringcompleted(object sender, uploadstringcompletedeventargs e) { var logindetails = jsonconvert.deserializeobject<logresponse>(e.result); } but need header in above method (webclientuploadstringcompleted). send header follows httpcontext.current.response.appendheader("msg","checked"); response created in webapi how this? able head

c# - Drawing Oracle spatial geometries with sharp map -

i need create simple app can display geometries oracle spatial in c#. these geometries exported shape file oracle spatial. i need pan,zoom layers. when trying use sharp map produces error could not load file or assembly 'oracle.manageddataaccess, version=4.112.3.60, culture=neutral, publickeytoken=89b483f429c47342' or 1 of dependencies. system cannot find file specified. my code is sharpmap.layers.vectorlayer vlay = new sharpmap.layers.vectorlayer("states"); string connstr = "server=10.2.5.55;port=5555;user id=xxxx;password=xxxx;database=mygis;"; vlay.datasource = new sharpmap.data.providers.oracle(connstr, "states_new", "geometry", "objectid"); messagebox.show(vlay.datasource.getfeaturecount().tostring()); mapbox1.map.layers.add(vlay); mapbox1.map.zoomtoextents(); mapbox1.refresh(); i using oracle version of oracle11g_home2 , operating system windows 8. please me..

java - Convert string to Date -

i have string string ackwarddate="2012-10-30t19:14:58"; i need convert date format.then tried this ackwarddate=ackwarddate.replace("t", " "); simpledateformat formatter = new simpledateformat("yyyy-mm-dd hh:mm:ss"); try { date date = formatter.parse(ackwarddate); system.out.println(date); system.out.println(formatter.format(date)); } catch (parseexception e) { e.printstacktrace(); } it working fine. there other method? you can include t in date format. , looking @ ackwarddate string, need use hh instead of hh has 24-hour format , represented h . string ackwarddate="2012-10-30t19:14:58"; // ackwarddate=ackwarddate.replace("t", " "); // not needed anymore simpledateformat formatter = new simpledateformat("yyyy-mm-dd't'hh:mm:ss"); simpledateformat docs sho

perl - how to run command in local or may be on remote machine -

i have setup hosta software application components installed .i have written script works if run same host (hosta) .the kind of operation doing truncate file ,read pattern file etc. in other cases components may not installed in same host .may component on hosta, component b , c on hostb.how write script handle such situation? some of code performing action .now want if provide truncatelogfile(/path/to/file) should truncate regardless whether on local machine or remote machine. sub truncatelogfile { $pathfile = shift; if (! -e $pathfile ){ warn "the [$pathfile] not exist\n" } ; system("truncate $pathfile --size 0") == 0 or warn "failed "; } sub folderclean { $self = shift; $pathfolder = shift; opendir (dir,$pathfolder) or warn "[!] failed open dir $!"; @files = map { $pathfolder . '/' . $_ } grep { !/^\.{1,2}$/ } readdir (dir); closedir (dir); print &quo

android - Error in ADT 23 Update -

first, know that's asked question i'm here since pair of weeks don't have enough reputation comment in threads. well, have tried in question-threads no success (with https , without, adt23.zip download :( ) that's got cannot complete install because of conflicting dependency. software being installed: android ddms 23.0.0.1245622 (com.android.ide.eclipse.ddms.feature.feature.group 23.0.0.1245622) software installed: android developer tools 22.6.2.v201403212031-1085508 (com.android.ide.eclipse.adt.package.product 22.6.2.v201403212031-1085508) 1 of following can installed @ once: dalvik debug monitor service 23.0.0.1245622 (com.android.ide.eclipse.ddms 23.0.0.1245622) dalvik debug monitor service 22.6.2.v201403212031-1085508 (com.android.ide.eclipse.ddms 22.6.2.v201403212031-1085508) cannot satisfy dependency: from: adt package 22.6.2.v201403212031-1085508 (com.android.ide.eclipse.adt.package.feature.group 22.6.2.v201403212031-1085508) to

python - SQLAlchemy session error: InvalidRequestError -

i trying commit query results @ same time db , ended error. sqlalchemy.exc.invalidrequesterror: session in 'committed' state; no further sql can emitted within transaction. full traceback: traceback (most recent call last): file "c:\python34\lib\site-packages\flask\app.py", line 1836, in __call__ return self.wsgi_app(environ, start_response) file "c:\python34\lib\site-packages\flask\app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) file "c:\python34\lib\site-packages\flask\app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) file "c:\python34\lib\site-packages\flask\_compat.py", line 33, in reraise raise value file "c:\python34\lib\site-packages\flask\app.py", line 1817, in wsgi_app response = self.full_dispatch_request() file "c:\python34\lib\site-packages\flask\app.py", line 1477, in full_dispatch_request rv = self

hashtable - How do I look up the key in a hash by its value? (JavaScript) -

i have small program below takes array of strings input, say, ["abc","defg","z","hijk"] . strings taken 1 one , stored in hash, respective lengths recorded next them. eg---> { abc: 3, defg: 4, z: 1, hijk: 4 } a new array formed, , values of keys created goes it. max number removed twice. third max value 1 have grabbed. have it, how call associated key returned, please? so example: if strarr ["abc","defg","z","hijk"] , because "abc" 3 chars, return 3, "abc". how refer "abc" in above hash it's value? for illustrative example, if strarr happened ["hello", "world", "before", "all"] ultimate output should 5 associated world because "before" 6 letters long, , "hello" , "world" both 5 , output should world because appeared last 5 letter word in array. var hashobject = {}; var strarr = [

scaffolding - Laravel jrenton/laravel-scaffold -

i starting use laravel , having problems jrenton/laravel-scaffold library. when use scaffold generates everything, controllers empty files. i`m generating file shown in github page of library: resource = true namespace = oxford university hasmany department string( name city state homepage ) -nt department belongsto university, hasmany course string( name description ) number:integer resource = false course belongsto department, hasmany lesson string( name description ) integer( number credits ) -sd if need more information ask in comment section. there's template folder contains controller , view templates use scaffolding. check under 'resource' , 'restful' folders them at: https://github.com/jrenton/laravel-scaffold/tree/master/src/jrenton/laravelscaffold/templates

neural network - JNA class not Found Error using FANNJ for Ubuntu in Eclipse -

i'm trying use fannj in eclipse (on ubuntu), trying create toy program keeps giving error shown below. code: package mypackage; import com.googlecode.fannj.fann; public class mainclass { public static void man(string[] args) { system.out.println("1"); fann fann = new fann("/home/sahil/desktop/intern/java/eclipse/workspace/usingfann/ann_net_output1.net"); } } error: exception in thread "main" java.lang.noclassdeffounderror: com/sun/jna/platform @ com.googlecode.fannj.fann.<clinit>(fann.java:51) @ mypackage.mainclass.main(mainclass.java:9) caused by: java.lang.classnotfoundexception: com.sun.jna.platform @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.jav

How to synchronize Odoo(OpenERP)-ORM with Postgres tables -

when openerp modules uninstalled associated tables in postgres database still exist. there anyway synchronize openerp modules orm model remove tables , assigned user only. b/c gives no sense keep tables without application access it. you write routine starts ir_model table , tables in schema don't have matching entry in ir_model. have careful of transient (osv_memory in version 6 parlance) tables , models _auto = false done create database views.

Android import google play service in eclipse error -

i try add google play service in app( mean google map) added play service in sdk manager , imported library in eclipse library contains errors.in eclipse has error , in console have message "google-play-services_lib] unable resolve target 'android-9'" downloaded , installed android api version adt 9 java build path > android dependencies.how can solve problem ? solution if knows solution me p.s 'm new user in site welcome this result right click on google-play-services_lib projects , select properties , change target od project

android - Augmented Reality applications using Java API? -

i new augmented reality programming , ask question regarding ar app. i have downloaded "augmented reality" app play store . using augmented reality app, able view 3d model objects such front view, view, left , right side views. have taken print out of universal tracker sheet of universal tracker, able view 3d model objects. example, car or bike can placed on universal tracker (printed sheet) , objects can viewed in graphical views. can understand of "augmented reality" concept, objects can viewed in 3d graphic model actual size integrated in real time environment. able understand universal tracker software , should capture objects of software objects can rendered , viewed 3d model! when researched augmented reality technology, able see many open source library , engines such ar-tool kit, mixare on. using wikitude sdk can achieve this! i know ar proviodes api interacting camera , supports opengl graphics java/android developer how can begin or develop ar ap

java - Remove user from Active Directory -

i have email distribution list "ctw dev". remove 1 user 'rakeshdw' activedirectory using java. please find below code. its giving exception. user not getting removed. please suggest required changes. ! import java.io.bufferedreader; import java.io.filereader; import java.io.ioexception; import java.io.randomaccessfile; import java.nio.bytebuffer; import java.nio.channels.filechannel; import java.util.iterator; import java.util.properties; import java.util.hashset; import javax.naming.context; import javax.naming.namingenumeration; import javax.naming.namingexception; import javax.naming.directory.attribute; import javax.naming.directory.attributes; import javax.naming.directory.basicattribute; import javax.naming.directory.dircontext; import javax.naming.directory.initialdircontext; import javax.naming.directory.modificationitem; import javax.naming.directory.searchcontrols; import javax.naming.directory.searchresult; import java.util.properties; import javax

ios - What is the swift equivalent of makeObjectsPerformSelector? -

in objective-c i'm using code remove sub-views: [self.view.subviews makeobjectsperformselector:@selector(removefromsuperview)]; but how use in swift? saw apple documentation use method in swift func makeobjectsperformselector(_ aselector: selector) but when try it, error: 'anyobject[]' not have member named 'makeobjectsperformselector' are there ways remove sub-views in swift? updated swift 2.0 (xcode 7) use foreach : self.view.subviews.foreach { subview in subview.removefromsuperview() } or this: view.subviews.foreach { $0.removefromsuperview() }

html - placing a <p> beside a centered <h1> -

below code center inside. want center title , append date not moving title left. title have remain in middle date appended behind. how can achieve that? <div class="row center"> <div class="col-md-12"> <h1 style="display:inline;">title</h1><p style="display:inline;"> 27th june 2014</p> </div> </div> here trick, can try: <div class="row text-center"> <div class="col-md-12"> <h1 class="title">title</h1> <p>27th june 2014</p> </div> </div> css: .text-center .title { display: inline-block; } .text-center .title + p { position: absolute; display: inline-block; top: 50%; margin: -5px 0 0 10px; /* adjust margin-top based on line height */ } demo: http://plnkr.co/edit/tforjup4g8pr0lxlwn9w?p=preview since col-md-12 has position: relative can posi

java - OnTouchListener return value -

i'm trying understand full ontouchlistener , have doubts. i have xml code: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.pablo.mainactivity" tools:ignore="mergerootframe" > <button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button" /> </linearlayout> and have implemented code java: public class mainactivity extends activity { button b; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); b = (button)findviewbyid(r.id.but

ElasticSearch: Indexing times out if number_of_replicas is greater than 1 -

i'm experimenting scaling elasticsearch , want increase amount of replicas, unable index if number_of_replicas set higher 1. i've been able replicate issue fresh install of es: download , unzip es modify config/elasticsearch.yml file , set index.number_of_replicas setting 2 run bin/elasticsearch index test document: curl -xput 'localhost:9200/test/example/1' -d '{body:"hello"}' timeout i'm running latest version of es (1.2.1) on mac osx 10.9.2. i've been running es on ubuntu wheezy vm, encountered same problem there. setting number of replicas on index-basis (using put request) has same effect. makes me feel i'm missing fundamental. power more es nodes (see second comment)

Passing a php variable to javascript inside php function that echos js code -

i'm coding plug-in wp , i'm writing javascript script head of page document using php's echo . need pass php variables script. tried json.encode() not pass right thing here function: function test_action() { global $wpdb; $contents = $wpdb->get_results("select content wp_map_user_demo"); $lats = $wpdb->get_results("select latitude wp_map_user_demo"); $longs = $wpdb->get_results("select longitude wp_map_user_demo"); //modifying header file of wp echo '<title>demo</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=mykey"></script>'; //including custom google maps script echo "<script type='text/javascript'>

unit testing - phpunit error with app helper in laravel 4 -

i try start using phpunit on laravel project. i call "phpunit" , got error: $ phpunit phpunit 3.6.10 sebastian bergmann. configuration read /home/bee/www/postaler/phpunit.xml ephp fatal error: cannot redeclare helper\ismenuactive() (previously declared in /home/bee/www/postaler/app/helpers.php:4) in /home/bee/www/postaler/app/helpers.php on line 6 php stack trace: php 1. {main}() /usr/bin/phpunit:0 php 2. phpunit_textui_command::main() /usr/bin/phpunit:46 php 3. phpunit_textui_command->run() /usr/share/php/phpunit/textui/command.php:130 php 4. phpunit_textui_testrunner->dorun() /usr/share/php/phpunit/textui/command.php:192 php 5. phpunit_framework_testsuite->run() /usr/share/php/phpunit/textui/testrunner.php:325 php 6. phpunit_framework_testsuite->run() /usr/share/php/phpunit/framework/testsuite.php:705 php 7. phpunit_framework_testsuite->runtest() /usr/share/php/phpunit/framework/testsuite.php:745 php 8. phpunit_framework_testcase-&

css - AngularJS - Sliding Effect On ng-click -

i have created simple ng-click function hides , shows div . however, rather , appearing , disappearing, angular have ability give sliding effect? here's plunkr: http://plnkr.co/edit/jbhidl3ooqvi4rbckjif?p=preview html: <div class="grid-wrap"> <div class="grid-col one-third"> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> <a href="#" class="link" ng-click="showme=!showme">show slidy section</a> </div> <div class="grid-col two-thirds" ng-show="showme"> hidden section want slide out <p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua</p> <p>ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis irure do

friendly urls with yii history.js -

currently when using history.js in view url looks this http://localhost/dev/clubs/ when sort or go next page adds modulesname , clubs , relationtable url http://localhost/dev/modulesname/clubs/index/?clubs_sort=relationtable.make.desc&page=2 how make nicer? maybe (without /index/ too) http://localhost/dev/clubs/?sort=make.desc&page=2 currently in modules controller have this public function actionindex() { $dataprovider=new cactivedataprovider('clubs', array( 'criteria' => array( 'with' =>'make', ), 'sort'=>array( 'defaultorder'=>'make.make asc', 'attributes'=>array( 'make.make'=>array( 'asc'=>'make.make', 'desc'=>'make.make desc', ) ) ), //for friendly url when

c# - Is it possible to use attribute routing and convention based routing in the same controller? -

i have controller called hotelscontroller insert , edit hotels. it has following setup (method implementation removed simplicity): [routeprefix("{member_id:int}/hotels")] public class hotelscontroller : applicationcontroller { [route("delete/{id:int}", name = namedroutes.hoteldelete)] public actionresult delete(int id) { } [route("new", name = namedroutes.hotelnew)] public actionresult new() { } [httppost] [validateinput(false)] public actionresult new(hoteldataentry hotel) { } [route("edit/{id:int}", name = namedroutes.hoteledit)] public actionresult edit(int id) { } [httppost] [validateinput(false)] public actionresult edit(hoteldataentry hotel) { } } as can see following routes using attribute routing: delete new (without parameters) edit (without parameters) the following routes use no attribute routing: new (with parameters) edi

javascript - Align SELECT-OPTIONS text to right -

Image
these screen shots of form developing. i want design select box in form in such way text in options right aligned , after selecting option selected text shown should displayed shown in below image. html code: <select> <option value="0" selected="selected" style="text-align: right;">equalsto</option> <option value="1">lessthan</option> <option value="2">greaterthan</option> <option value="3">lessthanequalsto</option> <option value="4">greaterthanequalsto</option> <option value="5">between</option> </select> try this. http://jsfiddle.net/mfdtu/1/ html <select id="myselect" dir="rtl"> <option value="0" selected="selected" >equalsto</option> <option value="1">lessthan</option> <opt

crash - Xcode 4.4.1 does not work properly under OSX Mavericks -

examples: organizer shows ios 3.1.3 'the digest missing' key it can crash next crash data: uncaught exception (nsinternalinconsistencyexception): extension xcode.device.iphone class 'dvtiphonelocator' not found required key 'locatorclass' for me happens after run xcode 6 beta install incompatible "mobiledevice.framework" on first launch. so solution: disconnect ios devices, close itunes, close xcode sudo rm -rf /system/library/privateframeworks/mobiledevice.framework start xcode 5.1.1 - install compatible mobiledevice.framework

(Partial) Extending "functions" in javascript? -

i have code... var = { helpers: { getname: function() { return 'john doe'; } } } // in file... var = { helpers: { getage: function() { return '40'; } } } // test... $("#mydiv").html(my.helpers.getname + " " + my.helpers.getage); http://jsfiddle.net/mojodk/8cmv7/ ... getname undefined. i hoping javascript smart enough merge this... var = { helpers: { getname: function() { return 'john doe'; }, getage: function() { return '40'; } } } how extend method (or it's called) above? have several "helper" files, needs "merge". redundancy this: my = window.my || {}; my.helpers = my.helpers || {}; my.helpers.getage = function() { return 40; }; demo of in action

ios - Using NSURLSession to download a lot of images -

i have created simple testing app learn how use nsurlsession . app has download images webservice , present them uitableview . i've written first part of app reads list of images urls web service, now, want display list. my doubt is: given list of images long list, ok create nsurlsessiondownloadtask each image? thought create session in cellforrowatindexpath function , store nsurlsessions in nsdictionary using key indexpath of cell (and relying on nsurlcache avoid download same images more once). other solutions : i can see 3 more solutions: using gcd dispatch_async subclassing nsoperation , store nsoperation image need download. using third party library afnetwork ... since learning purpose app prefer go code . if multiple nsurlsession isn't solution, i'd choose 1 of options. what think approach? nsurlsessiontask fine large number of downloads. 1 advantage of on of other methods mentioned downloads can cancelled or paused. correctly

knockout.js - Cyclic dependency using Knockout subscribe -

is there possible fix below code face cyclic dependency using knockout.js subscribe. this.observable1.subscribe(function(value){ self.observable2("somevalue"); }); this.observable2.subscribe(function(value){ self.observable1("somevalue"); }); where "self" alias "this" , observable1 linked combo box, , observable2 linked date picker. kindly suggest as @origineil said, need re-think solution. but if want keep current solution, use flag break cycle. var isinnerupdate = false; this.observable1.subscribe(function(value){ if (isinnerupdate) { isinnerupdate = false; } else { isinnerupdate = true; self.observable2("somevalue"); } }); this.observable2.subscribe(function(value){ if (isinnerupdate) { isinnerupdate = false; } else { isinnerupdate = true; self.observable1("somevalue"); } });

css - not able to see the dot dot dot at the end of the line in the IE 11 -

i have requirement, need show in jsp pargagraph content. working fine in chrome. same code not working in ie 11. problem ... missing in ie11. just see output in chrome: sample 1-announcement contentsample 1-announcement with... in ie 11 sample 1-announcement contentsample 1-announcement content ldjflk for above output have used following css : .vp_announce_card_line_clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; display: -ms-flexbox; } please tell me how can resolve in ie 11 or there alternative problem.

c# - How to bind a list in store apps -

i have problem binding list in store apps. public class category { public category(int id, string name) { this.id = id; this.name = name; } public int id { get; set; } public string name { get; set; } } i created colllecionviewsource , gridview <collectionviewsource x:name="categoriesviewsource" issourcegrouped="true"/> <gridview itemssource="{binding source={staticresource categoriesviewsource}}" > <gridview.itemtemplate> <datatemplate> <stackpanel> <textblock text="{binding name}"></textblock> <textblock text="{binding id}"></textblock> </stackpanel> </datatemplate> </gridview.itemtemplate> </gridview> in constructor of page add list of category collectionviews

ruby - Login automatically to get a scraped file on Rails app with Mechanize -

to login download pdf file, have code works fine on ruby when debug. problem is, when try use code on rails app instance variable, can't download file, guess it's cookie issue didn't achieve resolve it here code works on ruby (i can download pdf file, login success): require 'rubygems' require 'mechanize' agent = mechanize.new agent.pluggable_parser.pdf = mechanize::filesaver page = agent.get("http://elwatan.com/sso/inscription/inscription_payant.php") # login site form = page.form_with(:id => 'form-login-page') form.login = "my_login" form.password = "my_password" page = form.submit #get pdf link agent.get("http://elwatan.com/").parser.xpath('//div[2]/div/p/a/@href|/img').each |link| agent.get link['href'] end and below attempt on ruby on rails 3, didn't work (i can scrape link, not downloading file because getting redirected login page: controller.rb @agent

java - Why compiler warns about resource leak? -

i cannot understand why compiler warns me resource leak ( resource leak: 'conn' not closed @ location ) in following code: connection conn = null; try { conn = databaseconnectionpool.getconnectionfrompool(); // code try { // other code } catch (final someexception e) { // more code throw e; // resource leak: 'conn' not closed @ location } } catch (final sqlexception | otherexceptions e) { // more code } { try { // bunch of code } { databaseconnectionpool.freeconnection(conn); } } note if write this connection conn = null; try { conn = databaseconnectionpool.getconnectionfrompool(); // code try { // other code } catch (final someexception e) { // more code throw e; } { databaseconnectionpool.freeconnection(conn);

c++ - libcurl curl_easy_setopt "Unknown error" -

i'm trying use c++ curl library sending json data via put method , code looks this curl* m_curlhandle; curlcode m_returnvalue; //function1 start curl_global_init(curl_global_all); struct curl_slist* headers = null; std::ostringstream oss; struct curl_slist* slist = null; slist = curl_slist_append(headers, "accept: application/json"); slist = curl_slist_append(headers, "content-type: application/json"); slist = curl_slist_append(headers, "charsets: utf-8"); m_curlhandle = curl_easy_init(); if (!m_curlhandle) // throw exception curl_easy_setopt(m_curlhandle, curlopt_httpheader, headers); //function1 end //function2 start std::string url = "some url"; // url curl_easy_setopt(m_curlhandle, curlopt_url, url.c_str()); unsigned int timeout = 5; curl_easy_setopt(m_curlhandle, curlopt_timeout, timeout); std::string localip = "some ip"; // ip address curl_easy_setopt(m_curlhandle, curlopt_interface, localip.c_str()); curl_e

android - Strange dialog with GooglePlayServicesUtil -

Image
i'm checking avalibility of google play services on device. these code: final int resultcode = googleplayservicesutil.isgoogleplayservicesavailable(this); if (resultcode != connectionresult.success) { final dialoginterface.oncancellistener cancellistener = new dialoginterface.oncancellistener() { @override public void oncancel(final dialoginterface dialog) { finish(); } }; final dialog errordialog = googleplayservicesutil.geterrordialog( resultcode, this, google_play_services_request_code, cancellistener ); errordialog.show(); } i resultcode = 2 (it's mean google play services needs update). dialog shown, instead of text, paths layout. it's looks there interference of resource in app , resource in playservices lib. how it's possible , how avoid id? since accepted answer unclear, i'll leave signpost conclusions

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

request animation frame stops working when exiting fullscreen clicking on original space's safari window. fine if fullscreen mode canceled escape key or calling cancelfullscreen(). steps reproduce: open https://dl.dropboxusercontent.com/u/769042/prezi/safari-fullscreen.html click "draw raf", kittie appears click "fullscreen", go fullscreen click "draw raf", kittie appears go space original safari was, showing "click exit fullscreen mode", click anywhere, out fullscreen click "draw raf", nothing happens what handling click calling: window.requestanimationframe(draw); which draws on canvas context: function draw() { ctx.drawimage(img, math.random()*500|0, math.random()*400|0, 100, 100); } i checked .hidden , .visibilitystate, updated correctly. tested on osx 10.9.3, safari 7.0.4 (9537.76.4). has workaround/solution other switching old settimeout? this sounds webkit bug 88940 : using reque