Posts

Showing posts from May, 2010

javascript - Updating controller data doesnt update the view - Angular JS - Ionic -

i have controller : .controller("mainctrl",function($scope,$state){ var self = this; var usuario = window.localstorage.getitem('usuario'); this.msjs=[]; var res = window.localstorage.getitem(usuario+'_msjs'); if(res===null) { this.msjs=[]; } else{ this.msjs=json.parse(res); } $scope.$on('newmessagereceived', function(e, msg) { //alert('message received:'+msg); self.msjs.push(msg); alert('mensaje recibido'); alert(json.stringify(self.msjs)); window.localstorage.setitem(usuario+'_msjs',json.stringify(self.msjs)); $state.reload(); }); } and view: <ion-view ng-controller="mainctrl m" > <ion-nav-buttons side="right"> <button class="button" ng-click="m.logout...

html - What is the difference between phrasing content and flow content? -

Image
i new html , css , know difference between flow content , phrasing content. other w3 official documentation mdn documentation helpful , states: flow content defined following: elements belonging flow content category typically contain text or embedded content. phrasing content defined following: phrasing content defines text , mark-up contains. runs of phrasing content make paragraphs. however, documentation gives little difference between two, can clarify major differences between phrasing content , flow content? the easiest way remember, if can inside sentence, it's phrasing content. text can inside sentence, it's phrasing. an emphasised bit can inside sentence, it's phrasing. an image can inside sentence, it's phrasing. a sub-heading or article cannot inside sentence, not phrasing. a link can inside sentence, it's phrasing. of html 5, 1 allowed have link containing whole blocks of text, in case not phrasing. phr...

Highlighting failed field in selenium webdriver during runtime -

i want highlight failed field using selenium webdriver during run time. can tell me code that? in advance!! you can update html elements css @ runtime using little javascript. following method add red border element: // method highlight element public static void highlightelement(webdriver webdriver, webelement element) throws interruptedexception { javascriptexecutor driver = (javascriptexecutor) webdriver; driver.executescript("arguments[0].setattribute('style',arguments[1]);", element, "border: 2px solid red;"); }

java - Access image file inside a Jar file dynamically -

i have java project,exported jar file (desktop application) generates html file output. output html file, needs read 1 image file, page's logo. jar application in x folder. target html file placed dynamically anywhere. how make html,residing in someother location, access image, inside jar file. in short, how determine path below code, above scenario. java.net.url url = getclass().getresource("image.jpg"); fw.write("<tr><td><b>"+csname+"</b></td><td> <img src = "+url.tostring()+"'>/td></tr>"); works fine, when run in eclipse. not when exported jar resultant html file,in other folder has code <img src="rsrc:com/demo/dirapitoword/image.jpg"> you need read image stream classpath , e.g.: inputstream in = getclass().getresourceasstream("image.jpg"); and write stream out file known place on disk. there lots of ways this , if you're using jav...

java - How to reopen connection in JPA -

i have app in springboot jpa. when lost connection app send me error: warn 6812 --- [io-8080-exec-42] o.h.engine.jdbc.spi.sqlexceptionhelper : sql error: 17002, sqlstate: 08006 error 6812 --- [io-8080-exec-42] o.h.engine.jdbc.spi.sqlexceptionhelper : io error: socket read timed out after estabilishin connection can't use entitymanager, because get: warn 6812 --- [io-8080-exec-50] o.h.engine.jdbc.spi.sqlexceptionhelper : sql error: 17008, sqlstate: 08003 error 6812 --- [io-8080-exec-50] o.h.engine.jdbc.spi.sqlexceptionhelper : closed connection my connection properties: spring.datasource.driverclassname=oracle.jdbc.driver.oracledriver spring.datasource.url=jdbc:oracle:thin:@...:..:.. spring.datasource.username=... spring.datasource.password=... spring.datasource.test-on-borrow=true spring.datasource.test-while-idle=true spring.datasource.validation-query=select 1; what should reconnect db connection? try adding external ...

REST Get for multi values with multi keys -

i have restful server implement request entity while entity have multi keys. example, getting contact information specific company in specific country (nike, germany): get: http://hostname/rest/accounts/{company}/{country} i want add functionality allow client query multiple company/countries pairs in 1 call. since have millions of records in db don't ever want return data. also, client may need ~1000 records, don't want him make ~1000 calls. i thought of adding pairs of company/country in body of request, answer here http request body suggested it's bad practice. i can't use query string params because have information , servers have limit on size of url. what's rest practice such case? there official proposal multi-request protocol - here ( background ). possibly because relies on http/2 deliver efficiency gain, doesn't seem have momentum @ present. for few resources, specify them in url. problem de-facto url limit of ~2000 character...

javascript - Hide content inside iframe? -

here situation. i have file called iframe.html. has code in below, <!doctype html> <html lang="eng"> <head> <meta charset="utf-8"/> <title>pluign development</title> <script src="js/jquery-1.11.0.js" type="text/javascript"></script> </head> <body> <iframe id="abc" src="test.html"></iframe> <div id="sub">click</div> </body> <script src="js/script-22.js" type="text/javascript"></script> </html> and have test.html file. has code in below, <!doctype html> <html lang="eng"> <head> <meta charset="utf-8"/> <title>pluign development</title> </head> <body> <div id="red">prasanga karunanayake </div> ...

ios - SHGraphLineView remove a plot -

i'm using class called shlinegraphview , it's working good, have problem didn't implemented methods removing plot. have it, can't quite figure right way do. this how drawing plot: - (void)addplot:(shplot *)newplot; { if(nil == newplot) { return; } if(_plots == nil){ _plots = [nsmutablearray array]; } [_plots addobject:newplot]; } - (void)drawplot:(shplot *)plot { nsdictionary *theme = plot.plotthemeattributes; // cashapelayer *backgroundlayer = [cashapelayer layer]; backgroundlayer.frame = self.bounds; backgroundlayer.fillcolor = ((uicolor *)theme[kplotfillcolorkey]).cgcolor; backgroundlayer.backgroundcolor = [uicolor clearcolor].cgcolor; [backgroundlayer setstrokecolor:[uicolor clearcolor].cgcolor]; [backgroundlayer setlinewidth:((nsnumber *)theme[kplotstrokewidthkey]).intvalue]; cgmutablepathref backgroundpath = cgpathcreatemutable(); // cashapelayer *circlelayer = [cashapelayer layer]; circlelayer.frame = self....

c# - Keypress event is not working properly -

i'm having problems keypress events. when enter 10 digits in textbox1 takes 10 digits want. if press backspace shows message "you can't enter more ten digits". first problem. the second problem when clear textbox1 pressing backspace , enter digits again takes 9 digits. please tell me what's going wrong code: private void textbox1_keypress(object sender, keypresseventargs e) { if (textbox1.text.trim().length > 9) { messagebox.show("you can't enter more ten digits..."); textbox1.maxlength = 9; } } you can check if keychar backspace: if (e.keychar != '\b' && textbox1.text.trim().length > 9) { e.handled = true; messagebox.show("you can't enter more ten digits..."); }

ios - React-native app and Facebook SDK -

i managed create native component logins user facebook. so, in react-native app, i've got access token , userid. now, i'd use facebook sdk (for example, graph api) access basic infos (profile name, profile picture, etc.) , basic things (share post, etc.) at point i'm quite lost: how can that? can use fetch api? need add node plugin app (i looking this: https://github.com/thuzi/facebook-node-sdk )? you can make request using fetch api query can https://graph.facebook.com/me?access_token=token_you_got fetch('https://graph.facebook.com/me?access_token=token_you_got') .then(response => response.json()) .then(json => this._handleresponse(json.response)) .catch(error => this.setstate({ isloading: false, message: 'something bad happened ' + error })); more information here: http://www.raywenderlich.com/99473/introducing-react-native-building-apps-javascript

amazon web services - AWS and o365 emails are delayed -

we have problem sending transactional emails out of our web app. when number of sent emails increasing of emails delivered delay - 300min. using amazon aws , o365 smpt server. amazon aws has email sending limitations on account using default port (if using external email solution)? it's resulting emails delivered delay (up 300 min in our case). to save time please take thread https://forums.aws.amazon.com/thread.jspa?threadid=37650 solution: https://portal.aws.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request hope saves time too.

android - Admob Interstitial show before game start -

i want add interstitial ad on game before game starts. when run app, have 3 diferent game modes when select one, game starts on mode. idea show interstitial after press button, before game starts. i have followed guide on android developers page, here , doesn't fit need. have modified bit fit code, interstitial not shown before starting game, shown when finish game , returning mainactivity. this code: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); btn1player = (imagebutton) findviewbyid(r.id.oneplayerimgbtn); btnversus = (imagebutton) findviewbyid(r.id.versusimgbtn); btnlocalmultip = (imagebutton) findviewbyid(r.id.lclmultiplayerimgbtn); minterstitialad = new interstitialad(this); minterstitialad.setadunitid(getstring(r.string.ad_intersticial_1_id)); requestnewinterstitial(); btn1player.setonclicklistener(new view.onclicklistener() { @overri...

java - About checking whether a client is disconnected from the Server Socket -

this question has answer here: java socket api: how tell if connection has been closed? 5 answers from ( java network programming fourth edition ): tell if socket open, need check isconnected() returns true , isclosed() returns false. example: boolean connected = socket.isconnected() && ! socket.isclosed(); i need find way discover possible client has disconnected server socket. using trick described above,i have tried following : socket socket = ...; while (socket.isconnected() && !socket.isclosed()) { // ... // here, client connected } // client disconnected the above approach works me, correct?. detects cases? depending on application, catching exceptions intelligently seem solution. requirement, however, wants send/do client. possibly combination of 2 approaches suits specific application. try se...

mongodb - MongoException: Index with name: code already exists with different options -

i have mongodb collection term following structure { "_id" : "00002c34-a4ca-42ee-b242-e9bab8e3a01f", "terminologyclass" : "user", "code" : "x67", "terminology" : "some term related notes", "notes" : "some notes" } and java class representing term collection term.java @document public class term{ @id protected string termid; @indexed protected string terminologyclass; @indexed(unique=true) protected string code; @indexed protected string terminology; protected string notes; //getters & setters } i have many documents in term collection. added new field term.java as @indexed protected string status; after adding field status term.java , while inserting new term term collection getting exceptoin : com.mongodb.mongoexception: index name: code exists different options i using mongodb versio...

php - Searching nested arrays and returning the key from a matching value -

[ [mile] => [ [acronym] => mi ], [kilometer] => [ [acronym] => km ] ] $acronym = 'km'; how may return key name matching acronym value? in example want return kilometer . this should work you: here create array array_combine() use array_column() keyname acronym keys , array_keys() $arr values. <?php $acronym = "km"; $arr = array_combine(array_column($arr, "acronym"), array_keys($arr)); echo $arr[$acronym]; ?> output: kilometer

javascript - Two Css Files Have Same Class - Remove class from particular Class, How? -

i calling 2 css files in html page having same class name different properties. first css file .text { font-family: verdana; font-size: 11px; color: #000000; text-decoration: none; line-height: 20px; } second css file .text{ margin: 0px; font: 13px/20px arial,helvetica,sans-serif; padding: 20px 20px 40px 35px; } i want remove functionality of .text second css file through jquery or javascript .... as stated in comments, loading unwanted css rules disable them , apply new rules same existing rule bad practice. if don't want or can't way, modifying existing css or adding new css rules, jquery: with jquery: $(document).ready(function() { $('.text').css({'font-family':'verdana', 'font-size':'11px', 'padding':'0', 'margin':'0'}); }); demo: https://jsfiddle.net/chimos/6g9xmxxo/ so here it's giving padding , margin default values (this can problematic if ...

optimization - Possible Workaround for Optimal solution for split function in java while reading multiple lines? -

the input begins number t of test cases in single line (t<=10) . in each of next t lines there 2 or more numbers m , n (1 <= m <= n <= 1000000000, n-m<=100000) separated space. print each number in separate line can used further summation input 2 50 100 100 50 105 output 50 100 100 50 105 now code i've written giving me output import java.util.scanner; import java.util.stringtokenizer; public class generation { public static void main(string[] str) { scanner keyboard = new scanner(system.in); int inputsize; { system.out.println("enter value of t size"); inputsize = keyboard.nextint(); keyboard.nextline(); if (inputsize < 2 || inputsize > 10) { system.out.println("not valid input size"); } } while (inputsize < 2 || inputsize > 10); string[] inputvalue = new string[inputsize]; int to...

webview - Android development adding custom string to useragent -

i'm trying add custom http header webview of android application validate if webview running our app. when use webview.getsettings shows error message time. android.webkit.webview not contain defenition getsettings() this our code: using android.app; using android.os; using android.webkit; using android.widget; using android.views; namespace loadwebpage { [activity(label = "loadwebpage", mainlauncher = true, icon = "@drawable/icon")] public class activity1 : activity { protected override void oncreate (bundle bundle) { base.oncreate (bundle); setcontentview (resource.layout.main); webview webview = findviewbyid<webview>(resource.id.localwebview); webview.setwebviewclient (new webviewclient ()); websettings settings = webview.getsettings(); webview.settings.javascriptenabled = true; webview.loadurl("http://www.google.nl"); webview.settings.builtinzoomcontrols...

The schema in this data file must match the datasource : Amazon Machine Learning -

when create model (regression) using amazon machine learning, provide datasource schema. data source contains values along target attribute. data source splitted in 70-30 training , evaluation of model , still need target attribute values in it. data used training first , evaluation target attribute required, understand. now come batch prediction part. in have provide datasource , understand schema have similar schema used train model, again target attribute required why values required in part not understand. if provide dataset similar schema , no data in target attribute gives me schema in data file must match datasource used create ml model ml-ksc8japcco0. ensure data file using matches schema structure. when use same schema same model values in target attribute works fine. you needs provide batch values make prediction less field predict; example, i used structure make de model , training, select seconds_taken target serial,operator,station,phase,next_phase...

math - get amount of Days until a dam "Event" in java -

i'm running issue making formula calculating amount of days take dam either empty, or fill. in public class called dam. basically have: int capacity = 3538000; // acreft int storage = 1796250; // acreft int inflowrate = 1050; // cubic-ft/sec int outflowrate = 2530; // cubic-ft/sec and make if-else statement saying like: if(inflow > outflow) { //formula here } else if (outflow > inflow) { //formula here } else { return -1; // if dam inflow/outflow equal basically, "holding." } how go formula here? if start off with; if(outflow > inflow) { int data = outflow - inflow; // still in cubic-ft per sec // convert data acresft? using sort of conversion variable? // using new variable converted data * storage..? // times second in day (86400 seconds, variable established @ top of program.) } this may pretty rough read, didn't want upload whole file here. i take meaning of variable below capacity tot...

asp.net - How to convert XML into Object format in C# -

i wanted convert xml in object format - <information> - <item> <key>name</key> <value>namevalue</value> </item> - <item> <key>age</key> <value>17</value> </item> - <item> <key>gender</key> <value>male</value> </item> - </information> object like, person.name = "name value" person.age = 17 person.gender = "male" you can xdocument reflection achieving following way: xdocument xdocument = xdocument.parse(myxml); var nodes = xdocument.descendants("item"); // type contained in name string type type = typeof(person); // create instance of type object instance = activator.createinstance(type); // iterate on properties , set each value 1 one foreach (var property in type.getproperties()) { // set value of given property on given instance if (nodes.descendants("key").any(x =>...

compiler construction - Export C/C++ switch/case jump table information -

in c/c++ on x86-64, if switch/case statement relatively large (more 3 or 4 entries), jump table generated llvm, instead of conditional jump instructions. in clang/llvm, how export these tables' base, index, , scale information? program source code available. for example, jmpq *0x400000(,%rbx,8) , how export base 0x400000 , index value compared value in %rbx , , scale 8 ?

android - How to get devices Cell IDs under same BTS? -

i have develop android application has mobile devices info in same telco bts mine phone. can other mobile devices cell ids? in comments mention requirement 'i have send broadcast neighboring mobile devices'. there solution built deployed gsm networks - called cell broadcast (or sms-cb). it intended emergency situations , allows operator send message devices in given cell efficiently , when network congested. there newer standard embms similar concept designed multimedia broadcast, maybe suitable more commercial applications. not deployed @ moment, afaik. either way, api's in telco's domain , not available device unless telco has provided special service this. as others have pointed out, regular android device not have ability discover peers or message in same cell, although telco provide web service device call if wished. the division between 'phone' part of android phone , 'app or computer' part of device strictly defined in and...

Error ROLLBACK TRANSACTION MSSQL with PHP try catch -

<?php try { $db->query("begin transaction"); $db->db_insert('insert',$fields); $db->query("commit transaction"); } catch(exception $e){ $db->query("rollback transaction"); } ?> my code commit ok. when rollback error " rollback transaction request has no corresponding begin transaction. "

Collection being updated while performing stream operation java 8 -

i have list of objects being updated on regular basis couple of threads. while being updated want use stream filter elements out. for example; have list being updated regularly: list<myobject> mylist now @ point in time use stream on list list<myobject> result = mylist.stream().filter(myobj->myobjt.isvalid()).collect(tolist()); is thread-safe given list being update couple of threads? the javadoc of copyonwritearraylist states following: the "snapshot" style iterator method uses reference state of array @ point iterator created. array never changes during lifetime of iterator, interference impossible , iterator guaranteed not throw concurrentmodificationexception. iterator not reflect additions, removals, or changes list since iterator created. so, yes, code should threadsafe. stream ignore additions list after has started.

osx - App dev on Mac Mini 1.1? -

could first generation of mac mini handle app development iphone? friend said he'd give me free use xcode, want make sure run before take it. short answer: current ios versions? no. iphone? yes. the latest os x supported on hardware (officially, don't know hacks) 10.6 , latest xcode can 4.2 ( if have paid account, seems ). xcode 4.2 support ios 5.0 , if that's enough, can used development iphone. assume that's not you're after, since lot has changed since ios 5.0.

dynamic - Implementing a solver in c++ for problems described in some scripting syntax -

Image
i have generic question on how write c++ code solve general class of problems. class of problems described in scripting language read dynamically c++ program. e.g. problem can described following: syms b c x sol = solve(a*x^2 + b*x + c == 0) sola = solve(a*x^2 + b*x + c == 0, a) here using matlab illustration purposes, , not trying build matlab. after find out how, in general, 1 go designing c++ program take in script, describes calculation instructions, , read/interpret logic described in script , perform calculations described. the general architecture of program follows: (from parsing article on wikipedia) there plenty of tutorials covering lexical analysis , parsing , building parse trees or, more often, abstract syntax trees (ast). see, example, kaleidoscope tutorial llvm. once constructed ast, you'll need translate internal representation such byte code , pass interpreter or virtual machine. in cases possible skip step , work directly ast. inte...

Obfuscate javascript generated by PHP -

i have audioplayer running on website. there's no problem player although wish obfuscate javascript code. the problem javascript called on page includes php file. the player.php contains: <script type="text/javascript"> $(function(){ $('.player').plate({ playlist: [ <?php include ('inc/trackimport.inc.php'); ?> ] }); }); </script> and trackimport generates (in foreach each $dj found in database): echo '{"title":"'.$dj.'", "artist":"'.$set.'", "cover":"http://domain.com/'.$imglink.'", "file":"http://domain.com/'.$djurl.'/archive/'.$url.'"},'; is there away make full code obfuscated? your best bet use one of these php-based javascript minifiers. it's same effect, can put in configuration flag make 1 of them run when want it.

ruby - how can I acess elements of a JSON retunr from a Stripe api call? -

i using ruby , sinatra. after stripe api call, want access element, json return, , put database. the ruby code is: require 'sinatra' require 'stripe' require 'pg' require 'sequel' '/save_customer' customer = stripe::customer.retrieve("cus_6efjsbj8gctxxx") puts customer last4 = customer["sources"]["data"]["last4"] db[:stripe_customers].insert(:user_id=>user_id, :email=>email, :stripe_customer_id=>customer_id, :stripe_customer_card=> last4) end the json (taken api docs, not return) follows: { "object": "customer", "created": 1431570089, "id": "cus_6efjsbj8gctxxx", "livemode": false, "description": "example customer", "email": null, "delinquent": false, "metadata": { }, "subscriptions": { "object": "list", "total_...

pdf generation - Using Cocoa, NSPrintOperation, How Do I correctly Create a PDF file from text in an NSView? -

using nsprintoperation, how correctly create pdf file text in nsview? * * notice found workaround, shown @ bottom * what have done: 1. put text nstextview. - (nstextview *)printableviewwithrecipe:(recipe *)recipe { [_printview setstring:@""]; [_printview settextcolor:[nscolor textcolor]]; [_printview setfont:[nsfont userfontofsize:0]]; nsdictionary *titleattr; _printview = [[nstextview alloc] initwithframe:[[self printinfo] imageablepagebounds]]; [_printview setverticallyresizable:yes]; [_printview sethorizontallyresizable:no]; // begin add text [[_printview textstorage] beginediting]; // set attributes title [[_printview textstorage] beginediting]; titleattr = [nsdictionary dictionarywithobject:[(appdelegate*)[[nsapplication sharedapplication] delegate] tablefont] forkey:nsfontattributename]; // add title [ [_printview textstorage] appendattributedstring: [[nsattributedstring alloc] initwithstring:[recipe name] attributes:titleattr ] ]; // create co...

How To Install Laravel On Linux Ubuntu 12.04 -

i trying install laravel on ubuntu 12.04 . have been following lot of tutorials , same steps. managed download , setting requirements cannot figure out why when want excute laravel.example.com on browser , webpage showed me server not found error.. if put my-ip-adress/laravel/public laravel welcoming page showing index.php anyone can me this? website referred - http://tecadmin.net/install-laravel-framework-on-ubuntu/ thank you. my laravel.example.com.conf : <virtualhost *:80> servername laravel.example.com serveralias www.laravel.example.com documentroot /var/www/laravel/public <directory /> options followsymlinks allowoverride none </directory> <directory /var/www/laravel> allowoverride </directory> errorlog ${apache_log_dir}/error.log loglevel warn customlog ${apache_log_dir}/access.log combined my apache2.conf file: # main apache server configuration...

css - How can I compile SASS using TFS online? -

i'm using visualstudio.com's hosted tfs build our project. introduced sass, compiled locally developers in vs 2013 update 4, web essentials installed. how can make online version of tfs compile sass css? checking in compiled css , map files nightmare merging. thanks! if you're building mvc app, can use mvc's bundling feature along sass nuget package . and, sure enable minification. there's usenativeminification property on sassandscsssettings.

html - Animating the border in CSS -

i have navigation menu has border bottom 3 pixels has appearance similar of underline. have 2 animations in mind not sure how go including them. either have border fade 0.0 opacity 1 (full) opacity. or have border appear left right i.e. draw itself. nav li:hover { border-bottom: 1px solid orange; padding-bottom: 3px; animation-name: navhover; animation-duration: 3.3s; } @-webkit-keyframes navhover { 1% { opacity: 0; } 100% { opacity: 1; } } any answers appreciated! thank time. i'd in case, want transitions , not animations. personally, if can use transition instead of animation, should use transition. use animations when can't want transition. changing border colour on hover trivial: .my-element { border-bottom: 1px solid transparent; transition: border-color 300ms; } .my-element:hover { border-color: orange; } if want border animate 0 100% width, can't border. can use pseudoelement: .my-element::after { content...

wifi - USB Wireless adapters enabling Power Saving Mode -

i being confused on terminology referring it, here request: name @ least 1 usb wireless adapter wi-fi chipset supported wireless driver enabling ap mode , monitor mode , psm (power saving mode) in softmac implementation (psm functions accessible , modifiable via software). the goal work on new power saving mode implementation, modifying existing implementations of either psm or apsm. check out mediatek usb dongles: http://www.mediatek.com/en/products/connectivity/wifi/pc/usb/ most of these can work straight away using linux mainline rt2x00 driver. rt2x00 open-source, supports monitor mode (can sniff packets), ap mode (can work wpa_supplicant/hostapd), , softmac driver (as works mac80211 driver). psm, i'm not sure although there seems chance rt2x00 supports well..

cmake - Clion CMakeLists.txt not found when switching PC -

i'm having issues clion (1.0.1) , cmakelists.txt. i use github projects, , commit them directly within ide. if checkout project on different computer, ide looks cmakelists.txt in original pc's directory. the specific error message reported clion this: error: cmakelists.txt not found in c:\users\chris\clionprojects\sdltestclion however, linux machine, there's no c drive. here's i've tried: file > invalidate caches/restart change project root (from cmake window; obvious solution) file > settings > build, execution, deployment > cmake there no settings or variables here indicate directory above. i can't find else, either i'm missing or bugged in version 1.0.1 , need sift through project files change path clion looks cmakelists.txt file. well, found issue. far can tell, in version 1.0.1 there no way remedy problem through ide. solution: go projectdir/.idea open misc.xml edit field project_dir point directory p...

android - trim string to a specific character -

i want trim specific string till specific character. string: com.icecoldapps.screenshoteasy example shall string screenshoteasy . larger strings com.google.android.syncadapters.contacts shall trimed contacts . how that? thanks string yourstring = "com.google.android.syncadapters.contacts"; string[] sarr = yourstring.split("\\."); string output = sarr[sarr.length-1];

powershell - Failed activate for python3 with Anaconda on Windows 8.1 -

i'd have both anaconda python v2 , python v3 environment. i've run both anaconda installers, working in microsoft's powershell. create python3 env run: ps c:\users\jo> conda create -n py3 python=3.4 fetching package metadata: .... solving package specifications: . package plan installation in environment c:\anaconda\envs\py3: following new packages installed: pip: 6.1.1-py34_0 python: 3.4.3-0 setuptools: 15.2-py34_0 proceed ([y]/n)? y linking packages ... [ complete ]|##################################################| 100% # # activate environment, use: # > activate py3 # however activating env ignores new env: ps c:\users\jo> activate py3 activating environment "py3"... ps c:\users\jo> python python 2.7.9 |anaconda 2.2.0 (64-bit)| (default, dec 18 2014, 16:57:52) [msc v.1500 64 bit (amd64)] on win32 type "help", "copyright", "credits" or "license" more informat...

Case Insensitive search in jquery-bootgrid -

hi have implemeted jquery-bootgrid. however, searching based on case. requirement searching should done irrespective of case used i.e if searching "australia" , user types "australia" or "australia" result should same. i looked documentation , search setting have "dealy" or "charatcers" option. how should implement case insensitive search? the option switch behaviour named casesensitive , documented under general settings . move option in next major release searchsettings sake of consistency. example: $("#grid").bootgrid({ casesensitive: false });

PHP scan directory and array -

i have script scans folder , put in array file names contains. shuffle array , display file names. like this: $count=0; $ar=array(); $i=1; $g=scandir('./images/'); foreach($g $x) { if(is_dir($x))$ar[$x]=scandir($x); else { $count++; $ar[]=$x; } } shuffle($ar); while($i <= $count) { echo $ar[$i-1]; $i++; } ?> it works reason this: fff.jpg ccc.jpg array nnn.jpg ttt.jpg sss.jpg bbb.jpg array eee.jpg of course, order changes when refresh page because of shuffle did among 200 filenames these 2 "array" somewhere in list. what be? thank you just explain part wherein gives array . first off, scandir returns following: returns array of files , directories directory. from return values, returned (this example, reference): array ( [0] => . // current directory [1] => .. // parent directory [2] => imgo.jpg [3] => logo.png [4] => picture1.png ...

Best way to convert C++ object <--> C struct? -

so trying integrate custom c library existing c++ project. have various c++ objects need stored/loaded c db , interface various c functions. need convert c++ objects c structs, , again. have made progress, running memory allocation issues. i know haven't included code here, wondering if there general tips task? have seen void* used in extern "c" generic c++ objects, need load/save data from/to c++ objects , c structs. if haven't worded correctly, please ask! use extern "c" declare c structures: extern "c" { struct some_c_struct { int field1; char *p; }; }; then, in c++ code can use some_c_struct other c++ class or struct , guaranteed c compatibility, , pass them , c code library you're using. practically speaking, extern "c" declaration isn't needed, language lawyers demand it. additionally, struct cannot use c++-specific features, virtual functions.

wordpress - Wishlist Member redirects some, not all, registrants. Why? -

strange problem wishlist member. i set membership script , sent out registration url 20 or people willing test-drive site. however, handful of them able reach registration page successfully, whereas others redirected homepage. i checked wlm support says can happen if enter destination url rather registration url, didn't that. copy , pasted exact registration url member level. i've never encountered problem before, 1 group of people 1 result, group different result taking same action. i'm in contact support guys there, still looking resolution. upgraded plugin, made sure hit checklist, , asked test-drivers try again. 1 able succeed, others not. i wondering if here had suggestions? it'd hugely appreciated.

ruby regex not matching a string if "+" character in source -

i have string contains international phone number e.g. +44 9383 33333 bizzarely when attempt regex match (note regex correctly 'escaped') regex match fails e.g. "001144 9383 33333".match(/(001144|004|0|\\+44)/) # works "+44 9383 33333".match(/(001144|004|0|\\+44)/) # not work i've tried escaping input string e.g. +, \+ etc. etc no avail. i must doing stupid here!? you've got double backslash, telling regex parser literal backslash. since it's followed + regex parser looking 1 or more backslashes. try \+ (so whole thing should be: /(001144|004|0|\+44)/

java - Set wallpaper using RecyclerView -

i need set image wallpaper using recyclerview . in adapter i'm using code: @override public void onbindviewholder(viewholder viewholder, final int i) { final griditem nature = mitems.get(i); viewholder.tvspecies.settext(nature.getname()); viewholder.imgthumbnail.setimageresource(nature.getthumbnail()); viewholder.imgthumbnail.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { log.i("click",nature.tostring()); try { wallpaper.setresource(mitems.get(i)); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } }); } so onclick should set image wallpaper under "setresource" word have error: the method setresource(int) in type wallpapermanager not applicable arguments (griditem) how can s...

How to remove a single character from the filename of a list of files in a folder using DOS command? -

i have list of files these: icone1.gif icone2.gif icone1.gif icone11.gif icone12.gif icone13.gif icone14.gif icone15.gif i want remove 'e' icon1.gif, icon2.gif , on... i tried dos command prompt: ren icone*.gif icon*.gif didn't work. create batch file in folder typing "notepad go.bat" @ command prompt , hitting enter , drop in save , exit notepad: for %%i in ("*.gif") (set fname=%%i) & call :rename goto :eof :rename ::cuts off 1st 5 chars, appends icon , remaining chars ren "%fname%" "icon%fname:~5%" goto :eof double click batch file in windows or command prompt type go , press enter

javascript - How to check if react shouldComponentUpdate works correctly -

so have lots of components , each of them has own shouldcomponentupdate() function. of them compare states based on immutable.js datasets. of them compares props. of them work purerendermixin . app's growth new states added, new props added, stores change api , on. so, @ moment need check going on while developing. can use chrome devtools review , visualize dom changed have no idea how check if react virtual dom changed. i have idea cover shouldcomponentupdate() -s tests seems testing overhead test each possible state twice: behavior in app , behaviour in shouldcomponentupdate() . since using base pure component in este.js, need check updated components uncomment this: https://github.com/steida/este/blob/fb951cfd3805926c22697486c12bc7ddce3f1ecb/src/client/components/component.react.js#l26

php - Update row with data from another row in different tables -

i new mysql , not sure how can update row table while checking if logged in user same: telefonist='".$_session["username"]." and need check if date same gets right person on right date in row: log.datum=telefonisti_podaci.datum here trying count 1s , enter sum table1 table2 in specific place. code: $sql_zapis_do30 = "update telefonisti_podaci set `total tura 30` = (select count(*) `ture 30` log,telefonisti_podaci `ture 30` not null , `ture 30`=1 , log.datum=telefonisti_podaci.datum ) `telefonist`='".$_session["username"]."'"; customquery($sql_zapis_do30); i error: you can't specify target table 'telefonisti_podaci' update in clause thanks i have solved this: $sql_zapis_do30 = "update telefonisti_podaci set `total tura 30` = (select count(`ture 30`) log `telefonist`='".$_session["username"]."' , `ture 30`=1 , `datum`='".$datum_danas."...

c# - UnAuthorizedAccessException on StorageFolder.GetFolderFromPathAsync while having access through FilePicker -

i try read files network location. keep getting unauthorizedaccessexception. i pick storagefolder through storagefolder.getfolderfrompathasync listing files throws exception. when pick same folder through folderpicker works. so tried pinpointing problem code: folderpicker picker = new folderpicker(); picker.filetypefilter.add("*"); storagefolder pickedfolder = await picker.picksinglefolderasync(); if (pickedfolder != null) { var pickedfolderlist = await pickedfolder.getfilesasync(); var count = pickedfolderlist.count; if (count > 0) { storagefolder folder = await storagefolder.getfolderfrompathasync(pickedfolder.path); var pathfolderlist = await folder.getfilesasync(); //exception if (pathfolderlist.count == count) { processfolder(folder); } } } the exception thrown @ marked line variable pathfolderlist set. while had listed same folder few lines above. i have set these capabilities: ...