Posts

Showing posts from January, 2014

arrays - Will you please help me in my migration to VB.NET from VB 6.0? -

this question has answer here: control array in vb.net 3 answers i read article control arrays of vb6 not present in vb.net , rather, became "collection" or something.... ( http://visualbasic.about.com/od/usingvbnet/l/bldykctrlarraya.htm ) now, i'm planning learn vb.net , accept whole new language. so, "few steps" me migrate, here code vb6: private sub command1_click() = 0 9 command2(i).caption = next end sub private sub command2_click(index integer) label1.caption = label1.caption + index end sub i wonder if program is? let's it's number pad program. i'll explain program does, @ least now... as can see, have 12... controls? (i'm sorry, i'm still little bit new in terms of programming)... yeh, 12 of them... 11 buttons , 1 label. 1 button, command1, give captions of other 10 buttons command2(in

File Sorting in Python -

i sort file in python based on numerical values: my input file looks this: 66135 - 65117 - b 63301 - c 63793 - d output should be: 63301 - c 63793 - d 65117 - b 66135 - how it? f2.writelines(sorted(f1, key=lambda line:int(line.split()[0]))) where f2 output file , f1 input file.

.htaccess - Setting up mod_rewrite in htaccess -

i need set rules: if url is: www.example.com/test1234 then: www.example.com/load.php?id=1234 if url is: www.example.com/proceed1234 then: www.example.com/activate.php?id=1234 my .htaccess following: rewriteengine on rewriterule ^test/([0-9]+)/?$ /load.php?id=$1 [l] rewriterule ^proceed/([0-9]+)/?$ /activate.php?with=$1 [l] and don't know why doesn't work. not @ regexpressions, please, me find right solution, please.

get unique entries from a complex list in r -

i have list of lists: $markers mi chr phys.pos group 19 mg001 8 4803507 1 20 mg002 8 4841939 1 3 mg003 8 5268581 2 1 mg004 8 5278404 2 6 mg005 8 8352013 3 7 mg006 8 8352443 3 9 mg008 8 8354875 3 10 mg009 8 8356039 4 11 mg010 8 8357610 4 13 mg012 8 8361049 5 14 mg013 8 8361845 5 15 mg014 8 1640281 6 16 mg015 8 1640663 7 $plants plant group 9 dl750 1 11 d827 1 17 dl26 1 25 d901 2 30 dr202 3 35 d356 3 52 f015 4 i list of entries unique in "group", , list of leftovers. results expected as: (a) unique list: $markers mi chr phys.pos group 19 mg001 8 4803507 1 3 mg003 8 5268581 2 6 mg005 8 8352013 3 10 mg009 8 83560

emacs - Disable screen jump when the cursor moves out of the screen -

i new emacs , using evil mode. when scroll j,k , move out of screen, emacs readjust current line under cursor middle of screen. where can disable feature? by adding following setting .emacs file (or similar user customization file -- e.g., init.el ), user can override default setting recenters point moves off screen: (setq scroll-conservatively 101) the doc-string scroll-conservatively , visible typing m-x describe-variable ret scroll-conservatively ret reads follows (at least in far developer snapshot of emacs trunk goes, is): "if value greater 100, redisplay never recenter point, scroll enough text bring point view, if move far away. value of 0 means recenter point if moves off screen."

parameters - Jenkins parameterized build changing default value -

Image
i using jenkins "extended choice parameter" plugin , want schedule build run periodically without human intervention. the parameter build selected drop down list. the drop down list parameter generated through external script , want pick top value default value. is there way select top element default value scheduled job? i read there ways run job remotely using url hoping can achieve making changes job configuration don't have manage separate script it. my jenkins instance running on linux , run job using build trigger --> build periodically section of jenkins job configuration. well, if want latest picked default scheduled job, have modify external script use populate drop-down menu. i'm not sure how you're populating list through external script know way have used , works fine me. use external script generate list , store list in file. in case, things little different . discuss further. first, select following options in extended c

c# - How to minimise OleDbDataAdapter time to fetch data from remote database -

my windows form application contains oledbdataadapter, consuming longer time fetch data remote db. not able retrieve/hold table data 5000 rows(application gets struck). here code. environments = configurationmanager.getsection("environment") namevaluecollection; string strconnstring = environments[envs]; conn = new oledbconnection(strconnstring); conn.open(); oledbdataadapter objda = new oledbdataadapter("select * tblabc", conn); dataset ds1 = new dataset(); objda.fill(ds1); datagridview1.datasource = ds1.tables[0]; environment section configured in app.config file : <configuration> <configsections> <section name ="environment" type="system.configuration.namevaluesectionhandler" /> </configsections> <environment> <add key ="cit" value ="password=pwd123;user id=abc123;data source=db1;persist security info=true;provider=msdaora"/> <add key ="sit" value

vb6 - How to use multiple inner joins for visual basic 6 -

i looking way use 2 inner joins can link 3 databases together. use : rs.open "select * school inner join name on school.id = name.id", db, 3, 3 i need add database called opdracht. after db linked want link ids together. in code above 3 ids. i hope can me this. the specific syntax depend on database / driver using add join statement. prefer building string , assigning string makes code easier read. ... dim strsql string strsql = "select * (school " & _ "inner join name on school.id = name.id) " & _ "inner join opdracht on opdracht.id = name.id" rs.open strsql, db, 3, 3 ...

How to redirect to specific port from DNS -

i've got teamspeak 3 server friend, problem we've got remember ip adress if want connect onto anywhere else home. so bought domain , wanted redirect teamspeak server though domain problem is: everytime want connect teamspeak have enter port (in case 8020) too, , cant enter port dns. is there way redirect teamspeak server without playing main server? i've seen things srv record got no idea how make work. thanks each response. there pretty nice help page on teamspeak's server achieve trying do. this page explains how works, , correct syntax use add srv record dns zone. according following page , default ports tcp 8765 , udp 8766, you'd need following 2 records: _ts3._udp.yourdomain.tld. 3600 in srv 0 5 8766 yourdomain.tld. _ts3._tcp.yourdomain.tld. 3600 in srv 0 5 8765 yourdomain.tld. you should modify ports if ts server not using defaults. also, have no ts instance test myself answer might inaccurate.

excel vba copy-paste a shape and saveas 1004 error -

i'm experiencing 1004 runtime error when saving workbook (wbk_new) on copy-pasted group of shapes workbook (wbk_old). should tell macro wbk_old assigned group. wbk_old.worksheets("dashboard").activate charttop = activesheet.shapes("group_vesselgraphics").top chartleft = activesheet.shapes("group_vesselgraphics").left activesheet.shapes("group_vesselgraphics").onaction = "" activesheet.shapes("group_vesselgraphics").copy wbk_new.worksheets("dashboard").activate activesheet.shapes("group_vesselgraphics").delete activesheet.paste activesheet.shapes("group_vesselgraphics").top = charttop activesheet.shapes("group_vesselgraphics").left = chartleft activesheet.shapes("group_vesselgraphics").onaction = "'" & activeworkbook.name & "'!updateshipgraph" wbk_old.close wbk_new.saveas path_old i can't figure out causing error...does have

javascript - sharing 1 ajax repsonse between controllers -

the big picture - tyring ajax call fire in 1 place , send controllers (there 8) , based on string answer set show/hide in of them. seems pretty simple having trouble working kinks out. able figuire out how shre json object between 2 controllers little bit different i'm thinking maybe i'm applying previous logic worked me in incorrect way. i set factory share between controllers so .factory('statuscheck', ['$http', function ($http) { var currentid = self.location.search; if(currentid[0] === "?"){ currentid = currentid.slice(1); } var stats = $http({ method: "get", url: "/getlessondetails/" + currentid }) .success(function(data, status, headers, config){ return data.status; }); return stats; }]) all trying here have ajax call (you can ignore currentid part) , return data.status. in each controller inject statuscheck , use it. once have statuscheck coming right string value (the data

Android Location Manager cant fetch the location ? -

using sort of code location of current gps positon ... public double[] showcurrentlocation() { double[] gps = new double[2];; try { location location = locationmanager .getlastknownlocation(getbestprovider()); if (location != null) { gps[0] = (location.getlatitude()); gps[1] = (location.getlongitude()); log.d("-------------- >>> latitude", "--"+gps[0]); log.d("-------------- >>> longitude", "--"+gps[1]); } } catch (exception e) { toast.maketext(context, "enable location", toast.length_long) .show(); } log.d("-------------- >>> latitude", "--"+gps[0]); log.d("-------------- >>> longitude", "--"+gps[1]); return gps; } public string getbestprovider() { locationmanager = (locationmanager) context .g

node.js - GitHub Webhook Secret Never Validates -

i'm using github webhook pipe events application of mine (an instance of github's hubot) , secured sha1 secret. i'm using following code validate hashes on incoming webhooks crypto = require('crypto') signature = "sha1=" + crypto.createhmac('sha1', process.env.hubot_github_secret).update( new buffer request.body ).digest('hex') unless request.headers['x-hub-signature'] signature response.send "signature not valid" return the x-hub-signature header passed through in webhook looks this x-hub-signature: sha1=1cffc5d4c77a3f696ecd9c19dbc2575d22ffebd4 i passing in key , data accurately per github's documentation, hash ends different. here github's documentation. https://developer.github.com/v3/repos/hooks/#example and section misinterpreting secret: optional string that’s passed http requests x-hub-signature header. value of header computed hmac hex digest of body, using secret key. c

powershell - How do I correctly serialize a PSObject with a DateTime into JSON? -

lets have psobject integer , date want serialize json , have recipients able deserialize it. in javascript following json: json.stringify({date: new date(), number: 23}) "{"date":"2014-09-10t14:11:27.092z","number":23}" json.parse(json.stringify({date: new date(), number: 23})) >> object {date: "2014-09-10t14:13:28.950z", number: 23} that looks pretty standard json can interpreted correctly javascript. however, appears powershell's convertto-json inconsistent datetime serialization can't convert , forth correctly. illustrate this: ps c:\dev> $testobj = new-object -typename psobject -property @{ date = get-date; number = 23; } ps c:\dev> $testobj number date ------ ---- 23 9/10/2014 9:52:14 ps c:\dev\git\strawman> $testobj | convertto-json { "number": 23, "date": { "value": "\/date(1410357134361)\/", "d

How to consume rpc-encoded SOAP Web Service with Java -

is there way consume soap web service java using: the soapaction required (for example methodname called "find") the url of web service header authentication (username , password) in end output results i have example request xml file consuming php can't find proper way on java. [update: web service's wsdl style rpc/encoded] [update #2: can find how solved problem below (by using java stubs generated ides)] you can use java.net.httpurlconnection send soap messages. e.g.: public static void main(string[] args) throws exception { string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" + "<soap:envelope xmlns:xsi=\"http://www.w3.org/2001/xmlschema-instance\" xmlns:xsd=\"http://www.w3.org/2001/xmlschema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n" + " <soap:body>\r\n" + " &

reshape - Reshaping from wide to long in R -

i trying learn r , have question on reshaping following dataset. bankname,date,year,month,quarter,totalliabilities,corr1,amt1,corr2,amt2 bank of pittsgurgh,2/7/1950,1950,2,1,237991,#n/a,#n/a,#n/a,#n/a bank of pittsgurgh,5/2/1950,1950,5,2,258865,#n/a,#n/a,#n/a,#n/a bank of pittsgurgh,8/7/1950,1950,8,3,218524,#n/a,#n/a,#n/a,#n/a,#n/a bank of pittsgurgh,11/6/1950,1950,11,4,237520,first bank,17472,third bank,30711 arsenal bank,2/2/1950,1950,2,1,218508,#n/a,#n/a,#n/a,#n/a arsenal bank,5/3/1950,1950,5,2,224110,#n/a,#n/a,#n/a,#n/a arsenal bank,8/2/1950,1950,8,3,216071,#n/a,#n/a,#n/a,#n/a arsenal bank,11/1/1950,1950,11,4,226166,national bank,20966,trust company,873 when run following code reshape, following error. how can fix this? also, destring amt variable numeric variables , remove #na in dataset. how can destring variable? -first tried create "id" bank_test2$id<-as.numeric(as.factor(bank_test2$bankname)) -then tried create unique time variable using year , qua

powershell - Adding AD users as an Admin -

here's situation. i'm new powershell use small words... i have new user in active directory need add 100 computers efficiently possible. hope make powershell script add user either through login script or remotely. need have bit of precision control on deployment because don't want push user every computer in company. can powershell me this, , if not have sage advice help? to add user local administrators group using powershell: ([adsi]"winnt://./administrators,group").add("winnt://your-domain/new-user,user") just replace your-domain , new-user parts of command appropriate values environment.

java - Problems with jCifs authentication on oracle RDMS embedded jvm -

i'm using jcifs 1.3.17 connect , list files on remote windows share. works fine on local jre(5,6,7), same code executed on oracle 11g database (11.2.0.3.0) crashes following stack: jcifs.smb.smbauthexception: logon failure: unknown user name or bad password. @ jcifs.smb.smbtransport.checkstatus(smbtransport.java:546) @ jcifs.smb.smbtransport.send(smbtransport.java) @ jcifs.smb.smbsession.sessionsetup(smbsession.java) @ jcifs.smb.smbsession.send(smbsession.java:218) @ jcifs.smb.smbtree.treeconnect(smbtree.java:176) @ jcifs.smb.smbfile.doconnect(smbfile.java:911) @ jcifs.smb.smbfile.connect(smbfile.java:954) @ jcifs.smb.smbfile.connect0(smbfile.java:880) @ jcifs.smb.smbfile.exists(smbfile.java) @ pl.openlife.cifsconnect.listcifsfiles(cifsconnect.java:49) i found out, user password lenght might cause problem: 1. windows env jdk1.5.0_22 -> works long passwords 2. oracle linux, rdms embeded jvm -> works short passwo

c++ - Will the destructor of an object be called if a function returns early or throws an exception? -

in following code, use wrapper object temporarily store stuff db in memory. question simple: can sure destructor called? particularly worried cases a) testcondition true , function returns inner scope of scope in tempobj constructed b) runtime error occurs during execution of function (which caught @ higher level) (as side question: way temporarily store data? in application, somefunc() save/export function of current db.) class tempstore { public: tempstore() {/* delete stuff db , store in memory*/} ~tempstore() {/* write stuff db*/} }; void somefunc(bool testcondition) { tempstore tempobj = tempstore(); // code if (testcondition) return; //early return // more code } the destructor of automatic object called when program leaves object's scope. includes returning function (early or otherwise), , leaving via exception - long exception handled. in case of exception, it's called during stack unwinding before exception handl

Automated Warning message appended to the email in rails -

i testing rails action mailer application send emails mail id. mail being delivered inbox, but, following warning message being automatically appended @ end of email. warning : message originates internet can please guide me if setting needs done in action mailer remove message? thanks in advance.

android - Slow down animation in AndroidSlidingUpPanel -

i trying use androidslidinguppanel library. want change slowing down animation when click view dragview. default expands or collapse dragview fast. can slow down? there way make fast , slow readched end? reference library link: https://github.com/umano/androidslidinguppanel following xml layout. <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".demoactivity" > <com.sothree.slidinguppanel.slidinguppanellayout xmlns:sothree="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="bottom" sothree:panelheight="68dp" sothre

ember.js - EmberJS: The right way to use a page multiple times -

i've got product index page need use multiple times: # products product-index -> product # categorized products category -> subcategory -> product-index -> product # persons products profile -> product-index -> product as can see product-index , product routes nested in multiple situations. in cases each view fullscreen page , pages user can navigate until root page. my idea configure router this: // router.js this.resource( "products", function() { this.route( "product", { path: "/:product_id" } ); } ); this.resource( "categories", function() { this.route( "category", { path: "/:category_id" }, function(){ this.resource( "products", function() { this.route( "product", { path: "/:product_id" } ); } ); } ); } ); this.route( "profile", function() { this.resource( "products", function() { this.route( "product

php - Craft calculator loop -

i'm trying craft calculator game. i have database looks : crafts : id item_id item_name amount 3 1895 5 8 2486 c 1 craft_materials : id craft_id item_id item_name amount 1 3 2486 c 15 2 3 5302 d 23 3 3 5698 e 2 4 8 2014 f 3 and here query retrieve data : $craftproduct = $db->query("select * crafts item_id=$item"); $craftproduct->setfetchmode(pdo::fetch_obj); $product = $craftproduct->fetch(); $craftid = $product->id; $craftmaterial = $db->query("select * craft_materials craft_id=$craftid"); $craftmaterial->setfetchmode(pdo::fetch_obj); echo '<ul>'; echo '<li>'.$product->item_name.' ('.$product->amount.')</li>'; echo '<ul>'; while($material = $craftmat

PHP cURL function -

we have develop curl function on our application. curl function map data on 1 site our form-field in our application. however, function has been working fine while , ready use more 2 months. yesterday, fucntion broken down. data website no longer able map over. trying find out why problem is. when troubleshooting, shows there response timeout issue. to re-ensure there nothing wrong on our coding , our server performance working, have duplicates instance server , try out function. working perfectly. wondering if 1 out there facing such problem? what possibility cause issue? when using curl, site owner know calling data map ours server application? if so, there way can overcome this? could owner block our server ip address? tht's why function works on server not in original server? appreciate on this. thank you, your problem description far generic determine specific cause. there specific block in place. for example firewall rule on other end, or on end,

ios - SMS intercept on iPhone without jailbreak -

some know if there way intercept incoming sms on iphone device, out jailbreak?? so, if posible, when send app appstore, there way explain , demonstrate apple application access sms purpose, out compromise user security?? any advice useful me. regards. it not possible. you might want browse coretelephony related things exposed. might imagine, it's pretty small framework.

OpenGL line thickness -

i have drawn helix gl_line_strip . i'm wondering if possible make line thicker somehow. google searches made me realize 2 choices. can make triangles make quad... or somehow use gllinewitdh ? want simplest way it, supports next im going do. color specific line segments. using opengl es 2.0 gllinewidth() easier if meets needs. there's 1 big caveat in es 2.0, though: maximum width supported specific device can low 1.0. means devices can es 2.0 compliant without supporting wide lines @ all. you can range of supported line widths with: glfloat linewidthrange[2]; glgetfloatv(gl_aliased_line_width_range, linewidthrange); linewidthrange[1] maximum supported line width. based on table 6.18 of spec, minimum allowed value limit 1. based on this, drawing geometry (triangles) give actual width lines approach guaranteed work across devices.

Get SQL Replication PowerShell script to email output -

i utilizing following script output replication status between sql servers in out environment. script works great , gives me need in powershell console, need email results script specific dl. i've tried few methods can't seem output/format properly. ##cross-server replication monitor ## script referenced http://www.madeirasql.com/cross-server-replication-health-check-using- powershell/ ##if not loaded, please load sqlserver snapins powershell running following cmdlets: [system.reflection.assembly]::loadwithpartialname("microsoft.sqlserver.smo") [system.reflection.assembly]::loadwithpartialname("microsoft.sqlserver.smoextended") add-pssnapin sqlservercmdletsnapin100 add-pssnapin sqlserverprovidersnapin100 ##if script execution disabled please run following cmdlet: ##set-executionpolicy remotesigned ## beginning of monitor ## path server listfile: edit path , list target servers in file line breaks, named instances use typical "serve

rjson - how do you create a custom json output from an R function with dataframe and column names as arguments -

i need create , r function take data frame , column names arguments (there should @ least 2 column names in argument list , maybe more). given data frame, need create json formatted output based given column names. example, this df: structure(list(datetime = structure(1:8, .label = c("8/24/2014 15:20", "8/24/2014 15:55", "8/24/2014 16:04", "8/24/2014 16:18", "8/24/2014 16:27", "8/24/2014 16:42", "8/24/2014 16:56", "8/24/2014 17:10"), class = "factor"), server1 = c(6.09, 4.54, 5.03, 4.93, 6.27, 4.59, 5.91, 4.53 ), server2 = c(5.7, 4.38, 4.52, 4.61, 4.18, 4.61, 4.37, 4.3 ), server3 = c(5.21, 5.33, 4.92, 5.56, 5.62, 6.73, 4.76, 4.59)), .names = c("datetime", "server1", "server2", "server3" ), class = "data.frame", row.names = c(na, -8l)) i need function return output: [{"name":"server1","data&qu

Unwanted decimal in Python -

this question has answer here: formatting floats in python without superfluous zeros 13 answers i have written code add values in tuple , calculate average: def average(values): return sum(values[0:]) / len(values[0:]) however, unwanted floating point, 2.0 instead of 2. how eliminate this, still manage correct average should average not integer? you may try this: if (yournumber).is_integer(): print int(n) else print (n)

c# - Joining PIVOT table with data from two other tables with ACCESS -

i'm having trouble joining pivot table data 2 other tables. pivot table works fine when join it says 'syntax error in clause' select r.resourcename 'employee name', p.projectnumber 'project number', p.projectsystem 'project system', p.projectmanager 'project manager', a.projectname 'project name' projects p left join (transform sum(a.allocationvalue) select r.resourcename, a.projectname resources r group a.resourcename, a.projectname pivot a.allocationmonth in ('june, 2014', 'july, 2014', 'august, 2014') q on p.resourcename = q.resourcename p.projectname = a.projectname order r.resourcename, a.projectname any appreciated, thanks! i don't think can have combination of implicit , explicit joins, , aliasing both table projects p , , subquery p . instead of from projects p, resources r , implicit join, should make explicit join from pr

git - What's a good way to diff a folder into a Subversion working copy -

i have working copy external company using subversion server. locally have git repository same project since @ company use git everything. want bring changes git repository on subversion server on regular basis preferably in automated fashion. i've tried using 2 different merge tools purpose kdiff3 ( http://kdiff3.sourceforge.net/ ) , kaleidoscope ( http://www.kaleidoscopeapp.com/ ) in both cases when copying files git folder subversion working copy .svn folder gets deleted not want puts subversion working copy in "obstructed" state. can archive of git repo , copy archived folder subversion working copy when doing file deletions on git repo paste subversion working copy won't delete missing files sort of gets me want. suggestions on perhaps approach haven't considered? use single point of change (git's working dir) , link git-repo subversion, using git-svn (or subgit )

Pointer to Array of 10 NodeLists? OR Array that contains Pointers to 10 NodeLists Objects -

struct nodelist * headnodeptrlist; headnodeptrlist= new nodelist[10]; is above pointer array of 10 nodelists objects? or array contains 10 pointers 10 nodelists objects headnodeptrlist[list].headoflist=newnode; when try above works, if headnodeptrlist[list] -> headoflist=newnode; base operand of ‘->’ has non-pointer type ‘nodelist’. understand saying thought top 2 lines created array of 10 nodelist pointers struct nodelist * headnodeptrlist; headnodeptrlist = new nodelist[10]; is above pointer array of 10 nodelists objects? or array contains 10 pointers 10 nodelists objects it none of them. headnodeptrlist a pointer location have reserved 10 * sizeof(nodelist) bytes of memory. when accessing single element array, compiler takes base address of pointer headnodeptrlist , adds x times sizeof(nodelist) no address. here mean: headnodeptrlist[4].int_member = 1234; is same as: *(headnodeptrlist + 4 * sizeof(nodelist)).int_member = 123

java - Using same table twice in JPA Criteria -

i have sql query: select lf.load_factor, ls.load_incidences, avg(lsa.accumulated_load_incidences) load_factor lf inner join load_spectrum ls on (lf.load_factor_id = ls.load_factor_id) inner join load_spectrum_aircraft_history lsa on (lf.load_factor_id = lsa.load_factor_id) inner join flight f on (lsa.flight_id = f.flight_id) inner join aircraft on (f.aircraft_id = a.aircraft_id) a.aircraft_id = x group (lf.load_factor_id) having count(lf.load_factor_id) > 1; on clause "x" variable. so, x can assume number. i tried same query using jpa criteria. so wrote code: // criteria builder criteriabuilder cb = entitymanager.getcriteriabuilder(); criteriaquery<object[]> query = cb.createquery(object[].class); // root root<loadspectrumaircrafthistory> loadspectrumaircraftroot = query.from(loadspectrumaircrafthistory.class); root<loadspectrum> loadspectrumroot = query.from(loadspectrum.class); // join declarations join<loadspectr

r - Place on.exit() within function but active for the script -

in r, let's want place on.exit() command within function, want on.exit command apply when rscript exits opposed when function exits. how go it? to rephrase have on.exit() within function, on.exit() command applies local scope within function. possible on.exit() command apply global scope while still within function.

c - What is wrong with my string generating program? -

i have program takes 7 arguments. first argument ignored. main function fcfsa takes 8 arguments : s1, s2, x1, y1, z1, x2, y2, z2. s1 , s2 char pointer variables , x1..z2 last 6 integer arguments in argv in consecutive order. fcfsa should this: first string, s1, consist of x1 r's, followed y1 w's, followed z1 r's. second string, s2, consist of x1 r's, followed x2 r's, followed y2 w's, followed z2 r's. but not getting correct output when executing program ./main 0 4 2 7 3 6 5 again first argument 0 ignored now. this output: inputs: 0 4 2 7 3 6 5 maxsize=27 part 1 rrrrwwrrrrrrrrrrrr+y? rrrrrrrwwwwww 0 4 2.0 0.86364 and main.c: #include <stdio.h> #include <stdlib.h> #include <string.h> #include "pslibrary.h" void part0(char *s1, char *s2); void display(char *heading, char *s1, char *s2); void fcfsa(char *s1, char *s2, int x1, int y1, int z1, int x2, int y2, int z2); int main(int argc, char **argv) { int i;

Barcode Scan with Python -

what want capture barcode of products webcam or usb barcode reader don't have clue begin with. in case, user scan barcode , based on barcode happen, browser display picture of product. i have heard zbar, looked @ information on youtube , other places found built products in use. could me on it? i haven't played much, zbar seems work ok, long barcodes (including qr codes) of reasonable quality. iirc, got zbar-tools , python-zbar debian repos. the zbar python documentation pretty minimal, there 2 example programs @ sourcearchive , 1 scanning barcodes /dev/video (i.e. video4linux device) , 1 scanning image file; image file read using imagemagick library, can handle wide range of image file formats. i don't have scanner, webcam, etc, i've tested zbar image files. tries find & decode in image looks barcode, , doesn't mind if barcodes aren't aligned nicely or little bit noisy.

scala - SPARK_EXECUTOR_INSTANCES not working in SPARK SHELL, YARN CLIENT MODE -

i new on spark. trying run spark on yarn in yarn-client mode . spark version = 1.0.2 hadoop version = 2.2.0 cluster of yarn has 3 live nodes. properties set in spark-env.sh spark_executor_memory=1g spark_executor_instances=3 spark_executor_cores=1 spark_driver_memory=2g command used : /bin/spark-shell --master yarn-client but after logging spark-shell , registers 1 executor default mem assign it. i confirmed via spark-web ui has 1 executor , on master node ( yarn resource manager node ) only. info yarn.client: command starting spark applicationmaster: list($java_home/bin/java, -server, -xmx2048m, -djava.io.tmpdir=$pwd/tmp, -dspark.tachyonstore.foldername=\"spark-fc6383cc-0904-4af9-8abd-3b66b3f0f461\", -dspark.yarn.secondary.jars=\"\", -dspark.home=\"/home/impadmin/spark-1.0.2-bin-hadoop2\", -dspark.repl.class.uri=\" http://master_node:46823 \", -dspark.driver.host=\"master_no

Excel VBA, Invalid Qualifier, Array.Rank -

in below code, nx = xmat.rank returns error "invalid qualifier." why? i'm using excel 2010's built-in vba editor: public function polyreg(byref x() double, byref y() double) double() ' ============================= dim nx, ny, i, j integer dim xmat() double nx = ubound(x) ny = ubound(y) redim xmat(1 nx, 1 order) ' ============================= = 1 order j = 1 nx xmat(j, i) = 1 next j next ' ============================= nx = xmat.rank ' ============================= polyreg = y ' ============================= end function i looked @ few related posts failed address concern: invalid qualifier string.add in outlook vba https://stackoverflow.com/questions/7889653/invalid-qualifier-error-in-vba invalid or unqualified reference i have not found answer question in excel's vba documentation. i'm not vb expert. if answer below incorrect, please notify me: visual basic <> vi

serialization - Android LinkedHashMap deserializing as HashMap, causes CCE error -

i'm attempting pass serialized linkedhashmap between activities, , getting confusing result/error when deserialize object. i serialize object follows: bundle exdetails = new bundle(); linkedhashmap<string, exercise> exmap = new linkedhashmap<string, exercise (workout.getexercises()); exdetails.putstring(workoutname, workout.getworkoutname()); exdetails.putserializable(workout.getworkoutname(), exmap); icomplete.putextra("wname", exdetails); startactivity(icomplete); that seems work fine, problem shows in next activity: bundle exdetails = getintent().getbundleextra("wname"); workoutname = exdetails.getstring(workoutname); serializable edata = exdetails.getserializable(workoutname); ex = new linkedhashmap<string, exercise>(); ex = (linkedhashmap<string, exercise>) edata; at point, deserialized object (edata) contains hashmap object (not linkedhashmap), , gives me java.lang.cl

asp.net web api - 404 NotFound with HttpClient -

i using httpclient class (from namespace system.net.http) post data asp.net web api action in windows form application. problem keep receiving status code 404 not found (endpoint not found). missing something? please help. thank in advance. the following c# code uses httpclient make post request xml web api: private async task postcustomform() { using (var client = new system.net.http.httpclient()) { nlog.logger logger = nlog.logmanager.getcurrentclasslogger(); try { customformlog customformlog = new customformlog(); customformlog.deviceid = 1234; customformlog.userexperienceid = 33442036854775807; customformlog.networkitemid = 58595555; client.baseaddress = new uri("http://xyzwebserver/"); client.defaultrequestheaders.accept.clear(); client.d

javascript - Clicking on the cross to remove an option in multi-select box of Angular-UI-Select redirects to app home -

i have angularjs app multiple routes. on 1 of pages, i'm using angular-ui-select. clicking on cross button remove option in multi-select box of angular-ui-select redirects home of app, instead of removing option. i think reason issue url has # @ app home, , cross button linking # causing browser redirect home. i have looked @ demo , work fine doesn't have existing # in url. there workaround work correctly? this should fixed commit

scipy - In Python, how can I export a 3D isosurface into Blender -

Image
i have 3d (x,y,z,value) data in python , can visualize isosurfaces in mayavi. how can export isosurface file can read blender? here example code: import numpy mayavi import mlab x, y, z = numpy.ogrid[-5:5:64j, -5:5:64j, -5:5:64j] values = x * x * 0.5 + y * y + z * z * 2.0 mlab.contour3d(values, contours=[.5]) mlab.show() using @timday's suggestion, added following code save isosurface in wavefront (.obj) format: mlab.savefig('surface.obj') then, can open in blender file>>import>>wavefront (.obj) i had scale down image considerably (~100x) make visible in blender viewport. the origin set way off side of actual object, object easier deal if use object>>transform>>origin geometry after adding lighting , plane, object looks pretty good!

google maps - Integrate GoogleMaps with Mapbox iOS sdk -

i'm using mapbox ipad app , want use various image sources map imagery. is there way google map tiles , show them in mapbox? we construct url's tiles directly google block if this, because wouldn't using official api. is there other option solve problem? it technically possible, google's terms of service don't allow display of tiles outside of own software frameworks.

android - Receive touch event on any screen -

i'm trying make custom navigation button , have disabled default navigation buttons provided android rooting device. want custom navigation buttons disappear after interval of time (say 5 seconds). have managed so. want make such whenever touch anywhere on screen, can detect touch event , show navigation bar. whether i'm on homescreen or application, can receive touch event. there way or need go android source code? thank you oncreate of service: used windowmanager.layoutparams.flag_watch_outside_touch flag. @override public void oncreate() { super.oncreate(); toast.maketext(getbasecontext(),"oncreate", toast.length_long).show(); mview = new hudview(this); windowmanager.layoutparams params = new windowmanager.layoutparams( windowmanager.layoutparams.type_system_overlay, windowmanager.layoutparams.flag_watch_outside_touch, pixelformat.translucent); params.gravit

c# - ASP.NET MVC 4 Custom Role Authorization show/hide Edit/Delete links in Views -

i want show/hide edit/delete links (including menu items) depending on user's authorization. have implemented authorizeattribute , have custom logic roles checking in overriden authorizecore. use logic when checking whether user has permissions view edit/delete links inside linkextensions method. setup: public class authorizeactivity : authorizeattribute { public override void onauthorization(authorizationcontext filtercontext) { base.onauthorization(filtercontext); } protected override bool authorizecore(system.web.httpcontextbase httpcontext) { bool isauthorized = base.authorizecore(httpcontext); string actiontype = httpcontext.request.httpmethod; string controller = httpcontext.request.requestcontext.routedata.values["controller"].tostring(); string action = httpcontext.request.requestcontext.routedata.values["action"].tostring(); //admins if (controller == "admin")

linux - Logrotate every 30th second and store logfiles in date-named directories -

i've got centos installation busy webserver. need aquire stats log files , keep old ones, ordered date. every 30th second, current logfile should closed , processed (analysing entries , storing them database). since generates lot of logfiles, want group them directories, named date. at moment, have 2 files; rotation.conf , rotatenow.sh. shell-file creates directories, based on ymdhms. after that, run command "logrotate ./rotation.conf -v --force" in order invoke proces, how make config-file put log newly generated directory? can whole thing done inside config-file? now="$(date)" now="$(date +'%y-%m-%d-%h:%m:%s')" foldernavn="/var/www/html/stats/logs/nmdstats/closed/$now" mkdir $foldernavn logrotate ./nmdhosting.conf -v --force at moment, config-file looks this: /var/www/html/stats/logs/nmdhosting/access_log { ifempty missingok (i stuck) (do post-processing - run perl-script) } any ideas appreciated. u