Posts

Showing posts from March, 2010

r - Make result in tryCatch expr available to warning handler -

in usual implementation of trycatch , warning handler returns custom value, e.g. trycatch(expr, warning = function(w) { print(w) ; return(null) } what if want warning handler return result of expr without running expr again? (the reason expr api call cuts limit.) tried trycatch({res <- expr; return(res)}, warning = function(w) { print(w) ; return(res) } but of course doesn't work because res not available in warning handler.

javascript - Flow type and merging json objects -

assume code of following kind (e.g. using lodash or explicitly here): function extend(base, overwrite) { (var key in overwrite) base[key] = overwrite[key]; return base; } var first = extend({ a: 1 }, { b: 2 }); var second = extend({ c: 3 }, { d: 4 }); console.log(first.a + first.b + second.c + second.d); how can explain flowtype fine? try putting above function declaration: declare function extend<a, b>(a: a, b: b): & b

Generating Random Groups of Elments from an Array Javascript -

hi working on project school , trying generate random groups of names list of names. group size , amount of groups based off users input. have code randomly generate single element array, need grouping. code far. not functioning please thanks function yeah() { var arr = prompt("enter names").split(",") console.log(arr); var random = arr[math.floor(math.random() * arr.length)]; document.getelementbyid("h2").innerhtml = random; } function groups() { var arr = prompt("enter names").split(","); var random = arr[math.floor(math.random() * arr.length)]; var numelem = document.getelementbyid("input2").value; (i=0;i <= arr.length; i++) { var newarr = [random]; console.log(newarr); //print na

duplicate results on join sql -

i have 2 sql scripts. need combine data both of them. i've set them 2 seperate volatile tables join them finished report. script below example of i'm trying extract data. true script complex, , has many sub queries meriting need use volitile table instead of regular join. join on "customer_acct".the purpose of script produce record of orders, , have column on whether or not refund has been applied said order, tied "customer_acct". the result gives me cust_acct product_ordered refund_amt 1111111 item#5 10.00 1111111 item#5 20.00 1111111 item#5 30.00 2222222 item#5 10.00 2222222 item#5 20.00 2222222 item#5 30.00 3333333 item#5 10.00 3333333 item#5 20.00 3333333 item#5 30.00 my script summarized below. create volatile table orders, no log as( select p.customer_acct p.product_ordered etc. serv

cocoa - How do I prevent the menu bar from moving down when my popover is open? -

Image
i have app popover appears on status bar item. thing is, when click on icon while you're in full screen app, move mouse away menu bar click on in popup, menu bar moves up, , popup. it's annoying. anyone know of way solve this? i've tried attaching invisible menu popup, can't menu invisible. screenshot clarity, annoying part wave mouse around: the popover window moving because parent window status item window, , when parent window moves, child moves it. (before investigated this, didn't know cocoa had parent , child windows.) solved problem code after showing popover: nswindow *popoverwindow = self.popup.contentviewcontroller.view.window; [popoverwindow.parentwindow removechildwindow:popoverwindow]; now, menu bar still moves up, @ least popup stays in same place.

python - remove low counts from pandas data frame column on condition -

i have following pandas data frame: new = pd.series(np.array([0, 1, 0, 0, 2, 2])) df = pd.dataframe(new, columns=['a']) i output occurrences of each value by: print df['a'].value_counts() then have following: 0 3 2 2 1 1 dtype: int64 now want remove rows column 'a' value less 2. can iterate through each value in df['a'] , remove if value count less 2, takes long time large data frame multiple columns. can't figure out what's efficient way that. one approach join counts data original df. df2 = pd.dataframe(df['a'].value_counts()) df2.reset_index(inplace=true) df2.columns = ['a','counts'] # df2 = # counts # 0 0 3 # 1 2 2 # 2 1 1 df3 = df.merge(df2,on='a') # df3 = # counts # 0 0 3 # 1 0 3 # 2 0 3 # 3 1 1 # 4 2 2 # 5 2 2 # filter df3[df3.counts>=2]

How to structure my little python framework -

i wrote simple set of python3 files emulating small set of mongodb features on 32 bit platform. fired pycharm , put directory looked like: minu/ client.py database.py collection.py test_client.py test_database.py test_client.py my imports simple. example, client.py has following @ top: from collection import collection basically, client has client class, collection has collection class, , database has database class. not tough. as long cd minu directory, can fire python3 interpreter , things like: >>> client import client >>> c = client(pathstring='something') and works. can run test_files well, use same sorts of imports. i'd modularize this, can use project dropping minu directory alongside application's .py files , have work. when though, , running python3 directory, local imports don't work. placed empty init .py in minu directory. made import minu . others broke. tried using things from .collection

ios - UIProgressView won't update progress when updated from a dispatch -

i'm trying make progress bar act timer , count down 15 seconds, here's code: private var timer: dispatch_source_t! private var timeremaining: double = 15 override public func viewdidappear(animated: bool) { super.viewdidappear(animated) profilepicture.layer.cornerradius = profilepicture.bounds.width / 2 let queue = dispatch_queue_create("buzz.qualify.client.timer", nil) timer = dispatch_source_create(dispatch_source_type_timer, 0, 0, queue) dispatch_source_set_timer(timer, dispatch_time_now, 10 * nsec_per_msec, 5 * nsec_per_msec) dispatch_source_set_event_handler(timer) { self.timeremaining -= 0.01; self.timerbar.setprogress(float(self.timeremaining) / 15.0, animated: true) print(string(self.timerbar.progress)) } dispatch_resume(timer) } the print() prints proper result, progress bar never updates, somestimes single update @ around 12-15% full , jump there , nothing else. how can make bar steadily flo

asp.net mvc - How would I create an MVC route that directs all requests to a single method on a single controller and resolve the route parameter as {id}? -

given following examples http://my.url/123 or http://my.url/abc how configure route passes either request same action method on same controller how resolve 123 or abc input paramter (id) action method public actionresult index(string id) { viewdata["message"] = id; return view(); } so if went http://my.url/123 print "123", etc. thanks in advance! the following work, may break other routes you're doing catch-all on first part of path: routes.maproute( name: "id-route", url: "{id}", defaults: new { controller = "yourcontroller", action = "youraction", id = "{id}" });

lua - How do I access a variable in a elseif statement -

--if statement elseif line:match("^if") local v, e, c, v2 = line:match("^if (.+) = (.+) > (.+) > (.+)") if vars[v] == e if c == "print" print(v2) elseif c == "run" if funcs[v2] if funcs[v2] == "print" print("hi") end end end end --functions elseif line:match("^func") local n, c, o = line:match("^func (.+) > (.+) > (.+)") funcs[n] = c end this code used programming language im developing , im having troubles running functions while code there works, there 1 problem... want print off var "o" set in elseif statement under "--functions", detecting want prin

VBA to insert reference page into MS word endnote -

book endnotes forgo superscript numbers page numbers. e.g., instead of abe lincoln assassinated pistol.^33 : 33. single-shot derringer pistol. books several authors write abe lincoln assassinated pistol. : page 297. abe lincoln shot single-shot derringer pistol. word doesn't have feature, believe have macro. came simple code below loops through of endnotes , adds "page ???. " before each endnote, "???" need to correctly insert page number in manuscript citation's located on? sub redefineexistingendnotes() dim fn endnote each fn in activedocument.endnotes fn.range.paragraphs(1).range.font.reset fn.range.paragraphs(1).range.characters(1).insertbefore "page" & "???" & " - " next fn end sub try below vba code: sub insertpagenumberforendnotes() dim endnotecount integer dim curpagenumber integer if activedocument.endnotes.count >

sql - Parse Dataframe string column into Street, City, State & Zip code -

i trying break following fixed string several columns street ,city, state & zip code. possible in sqldf via instr & subtr method? sample address string. difficult part nv , zip code parsing. 727 wright brothers ln, las vegas, nv 89119, usa i able parse city/street information using sqldf/instr unable parse final 2 values state/zip code parsed_tweetaddressdf <- sqldf("select lon, lat, result, substr(result,0,instr(result,',')) street, substr(result,instr(result,',')+1,instr(result,',')-1) city tweetaddressdf") here alternatives. use instr , substr required question although third writes out data , reads in (in addition using instr , substr ). notes @ end point out easy in plain r or using read.pattern in gsubfn. 1) assume state, zip , country fields fixed width 1 sample record impossible know general case if assume every record ends in ss zzzzz, usa ss 2 letter state abbreviation , zzzzz 5 digit zip works:

ios - Segfault from NSLog? -

i'm seeing segfault using nslog , specifically, on 64 bit device, segv_accerr . i'm new ios, i'm little confused. here's stack trace: exception type: sigsegv exception codes: segv_accerr @ 0x108074000 crashed thread: 0 thread 0 crashed: 0 libsystem_platform.dylib 0x00000001826ea31c _platform_memmove + 300 1 libsystem_asl.dylib 0x00000001825289a4 asl_string_append_no_encoding_len + 92 2 libsystem_asl.dylib 0x0000000182522fc8 asl_string_new + 108 3 libsystem_asl.dylib 0x0000000182522df4 asl_msg_to_string_raw + 68 4 libsystem_asl.dylib 0x00000001825228dc _asl_send_message + 828 5 libsystem_asl.dylib 0x00000001825224fc asl_send + 8 6 corefoundation 0x0000000182a6fa1c __cflogcstring + 568 7 corefoundation 0x0000000182a6f7ac _cflogvex2 + 300 8 corefoundation 0x0000000182a6fc14 _cflogvex3

workflow - Modelling engineering processes for data harvesting and AI implementations -

let's know nothing ai (that's not true, know basics). practical experience on , on programming (i'm learning c# , wpf @ time being, , once again, i've never reached out of basics). let's there specific engineering workflow model after gate models (stages), , step on gate 1 , retrieve data like amount of item x required amount of item y required timestamp of start of gate some strings (mainly comboboxes , specific inputs) for second gate, similar, until reach last gate end of workflow. i gather information , feed ai find pattern me on guessing state of following gates (inputs next gate, time-related milestones , on). program (python or c#) work people have different inputs on same stage, without them having modify/understand code the thing is, wish learn , ai basic algorithms. have money books , need recommendations, because i'm not sure of whatever want has name already. need: general advice (is feasible? such ai exists? how data need?

iPhone issue while accessing Web service -

i have created project in xcode. access webservice each uiviewcontroller. there no issues while accessing data web services. can't navigate same page agin. have issue following scenario : i have table view of data user1, user2, user3; while clicking on user lead me detailed user page show particular user profile in detail. in app can navigate user1 , can see detailed profile , once , again trying go user2's profile app crashed , there no errors in console. and if restarting app , again trying access user2's profile, works , won't works other items in list. can guys me sort out issue? thanks in advance...... you crate array of users object , store details of user , when going user pass particular users object work fine requirement

php - paypal do not return txn_id in mobile site -

i have using paypal in desktop website , worked. below code: <?php ...... echo '<form name="form1" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"><div> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="charset" value="utf-8"> <input type="hidden" name="cancel_return" value="'.$host.'/my-order-history"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="return" value="'.$host.'/payment-done?nid='.$node->nid.'&order='.date("ymdhis",$time).'"> <input type="hidden" name="rm" value="2"> <input type="hidden" n

html5 - IndexedDB: When to close a connection -

i know correct place close connection database is. let's have following piece of code: function additem(dbname, versionnumber, storename, element, callback){ var requestopendb = indexeddb.open(dbname, versionnumber); //idbrequest requestopendb.onsuccess = function(event){ //console.log ("requestopendb.onsuccess "); var db = event.target.result; var trans = db.transaction(storename, "readwrite"); var store = trans.objectstore(storename); var requestadd = store.add(element); requestadd.onsuccess = function(event) { callback("success"); }; requestadd.onerror = function(event) { callback("error"); }; }; requestopendb.onerror = function(event) { console.log ("error:" + event.srcelement.error.message);/* handle error */ callback("error"); };

How to make button as one of the column inside table component in CDE Pentaho? -

i trying make table component button inside table column in cde pentaho. how can achieved? i guess need work. in draw function of table, may put javascript manipulate dom , add button : far remember, draw function receives parameter structure column , row index of current cell. try first code in draw function : function(paramdraw) { console.log(paramdraw); } and content of paramdraw iin console. maybe there better way it...

python - Nested / alternating apps with Kivy -

i'd have kivy app function launcher other kivy apps, depending on input. way implemented below not working (because kv file gets reloaded , styles reapplied, adding more , more buttons), , there seems recursion trace suggests when hit esc exit. i warning app1.kv loaded multiple times, however, in documentation app.load_kv() says this method invoked first time app being run if no widget tree has been constructed before app. this implies me should possible run() app multiple times? here code: main.py from kivy.uix.widget import widget kivy.uix.gridlayout import gridlayout kivy.app import app kivy.properties import objectproperty kivy.uix.button import button kivy.clock import clock kivy.logger import logger kivy.lang import builder class outsideapp(app): current_app = objectproperty(none) def build(self): clock.schedule_interval(self.update, 3) return widget() def update(self, dt): if isinstance(self.current_ap

java - Intellij run JSP page option disappear when edit web.xml -

Image
first picture, option run jsp page still appear if not set config in web.xml second picture, option run jsp page disappear when config in web.xml what happen , how can solved problem. it's difficult test each jsp page without option. otherwise, have start index.jsp navigate particular page or typing url manually not convenience. thank you

php - Android failed to connect to database -

i new in android, wanna connect android app mysql database via php (i use mamp-pro create database). don't know why response failed. in php file, insert new record in database table, doesn't add new record database. here code: okhttpclient client = new okhttpclient(); file cachedirectory = new file(this.getcachedir(),"http"); int cachesize = 10 * 1024 * 1024; cache cache = new cache(cachedirectory, cachesize); client.setcache(cache); request request = new request.builder().url("http://localhost:8888/myfirstphp.php").build(); client.newcall(request).enqueue(new callback() { @override public void onfailure(request request, ioexception e) { updatetextview1(); } @override public void onresponse(response response) throws ioexception { if (response.code() >= 200 || response.code() <= 300){ responsebody responsebody = response.body();

python - Django migration with DateTimeField and timedelta default -

i'm having trouble setting default datetime on 1 of django models from django.db import models django.utils import timezone class mymodel(models.model): my_datetime = models.datetimefield(default=timezone.now() + timezone.timedelta(+14)) the problem everytime run makemigrations creates new migration on field, default value serialized value equals now . migrations.alterfield( model_name='mymodel', name='my_datetime', field=models.datetimefield(default=datetime.datetime(2016, 2, 4, 5, 56, 7, 800721, tzinfo=utc)), ) is there anyway can set default value datetimefield that's in future? problem put result of expression in default. instead need assign default callable want. here example: from django.db import models django.utils import timezone def default_time(): return timezone.now() + timezone.timedelta(+14) class mymodel(models.model): my_datetime = models.datetimefield(default=default_time)

jquery - CSS drop down menu list color does not change on hover in Google chrome -

i have problem css drop down menu not work in chrome on hover. expected behavior: hovering on of list item should change background color set using css rules. actual behavior: default color(blue) stays after hovering on list item. if run same code in internet explorer(ie 10,11) working absolutely fine not in chrome.my chrome version 47. mycode: <style> option:hover { background: #01a982; } </style> <select> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> jsfiddle link : https://jsfiddle.net/sandeepb/p7jz9g95/ chrome doesn't support :hover on option elements. there isn't simple workaround this. need use javascript solution or other type of elements made & act select, if need :hover support in chrome.

c# - Trying to read a file and then write a file during a WiX install in a CustomAction -

update this solved now, i've updated article future readers i having tough time this. there lot of so articles these settings stuck. my goal perform 2 steps: 1) read file physically shipped msi. in other words, there 3 files setup.exe, test.msi, specialfile.txt 2) during install, want create new file in install path. c:\program files\mycompany\myapplication\newfile.txt the file in step 2 created reading out of specialfile.txt step 1. my problem navigating murky combinations of wix settings enable me read session variables , have high enough privs write file out. has not been easy. here solution: <binary id="mycustomaction.ca.dll" sourcefile="path\to\mycustomaction.ca.dll" /> <customaction id="myactionsname" return="check" execute="deferred" binarykey="mycustomaction.ca.dll" dllentry="mycustomaction" impersonate="no"/> <customaction id

javascript - Issue On Using Text() in a loop -

can please take @ demo , let me know why getting last item in .result for (i = 0; < 5; i++) { $('.result').text('hello' + [i]); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="result"></div> you can append source code within new element. for (i = 0; < 5; i++) { $('.result').append( $('<p>').text('<p>' + 'hello' + [i] + '</p>') ); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="result"></div>

Error:Cause: com.android.sdklib.repository.FullRevision -

i wanted try instant-run 2.0 - work had update build-plugin 2.0.0-alpha6 - when doing cannot gradle-sync project anymore getting: gradle 'myproject' project refresh failed error:cause: com.android.sdklib.repository.fullrevision knows reason/workaround this? i use jakewharton/sdk-manager-plugin . build-plugin 1.5.0 not problem. in project have added apply plugin: 'android-sdk-manager' i removed gradle file of app & worked. hope you.

java - Unable to load library 'xxx.dll': Native library (win32-x86/xxx.dll) not found in resource path (JNA + DLL + eclipse rcp) -

i'm using jna in eclipse rcp project. i'm following fragment style. fragment:` `bundle-symbolicname: a.b.c.d.win32.win32.x86` `bundle-classpath: lib/jna-4.1.0.jar, . ` `eclipse-platformfilter: (& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))` `bundle-nativecode: xxx.dll;processor=x86; osname=win32,*` `fragment-host: a.b.c.d xxx.dll directly inside a.b.c.d.win32.win32.x86 fragment project. host: bundle-symbolicname: a.b.c.d error get: exception in thread "main" java.lang.unsatisfiedlinkerror: unable load library 'xxx.dll': native library (win32-x86/xxx.dll) not found in resource path need help. i'm using jna-4.2.1. downloaded source , debug. found jna introduces prefix based on platform. string libname = name.startswith("/") ? name : nativelibrary.mapsharedlibraryname(name); string resourcepath = name.startswith("/") ? name : platform.resource_prefix+ "/" + libname; so included x

How to return two strings in one return statement in java? -

@suppresswarnings("unchecked") public tblseed getseed(string tablename, string tablename1) { session session = this.sessionfactory.getcurrentsession(); list<tblseed> list = new arraylist<tblseed>(); tblseed tblseed = null; try{ query query = session.createquery("from tblseed seedname =:tablename"); query.setparameter("tablename", tablename); query query1 = session .createquery("from tblseed seedname =:tablename1"); query.setparameter("tablename1", tablename1); list = query.list(); if (list!=null && list.size()>0) { tblseed = list.get(0); } list = query1.list(); if (list != null && list.size() > 0) { tblseed = list.get(0); } }catch(exception ex){ tblseed = null; logger.error(

php - bind_param giving error "Parameter 3 to mysqli_stmt_bind_param() expected to be a reference" -

i'm trying values of column datetime , using values number of entries made on day. i'm passing array bind_param. here error: "parameter 3 mysqli_stmt_bind_param() expected reference" i've tried commented method doesn't seem work either. here's code : <?php $hostname = "localhost"; $database = "ti_project"; $username = "root"; $password = ""; $mysqli = new mysqli($hostname, $username, $password, $database); $query = "select datetime feedback"; $result = $mysqli->prepare($query); /*$result->bind_param('s', $datetime);*/ $result->execute(); $result->bind_result($date); while ($result->fetch()){ $feedbackdate[] = array($date); } $type="s"; $query = "select count(*) feedback datetime = ?"; $result = $mysqli->prepare($query); call_user_func_array('mysqli_stmt_bind_param', array_merge (array($result, $type),$feedbackdate))

java - Mybatis not able to perform query and map to apt Model class -

i have model class holds foreign keys 2 other tables. : create table `toolosrelation` ( `tooltype` varchar(100) not null default '', `osname` varchar(50) not null default '', primary key (`tooltype`,`osname`), key `osname` (`osname`), constraint `toolosrelation_ibfk_1` foreign key (`tooltype`) references `tools` (`tooltype`), constraint `toolosrelation_ibfk_2` foreign key (`osname`) references `os` (`osname`) ) correspondingly have following model class toolosrelation.java : public class toolosrelation { private tools tooltype; private os osname; public toolosrelation() { } //remaining getters , setters here after this, have following mybatis mapper : <mapper namespace="com.dexter.devicetype.toolosrelationdao"> <select id="gettoolsforos" resultmap="toolosrelationmap" parametertype="string"> select t.tooltype toolosrelation t

debugging - How to find out where the method was called in Java? -

i have more 100 class files. got error message in 1 method when return values. example: public string name() { return("john"); // error message appeared here } my problem couldn't find out has been called. you may print calling stack way : for (stacktraceelement ste : thread.currentthread().getstacktrace()) { system.out.println(ste); } note ide have shortcuts find given method called. for instance in eclipse, select method, ctrl+shift+g show possible callers of method. you may use debugger , step-by-step check.

objective c - Reading plist in iOS program -

as i'm beginner ios , want read simple property list file ( plist ) in program shows me message "terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[viewcontroller datafilepath]: unrecognised selector sent instance 0x15638660'". kindly me out had issue in program. (.h file) @interface viewcontroller : uiviewcontroller { nsstring *listpath; nsmutablearray *array; } - (nsstring *) datafilepath; - (void) writeplist; - (void) readplist; (.m file) @interface viewcontroller () @end @implementation viewcontroller - (void)viewdidload { uibutton *readbtn = [uibutton buttonwithtype:uibuttontyperoundedrect]; readbtn.frame = cgrectmake(110,110,72,39); [readbtn settitle:@"read" forstate:uicontrolstatenormal]; [readbtn addtarget:self action:@selector(readplist)forcontrolevents:uicontroleventtouchupinside]; [self.view addsubview:readbtn]; uibutton *writebtn = [uibutton buttonwithtype:uibuttontyperoundedr

Auto run PHP script in windows -

how can run php file everyday in windows without using task scheduler or cron? have used jquery have realized not solve problem me. there way use php without using javascript, jquery or windows. i found phpjobscheduler , solved problem. phpjobscheduler

In sterling where we can set the max Elements In Memory? -

i tried search in customer overrides properties file. couldn't find remarkable difference in that. please help. thanks in advance. we can set value in cacheoverride.xml.

android - Universal Image Loader and BitmapDrawable -

we have image in b64, want use image loading image in universal image loader while better image isn't loaded url. create bitmap url in b64 , convert bitmapdrawable. result shown fine if do: imageview.setimagedrawable(bitmapdrawable) but, on displayimageoptions, if set bitmapdrawable image on loading, image never shown. i'm doing following: final displayimageoptions imageoptions = mdisplayimageoptionsdefaultbuilder. .showimageonloading(bitmapdrawable) .showimageonfail(bitmapdrawable) .showimageforemptyuri(bitmapdrawable) .build() as can see, setting bitmap drawable not image when loading, image when fails (as don't want image change in case of error while loading better image url). result of bitmap drawable never shown. doing wrong? update: after debugging happening i've seen problem not bitmap drawable, supported , working fine. problem using default display options builder (mdisplayimageoptionsdefaultbuilder), @ point did:

Transpose and split a record using awk -

i've record this 35366302,shenzhen basicom h838 35180800,adcon telemetry a733 addwave gsm 35347200 35557601,act''l ewon 45005801 45006201 45006202,aeg 9020/aeg ht901 and want result this. 35366302,shenzhen basicom h838 35180800,adcon telemetry a733 addwave gsm 35347200,act''l ewon 35557601,act''l ewon 45005801,aeg 9020/aeg ht901 45006201,aeg 9020/aeg ht901 45006202,aeg 9020/aeg ht901 how use proper awk command case ? a complete records such below. 45006401 45006402 45006405 45006501 45006502 45006701 45006702 45006705 45006801 45006802 45006805,39,aeg ht911,alqn5h,-9,aeg_ht911,n,n/a,n/a,no,no,n,proprietary,proprietary,n/a,n/a,gsm 900,n,y,n,n,u,u,no,u,n,n,n,n,0,n,0,n,n,n,n,no,-9,-9,-9,-9,n/a,basic phone,n/a,n/a,-9,-9,-9,-9,n/a,n,n/a,n,n,n/a,n/a,n,n,no,0,n,n,n,n,n,n,n,n,n,n,n,n/a,-9,-9,-9,-9,u,-9,n/a,n/a,u,u,u,u,u,u,u,n/a,n,u,n,n,n,y,n,n,n,n,n,u,n,n,n,n,u,u,-9,n,n,u,n,n,n,n,n,n,1,1,0,0,-9,-9,n/a,n/a,n/a,n/a,-9,-9,n/a,n/a,-9,-9,n/a,n/a,0,n/a,-9,

c++ - Segmentation fault while calling malloc and program in deadlock futex -

the code working on has lot of calls create new strings , stuff.. after upgrading servers 12.10 ubuntu, have started facing troubles. of child processes stuck in futex . went , attached gdb running process in futex long time, did backtrace , found following logs #0 0x00007f563afc69bb in ?? () /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007f563af4a221 in ?? () /lib/x86_64-linux-gnu/libc.so.6 #2 0x00007f563af47fa7 in malloc () /lib/x86_64-linux-gnu/libc.so.6 #3 0x00007f563afcfbfa in backtrace_symbols () /lib/x86_64-linux-gnu/libc.so.6 #4 0x0000000000446945 in sig_segv (signo=<optimized out>) @ file has handler,sighandler #5 <signal handler called> #6 0x00007f563aefb425 in raise () /lib/x86_64-linux-gnu/libc.so.6 #7 0x00007f563aefeb8b in abort () /lib/x86_64-linux-gnu/libc.so.6 #8 0x00007f563af3939e in ?? () /lib/x86_64-linux-gnu/libc.so.6 #9 0x00007f563af43b96 in ?? () /lib/x86_64-linux-gnu/libc.so.6 #10 0x00007f563af463e8 in ?? () /lib/x86_64-linux-gnu/libc.so.

html - CSS acting weird with change in reading direction -

good morning, i have weird reaction css, when changing document reading direction ltr rtl. when try display text such adress: 28 main street - xxxx -xxx -xxxx i end main street - xxxx -xxx -xxxx 28 see http://codepen.io/anon/pen/dgjzog <html dir="rtl"> <span>28 main street - 00000 - city - country</span> </br> <span>main street - 00000 - city - country</span> </br> <span>plop 28 main street - 00000 - city - country</span> </html> i think that's how supposed work. check out these links. right-to-left text in html , css direction . reversing text, check link . hope helps.

javascript - Add multiple markers on map using json object -

my index.php file shown below. in want show map , multiple marker on using json object. code 1 marker. u please tell me how can code modify multiple markers , how can access json object in $.ajax()?? <!doctype html> <html> <head> <style> #map { width: 1000px;height: 500px;} </style> <script src="https://maps.googleapis.com/maps/api/js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script> var latlng = {lat: 31.566470, lng: 74.297723}; var marker; function initialize() { var mapcanvas = document.getelementbyid('map'); var mapoptions = { center: latlng, zoom: 11, maptypeid: google.maps.maptypeid.roadmap } var map = new google.maps.map(mapcanvas, mapoptions); marker = new google.maps.marker({ position: latlng,

Azure - AD - AcquireTokenSilent giving error failed_to_acquire_token_silently -

we using azure ad authenticate , refreshed access token every 30 mins. invoke below method acquires security token , add request header. var userobjectid = claimsprincipal.current.findfirst("http://schemas.microsoft.com/identity/claims/objectidentifier").value; var authcontext = new authenticationcontext(authority, new naivesessioncache(userobjectid)); var credential = new clientcredential(configurationmanager.appsettings["ida:clientid"], configurationmanager.appsettings["ida:clientsecret"]); try { var authenticationresult = authcontext.acquiretokensilent(configurationmanager.appsettings["webapibaseaddress"], credential, new useridentifier(userobjectid, useridentifiertype.uniqueid)); //set cookie azure oauth refresh token - on successful login var httpcookie = httpcontext.current.response.cookies["refreshtoken"]; if (httpcookie != null) httpcookie.value = authenticationresult.refreshtoken; req

javascript - is data grouping supported in highcharts? -

hey tried lot work merging set of data days months. highcharts doesn't group them. chart tries show data. data grouping supported in highcharts? (i not using highstock) highcharts doesn't suport data grouping. have 2 options: use highstock, have support it: http://api.highcharts.com/highstock/#plotoptions.series.datagrouping group data yourself. if want process data group it, need loop through daily data, adding each value new data array, indexed on month.

functional programming - append data to dataFrame in R function -

i trying write r function adds new row existing dataframe. here code (r newbie here): qrows <- data.frame( rowquery = character(0), "backtest p&l" = character(0), stringsasfactors=false) # add row dataframe qrows[nrow(qrows) + 1, ] <- c("sp500(vwpc) | abc(30) | qcume", "12%") #define function add new row dataframe q <- function(data, y){ data[nrow(data) + 1, ] <- c(y,"88") } # run new function q(qrows, "newquery") #examine output: no new row added qrows the code runs without error, no new row added. two changes : you need return function output , assign outputted value qrows. qrows <- data.frame( rowquery = character(0), "backtest p&l" = character(0), stringsasfactors=false) # add row dataframe qrows[nrow(qrows) + 1, ] <- c("sp500(vwpc) | abc(30) | qcume", "12%") #define function add new row dataframe q <-

amazon web services - AWS Iam commands, Working correct in terminal and not working in Laravel/PHP AWS SDK -

Image
i using os: ubuntu 14.04 , installed awscli package using terminal. while running aws iam commands, working fine. eg: ran command aws iam list-users , got following results { "users": [ { "arn": "arn:aws:iam::3**16****332:user/xyz", "createdate": "2014-09-29t14:21:25z", "userid": "aidajy*******mw**w", "path": "/", "username": "xyz" }, { "arn": "arn:aws:iam::34****044**2:user/abcxyz", "createdate": "2014-02-07t21:08:53z", "userid": "aidaj******jml**v6y", "path": "/", "username": "abcxyz" }, } while using aws sdk laravel 5.1, configure key, secrect, region etc (same configured in awscli package) while running code

multithreading - Rails balance withdraw action threading issue -

Image
to allow users create balance withdrawal request, have withdrawalscontroller#create action. code checks if user has sufficient balance before proceeding creating withdrawal. def create if amount > current_user.available_balance error! :bad_request, :metadata => {code: "002", description: "insufficient balance"} return end withdrawal = current_user.withdrawals.create(amount: amount, billing_info: current_user.billing_info) exposes withdrawal end this can pose serious issue in multi-threaded server. when 2 create requests arrive simultaneously, , both requests pass the balance check before creating withdrawal, both withdrawal can created if sum of 2 exceeding original balance. having class variable of mutex not solution because lock action users, lock on per-user level desired. what best solution this? the following diagram illustrates suspected threading issue, occurring in rails? as far can tell code safe here, mutlith

mongodb - best practice for nested category in Mongo and Meteor -

i want handle nested category in mongo , meteor framework several ads. example this: ads object have category field this: maincategory_1 > subcategory_1.1 > subcategory_1.1.1 > subcategory_1.1.1.1 > { ad_1 here } > subcategory_1.2 > subcategory_1.2.1 > subcategory_1.3 maincategory_2 > subcategory_2.1 > subcategory_2.1.1 > subcategory_2.1.1.1 > subcategory_2.2 > subcategory_2.2.1 > subcategory_2.3 for example ad_1 object belongs subcategory_1.1.1.1 and want access ad_1 queries this: all maincategory_1 all subcategory_1.1 all subcategory_1.1.1 all subcategory_1.1.1.1 , all subcategory3 i have 2 approaches: store cat_id each object , merge result on multiple query. store category string of path , query on string field. this answer. i want know 1 better?? do know other approach better performance , simplicity?? it highly depends on relationship be

ios - Clicking on a link attribute in UITextView -

i have uitextview defined as: uitextview *textview = [[uitextview alloc] initwithframe:cgrectmake(0, 0, 100, 40); i have attributedtext so: textview.attributedtext = @"testing #tag"; when on screen, attributed text takes half (or so) width of text view. since made #tag clickable link , used function below, white space after #tag clickable. - (bool) textview:(uitextview *)textview shouldinteractwithurl:(nsurl *)url inrange:(nsrange)characterrange how stop white space being clickable?

java - How can i start the uiautomator in android code? -

i want start uiautomatortest program in android code. use: runtime.getruntime().exec("uiautomator runtest autorunner.jar -c com.runner.autorunner"); i error: java.lang.securityexception: not have android.permission.retrieve_window_content required call registeruitestautomationservice pid=7071, uid=10156 can tell me how solve problem? thanks as discussion seems, permission granted system apps , seems may have forgot add permission also, to add permission : add directly manifest <uses-permission android.permission.retrieve_window_content /> or inside service want operation done like <service android:name=".myaccessibilityservice" android:permission="android.permission.bind_accessibility_service"> <intent-filter> <action android:name="android.accessibilityservice.accessibilityservice" /> </intent-filter> . . . </service> have brief @ doc

javascript - Script for missing Time card in Service Now -

i need send notification every monday users located in particular location along supervisor if have missed filling time cards, or time card state pending. i have tested below script in background -script section , users don't have entry in time_card table week, simple find out. users have more 1 entry in pending state, more 1 notification go out them. need way group state 1 notification sent user per week time card still pending. var qry = 'active=true^location=7e294345ed9cf8c0b8536034d0f12dc7'; var tqry = 'week_starts_onrelativeee@dayofweek@ago@4'; var puneusr = new gliderecord('sys_user'); puneusr.addencodedquery(qry); puneusr.query(); gs.print("pune users: count" + puneusr.getrowcount()); while(puneusr.next()){ var timecard = new gliderecord('time_card'); timecard.addquery('user', puneusr.sys_id); timecard.addencodedquery(tqry); timecard.query(); if (timecard.getrowcount() == '0'){ gs.print(&

visual studio - How to stop multiple instances of my program(windows form) opening at the same time in vb.net -

my program windows form, when built in visual studio, gives .exe file form. , when .exe file clicked multiple times, creates multiple instances of same form. programming done in 1 class only. how solve this? when program open, how stop opening form again when .exe file clicked again?

php - Cannot create DOMdocument -

i cannot create new domdocument using: $dom = new domdocument; the output empty. not empty object domdocument object( ) , empty. should object like: domdocument object ( [doctype] => [implementation] => (object value omitted) [documentelement] => [actualencoding] => [encoding] => [xmlencoding] => [standalone] => 1 [xmlstandalone] => 1 [version] => 1.0 [xmlversion] => 1.0 [stricterrorchecking] => 1 [documenturi] => [config] => [formatoutput] => [validateonparse] => [resolveexternals] => [preservewhitespace] => 1 [recover] => [substituteentities] => [...] ) i'm using php version 5.6.7 , phpinfo() says: dom/xml: enabled dom/xml api version: 20031129 libxml version: 2.9.2` there other php code on server / in script, can php running normally. advice next steps should find cause? try this: <?php $do