Posts

Showing posts from February, 2014

Spring security for android app -

i'm trying consume rest services android. i want username , password entered once. system can work without having reapply username , password. i not know right way this. save password on phone seems bit insecure, maybe it's paranoia. applications facebook, store password in phone? what i'm trying generate token, store token on phone, , send token in header in each request. not know if right solution. can not find how without token lose session. i have read oauth2, have not got example of small application demonstrates use, not of facebook, google, twitter. i used spring server communicate android app.

c - Trouble Understanding MPI_Type_create_struct -

i'm having trouble understanding mpi_type_create_struct method. have struct: struct foo(){ float value; char rank; } and want send struct process. conside code sample below: int count = 2; //number of elements in struct mpi_aint offsets[count] = {0, 8}; int blocklengths[count] = {1, 1}; mpi_datatype types[count] = {mpi_float, mpi_char}; mpi_datatype my_mpi_type; mpi_type_create_struct(count, blocklengths, offsets, types, &my_mpi_type); i'm not sure offsets , blocklengths in example. can explain these 2 parts above? the purpose of mpi_type_create_struct() is, know, provide way create user's mpi_datatype s mapping structured types. these new types subsequently usable mpi communications , other calls default types, allowing example transfer arrays of structures same way transfer arrays of int s or float s. now let's see function in more details. here synopsis returned man command: name mpi_type_create_struct - create...

java - Sample project “hello-world” project is showing ERROR while trying to run on App engine -

i trying deploy "hello, world!" java on app engine managed vms java 8 , facing below listed error while running mvn gcloud:deploy. did not face issue while running on local machine (mvn jetty:run). can please point me on doing wrong? [info] building war: c:\users\krajendran\appdata\local\google\cloud sdk\java-docs-samples\managed_vms\helloworld\target\managedvms-helloworld-mvm-1.0-snapshot.war [info] [info] <<< gcloud-maven-plugin:2.0.9.95.v20160203:deploy (default-cli) < package @ managedvms-helloworld-mvm <<< [info] [info] --- gcloud-maven-plugin:2.0.9.95.v20160203:deploy (default-cli) @ managedvms-helloworld-mvm --- [info] running gcloud app deploy... [info] running python.exe -s c:\users\krajendran\appdata\local\google\cloud sdk\google-cloud-sdk\lib\gcloud.py --quiet preview app deploy c:\users\krajendran\appdata\local\google\cloud sdk\java-docs-samples\managed_vms\helloworld\target\appengine-staging/app.yaml --promote [info] -------------------...

javascript - How to detect table that have overflow when reach bottom [jQuery] -

Image
i want create ui infinite scroll inside table element overflow style. can dynamically adding row when reach bottom table. can it? i'll try many script still can't end of table overflow. $('#table').on('scroll', function () { if ($(this).scrolltop() + $(this).innerheight() >= $(this)[0].scrollheight) { alert('end reached'); } }) thanks in advance. you may have set scroll handler on tbody instead of table . https://jsfiddle.net/guanzo/ocfyu8ml/

Is it possible to write a program in C which is able to set the MSL for a UDP-Packet? -

is possible write program in c able set msl udp-packet , receive return information of death, can information package was? read can set in os how possible programs traceroute use headeroption udp? are talking time live (ttl)? should able use ip_ttl socket option (see ip(7)) set time live of packets sent on socket. if packet goes through enough hops ttl become zero, node discards packet should send icmp time exceeded message originating host. receive error, think might have create icmp socket. traceroute does, might want take @ source code.

csv - In Google Sheets, how do I separate comma separated values? -

