Posts

Showing posts from April, 2012

ruby on rails - How I can get a location of response headers for this? -

could please tell me, how can location of response headers following respones? http = net::http.new "s3.amazonaws.com" response = http.request_head(url) net::http response headers accessible using element selection operator ([]) on response object itself: response['authorization']

javascript - Check if image exists with url Doesn't work in all browsers -

hi guys need in project show image other fields in loop image src differs every iteration, , have know if image exists make default src if not, code show works on firefox not in chrome , ie : var img = new image(); img.src = "www.imagesource.com/image.jpeg"; var imgcheck = img.width; if (imgcheck==0) { alert("you have 0 size image"); } else { alert('you have img'); //do } need helps.. two problems there: img.src = "www.imagesource.com/image.jpeg" that's relative url, it's meant absolute one. add http:// , https:// , or // in front of it. you're not allowing asynchronicity of retrieving image. before setting src (correctly), hook load , error events. load tells worked. error tells didn't. check width won't tell anything, because image (probably) isn't loaded yet. so: var img = new image(); img.onload = function() { // loaded, check `width` if think that's nece...

Flask Socket-IO misses current_user with request from NGROK -

i got flask app running @ house normally. no error ever. uses flask-socketio , flask login. since started use ngrok, have noticed weird. whenever make request outside home network error below. seems login-in anonymous user, not because logged in. @ home not happen. have debugged , http requests current_user fine, reason socket-io doesnt. using nginx reverse proxy, have tested without nginx binding ngrok straight flask server port (both development , gunicorn). traceback (most recent call last): file "/home/cesco/projects/power/venv/local/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run result = self._run(*self.args, **self.kwargs) file "/home/cesco/projects/power/venv/local/lib/python2.7/site-packages/socketio/virtsocket.py", line 403, in _receiver_loop retval = pkt_ns.process_packet(pkt) file "/home/cesco/projects/power/venv/local/lib/python2.7/site-packages/socketio/namespace.py", line 164, in process_packet return self.call_method...

Android - Video ads in app -

i wondering how integrate video ads in android app. there tutorial? can explain me step step shortly? here list of video ads website. vungle adcolony and unity ads

powershell - Referencing variable in scriptblock -

i have following code parsing xml file in powershell, , iterating through entries in config file (which backup jobs) , performing backups (by calling functions). if ($xmlfile.configuration.dbandfilesbackup.item("mssql").haschildnodes) { $xmlfile.configuration.dbandfilesbackup.mssql.backup | start-rsjob -name {$_.name} -throttle 2 -scriptblock { # begin backup beginbackup $_.name $log # backup mssql database mssqlbackup $_.name $_.dbpath $using:backupdir $using:backuptempdir # backup files filesbackup $_.name $_.foldername $_.filespath $using:backupdir $using:backuptempdir # end backup endbackup $_.foldername $_.name $log $using:emailto $using:backupdir $using:backuptempdir } -functionstoload beginbackup,mssqlbackup,filesbackup,endbackup,mailer,printheader | wait-rsjob | receive-rsjob | out-file "$scriptdir\logs\corebackup\...

.net - C# WPF Generate a Sequential int value and Save it on SQL Server -

i have situation need generate sequential int value , save on database, it's never can duplicated. i'm new in c# wpf, , how can it? generated value must displayed in textbox. possible scenario using sequence sql server 2012+ create sequence in db create sequence dbo.sequence_name start 1 increment 1; query application using select next value dbo.sequence_name; remember in application, show user use when insert db

laravel - Dynamic information in my include file -

i'm using @include('folder.mypage') usual include page contains dynamic information. unfortunately dynamic information not being included. how round this? you can pass dynamic information view include including array of data. @include('view.name', ['some' => 'data']) http://laravel.com/docs/5.1/blade#control-structures

excel - VBA. Search a value X in column and copy a part of the row with the X and below ones in another sheet -

i'm learning vba , i'm stuck this: i have button moves "x" (text) across column (sheet1) every time click button. well, make button able copy columns (b,c,d,f) of "x marked" row , next 4 below, , paste on sheet2 , sheet3.

ios - AWSDynamoDB - empty task result -

task = [[task continuewithsuccessblock:^id(bftask *task) { nslog(@"%@: profile identity : %@", nsstringfromselector(_cmd), cognitouid); awsdynamodbobjectmapper *dynamodbobjectmapper = [awsdynamodbobjectmapper defaultdynamodbobjectmapper]; return [dynamodbobjectmapper load:[tplcognitouserdbo class] hashkey:cognitouid rangekey:nil]; }]continuewithblock:^id(bftask *task) { if (task.error) { nslog(@"%@: request failed. error: [%@]",nsstringfromselector(_cmd), task.error); } if (task.exception) { nslog(@"%@: request failed. exception: [%@]", nsstringfromselector(_cmd), task.exception); } if (task.result) { tplcognitouserdbo *cognitoprofile = task.result; if(cognitoprofile) { nslog(@"%@: user id %@ ::",nsstringfromselector(_cmd), [cognitoprofile...

Asynchronous POST Requests - R, using RCurl? -

i trying make async requests rest api r. below curl command illustrates parameters need pass api. i'm giving guys linux curl command i'm hoping make clear: curl -v -x post https://app.example.com/api/ \ -h 'authorization: somepwd' \ -h "content-type: application/json" \ -d {key1: value1, key2: value2} right now, i'm accomplishing same thing in r executing following: library(httr) library(jsonlite) content(post('https://app.example.com/api/' ,add_headers(authorization = 'somepwd') ,body = tojson(rdataframe) ,content_type_json() ) ) the goal submit above post request r vary json string sent in body, , asynchronously . i have been searching packages me make asynchronous requests rather making requests serially. closest thing find geturiasynchronous() function rcurl package ( https://cran.r-project.org/web/packages/rcurl/rcurl.pdf ) not understand...

c# - How to parse this JSON using JSON.Net? -

i cannot retrieve values inside queued_messages. im using c# here sample json data: { "queued_messages": [ "messageid082420150825111152", "messageid082420150825111153", "messageid082420150825111154" ] } here code: string json = httprequest.message.trim(); jobject jsonids = jobject.parse(json); queued_messages queuedmessageids = jsonids["queued_messages"].toobject<queued_messages>(); class of queued_messages: public class queued_messages { [jsonproperty("queued_messages")] public string queued_messages { get; set; } } queued_messages must array public class queued_messages { [jsonproperty("queued_messages")] public string[] queued_messages { get; set; } } jobject jsonids = jobject.parse(json); queued_messages queuedmessageids = jsonids.toobject<queued_messages>();

javascript - MongoDB database db.collection.find returns results but meteor-angular pub/sub nor collection.find does not -

in meteor have: var data_set = elephant_site_service_calcs_ts.find( { calc_tag_id: parseint(calc.alert_id), calc_ts_update_hour: start_date }); console.log(data_set.fetch()); in autorun. testing have: var calc_tag_data = $meteor.collection(elephant_site_service_calcs_ts) .subscribe('site_calcs_realtime',{ calc_ts_update_hour: 1, calc_tag_id: 1, values: 1 }, { calc_tag_id: parseint(calc.alert_id), calc_ts_update_hour: { $gt: start_date.tostring() } }); console.log("calc time series data " + calc_tag_data); when run either of them dire...

java - how to Call Android Layout(XML) Programmatically? -

i want call android layout(xml) programmatically in function. layout created in xml. asking question because don't want use in android native app, call these layouts in unity3d gaming engine. let have layout. example @ below code: <linearlayout android:layout_width="0dp" android:layout_height="wrap_content" android:orientation="vertical"> <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/useful_nums_item_name"/> <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/useful_nums_item_value"/> </linearlayout> <imagebutton android:layout_width="0dp" android:layout_height=...

what determines controller action ruby rails -

at https://www.codecademy.com/en/courses/learn-rails/lessons/start/exercises/start-views , controll action described 'pages#home': well done! when user visits http://localhost:8000/welcome, route 'welcome' => 'pages#home' tell rails send request pages controller's home action. but when made controller did rails generate controller pages uppercase. pages_controller.rb: class pagescontroller < applicationcontroller def home end end is pages part of pages#home determined first part of pages_controller.rb , ignoring _controller.rb end? what happens if change pages_controller.rb renamedpages_controller.rb leave class name pagescontroller? thank you yes. , #home "action" in pagescontroller you uninitialized constant pagescontroller error so, controllers should in form namecontroller defined in name_controller.rb , , actions public methods in namecontroller .

java - How could i make HashSet as parameter to the HashMap? -

i have maintain list of indexes each of key value in hashmap. declared hashmap as hashmap<integer,hashset<integer> hset = new hashset<integer>()> hm = new hashmap<integer,hashset<integer> hset = new hashset<integer>()>(); but above declaration seems not correct. declared as hashset<integer> hset = new hashset<integer>(); but here problem is,how declare type of objects stored in hashset i,e integer, bacause in above declaration hashset rawtype. i add more here, need initialize outer map below hashmap<integer,hashset<integer>> map = new hashmap<integer,hashset<integer>>(); and inner collection hashset<integer> hset = new hashset<integer>(); and insert values below in map , hash set. hset.add(1); hset.add(2); map.put(100,hset); hset = new hashset<integer>(); hset.add(3); hset.add(4); map.put(101,hset); so every time need new instance of hashset put in map. yo...

javascript - ExtJS ComboBox Uncaught TypeError: Cannot read property 'scrollIntoView' of null -

my ext version 4.07. i create combobox , want store data json file. var combo = ext.create(ext.form.combobox, { editable: false, fieldlabel: 'choose format', store: ext.create(ext.data.store, { autoload: true, fields: ['format', 'dimension'], proxy: { type: 'ajax', url: 'jsonurl', // has masked here reader: { type: 'json', root: 'formats' } }, listeners: { load: function(me) { var defaultvalue = me.getat(0).data.dimension; combo.select(defaultvalue); } } }), displayfield: 'dimension...

bash - Not able to call a shell script from an ansible playbook -

i trying run 2 shell scripts in background through ansible playbook. playbook running , displaying tasks ran successfully. but these 2 shell scripts not running. have checked with: ps -ef | grep sh these 2 shell scripts required run sage service , trying automate s age server configuration using ansible. here how playbook looks : --- - hosts: localhost remote_user: root tasks: - name : update system shell : apt-get update - name : install dependencies shell : apt-get install -y m4 build-essential gcc gfortran libssl-dev - name : install python-software-properties shell : apt-get install python-software-properties - name : add sage ppa repo shell : apt-add-repository ppa:aims/sagemath - name : update system shell : apt-get update - name : install dvipng shell : apt-get install dvipng - name : install sage binary shell : apt-get install sagemath-upstream-binary - name : run create sage script shell :...

android - Can we use .wma sound files in andengine? -

i trying use 1 sound file wma extension. when try play it, doesn't play. andengine support .wma extension files? sound sound = soundfactory.createsoundfromasset(activity.getsoundmanager(), activity, "mfx/sound111.wma"); sound.play(); but doesn't play. finally got answer. have use mp3 or ogg rather wav format. because wma closed format , it's support depend on libraries not available on android devices, , they're not part of aosp (android open source project) tree itself.

Implementing Android Content provider Insert(), using notifyChange() -

sorry, i'm not @ english. i'm learning developing android apps in udacity. implemented insert() in content provider, , wonder. in code, there 2 different uris, returnuri , uri(past uri passed parameter). @override public uri insert(uri uri, contentvalues values) { final sqlitedatabase db = mopenhelper.getwritabledatabase(); final int match = surimatcher.match(uri); uri returnuri; switch (match) { case weather: { normalizedate(values); long _id = db.insert(weathercontract.weatherentry.table_name, null, values); if ( _id > 0 ) returnuri = weathercontract.weatherentry.buildweatheruri(_id); else throw new android.database.sqlexception("failed insert row " + uri); break; } default: throw new unsupportedoperationexception("unknown uri: " + uri); } getcontext().getcontentresolver().notifychange(uri, null); return returnuri; } please pay attention bottom of code. in lecture, ...

ruby on rails - NoMethodError (undefined method `create' for nil:NilClass): while creating the new record in single table -

i new ror , trying create records in table, namely consultants using active records. getting error nomethoderror (undefined method 'create' nil: nilclass): @ create(self.params) class createconsultant < struct.new(:params) # returns newly created user def run consultant = tutconsultant::stores::entitystore.for( tutconsultant::entities::consultant).create(self.params) end end it seems dont have create method. should add create method in controller. def create //your create codes here end

Angular/Typescript for Adobe Premiere Panel -

i'm totally new cc "addon"/panel coding , informed myself bit. i saw possible code javascript , html5 , therefore thought should possible code in angular since gets compiled js. is solution out there ? searched online , didn't come conclusion. regards!

html - PHP: Text Area echo in form won't echo during validation -

currently have form goes through validation, , echo statement entered , returned errors on needs filled in. commenting area within tag. throws error when it's empty. when it's filled , other areas empty, not echo entered text. i view question claims have answer. previous using: <?php echo $_post['email']; ?> in value result. "answer" said replace value , htmlentities() such: <?php echo htmlentities($comments, ent_compat,'iso-8859-1', true);?> however, did not work either. i want comments echo, when text entered, other areas still need info. html form text area: <textarea name="comments" maxlength="500" rows="10" cols="10" placeholder="please enter comments here..." value="<?php echo htmlentities($_post['comments'], ent_compat,'iso-8859-1', true);?>"></textarea> php (not sure if needed here in answer): <?php if(!empty($_post))...

html - show different content in multiple css popups -

i have html/css popup code. want multiple popups in page. when click on popup, first popup's content comes on. how can make them show different content ? thank you. html <div id="closed"></div> <a href="#popup" class="popup-link">klik untuk memunculkan popup</a> <div class="popup-wrapper" id="popup"> <div class="popup-container"><!-- konten popup, silahkan ganti sesuai kebutuhan --> <form action="http://www.syakirurohman.net/2015/01/tutorial-membuat-popup-tanpa-javascript-jquery.html#" method="post" class="popup-form"> <h2>conent</h2> </div> </form> <!-- konten popup sampai disini--><a class="popup-close" href="#closed">x</a> </div> </div> css a.popup-link { padding:17px 0; text-align: center; margin:7% auto; position: relative; width: 300px; color: #fff; text-d...

reportbuilder - rdl report builder file not launching from SharePoint site -

i have links 2 sharepoint sites (different servers) , when click on menu option "edit in report builder" on 1 site not load supposed other. dialog has show details button on when clicked opens log file. log file says: ... activation of <path>\reportbuilder_3_0_0_0.application resulted in exception. following failure messages detected: system.deployment.application.deploymentdownloadexception (unknown subtype) + downloading file:///<path>/rptbuilder_3/msreportbuilder.exe.manifest did not succeed. ... any ideas on how work? all know designed ones on site works using report builder 12.0. if go error above mean report builder 3.0 , not backward compatible? i have tried clear cache option not work me either, i.e.: open command window type: cd c:\windows\system32 type: rundll32 dfshim cleanonlineappcache it seems issue between servers cannot put finger on. not ideal solution workaround. goto following folder c:\users\[username]\appdata\loc...

mod rewrite - Redirect Rules for .htaccess File -

what code these redirects in .htaccess file? www.site.com/books/ =====> www.site.com/movies/ www.site.com/books/title/ =====> www.site.com/movies/title.html if need 301 redirect (and assuming htaccess file in root folder), these rules trick: rewriterule ^books/$ http://www.example.com/movies/ [r=301,l] rewriterule ^books/title/$ http://www.example.com/movies/title.html [r=301,l] replace example.com domain name. search here in s.o. also. there countless posts on how these redirections. edit : dynamic titles second rule becomes: rewriterule ^books/([^.]+)/$ http://www.example.com/movies/$1\.html [r=301,l]

php - Laravel Route resource MethodNotAllowedHttpException on destroy method -

i using resource laravel route defined following line in routes.php : route::resource('test', 'app\controllers\teacher\testcontroller', ['only' => ['index', 'create', 'destroy']]); the index method works fine . in template of index have created form in order remove item of list. <form method="delete" action="{{ url::action('app\controllers\teacher\testcontroller@destroy', $audit->id ) }}"> <input type="submit" value="remove" /> </form> the url correctly generated laravel when post form following error : exception 'symfony\component\httpkernel\exception\methodnotallowedhttpexception' in /var/www/project/bootstrap/compiled.php:5365 i have try change delete post in method attribute of form doesn't work. i read post doesn't me : methodnotallowedhttpexception on resource defined method laravel-4 when manually create form sh...

Outputting values 1 to A, with B values per row (Java) -

public static void applicationb(int a, int b) { int number = 1; (int row = 0; row < a; row++) { (int col = 0; col < b; col++) { int output = number + row++; system.out.printf("% 4d", output); } // skip because of this? system.out.println(""); } } it outputs = 20, b = 5 1 2 3 4 5 7 8 9 10 11 13 14 15 16 17 19 20 21 22 23 the correct output should be 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 i cannot figure out how stop skipping 6, 12, , 18. doing horrible way? or on right track? you incrementing row in 2 places. also, easier have 1 loop, , output line break every b elements (you can use i % b test this).

javascript - dgrid custom sort issue -

i'm trying override sort logic in dgrid suggested kfranqueiro in link - https://github.com/sitepen/dgrid/issues/276 . i data server in sorted order , want update ui of column header. i'm doing - on(mygrid, 'dgrid-sort', lang.hitch( this,function(event){ var sort = event.sort[0]; var order = this.sort.descending ? "descending" : "ascending"; console.log("sort "+ this.sort.property + " in " +order+" order."); event.preventdefault(); mygrid.updatesortarrow(event.sort, true); myfunctiontorefreshgrid(); })); ... myfunctiontorefreshgrid: function() { ...//get data server in sorted order var mystore = new memory({data: sorteddatafromserver, idproperty: 'id'}); mygrid.set("collection", mystore); ... } memory here "dstore/memory" . i'm using dgrid 0.4, dstore 1.1 , dojo 1.10.4 before calling set('collection',...) see sorteddatafromserver ...

php - Laravel 5.1 - Remove "public/" of the URL whith Method bind? -

i need please, i'm beginner laravel , mvc. want remove "public/" of url. the 2 "solutions" found in google, are: either .htaccess. me (and not me) it's not working. either putting in "public" folder @ root of project laravel. not security reasons. there real solution remove "public/" url? example url: localhost/laravel/public/test accessible url: localhost/laravel/test because if or has no solution, of no use continuous take courses on frameworks. _i had read, there may solution in appserviceprovider: http://www.creerwebsite.com/medias/upload/larav2.png or in router or container: app::bind('path.public', function() { return base_path().'/public_html'; }); but beginner, not find solution. thank you. the best option configure local installation of wamp use laravel's public folder document root. have 2 options here: option 1. use wamp project alone find httpd.conf file. server...

excel - transferring variable form one workbook to another woorkbook vba -

i still newbies in vba programming i have simple questions looking simple methode if possible. i creating userform( userform1) in workbooka , in userform, i'll needing module(module1) created in other workbook( workbookb) made calculation. in order launch calculation, module need info( ttaa, tolerance). love know easiest way transfer variable userform1(workbooka.userform1) module1(workbookb.module1) , re-transfer results userform1. below, can find small part of programm i've coded call module. ttaa = cdbl(me.ttaa_textbox.value) tolerance = cdbl(me.tolerance_textbox.value) application.run ("'workbooks.xls'!module1") i've declared public, variable ttaa , tolerance in module1 really appreciated help. in advance the easiest way (which know work) temporarily "save" variable on sheet in 1 of either file , reference as worksheets.add.name = "tmp" workbooks(workbooka.name).worksheets("tmp").range("a1...

Library of icons mostly used for iOS/swift/xcode -

i'm looking icons such those: microphone, email, record, play, pause, stop, ... there library of .png/.jpg available? i've tried google can't find one. or should xcode? in advance! this super broad question, i'll give best advice can think of. here's free library of mobile icons. used ios , android: https://github.com/google/material-design-icons

agile crm - Add contacts using PHP Api with AgileCRM -

i have implemented on add contact agilecrm php api in agile_curl_wrap function, have provided 3 requirements domain, user , api_key after clicking submit, got 401 unauthorize response back. i'm sure have set requirement needed api. got stuck in step. thank in advance helps. you can check gist i've created show how works. replace strings on both files , go on! in agilecrm php wrap replace: define("agile_domain", "yourdomain"); define("agile_user_email", "youremail"); define("agile_rest_api_key", "yourapikey"); in agilecrm php wrap usage replace: $email = "some@email.com"; and must work!

c# - ASP.Net MVC Web does not validate empty fields -

i use visual studio 2013, update 5 with asp.net mvc project template created simple web deeper mvc after taking few steps. i added model creaded standard edit view , controller. in model use "required" , minlength attributes. minlength attibutes raised validation messages if fields kept empty "required" attributes doesn't work. what works is, if put 1 character in field, , leave field (so minlenth validation fails) , afterwards clear complete field. in case, required attribute seems anythings. (bug or feature?! :-) ) here model use edit view generated "new view" template of visual studio public class apotheke { [displayname("apotheken nr.")] [displayformat(dataformatstring = "{0:d4}")] [range(1, 9999)] [required(allowemptystrings = false)] public int apothekennr { get; set; } [displayname("name der apotheke")] [minlength(3)] [required(allowemptystrings = true)] public ...

excel - Filter in X axis, within a chart -

Image
i want use filter in x axis, within chart in excel, data 1 value displayed @ time upon selection. kindly suggest me how without using pivotchart. 1 - use range plot chart ... 2 - have selected xy scatter chart... 3 - apply filter on cells headers of x , y 4 - filter x values want select , chart show data visible filter results please see attachment images example..

ebay - ebaysdk-python Authentication failed : Invalid Application -

i trying connect ebay python script. here code, have used ebaysdk-python import ebaysdk ebaysdk.finding import connection finding ebaysdk.exception import connectionerror try: api = finding(debug=true, config_file='myebay.yaml',) api_request = { 'keywords':'harry potter', 'maxentries': 2, 'availableitemsonly':true, } response = api.execute('finditemsadvanced', api_request) print response except connectionerror e: print "\n\n\n",e print "\n\n\n",e.response.dict() while running getting below error. here debug result 2015-08-25 12:24:18,101 ebaysdk [debug]:execute: verb=finditemsadvanced data={'keywords': 'harry potter', 'maxentries': 2, 'availableitemsonly': true} 2015-08-25 12:24:18,107 ebaysdk [debug]:request (cb3019a4-1f9a-4e82-9ba9-b45ed84329dd): post http://svcs.ebay.com/services/search/findingservice/v1 201...

java - How to substitute HttpServletResponse output stream? -

i need use jsp generate html report. made example, not work in tomcat6 far. public class substitutionservlet extends httpservlet { @override protected void service(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { requestdispatcher dispatcher = request.getrequestdispatcher("/web-inf/jsp/report.jsp"); final bytearrayoutputstream buf = new bytearrayoutputstream(); servletresponsewrapper wrapper = new httpservletresponsewrapper(response){ @override public printwriter getwriter() throws ioexception { return new printwriter(buf); } }; dispatcher.forward(request, wrapper); string html = buf.tostring("utf-8"); // "" returned system.out.println(html); response.getoutputstream().print("completed"); } } when try run example, empty string result. mistake have made? the...

SQLSERVER 2008 R2 replication error -

i have problem replication. sql server shows me in log : 3 errors skipped while submit replication. how see records problems appear ? :'( thk in advance. if you're interested in exploring differences should use either query or tablediff utility find differences between publisher , subscriber. https://msdn.microsoft.com/en-us/library/ms162843.aspx

c++ - Better cast an element of a list or use a pointer to it? -

say have struct this struct mystruct { int a; int b; string str; [...and on...] }; now have pointer list of structures list<mystruct*>* mylist; and need use elements in for-loop . access element in for-loop need this ((mystruct)mylist[i])->a in terms of performance better way (i.e. cast) or better use pointer element, i.e. declare pointer before for-loop , each time this //before for-loop mystruct* s; //inside for-loop for(...) { s = mylist[i]; s->a; ... } list<mystruct*>* mylist; since mylist pointer list of mystruct* , don't need cast. need dereference mylist before index it: (*mylist)[i]->a

java - Change the user agent of Crosswalk 13+ as webview in Cordova -

i trying change user agent of crosswalk used webview cordova. using plugin cordova-plugin-crosswalk-webview. i able accomplish customization of user agent vanilla cordova following code: import android.webkit.websettings; import android.webkit.webview; public class mainactivity extends cordovaactivity { public websettings settings; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); super.init(); settings = ((webview) super.appview.getengine().getview()).getsettings(); string defaultua = settings.getuseragentstring(); string customua = defaultua+" oreeganoc1"; settings.setuseragentstring(customua); loadurl(launchurl); } } however, when run app crosswalk plugin crashes due piece of code. works without crosswalk. using cordova 5.2.0 , crosswalk 13. any hints? i'm not sure if preferred method or not, here's did (using crosswalk ...

c++ - What is better: reserve vector capacity, preallocate to size or push back in loop? -

i have function takes pointer char array , segment size input arguments , calls function requires std::array<std::string> . idea input char array "sectioned" equal parts, , string array formed. the input char array format several smaller arrays (or strings) of determined size, concatenated togeather. these not assumed zero-terminated, although might be. examples segment size 5 , number of elements 10: char k[] = "1234\0001234\0001234\0001234\0001234\0001234\0001234\0001234\0001234\0001234\000"; char m[] = "1234\00067890987654321\000234567809876\0005432\000\000\0003456789098"; char n[] = "12345678909876543211234567890987654321123456789098"; length of char arrays 51 (segment * elements + 1). goal make function use resources efficiently, importantly execution time. since there many ways skin cat, have 2 (or three) ways tackle this, , question is, "better"? mean faster , less resource-wasteful. not professional, patient me...

ios - How to make stretchable circular region around pin like Reminder App -

Image
i tried following code make circle: mkcircle *circle = [mkcircle circlewithcentercoordinate:userlocation.coordinate radius:1000]; [map addoverlay:circle]; then in map view's delegate: - (mkoverlayview *)mapview:(mkmapview *)map viewforoverlay:(id <mkoverlay>)overlay { mkcircleview *circleview = [[mkcircleview alloc] initwithoverlay:overlay]; circleview.strokecolor = [uicolor redcolor]; circleview.fillcolor = [[uicolor redcolor] colorwithalphacomponent:0.4]; return circleview; } it adds circle around pin, how make circle stretchable reminder app's location reminder feature? look found: https://github.com/d0ping/dbmapselectorviewcontroller you can set lot of things radius of circle, background , stroke color , radius text.

html5 - Generate pages on the basis of links with jekyll -

i'm newbie jekyll , maybe have find alternative ways. achieve following goal: i want avoid having code replaced in everywhere (for layout). have generate page on basis of previous link. so, have following architecture. x.html here have link bigcomponent.html <article> <div id="{{entry.id}}" class="panel panel-primary"> <div class="panel-heading clearfix"> <div class="pull-left"> {{ entry.title }} </div> <div class="pull-right"> <span class="label label-success">{{entry.projects}}</span> </div> <div class="pull-right" style="padding-right: 7px;"> <span class="label label-success status" >{{entry.status}}</span> </div> </p> </div><!-- panel-heading clo...

How can we use protractor in eclipse? -

can write protractor test/scripts in eclipse. enabling syntax highlighting , intellisense etc. javascript in eclipse. yes, can use protractor plugin in eclipse. go help-->marketplace search tern.java install tern eclipse ide and accept licence. now create project in eclipse right click on project, mouse hover configure , click on convert tern project properties window pop-up>> goto modules you able see protractor, select check box , click on protractor , also check dependencies well. now ready write scripts using protractor.

razor - asp.net web pages. Default route -

how can set site (asp.net web pages) urldata default page? site.com/default/1 this work, site.com/1 return 404 error. in web forms work fine, in web pages no if have default.cshtm l default start page, if it´s not listed in list default pages under settings. guess it´s because how routing works in asp.net web pages. if want index.html start page, need add list default pages, , remove default.cshtml if have that. see this link <defaultdocument enabled="true"> <files> <add value="default.htm" /> <add value="default.asp" /> <add value="index.htm" /> <add value="index.html" /> <add value="iisstart.htm" /> <add value="default.aspx" /> </files> </defaultdocument> here similar post

c++ - Win32 - Color static text (WM_CTLCOLORSTATIC) -

i have code bool callback msgproc(hwnd hwnd, uint message, wparam wparam, lparam lparam { static hbrush hbrush = getsyscolorbrush(color_btnface); switch(message) { ... case wm_ctlcolorstatic: hdc hdc = (hdc) wparam; // updated setbkmode(hdc,transparent); if(getwindowlong(hwnd, gwl_id ) == idc_radio_excellent) { // dark green. settextcolor(hdc,rgb(0,0x64,0)); } return (lresult) hbrush; case ... } } i'm trying color static text darkgreen. sure, settextcolor called. everything ok when use: #pragma comment(linker,"\"/manifestdependency:type='win32' \ name='microsoft.windows.common-controls' version='6.0.0.0' \ processorarchitecture='*' publickeytoken='6595b64144ccf1df' language='*'\"") then static text not dark green black. what doing wrong? solution i found solution works me. set off visual style radio button ...

iOS- Adhoc Builds with Distribution Certification Push notification comes twice -

in ios application, have implemented push notification. working fine except time push comes twice. i using adhoc builds distribution certificate. in back-end send request apns once. also, request apns production server calls i have googled didn't find solution. can 1 confirm me if ios bug or not. also, random behavior. 80% of time 2 notifications single event. any appreciated my guess have 2 different tokens registered same device, causes server send notification twice (one each token, resulting in 2 messages being sent same device). push tokens don't change, can. can result of re-installing app, changes in operating system or other consideration not disclosed app's developers. why apple indicates need send updated version of token whenever app launched. in case, it's possible token changed reason , though sending notification once each token, sending once each of 2 tokens representing device. explanation why you're receiving double messages...

visual studio 2013 - How to escape the dollar sign in pre-build step -

'm fighting against visual studio escape dollar sign ($) in pre-build step. goal provide variable name litteral. vs should not try process variable name. the documentation states %xx (where xx hexadecimal value of character) should used. i've tried following : %24(var.data.webhost.projectdir) but result is 4(var.data.webhost.projectdir) instead of $(var.data.webhost.projectdir) what doing wrong here ? update 1 : correct syntax put $ sign between double quotes. "$"(var.data.webhost.projectdir) is answer. as alternative using approach in documentation do: %2524(var.data.webhost.projectdir) %25 % , while remaining 24 appended, forming %24 , translating $(whatever) in output code. the "$" approach didn't work me writing osx-compatible post build event (for mono 5), needed this: if [ "$(uname)" == "darwin" ]; (...) and output, ""$"(uname)" didn't work me. i hope l...

javascript - Deleting a property of an object inside its definition; Why? -

looking @ recent google maps api loader source , i'm wondering purpose of following: google.maps.load = function(apiload) { delete google.maps.load; ... why delete property of object, inside definition? suspect have performance increase, can't figure out how property can delete inside definition. this ensure api loaded once. however, not throw useful error when function called second time, may cause exception. here alternative solution throws more useful error. google.maps.load = function() { throw new error("already loaded") };

c# - Detecting isSticky in Android custom keyboards -

i have custom keyboard buttons issticky enabled have problem detecting if turned on or off (true / false) , disabling them after key pressed if turned on (true). the problem can't find way detect keys , appending current edittext functions (all sticky buttons has specific functions). this should happen in onkey function, here keyboard class: public class mykeyboardlistener : java.lang.object, keyboardview.ionkeyboardactionlistener{ private readonly activity _activity; public mykeyboardlistener(activity activity){ _activity = activity; } public void onkey(android.views.keycode primarycode, android.views.keycode[] keycodes){ var eventtime = datetime.now.ticks; var keyevent = new keyevent(eventtime, eventtime, keyeventactions.down, primarycode, 0); switch ((int)primarycode) { case 1005: break; case 1006: break; default: _activity.dispatchkeyeven...

python - pandas: Dataframe.replace() with regex -

i have table looks this: df_raw = pd.dataframe(dict(a = pd.series(['1.00','-1']), b = pd.series(['1.0','-45.00','-']))) b 0 1.00 1.0 1 -1 -45.00 2 nan - i replace '-' '0.00' using dataframe.replace() struggles because of negative values, '-1', '-45.00'. how can ignore negative values , replace '-' '0.00' ? my code: df_raw = df_raw.replace(['-','\*'], ['0.00','0.00'], regex=true).astype(np.float64) error code: valueerror: invalid literal float(): 0.0045.00 your regex matching on - characters: in [48]: df_raw.replace(['-','\*'], ['0.00','0.00'], regex=true) out[48]: b 0 1.00 1.0 1 0.001 0.0045.00 2 nan 0.00 if put additional boundaries matches single character termination works expected: in [47]: df_raw.replace(['^-$'], ['0.00...

angularjs - How to write global event(touch/click) handler in angular application? -

if angular application not touched(mobile browser) or clicked particular seconds, should through alert. can on this? best way, if use angular js, use ng-idle. source demoes , git repo: http://hackedbychinese.github.io/ng-idle/

javascript - TypeError: Cannot read property 'find' of undefined -

i doing piece of code: var mongoclient = require('mongodb').mongoclient; // connect db mongoclient.connect("mongodb://${server}:27017/${db}", function(err, db) { if(!err) { console.log("successfully connected database"); }else{ console.log("error on connecting... aborting , exiting"); return console.dir(err); throw err; } db.authenticate('username', 'password', function(err, res) { var startid = 7882; var usercount = 100; var num = 190; var basegeologorig = db.geologs.find({user_id:279, created_at:{$gte:new isodate("2015-01-31"), $lte:new isodate("2015-02-02")}}).limit(1227); var basegeolog = []; // callback console.log("reached here...!"); }); }); after connected database , tried operations got following error: /usr/lib/node_modules/mongodb/lib/utils.js:97 ...

c# - Async/await deadlock while downloading images -

i'm developing windows phone 8.1 app. have screen list of news' titles thumbnails. first i'm making asynchronous http request news collection in json (satisfying notifytaskcompletion pattern ) newscategories = new notifytaskcompletion<observablecollection<newscategory>>(_newsservice.getnewscategoriesasync()); newscategory: public class newscategory : observableobject { ... public string title { get; set; } public observablecollection<news> items { get; set; } } news: public class news : observableobject { ... public string title { get; set; } public string imagepath { get; set; } } so far works perfectly, imagepath property, download , display given image. i've found solution asynchronously here: wp 8.1 binding image http request - when xaml gets image path, calls converter class ( binarytoimagesourceconverter ), using notifytaskcompletion pattern. the problem occurs in following method: private async...