i have column of comma separated values so: 1 a, b, c, d, e 2 a, d, e, f, g 3 b, e, f, h 4 a, b, c, d, e, f, g, h 5 d 6 f, g 7 a, e, f, g [...] i want of these values, separately, end list/array values ["a","b","c","d","e","a","d","e","f","g","b","e"…] can pass arrayformula() nested inside function. brownie points: need pass =mode(). if there easier/actually possible way without =mode(arrayformula(seperate(a1:a7))), seperate being hypothetical function defined above, please give me one. thank you! to mode, put first formula in column b. adds comma end of each set of letters split work. second formula find mode. can hide column b. =transpose(split(join(" ",arrayformula(a1:a7&",")),", ")) =arrayformula( index(b1:b, match( max(if(b1:b="",iferror(1/0),counti...

javascript - JSON parse object -

i have following json string comes http request: { '{firstname:\'joe\'}': '' } // output of console.log(req.body); i have tried print value console using: console.log(req.body.firstname); but says value undefined. how can value of firstname? to see client doing how sends json request: //angular2 headers.append('content-type', 'application/x-www-form-urlencoded'); this.http.post( 'http://192.168.1.45:3000/test', json.stringify({firstname:'joe'}), //this parameter want {headers:headers} ) converts array json string using json.stringify, , converts string array using json.parse <html> <head> <script> function gettz(){ var str=json.stringify({firstname:'joe'}); console.log(str); //parse object dataobj = json.parse(str); // object property console.log(dataobj.firstname); } <...

spring - MissingResourceException: Can't find bundle base name -

when running jar file created maven project such: java -jar basictool.jar i error exception: exception in thread "main" java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.jdt.internal.jarinjarloader.jarrsrcloader.main(jarrsrcloader.java:58) caused by: java.util.missingresourceexception: can't find bundle base name com/kit/version, locale en_us @ java.util.resourcebundle.throwmissingresourceexception(unknownsource) @ java.util.resourcebundle.getbundleimpl(unknown source) @ java.util.resourcebundle.getbundle(unknown source) @ com.factories.factoryimpl.<init>(factoryimpl.java:80) @ com.parsers.basicparser.<init>(basicparser...

How to get path 'C:\inetpub\wwwroot\wss\VirtualDirectories' at run-time in installer class (c#) -

i have created below code not give actual result want. code:- servermanager manager = new servermanager(); site defaultsite = manager.sites["default web site"]; string path = manager.sites[0].applications["/"].virtualdirectories["/"].physicalpath; output:- the above code give result ' %systemdrive%\inetpub\wwwroot ' instade of want actual path ' c:\inetpub\wwwroot\wss\virtualdirectories '. please me possible. thanks in advance. path = environment.expandenvironmentvariables(path);

php - How to fetch phone numbers from string? -

this question has answer here: php regex, extract phone numbers string? 3 answers i have string whom fetch database having different format how can fetch phone numbers strings string examples user name;foo@foo.com;0373xxxxxx;fooo;ccc user name;foo@foo.com;fooo;0373xxxxxx;ccc user name;0373xxxxxx;foo@foo.com;fooo;ccc and here 0373xxxxxx 10 digit phone number of user use below code : <?php $string = "user name;foo@foo.com;0373123456;fooo;ccc"; preg_match_all('!\d+!', $string, $matches); print_r($matches); ?> hope :)

angularjs - Any Way to Tell Compiler Service to Point Out Unknown Attributes? -

let's i've added directive <div my-directive>hello, world.</div> but i've forgotten correctly wire in actual directive code in javascript. app silently run without visible errors, , might take me while discover mismatch. is there way modify angular's compiler service more proactive notifying me if finds attributes doesn't understand? (anything both not valid html , not correspond found directives.) might illuminate configuration problems more , directly.

php - Add field to screen "New content type" in drupal -

i have drupal app , want have field checkbox, so, when create/edit content type, appears title , description, , if check it, of nodes type have field checked. ideas? thank in advance please go form want add field. view source, form_id there. get form_id use in 1 of following form alter hooks. alter form using hook_form_alter or hook_form_form_id_alter

java - Does Android's RTP library support multicast? -

i trying multicast audio stream 1 device many others using android's rtp classes. i do not want use third party libraries if @ possible. i able stream 2 way audio between 2 devices using audiostream , audiogroup set each other's ip addresses, stream multicast group. if try instantiate audiostream multicast address such 239.1.1.1 , then, on other device use audiostream.associate() same multicast address, streams not heard. i have read android devices not supporting multicast, devices (both samsung galaxy tab 2s) support it. have added following code try obtain multicast lock: wifimanager wifi = (wifimanager) getsystemservice(context.wifi_service); multicastlock = wifi.createmulticastlock("multicastlock"); multicastlock.setreferencecounted(true); multicastlock.acquire(); additionally have following permissions in manifest file: <uses-permission android:name="android.permission.internet" /> ...

c# - Exception querying table with dynamic columns from .NET application -

some time ago explained problem in question is "correct" database design? basically, have relational db containing tables dynamic columns, don't have fixed structure of these tables , when try retrieve data them problematic. now i'm developing web app point db , i'm using code execute query: ienumerable<result> res = db.executequery<result>(@"select * entity_properties_1 entityid = {0}), entity.id); but every time table structure changes error: {"the ole db provider \"sqlncli10\" linked server \"data-db2\" reported change in schema version between compile time (\"178395762719197\") , run time (\"178408647621334\") table \"\"icrm_ca\".\"dbo\".\"entity_properties_1\"\"."} how can solve problem? if using synonym linked server's objects. run following code: dbcc freeproccache which removes cache entries.

java - Extracting the initial characters from a string in one go -

please advise below code extract first 4 characters string shown below.. string external = ak.getreference(); string s= external.substring(0,4); can wrap 1 no string s need created , string external have 4 initial characters in 1 go well, can chain method calls... string s = ak.getreference().substring(0,4); ... doesn't mean string won't created, starting java 7u6 substring() method return new string object freshly allocated char[] (see post ). you're eliminating intermediate local variable, that's all.

javascript - How to access array like object/values in ember.js -

i need display data correctly. if try access thumbnail path, application throws following error: assertion failed: attributes must numbers, strings or booleans, not [http://example.com/imgage/example_thumb.jpg] how rid of error , show image(s) correctly? debug: ------------------------------- debug: ember.version : 1.0.0 debug: handlebars.version : 1.0.0 debug: jquery.version : 2.0.3 debug: ------------------------------- // models/collection_model.js app.collection = ds.model.extend({ title: ds.attr('string'), assets: ds.attr('object') }); // datastore.js app.collection.fixtures = [ { "id": 1, "title": "lorem ipsum", "assets": { "thumb": ['http://example.com/imgage/example_thumb.jpg'], "thumb_large": ['http://example.com/imgage/example.jpg'] } }, { "id": 2, "title"...

python - Extracting arguments of JavaScript function from HTML page with BeautifulSoup -

i'm parsing html page several script blocks: <script type="text/javascript"> // code </script> <script type="text/javascript"> foo(arg1, arg2); // code </script> i need extract arguments of foo function - 'arg1' , 'arg2'. can obtain inner content of script tag: def parse_foo(pagecontent): soup = beautifulsoup(pagecontent) scripttags = soup.find_all('script') script in scripttags: tagcontent = script.get_text() if tagcontent.count('foo') > 0: return tagcontent return '' is there way arguments using beautifulsoup or should use regular expression? pyesprima port of esprima, "a high performance, standard-compliant ecmascript parser written in ecmascript". fortunately, it's easy use. unfortunately, it's bit slow. there's online parser tool use: http://esprima.org/demo/parse.html when input foo(ar...

html - text flowing in concatenated divs -

i think going ask here big challenge! not guess way start make experiments... basically want simple thing possible in applications ms word, ooo writer, indesign, etc: need 3 empty text areas (div) connected each other exceeding text of first div go fill second div , on 3rd div. here graphic example of mean: http://i44.tinypic.com/21bj9fn.png as see, text start in div#1, longer div#1 can handle, goes automatically @ beginning of div#2, , on. the main problem don't know how long text, possible have few words or full page, , text need formatted way because text in div not article lot of small rows of data. the second main problem page has printed has in 1 single page, , small part of big form. can't make tall single column or print second page. is there way make possible html/css? edit: code have since now, ask if there way in css make exceeding text in first div go in second , third div, graphic example above. <style type="text/css"> .text-ar...

android - How to update ListView when Cursor is changed? -

i below: public class whitelistactivity extends listactivity { private dbadapter dbhelper; private simplecursoradapter adapter; private cursor recordscursor; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.whitelist); dbhelper = new dbadapter(this); dbhelper.open(); recordscursor = dbhelper.fetchwhitelistrecords(); startmanagingcursor(recordscursor); string[] = new string[]{dbadapter.key_w_sender}; int[] = new int[]{r.id.text1}; adapter = new simplecursoradapter(this, r.layout.whitelist_row, recordscursor, from, to); setlistadapter(adapter); ... @override public boolean oncontextitemselected(menuitem item) { switch(item.getitemid()) { case context_menu_delete_id: adaptercontextmenuinfo info = (adaptercontextmenuinfo) item.getmenuinfo(); ...

java - Why does my server initialize substantially slower in JUnit then when run stand-alone -

i have server want automated functional tests on. needs initialize few thousand total objects build it's in memory model, fetching data config files, still trivial computer , it's near-instantaneous bootup when run eclipse. when run same program part of junit test initialization phase takes 15 seconds or instead of instantaneous speed of stand-alone app. not long, if plan many dozens of tests add up. according jvisualvm time spread out on half dozen methods, no 1 method taking longer 14% of cpu time (this after optimized away method taking 50% of cpu). of methods running methods expect see running , seem taking reasonable percentage of total cpu time; can't compare live server because live server initializes fast can't start , stop jvisualvm fast enough profile it. seem if the init methods of objects may take longer, instance 1 object uses 3% cpu init, has self time of 000 ms , makes no other calls; don't know if that's common result using jvisualvm...

html - CGI::Session Expired cookies and browser refresh -

a user enters page in web application. if cookie expired provide user link login page ask user login again. if clicks logout button cookie set expire in past. $cookie = $cgi->cookie(-name=>"cgisessid",-value=>'', -path=>'/',-expires=>'-1d'); the cookie being set correctly expire in past seen in page info of browser page doesn't know until click refresh my $cookie = $cgi->cookie('cgisessid'); if ($cookie){ #show content }else{ $cookie = $cgi->cookie(-name=>'cgisessid', -expires=>'now'); print $cgi->header(-cookie=>$cookie); print "please log in again "; print "<a href=\"/login.html\"> login page </a>"; } how can force page refresh delete cookie. if redirect page simple button display content if cookie expired. i have login.pl , login.js set in http://www.ibm.com/developerworks/webservices/librar...

c# - How to Catch Custom Exception -

i have following code in 'main' method: static void main(string[] args) { try { int = 0; int b = 5; b /= a; } catch (myexception ex) { console.writeline(ex.message) } } and myexception class following: public class myexception : exception { public myexception() { } } the program breaks on b /= a; whereas i'm expecting go catch command. if replace myexception exception , exception caught , program doesn't break. how can catch custom exception? as mentioned in comments problem not can't catch exception, problem code isn't throwing type of exception. throws system.dividebyzeroexception . if want test code see catch exception replace b /= a; throw new myexception(); , see catch exception. catches when use base class exception because divicdebyzeroexception inherits exception . keep in mind way exception ever thrown if have line throw new myexception(); somewhere...

php - error in mysql insert query in MYSQL 5.6.12 -

i tried use following code insert, $op=$_post["ans"]; $username=$_get["username"]; mysql_query("insert $username values('q3','$op')") or die(mysql_error()); but got following error: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'values('q1','wrong')' @ line 1 why getting error? how can fix it? your query structure not making sense. you're inserting $username ? that's not name of table, it? mysql_query("insert `tablename` values('q3','" . mysql_real_escape_string($op) . "')") or die(mysql_error()); always careful escape , user data being put queries, , please, please stop using mysql_query in new code.

uinavigationbar - Cancel Navigation Bar action in iOS -

i'm working on ios application involves users filling out text fields , navigating through views. currently, navigation handled using navigation bar, , through buttons. tried make of fields required: preventing progress through application if fields left blank. worked button based navigation not navigation bar. code follows: - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([[segue identifier] isequaltostring:@"birthpopbus"]) { currentpopoversegue = (uistoryboardpopoversegue *)segue; pvc = [segue destinationviewcontroller]; [pvc setdelegate:self]; } else if([[segue identifier] isequaltostring:@"secondbuspagesegue"]) { //this code breaks next page //check fields, , create error message (code removed readability)... //if fields not filled in, display alert generated string. if(!(first && last && email && phone && address &...

javascript - Show sections based on value of Check box in jQuery (SharePoint 2010) -

i trying use jquery show section if user selects checkbox in sharepoint form. have had success doing button , simple checkbox 1 value show blog post http://akanoongo.blogspot.com/2008/04/how-to-hide-fields-in-sharepoint-list.html , struggling if select multiple values. <script type="text/javascript" src="/siteassets/libraries/jquery-1.10.2.min.js"></script> <script> $(document).ready(function(){ $("nobr:contains('desk calendars')").parent('h3').parent('td').parent('tr').hide(); $("nobr:contains('calendar refills')").parent('h3').parent('td').parent('tr').hide(); $("nobr:contains('spiral bound')").parent('h3').parent('td').parent('tr').hide(); $("nobr:contains('wall calendars')").parent('h3').parent('td').parent('tr').hide(); $("nobr:contains('misc. calendars...

objective c - how to switch between html source View and web view IN UIwebview IOS -

i'm creating html editor in ios using uiwebview want ask how make uiwebview switch between html sources code view , web view can show me how the uiwebview not support switching between preview , source modes. should @ custom uitextview view , edit html source.

ember.js - view is ignoring contentBinding -

i'm building playlist. have 2 models describing json response server app.chartsmodel = em.model.extend({ playlist: em.belongsto('app.playlistmodel', { key: 'playlist', embedded: true }) }) app.playlistmodel = em.model.extend({ description: em.attr() uc_date: em.attr() }) the instances of these models loaded controller in route. have primary template: #playlists app.playlistview controllerbinding="controllers.playlist" contentbinding="content.playlist" p {{content.playlist}} then app.playlistview template looks like: #playlist p {{this}} p {{model}} here renders: <div id="playlists"> <div id="playlist"> <p> <app.playlistcontroller:ember456> </p> </div> <p> <app.playlistmodel:ember454> </p> </div> i expected "#playlist" div have p-tag set instance of app.playlistmodel. not sure why contentbinding isn...

postgresql - How do I efficiently select the previous non-null value? -

i have table in postgres looks this: # select * p; id | value ----+------- 1 | 100 2 | 3 | 4 | 5 | 6 | 7 | 8 | 200 9 | (9 rows) and i'd query make this: # select * p; id | value | new_value ----+-------+---------- 1 | 100 | 2 | | 100 3 | | 100 4 | | 100 5 | | 100 6 | | 100 7 | | 100 8 | 200 | 100 9 | | 200 (9 rows) i can subquery in select, in real data have 20k or more rows , gets quite slow. is possible in window function? i'd love use lag(), doesn't seem support ignore nulls option. select id, value, lag(value, 1) on (order id) new_value p; id | value | new_value ----+-------+----------- 1 | 100 | 2 | | 100 3 | | 4 | | 5 | | 6 | | 7 | | 8 | 200 | 9 | | 200 (9 rows) i found this answer sql server w...

ColdFusion UI tags to jQuery conversion -

i trying convert code has various coldfusion ui tags jquery. have create migration plan. have tag replacement cfapplet ??? cfcalendar http://jqueryui.com/datepicker/ cfchart http://stackoverflow.com/questions/1201098/jquery-charting cfform many list cfgrid http://stackoverflow.com/questions/5622716/choosing-a-jquery-datagrid-plugin cfmap ??? cfprogressbar http://jqueryui.com/progressbar/ cfslider http://jqueryui.com/slider/ cftextarea (rich edit) ??? cftooltip http://jqueryui.com/tooltip/ cftree http://stackoverflow.com/questions/1710114/jquery-tree-plugin cfwindow http://jqueryui.com/dialog/ some of coldfusion tags such cfapplet , cftextarea don't seem have simple correspond replacement. particularly concerned cfmap , cftextarea. there jquery stuff corresponds these? here's couple replacement libraries use versus standard coldfusion tags: cfselect select2 (jquery) ...

c# - Ignore file if it is corrupted -

i using ionic zip in wcf service unzip files uploaded 'client'.the files zipped using ionic zip.however,there have been instances zipped files 'corrupted'.since code scans entire folder zipped files,exceptions thrown picking same 'corrupted' zipped files everytime.this stopped other files being processed.here's code: foreach (string filepath in directory.getfiles(zippedfilesdestinationfolder)) { using (zipfile zip1 = zipfile.read(filepath)) { foreach (zipentry e in zip1) { e.extract(unpackdirectory, extractexistingfileaction.overwritesilently); } } } i want move corrupted file folder , continue extracting other zipped files in folder.how should code modified achieve this? it stopped other files because exception unhandled within loop, causing loop exit. adding try/catch around read of zipped files allow files fail still allow next file processed....

exception - Java NoSuchElementException -

Image
so have pretty big java application wrote year ago , i'm trying understand again. i'm looking @ method in code there obvious risk of getting nosuchelementexception: i'm calling .next() on scanner variable has been constructed arbitrary string. thing method declared throw custom made subclasses of exception. risky command isn't written in catch-block either. code compiles , works fine , when use gui in such fashion should throw nosuchelementexception nothing happens :o as test wrote catch-block code, compiled it, ran gui , made throw nosuchelementexception again , application caught exception , acted accordingly. how can compile code without specifying exception may thrown? if it's use @ all, here code without catch-block: public static expression interpret(final scanner scanner) throws invalidposition, nosuchspreadsheet, illegalstartofexpression, invalidexpression, falsesyntax, invalidrange { string keyword = null; try { keyword...

ruby - Regex inside Nokogiri for numbers? -

i have code, , need add regex ahead of "href=" integers: f = file.open("us.html") doc = nokogiri::html(f) ans = doc.css('a[href=]') puts doc i tried doing: ans = doc.css('a[href=\d] or: ans = doc.css('a[href="\d"]) but doesn't work. can suggest workaround? if want use regular expression, believe have manually. cannot done css or xpath selector. you can iterating through elements , comparing href attribute regular expression. example: html = %q{ <html> <a href='1'></a> <a href='adf'></a> </html> } doc = nokogiri::html(html) ans = doc.css('a[href]').select{ |e| e['href'] =~ /\d/} #=> <a href="1"></a>

How to remove duplicate entry from ruby hash -

i have query result hash. hotels = [#<hotel id: 42, hotel_name: "vijay: resort de alturas,candolim", stars: "4">, #<hotel id: 42, hotel_name: "vijay: resort de alturas,candolim", stars: "4">, #<hotel id: 47, hotel_name: "locard", stars: "3", >, #<hotel id: 48, hotel_name: "testtttt", stars: "1">, #<hotel id: 41, hotel_name: "vijay: krish holiday inn,baga", stars: "2">, #<hotel id: 43, hotel_name: "indian hotel", stars: "3">, #<hotel id: 39, hotel_name: "vijay: estrela mar, calangute", stars: "3">, #<hotel id: 41, hotel_name: "vijay: krish holiday inn,baga", stars: "2">, #<hotel id: 39, hotel_name: "vijay: estrela mar, calangute", stars: "3">, #<hotel id: 40, hotel_name: "estrela mar, calangute", stars: "3">, #<hotel id: ...

how to get tuples from lists using list comprehension in python -

i have 2 lists , want merges them 1 list of tuples . want list comprehension , can working using map . nice know how list comprehension here work. code here >>> lst = [1,2,3,4,5] >>> lst2 = [6,7,8,9,10] >>> tup = map(none,lst,lst2) # works fine >>> tup [(1, 6), (2, 7), (3, 8), (4, 9), (5, 10)] >>> l3 = [lst, lst2] >>> l3 [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]] >>> zip(*l3) # works fine [(1, 6), (2, 7), (3, 8), (4, 9), (5, 10)] >>> [(i,j) in lst , j in lst2] # not work file "<stdin>", line 1 [(i,j) in lst , j in lst2] ^ syntaxerror: invalid syntax >>> i have written comments works , not. how can 2 for-loop coupled in list comprehension think list comprehensions loops. how can write 2 not nested loops? you can wierd list comprehension: [(x, lst2[i]) i, x in enumerate(lst)] or [(lst[i], lst2[i]) in xrange(len(lst))] but actually, i...

android - A tool to measure if some task is heavy or not? -

is there tool can use measure how execution of task lasts? if yes, how many milliseconds enough consider task being heavy task? saying "heavy task" meaning contemplating whether send task background thread or not. sending mean couple of days of work adopt structure it. , not send background thread if don't have to.

excel - Multiply Entire Range By Value? -

so best way think of accomplish on large range (about 450k rows) use following sue-do code: range("a1").copy ' a1 contains value want multiply column range("mytable[foocolumn]").pastespecial paste:=xlpasteall, operation:=xlmultiply now works, fact have copy , paste value seems redundant value never going change. for each c in range("mytable[mycolumnheader]") if isnumeric(c) , not c = "" c.value = c.value * 453.592 ' value in a1 previos sample end if next that works, slower. has loop every cell. i tried: with range("mytable[mycolumnheader]") .value = .value * 453.592 end but received runtime error type mismatch error if there more 1 value in column. i thought inserting column , using formular1c1 of "=r-1c * 453.592" .value = .value , shift column , overwrite seemed clunky , think slower paste multiply. so, have better ways of accomplishing task? sub test() dim ...

ios - Calling UICollectionView#reloadData in UICollectionViewDelegate#collectionView:didSelectItemAtIndexPath: hides all cells -

i have uiviewcontroller has following implementation didselectitematindexpath @interface id section1item nsmutablearray *section2items nsmutablearray *section3items @end @implementation - (void)collectionview:(uicollectionview *)collectionview didselectitematindexpath:(nsindexpath *)indexpath { if (indexpath.section == 0) { ; } else if (indexpath.section == 1) { self.section1item = [self.section2items objectatindex:indexpath.row]; } else { // indexpath.section == 2 id newsection2item = [self.section3items objectatindex:indexpath.row]; [self.section2items addobject:newsection2item]; [self.section3items removeobject:newsection2item]; } [collectionview reloaddata]; } @end the idea behind code collectionview has static number of sections, , taping on item in section 3 moves item section 2, , tapping on item in section 2 makes item in section 1. however once make changes datastructure (section1item, s...

php - Double explode string -

given string 2 different delimiters: $string = '123|foo,456|bar,789|bla'; result should array: array ( [123] => 'foo' [456] => 'bar' [789] => 'bla' ) or: array ( [0] => array ( [id] => 123 [value] => 'foo' ) [1] => array ( [id] => 456 [value] => 'bar' ) [2] => array ( [id] => 789 [value] => 'bla' ) ) what smartest way explode string , bring arrays? you can try this: $string = '123|foo,456|bar,789|bla'; $output = array(); foreach(explode(',', $string) $pair) { list($id, $val) = explode('|', $pair); $output[(int) $id] = $val; }

cursor - Load contacts in android in sorting order -

i want load contacts mobile app. piece of code works flawless except not return sorted list. e-d abid 012345678 on top of list abid 012345678 @ end. have tried different combination of cursor (as can see in // comments). looking guidance.. list<contactinfo> loadcontactlistfromphone() { cursor cursor = getcontentresolver().query(contactscontract.contacts.content_uri, null, null, null, "upper(" + contactscontract.contacts.display_name + ") asc"); //cursor cursor = getcontentresolver().query(contactscontract.contacts.content_uri, null, contactscontract.contacts.has_phone_number + " = 1", null, "upper(" + contactscontract.contacts.display_name + ") asc"); //cursor cursor = getcontentresolver().query(contactscontract.contacts.content_uri,null, null, null, null); if(cursor.movetofirst()) { while (cursor.movetonext()) { string contactid = cursor.getstring(cursor.getcolumnindex(co...

java - How do I use actionListeners without JButtons? -

i reading documentation on swing timers, when came across information actionlistener s. when further researched, find how create actionlistener attached jbutton , etc. how can create plain actionlistener , not attached anything? my timer not working correctly, , thought may because incorrectly using actionlistener . here code: import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.timer; public class mytimer { actionlistener al = new actionlistener() { public void actionperformed(actionevent evt) { system.out.println("testing"); } }; public mytimer() { timer timer = new timer(10, al); timer.start(); } public static void main(string[] args) { mytimer start = new mytimer(); } } how can create plain actionlistner, not attached anything? loot @ this: actionlistener listener = new actionlistener() { public void actionperformed(action...

osx - For Oh-My-ZSH, where do I put UNIX commands I want to executed when a new instance is started -

i want have set -o vi run on every instance of iterm window. know there file can add to, im not sure one. set -o vi equivilent bindkey -v , way i'd enable particular option. as zsh options, can put in zsh startup files (ie, ~/.zshrc ). use of oh-my-zsh not inhibit ability use ~/.zshrc yourself.

c++ - A* pathfinding work with big open list -

Image
i work on project demands use a* algorithm. in project select player left click , guide him in map right click, gameplay of thousand strategy game. graphics 2d, little game don't starve , game developped sfml / c++. i need use a* deplacement of player, indeed if obstacle appears on road has avoid it. moment, don't know how apply grid map, want place tree / rocks , other stuff anywhere in order not see grid cells. open list composed of pixels, not solution think ^^, algorithm pretty slow. if have solution realistic rendering while keeping fast algorithm i'd happy hear it. :) thank in advance, do have screenshot? the pathfinding grid, , rendering grid can different. zelda used different sized tiles movement , rendering. navigation mesh this may overkill map structure, may use navigation mesh. , edit: if haven't read it, amit has great resource: http://theory.stanford.edu/~amitp/gameprogramming/

how to combine multiple css class selectors for jquery buttonset? -

i using jquery buttonset , setting icon, when hovered on or when active, colored version of icon stands out. css looks like: .ui-button .ui-icon.line { background-image: url("/static/16x16/line-black.gif"); } .ui-button.ui-state-hover .ui-icon.line { background-image: url("/static/16x16/line-color.gif"); } .ui-button.ui-state-active .ui-icon.line { background-image: url("/static/16x16/line-color.gif"); } the above css works fine. question whether there way combine 2nd , 3rd css rules. i have tried, among other variations, this: .ui-button .ui-icon.line { background-image: url("/static/16x16/line-black.gif"); } .ui-button.ui-state-hover .ui-button.ui-state-active .ui-icon.line { background-image: url("/static/16x16/line-color.gif"); } but haven't found combination works. is there way combine 2 combinations (.ui-button.ui-state-hover , .ui-button.ui-state-active) in 1 css selector? you can ...

fastcgi - Why does PHP-FPM take 5 minutes to restart on my server? -

i using php-fpm default settings. server running latest arch linux. i issue command sudo systemctl restart php-fpm , takes 5 minutes restart , prompt. is there known solution problem? this caused way systemctl script php-fpm created. had exact same problem. here how i've resolved it. first find start-up script, if don't know can systemctl status php-fpm , you'll see like: /etc/systemd/system/php.service now edit file , should this: [unit] description=the php fastcgi process manager after=syslog.target network.target [service] type=notify pidfile=/run/php-fpm/php-fpm.pid privatetmp=true execstart=/usr/bin/php-fpm --nodaemonize --pid /run/php-fpm/php-fpm.pid execreload=/bin/kill -usr2 $mainpid [install] wantedby=multi-user.target change this: [unit] description=the php fastcgi process manager after=syslog.target network.target [service] execstart=/usr/bin/php-fpm --nodaemonize execreload=/bin/kill -hup $mainpid restart=always [install] wantedb...

wix - Test for Windows Features -

i have installer runs customaction runs embedded powershell script test installed status of various required windows features. works correctly terribly slow complete. is there alternative method test such features? expect there along lines of registry keys each feature , sub-feature have not found documentation on subject. in 1 of installation projects used dism.exe enable required windows features. for example, enabling asp.net in iis 8 done following custom action: <!-- 32-bit edition of windows knows find dism.exe --> <property id="dismexepath" value="dism.exe" /> <!-- 64-bit edition of windows requires workaround proper dism.exe version --> <setproperty id="dismexepath" value="[windowsfolder]sysnative\dism.exe" after="appsearch">versionnt64</setproperty> <!-- , ca job (with of [quiet execution ca][2]) --> <customaction id="setforenableaspnetiis8" property=...

java - More compact Eclipse autocomplete code -

eclipse great in suggesting standard pieces of code when needed , helping in autocompleting hints code. for example, in adt, if write piece of code: runnable r = new if press ctrl-space get, automatically: runnable r = new runnable() { @override public void run() { // todo auto-generated method stub } }; it's fantastic! generally, after this, spend little of time compact waste of space , make this: runnable r = new runnable() { @override public void run() { }}; now question is: there way instruct eclipse make more compact code, similar latest one? there option, or there code can change? obviously example, not complaining runnable() autocomplete code in itself, , it's not complain, eclipse behave differently in any similar case. thank you you can following 2 steps: step 1 create java formatting rules. to edit code formatting style go preferences> java> code style> formatting . starting built in style c...

java - What's the method to control volume in an MIDI sequencer? -

can show me how control volume of midi sequencer without using sound bank or synthesizer? i want make midi fade out before continuing next midi in sequence if(midiplay) { midi = s + savereq; try { //system.out.println("play midi " + midi); if (musicsr != null) { /* want fade out*/ musicsr.stop(); //stop sequencer musicsr.close(); //close sequencer } musicsr = null; musics = null; file music = new file(midi); if(music.exists()) { musics = midisystem.getsequence(music); } // create sequencer sequence musicsr = midisystem.getsequencer(); ...

seo - how to change image filenames using javascript -

i'm working site has on 50,000 products within database. problem file names cryptic problem: 51h5zpsj7il , was: 51i5cvruyrl. need change these more seo friendly names such "introduction-to-programming" or "c++-for-everyone". client sells products on amazon , therefore grabs these image names them. i've written code change alt, don't know how rename file isn't ours. able come technique have these files added imgs , work there? for convienenvce, js code changing alt text, not src text needs changed seo: var title = document.getelementbyid("product-description").getelementbyclassname("product-title")[0].innerhtml, img = document.getelementbyid("main-image").getelementsbytagname("img")[0].alt=title; from can tell, you're pointing image file on amazon's servers, have random image names. pretty summed when said, "i don't know how rename file isn't ours." it's not ...

scripting - Photoshop script - suppressWarnings, disable error dialogs -

Image
i have script.jsx photoshop, exports stuff many psd files. (1 in 20 files), upon opening psd file, following dialog shows up: var filetoopen = new file(...); open(filetoopen); i'm running script on hundreds of files, , need somehow ignore dialogs. "keep layers" ok, in general, prevent dialog help. i've found in manual option suppresswarnings, available pdfopenoptions or photoshopsaveoptions - there no such thing psdopenoptions or photoshoploadoptions , neither simple object {suppresswarnings: true} work. have tried adding displaydialogs = dialogmodes.no doesn't either. is there way prevent dialog? (ie. stop blocking script's execution) try try catch construction. if not help, set user interaction (though may cumbersome): https://forums.adobe.com/thread/289239?tstart=0 example: app.scriptpreferences.userinteractionlevel = userinteractionlevels.neverinteract; var filetoopen = new file(...); open(filetoopen); app.scriptpreferences...

Matlab: displaying message and cell array in msgbox -

i have cell array 'animals' contents as: 'cat' 'dogs' 'elephant' i want display in messagebox following: the animals in our zoo are: cat dogs elephant how achieve this? edit: sorry confusion: contents of cell array 'animals' change every time user runs code. size of 'animals' 3x1 or 4x1. so, variable size , contents has recognized. very easy if read doc msgbox : intro = 'the animals in our zoo are:' animals = {'cat','dogs','elephant'}; % define desired: msgbox([intro animals])

slider - Slide between two files in Titanium -

i have done slide between 3 windows using scrollview: var scrollview = ti.ui.createscrollableview({ views:[viewdatos,viewdependientes,viewasistencia] }); can make slide between 2 files .js in titanium app i'm developing? i think want create tour or walk through window this var win = ti.ui.createwindow(); var view1 = ti.ui.createview({ backgroundcolor:'#123' }); var view2 = ti.ui.createview({ backgroundcolor:'#246' }); var view3 = ti.ui.createview({ backgroundcolor:'#48b' }); var scrollableview = ti.ui.createscrollableview({ views:[view1,view2,view3], showpagingcontrol:true }); win.add(scrollableview); win.open() thanks

c++ - How to obtain const char * from QString -

i have read string in xml file utf8 encoding. store value in qstring object , concatenate other information. can see in qtcreator debugger qstring holds desired value. i need pass string library takes const char * argument. how obtain const char * please? i've tried tolocal8bit() , tolatin1() , toutf8() no luck. seems missing something... i need pass string library takes const char * argument. how obtain const char * please? i've tried tolocal8bit(), tolatin1(), toutf8() no luck. seems missing something... because if try those, qbytearray opposed const char*. use constdata() method on qbytearray got way, , have desired result. mixing std::string , qstring not necessary, hence better go through qt types (qstring -> qbytearray -> const char*) without introducing std::string in here. where use tolocal8bit(), tolatin1() or toutf8() depends on encoding, different question main 1 in here. return qbytearray you. note: should avoid using toasc...