Posts

Showing posts from January, 2012

android - Insert compound object into ContentValues -

i want insert object contentvalues. structure of object that: public class { string x; string y; object b; } you cannot put arbitrary objects contentvalues . see documentation can put in contentvalues . option see if can convert object , byte array.

javascript - How to toggle style in animation using jQuery? -

how can add opacity: 0.5 li when it's clicked , toggle opacity opacity:1 when clicked again animation? $('li').on('click', function () { $(this).animate({ opacity: 0.5 }, 500, function () { $(this).toggleclass('completed'); }); }); is there simple solution toggling between classes or need add logic check current opacity , change accordingly? don't want change markup or css through jquery. we can use math :) $('li').on('click', function () { $(this).animate({ opacity: (0.5 / $(this).css("opacity")) }, 500, function () { $(this).toggleclass('completed'); }); });

javascript - Kendo template add space where code is -

Image
so using bit of code create template kendo dropdown list <script id="itemtemplate" type="text/x-kendo-template"> #if(text.indexof('(deleted)') > -1){# <span style="display:none"></span> #}else{# <span>#:text#</span> #}# </script> the problem here line of code being interpreted white space. mean white space being added. when bind function select event , try text of selected item function typechanged(e) { console.log(e.item.text()); } $("#...").data("kendodropdownlist").bind("select", typechanged); what console.log return text 2 empty lines above , 2 below. please refer picture. want know there way strip empty line beside calling trim function? additional info when added more line of code in the template added line <script id="itemtemplate" type="text/x-kendo-template"> #if(text.indexof('(delet...

javascript - gulp-load-plugins.sourcemaps.init() TypeError: Cannot read property 'init' of undefined -

i'm trying adapt gulp file purposes , i'm running issues. care 1 task: gulp.task('js:browser', function () { return mergestream.apply(null, object.keys(jsbundles).map(function(key) { return bundle(jsbundles[key], key); }) ); }); it using browserify condense bundle usable single file. uses these 2 methods , object: function createbundle(src) { //if source not array, make 1 if (!src.push) { src = [src]; } var customopts = { entries: src, debug: true }; var opts = assign({}, watchify.args, customopts); var b = watchify(browserify(opts)); b.transform(babelify.configure({ stage: 1 })); b.transform(hbsfy); b.on('log', plugins.util.log); return b; } function bundle(b, outputpath) { var splitpath = outputpath.split('/'); var outputfile = splitpath[splitpath.length - 1]; var outputdir = splitpath.slice(0, -1).join('/'); console.log(outputfile); ...

ios - Xcode 7.3. Your account already has has a valid destribution certificate and than an App Id is not available -

after update xcode 7.3 getting errors while trying submit app on beta testing via testflight. strange because have managed submit more ten build same app id. i making archive , tap on upload app store result getting , error: "you account has valid ios distribution certificate. have valid ios distribution certificate in member center, not installed locally. if signing identity installed on mac, can export developer profile on mac , import on mac. can reset current certificate." if tap cancel on warning message, new one: "xcode attempted locate or generate matching signing assets , failed because of following issues. app id identifier 'com.abc.defg' not available. please enter different string". i have same thing. where different ways solve problem : 1.to install certificate again member center mac. 2.to install 1 new certificate , news parameters(app_id, , others) application. i didn't find why it's happening now, if can y...

parallel processing - PowerShell: How to write to a file from multiple jobs? -

okay, here's pseudo-code of i'm trying do: function dothings() { $onejob = { ### things... # want capture stdout *and* stderr of these 3 commands a_command >> "logfile.log" 2>&1 b_command >> "logfile.log" 2>&1 c_command >> "logfile.log" 2>&1 } $params = @{ } ($i=1; $i -lt 100; $i++) { ### manipulate $params here start-job $onejob -argumentlist $params } } however, naively running above resulted in several jobs ending errors, because apparently "logfile.log" being opened job running @ same time. so, how ensure jobs not step on each other's shoes when writing "logfile.log" file?

c# - 'Memory stream is not expandable' but size of array is the same? -

i trying multithread aes in c# can't seem fix weird exception. buffer sizes same still says can't expand maybe can see error file of size 101 bytes. in while loop skip if , go inside else creating (one thread?) writes not encrypted buffer encrypted buffer. after done synchronize want write encrypted buffer file in runworkercomplete function. issue presents when try write not encrypted buffer encrypted buffer. error message puzzles me since size of second buffer created length of first buffer yet says can't expand memory!? static list<backgroundworker> threadcompany = new list<backgroundworker>(); static list<backgroundworker> listworkers = new list<backgroundworker>(); static list<backgroundworker> listfreeworkers = new list<backgroundworker>(); static filestream fsin; static string file; static byte[] key; const int block_size = 1000; static filestream outfile; public static void encryptfile(string inputfile, string outputfile, ...

Undo an undesired merge in SVN -

we have repository running svn. @ moment, add feature (lets call 'branch'), created development branch main trunk (let's call 'trunk'). we kept doing our work , commiting branch, occasionally, merged changes made in trunk branch keep branch date trunk. at point, revisions 75051 77691 trunk merged branch, , commits kept going on branch, commiting new code in branch. but want branch date trunk revision 77089, is, want undo changes in branch due merge did, changes due rev77089-77691, without affecting work done in branch. suggestions revert or undo changes in branch due rev77089-77691 in trunk? thank much. you can undo change use reverse range in svn merge command: $ svn revert -r . #remove changes made $ svn update #and make sure date $ svn merge -r77691:77088 . this rid of changes 77089 77691 working directory. or can undo merge 1 revision @ time: $ svn merge -c -77691 . $ svn merge -c -77690 . $ svn merge -c -77689 .

c - clock_gettime always shows 0 -

i want measure wall clock time clock_gettime every time run code, shows 0. why that? ( i want result in miliseconds. ) #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <time.h> int main( int argc, char **argv ) { struct timespec start, stop; unsigned long accum; if( clock_gettime( clock_realtime, &start) == -1 ) { perror( "clock gettime" ); exit( exit_failure ); } int i; for(i=0; i<100000000; i++){int = 3; int b = 100; int c = a*b;} //system( argv[1] ); if( clock_gettime( clock_realtime, &stop) == -1 ) { perror( "clock gettime" ); exit( exit_failure ); } accum = (unsigned long)( (stop.tv_sec - start.tv_sec) * 1000) + (unsigned long)( (stop.tv_nsec - start.tv_nsec) / 1000000 ) +0.5; printf( "%lu\n", accum ); return( exit_success ); } because compiler optimizes away loop. inside loop can't simplified (by...

c# - Have you used Google's Directory API? -

i'm trying use google directory api library .net maintain email addresses domain. latest library google-admin-directory_v1-rev6-csharp-1.4.0-beta. best , farthest i've gotten far receive 403 error (not authorized access resource/api). has out there used it? if so, share code, tips, or tricks? i have used , got success in creating console-application. @ moment i'm trying find way skip copy/paste of authorization code. don't forget turn on api access in apis console. i'll show small sample: using system; using system.diagnostics; using system.linq; using system.threading.tasks; using system.security.cryptography; using system.security.cryptography.x509certificates; using dotnetopenauth.oauth2; using google.apis.authentication.oauth2; using google.apis.authentication.oauth2.dotnetopenauth; using google.apis.samples.helper; using google.apis.services; using google.apis.util; using google.apis.admin.directory_v1; using google.apis.admin.directory_v1.da...

swift - Changing User's Header Orientation -

is there way can change user's heading orientation? if using corelocation , apple mapkit manager.headingorientation = cldeviceorientation.landscapeleft seems can't invert heading. the mapbox ios sdk handles device rotation heading orientation automatically . can access heading via mglmapview.userlocation.heading , when it’s available. if need process raw heading differently or need available when heading tracking mode disabled, should instantiate own location manager. if we’re doing incorrectly heading, we’d love hear on github .

javascript - Node JS losing for loop index variable -

this question has answer here: javascript closure inside loops – simple practical example 32 answers when use simple loop access array values, index variable gets lost therefore unable access array. using index number instead of variable works not variable. annoying code ever. /* jshint esnext: true, asi: true */ var neo4j = require('node-neo4j') // create neo4j object var db = new neo4j(serveruri) exports.addperson = (body, callback) => { if (body.skills) { var sentskills = body.skills var arrayskills = sentskills.split(',') }else { var sentskills = [] } const sentname = body.name const sentemail = body.email const sentusername = body.username const sentpassword = body.password const lecturerstatus = body.lecturer db.readnodeswithlabelsandproperties('person',{ email: sentemail }, function (err, node) { if (err) { ...

grails - Reusing json/model object to avoid making extra calls to controller -

i've got groovy usercontroller , _listmyusers.gsp. _listmyusers.gsp using <g:dojoremoteform formname="usersearchform" id="usersearchform" url="[controller:'user',action:'search']" update="[success:'content']"> the method in usercontroller (search) simple criteria builder returns following gsp, can use controls in gsp customize search criteria parameters (passed controller param.field_name): render (template:"listusers", model:[ users:users, usertypes:usertypelookup.list(), sortby:params.sortby, direction:nextdirection, currentdirection:sortdirection, pager:pager, organizations:orgs, usertype:usersearchtypes ]) now works great , model used build out userslist...

python - How to remove .exe file created by Pyinstaller -

first time posting question here. used pyinstaller 3.1 create executable file of .py file. how remove executable file? manually delete build folder, dist folder , .spec file located in c:\python35\scripts? is there proper way? thanks answering!

Virtualbox port forwarding with docker -

i'm running virtualbox locally , i've used port forwarding this 0.0.0.0:7000 -> 0.0.0.0:7000 so can do curl http://localhost:7000 from host vm , able communicate application running in vm , listening port 7000 . is possible make reverse? want set port forward able to curl http://localhost:6000 from vm , able communicate app runs on host , listens on port 6000 . i'm using nat . i know bridged network , using network ip of host. can't use those. i'm interested in above. exclaimer: the reason of limitations above because i'm using dinghy docker , docker-machine . if change network else nat setup break. can't use else localhost since these defaults apps have , need them communicate if running both on host. possible options: setup ssh tunnel ssh -r, see https://unix.stackexchange.com/questions/46235/how-does-reverse-ssh-tunneling-work setup nginx or apache reverse proxy on vm forward traffic host. force vm think loc...

php - Google Drive API: copy file with service account -

edit: when copying files service account created via api, copy goes through, error persists , file id in error corresponds copy. when copying file service account not own (but has edit access to), copy not occur , file id in error original file. the service account not seem have visibility outside of files created via api, , not have visibility copies of files. =-=-=-=-=-=-=-=-=-=-=-=-=- i getting same error question: google drive api copy() - 404 error except setup little different. creating files works fine. i trying create documents via copy not owned users still give them read / write / no download access. i'll happy if copies now. here code: $service = googledrive::connect(); $copy = new \google_service_drive_drivefile(); $copy->settitle($documentname); try { $createdfile = $service->files->copy($source_id, $copy); } catch (\exception $e) { print "an error occurred: " . $e->getmessage(); } and...

javascript - IE Button click (on loop) with VBA -

i'm having issues executing following task: working - open ie , navigate intranet webpage (its database) not working - click "delete" button first row of data not working - wait ie refresh and not working - click "delete" button second row first. i want execute click-loop goes through entire webpage searching "delete buttons". using getelementbyid gives me run time error 424 object required error. this i'm getting stuck at. appreciate help!!! here code i'm using: sub website() dim ie object, doc object, username object, password object, strcode string set ie = createobject("internetexplorer.application") set ie = new internetexplorermedium ie.visible = true ' ie open webpage page ie.navigate "http://abc.com.au" while ie.readystate <> 4: doevents: loop end sub do use ie.document.getelementbyid??? there has doc...

html - How to only show elements of a class that I clicked while hiding everything else with jQuery? -

beginner here, tried best around didn't find same. i have situation have multiple appearances of same 4 types of links (each own class). ex: <a href="#" class="link1">link 1</a> <a href="#" class="link2">link 2</a> <a href="#" class="link3">link 3</a> <a href="#" class="link4">link 4</a> <a href="#" class="link1">link 1</a> <a href="#" class="link2">link 2</a> <a href="#" class="link3">link 3</a> <a href="#" class="link4">link 4</a> i trying if click 'link 1', links classes 2-4 disappear (off page) , links class, "link1" show. <a href="#" class="link1">link 1</a> <a href="#" class="link1">link 1</a>` i have tried creating assigning cl...

php - Changing the value of a session with Ajax in Wordpress not working -

i´m kind of new using ajax trying update value of session using ajax. ajax call shoud fires when clicked on button. when click on button returns succes function. using wordpress ajax call. currently code: ajax call: $('.button').click(function(){ $.ajax({ type: "post", url: "/wp-admin/admin-ajax.php", data: {click: "true"}, success: function() { alert('bro worked!'); } }); }); functions.php in wordpress: session_start(); function notificationcall() { $_session['clicked'] = $_post['click']; die(); } add_action('wp_ajax_notificationcall', 'notificationcall'); add_action('wp_ajax_nopriv_notificationcall', 'notificationcall'); echo $_session['clicked']; so ajax call returns succes function containing string "bro worked". however, se...

appcelerator - Hyperloop - Tokbox - iOS -

i need develop app (ios) videoconference, there lib called tokbox, works xcode ( mean, native code ), wondering if hyperloop can handle it. i use classic development , sdk 5.2.2 ga thanks in advance. tokbox lib i see tokbox available cocoapod , easiest way include ios stuff in hyperloop projects. hyperloop example app demonstrates this.

java - Get Google+ profile picture from Uri to Bitmap on Android -

i using google+ sign in instance of googlesigninaccount , can correctly load users name , email without issues, know correctly set up. uri of users profile picture , trying set icon imagebutton. the variable userphoto android.net.uri grabbed googlesigninaccount. photo, clear, not present on device. this code i'm using right no avail: profilebutton = (imagebutton) navheaderview.findviewbyid(r.id.navheadermainimagebutton); try { bitmap bitmap = mediastore.images.media.getbitmap(this.getcontentresolver(), userphoto); profilebutton.setimagebitmap(bitmap); } catch (ioexception e) { e.printstacktrace(); } this error get: w/system.err: java.io.filenotfoundexception: no content provider: https://lh5.googleusercontent.com/-s7xguonbdrk/aaaaaaaaaai/aaaaaaaafv8/htgjmty1xd8/photo.jpg w/system.err: @ android.content.contentresolver.opentypedassetfiledescriptor(contentresolver.java:1117) w/system.err: @ android.content.content...

benchmarking - Fewer FIO output. Update in the same line -

after reading fio manual , researching quite time, still not know answer. please if know trick: is there option can choose in fio doesn't print new line of progress every second? [root@localhost fio]# fio test.fio raw=random-read: (g=0): rw=randread, bs=8k-8k/8k-8k/8k-8k, ioengine=libaio, iodepth=16 fio-2.2.9 starting 1 process jobs: 1 (f=1): [r(1)] [5.0% done] [2023mb/0kb/0kb /s] [259k/0/0 iops] [eta 0 jobs: 1 (f=1): [r(1)] [6.7% done] [2016mb/0kb/0kb /s] [258k/0/0 iops] [eta 0 jobs: 1 (f=1): [r(1)] [8.3% done] [2018mb/0kb/0kb /s] [258k/0/0 iops] [eta 0 .... i know bit old, solution simple: make terminal wider , won't that.

c - passing a structure for comparison -

struct sign_in { char password[max_name_len+1];//the password each player char name[max_name_len+1];//name of people can sign in } //prototype int compare_names(char*, char*, struct sign_in*); int compare_names(char*pname,char*ppasscode,struct sign_in *var) { int icomparison = 1; int flag = 1; int icomparison2 = 1; int = 0; (i=0;i<6;i++) { printf("%s \t %s ", var[0].name,pname ); if(icomparison != 0) { icomparison = strcmp(pname,var[i].name); i++; } if(icomparison2 != 0) { icomparison2 = strcmp(ppasscode,var[i].password); i++; } printf("%d", icomparison); printf("%d", icomparison2); } } i have updated code , attempted take account many of aspects guys have recommended , news runs now. bad news still attempts print random jargon don't understand, it's collection of symbols usually...

C# linq-to-sql, set a database session variable in every session -

question: there way set database session variable: declare @app_user varchar(30)='otto' using linq-to-sql in c#, such variable available triggers in db? background: i'm implementing poor-man's journaling using triggers, , want pass application user inclusion in journal table: create trigger [trg_jrn_table1] on [dbo].[table1] insert, update, delete ... insert dbo.[jrn_table1] ([jrndmltype],[jrnuser],<cols>...) select @dml_type, @app_user, <cols> inserted (nolock) (i know i'll need bit suser_sname track ad hoc changes, too) everything can find linq2sql , session variables focused on c# session variables, , don't know start. hoping like: datacontext dc = createdatacontext(cfg); dc.addsessiondata("app_user", "otto"); but naturally doesn't exist :-) is db session variable possible? or maybe using :setvar or context_info ? update 4/22/2016: i've tried adding c# code in 2 places, datacontext created , ...

angularjs - Calling $wakanda.init multiple times from different Angular controllers -

i developing mobile application built in wakanda digital app factory 1.0.3 using ionic , angularjs 4d backend database. i have 2 different 4d methods available through 4d-mobile via 2 separate 4d tables accessed via 2 different angular controllers: .controller('homectrl', function($scope, $wakanda) { $wakanda.init('servers').then(function(ds) { ds.servers.www4dmionichomeoverview().$promise.then(function(event) { $json = event.result; $scope.overview = $json.servers; $scope.healthcheck = $json.healthcheck; }, function(err) { debugger console.log(err); }); }, function(err) { debugger console.log(err); }); }) .controller('errorlogctrl', function($scope, $wakanda) { $wakanda.init('server_log').then(function(ds) { ds.server_log.www4dmionicerrorlog().$promise.then(function(event) { $json = event.result; $s...

ios - How can I retrieve input from an alert box in Swift? -

how can retrieve input alert box in swift? don't understand why code isn't working. i'm c++ programmer i'm new swift. reason when print line says: "new style added is:" , that's there is. won't print out user has typed in textbox reason.. here code // generate text field user input func generatetextfield() { //1. create alert controller. var tempstyle = ""; var alert = uialertcontroller(title: "add new style", message: "enter name of new hairstyle below", preferredstyle: .alert); //2. add text field. can configure need. alert.addtextfieldwithconfigurationhandler({ (textfield) -> void in textfield.placeholder = "your new hairstyle goes here.."; }) //3. grab value text field, , print when user clicks ok. alert.addaction(uialertaction(title: "ok", style: .default, handler: { (action) -> void in ...

R combine data frame columns with regex -

this question has answer here: reshaping multiple sets of measurement columns (wide format) single columns (long format) 5 answers i have following data frame: dat <- data.frame( c = c(1 , 2) , a1 = c(1 , 2) , a2 = c(3 , 4) , b1 = c(5 , 6) , b2 = c(7 , 8) ) c a1 a2 b1 b2 1 1 1 3 5 7 2 2 2 4 6 8 that merged columns based on shared prefixes become data frame: dat2 <- data.frame( c = c(1 , 2 , 1 , 2) , = c(1 , 2 , 3 , 4) , b = c(5 , 6 , 7 , 8) ) c b 1 1 1 5 2 2 2 6 3 1 3 7 4 2 4 8 the way can think of try using melt() . attempt: melt(dat , measure.vars = c(grep("^a" , colnames(dat)) , grep("^b" , colnames(dat)))) variable value 1 1 a1 1 2 2 a1 2 3 1 a2 3 4 2 a2 4 5 1 b1 5 6 2 b1 6 7 1 b2 7 8 2 b2 8 > needless say, incorrect. ...

javascript - Aptana Studio 3 Syntax Errors Unexpected Tokens -

<body> <p>count numbers: <output id="result"></output> </p> <button onclick="startworker()">start worker</button> <button onclick="stopworker()">stop worker</button> <br /> <br /> <script> var w; function startworker() { if (typeofworker) !== "undefined") { if (typeof(w) == "undefined") { w = new worker("demo_workers.js"); } w.onmessage = function(event) { document.getelementbyid("result").innerhtml = event.data; }; } else { document.getelementbyid("result").innerhtml = "sorry! no web worker support."; } } function stopworker() { w.terminate(); w = undefined; } </script> </body> i have been teaching myself html5 on w3schools website. while trying replicat...

ios - Why can I not make my new UIWindow appear over top of the status bar? -

i'm trying place uiwindow above status bar temporarily alert purposes. the code quite simple: let newwindow = uiwindow(frame: uiscreen.mainscreen().bounds) newwindow.hidden = false newwindow.backgroundcolor = uicolor.greencolor() newwindow.windowlevel = uiwindowlevelstatusbar + 1.0 newwindow.makekeyandvisible() newwindow.hidden = false however when put in viewdidappear of root view controller, never see window. what doing wrong? you must retain newwindow somehow, try use strong property. rest of code seems ok except fact call 2 times hidden

c# - VS2010 on Win7, installer class within a setup is not called -

it installer class within setupproject, wich within winform project. till did hav errro message, not called. runinstallerattribute setted on true. the thing wich left "main void", cant put it, cause neede winformproject. here entire code: using system; using system.collections; using system.diagnostics; using system.componentmodel; using system.configuration.install; using system.security.accesscontrol; using system.security.principal; using system.io; using system.windows.forms; using system.text; using system.threading; [runinstaller(true)] partial class myinstaller : installer { public myinstaller() { messagebox.show("myinstaller"); initializecomponent(); } #region "onafter" protected override void onafterinstall(idictionary savedstate) { base.onafterinstall(savedstate); } protected override void onafterrollback(idictionary savedstate) { base.onafterrollback(...

php - Why Can't I Pass a String? -

i'm trying quiz program work in php. until now, i've had little problem getting code write work. however, time, can't seem string pass next page of form. basic idea trivia program. random question retrieved, user answers question, program checks see if answer right. eventually, program keep score, haven't got far yet because can't seem check answer against question. can't figure out i'm going wrong. if there's answer this, i'm sorry, missed it. thing saw said use javascript, beyond current skillset. thanks. the code: <!doctype html> <html lang="en-us"> <head> <!--link--> <meta charset="utf-8" /> <title>sports trivia</title> </head> <body> <form> <?php> extract($_request); include("triviaquestions.php"); //functions //display next question template provided dan brekke function nextquestion($trivia,&$used) { ...

bash - How do I change the column name of a CSV file? -

i have multiple csv files looks this: col1,col2 val1,val2 i want change col2 in each file column2 . how edit csv file's column name bash? use sed . sed -i '1s/col2/column2/' file.csv for multiple files, can use loop: for f in file1.csv file2.csv file3.csv sed -i '1s/col2/column2/' $f done or can use find execute sed : find . -name *.csv -exec sed -i '1s/col2/column2/' {} \; this replace col2 in csvs in current directory , sub-directories column2 .

Python & Vb.net Console Application print word into 2 lines with up & down -

i want print name 2 lines & down in python console & vb.net console, example name : dominic charles result of printing : d m n c h r e o i c l s like above using loop. can't figure out logic of printing name, can provide me solution of printing this?

Reading application stdout data using node.js -

let's take e.g. "top" application displays system information , periodically updates it. i want run using node.js , display information (and updates!). code i've come with: #!/usr/bin/env node var spawn = require('child_process').spawn; var top = spawn('top', []); top.stdout.on('readable', function () { console.log("readable"); console.log('stdout: '+top.stdout.read()); }); it doesn't behave way expected. in fact produces nothing: readable stdout: null readable stdout: readable stdout: null and exits (that unexpected). top application taken example. goal proxy updates through node , display them on screen (so same way running top directly command line). my initial goal write script send file using scp. done , noticed missing progress information scp displays. looked around @ scp node modules , not proxy it. backtracked common application top. top interactive console program designed ...

python - parse json without explciitely calling the key-name -

i have json-like file valid json per line looks {"some_key": {"name": "tom", "school_code":"5678", "sport": "football", "score":"3.46", "classid": "456"}} {"another_one": {"name": "helen", "school_code":"7657", "sport": ["swimming", "score":"9.8", "classid": "865"}} {"yet_another_one_": {"name": "mikle", "school_code":"7655", "sport": "tennis", "score":"5.7", "classid": "76532"}} so need create dictionary(? not need dictionary format me associate key value, array of 2 elements ex) extracting these first keys (i.e. "some_key", "another_key" etc), don't know in advance, , associating them value of score key inside dictionary. like: ...

android - Installing an APK results in a parse error -

i created app-debug.apk file in /sdcard/download i have code: @override public void onclick(view v){ intent intent = new intent(intent.action_view); intent.setdataandtype(uri.fromfile(new file(environment.getexternalstoragedirectory() + "/sdcard/download/" + "app-debug.apk")), "application/vnd.android.package-archive"); intent.setflags(intent.flag_activity_new_task); startactivity(intent); } i getting error: parse error there problem parsing package. how can modify programmatically without getting error?

php - Replace Value of Variable in Query -

currently have page1.php being entered url bar variable status , string in url http://example.com/page1.php?status=red . when user clicks enter, redirects page2.php , generates more variables , adds &status= @ end of url http://example.com/page2.php?status=red&varone=1&vartwo=2&status=green instead of having 2 status variables in url, remove 1st 1 left &status=green @ end. here code have header redirect: $query = $_server["query_string"]; header("location: page2.php" . $query . "&status=" . $currentstatus); i rather remove first ?status= if possible, since want &status= @ end of url if want remove first occurrence of status query string better remove previous url.

Heroku Prevent Python Django Objects from being uploaded -

so have programming forum site, users, threads, , responses post (these objects). however, everytime when deploy new version using: git push heroku master , resets of users, threads, , responses have on local machine. how can prevent happening?

sql server - How to find the first message between 2 parties in SQL? -

i have messages table looks this: | id | sender_id | recipient_id | |-------------------|---------------| ... | 1 | 23 | 20 | | 2 | 11 | 5 | ... | 3 | 20 | 23 | | 4 | 23 | 20 | ... | 5 | 7 | 11 | i'm hoping find first message between 2 user ids (the ids in sender_id , recipient_id columns). result above sample be: | id | sender_id | recipient_id | |-------------------|---------------| ... | 1 | 23 | 20 | | 2 | 11 | 5 | ... | 5 | 7 | 11 | at first thought group checksum of sender_id , recipient_id , , take min message id ( id ), because checksum different depending upon order of inputs, returns both first message (the intro) , first reply. there alternative checksum in order of inputs irrelevant? or maybe there's better way arrive @ solution. any appreciated. you...

How can I get CPU Usage with PHP on Windows IIS 8.5? (2012 R2) -

what i'm looking easy way either individual core usage or total cpu usage system php script running on. however i'm unable so. i've looked on manner of solutions using perf (with , without passthru) using winmgmts through com. the issue is, of these work on windows if use apache, iis security restrictions stop php being able use example winmgmts through com null object. how can solve this? - i've tried every solution can find on internet , while there lots of information how raise permissions guides point iis 7 or earlier , no longer applicable iis 8.5 literally suggested option changes being non-existent. if me i'd appreciative, workaround using third party application provide data acceptable if can query data through php either file or network etc asp.net script query? (i don't know asp.net use single thing if it'd work?) thank you. i managed solve , hope helps else. what must convert folder php (or asp) execute application. struct...

How to read @Multipart parameters using retrofit 2 in PHP? -

i'm trying upload image using retrofit 2 php server, don't know how can reach this/these parameters in php. @multipart @post("upload/testimage") call<resultobj> getimageone(@part("file\";file=\"image.png\"") requestbody file); @multipart @post("upload/testimage") call<resultobj> uploadimage(@partmap map<string, requestbody> params); i solved changing retrofit version: compile 'com.squareup.retrofit2:retrofit:2.0.1' , using multipart in way: @multipart @post("/example/updinfo") call updateinfo(@part multipartbody.part pic, @partmap map params);

ios - How to parse {status:0,val:450} from a HTML response -

i want take 450 from following: nsstring {status:0,val:450} using objective c: {status:0,val:450} please suggest me answer i cannot understand question . think have have json data like: { status:0; val:450; } if want data in app. want nsurl *blogurl = [nsurl urlwithstring:@"https://your url here"]; nsdata *jsondata = [nsdata datawithcontentsofurl:blogurl]; nserror *error = nil; nsdictionary *datadictionary = [nsjsonserialization jsonobjectwithdata:jsondata options:0 error:&error]; nsdictionary *data = [datadictionary objectforkey:@"status"]; nsdictionary *item = [data objectforkey:@"val"]; your json data in dictionary format. can access data using key. in here keys status , val. i hope links you. fetch parse json ios programming tutorial , link: json parsing in ios

c# - Web requests suddenly not working -

my app makes calls api so: debug.writeline ("making api request: " + action); var request = httpwebrequest.create("http://domain.com/api/"+ action"); request.contenttype = "application/json"; request.method = "get"; string content = "d"; using (httpwebresponse response = request.getresponse() httpwebresponse) { using (streamreader reader = new streamreader(response.getresponsestream())) { content = reader.readtoend(); } } return content; and has been working few months. 1 day app no longer working. debugging i'm finding requests either timing out or throwing error: (system.net.webexception) error getting response stream (readdone1): receivefailure what error mean? , why did start? code hasn't been changed since release of app. request works when typed browser. adding www. urls fixed issue.

.net - How to find a text and replace it with an image in C# -

i have code searches text , replace text in ms word document. want similar kind of operation. find text , replace image. can pass file location, image location. using system; using system.collections.generic; using system.linq; using system.text; using system.diagnostics; using system.io; using word = microsoft.office.interop.word; using system.runtime.interopservices; //using system.drawing; namespace writingintodocx { [comvisible(true)] public interface imyclass { void documentdigitalsign(string filep,string findt,string replacet); } [comvisible(true)] [classinterface(classinterfacetype.none)] public class program : imyclass { public void documentdigitalsign(string filep, string findt, string replacet) { string filepath = filep; string findtext = findt; string replacetext = replacet; ...

Android ActionBar API, getSupportActionBar() and setDisplayHomeAsUpEnable meaning? -

i added icon on action bar. , when click on it, opens activity via intent. however, in source, people add getsupportactionbar , setdisplayhomeasupenable. if without those, still works. my question meaning og these 2 api? if have included actionbar or toolbar in activity , if want go previous activity on tap of back arrow on left side (in ltr configuration) of actionbar, have first actionbar as, actionbar ab = getsupportactionbar(); and provide action go previous activity , have call setdisplayhomeasupenabled() method as, if (ab != null) { ab.setdisplayhomeasupenabled(true); }

mysql if elseif syntax condition -

if have 2 parameter "parameterx" , "parametery" and i'll using "parameterx" , "parametery" commend sql snytax like as select * test.test if(parametery!=0) test.test.'x'=parameterx , test.test.'y'=parametery else if test.test.'x'=parameterx end if i know this's can't work want know have other way , can work in mysql or easier (than @diehud's answer): select * test.test test.test.'x'=parameterx , (test.test.'y'=parametery or parametery=0)

python - Replacing regex with new regex -

say have "a acrobat jumped on bridge" and want change to "an acrobat jumped on bridge". right now, i'm using lyrics = re.sub(r" (a|e|i|o|u|y){1}([a-z]+|[a-z]+)", r" (a|e|i|o|u|y){1}([a-z]+|[a-z]+)", lyrics) and resulting string doesn't replace in way i'd hope would, expected. how else can this? to clarify, want able generalize every case, not example used above. according english grammar, an comes before word starts vowel. can use this: >>> import re >>> re.sub(r'\ba\b(?=\s+[aeiouaeiou])', 'an', "a acrobat jumped on bridge") 'an acrobat jumped on bridge' >>> re.sub(r'\ba\b(?=\s+[aeiouaeiou])', 'an', "a elephant") 'an elephant' >>> notice, a before acorbat has been changed an , whereas a before bridge has not been changed. a before elephant has been changed an , hence above regex generalized , w...

Group by single column in Linq c# -

i have table below: need display without duplicates. need groupby customer alone. c1 has both 'name' id name customer 1 xxxx c1 2 yyyy c1 i need values on c1 : xxx ,yyy. getting c1: xxx , c1: yyy. code is: public list<data> getcomponentstatus() { list<data> d= null; using(var entity=new fm()) { d = entity.getdata() .select( => new data { customer = a.id, name = a.name, }) .groupby(a=>a.customer).select(a=>a.firstordefault()).tolist(); } return d; } from this, getting first record or last record when using lastordefault(). i want both 'name' on single customer c1. if understood correctly want group customer , name comma seperated. created sample data of yours , wrote linq in query syntax. see demo output on rextester below. var data = new[] { new {id = 1,name = "...

class - how to properly overload the __add__ method in python -

i required write class involving dates. supposed overload + operator allow days being added dates. explain how works: date object represented (2016,4,15) in format year,month, date. adding integer 10 should yield (2016,4,25). date class has values self.year,self.month,self.day my problem code supposed work in form (date+10) (10+date). date - 1. should work in sense of adding negative number of days. date(2016,4,25) - 1 returns date(2016,4,24). my code works in form of (date+10) not in form (10+d) or (d-1). def __add__(self,value): if type(self) != int , type(self) != date or (type(value) != int , type(value) != date): raise typeerror if type(self) == date: day = self.day month = self.month year = self.year value = value if type(value) != int: raise typeerror days_to_add = value while days_to_add > 0: day+=1 if day == date.days_in(year,month): month+=1 if month > 1...

graphviz - How to pick which side a node is on in a simple binary tree? -

Image
in simple binary tree, able make graph right adding invisible nodes , invisible edges, instance from: digraph { vertex_1 [label="a"]; vertex_2 [label="b"]; vertex_2 -> vertex_1 [label="left"]; } which produces: to: digraph { vertex_1 [label="a"]; vertex_2 [label="b"]; vertex_0 [style=invis]; vertex_2 -> vertex_1 [label="left"]; vertex_2 -> vertex_0 [style=invis]; } which produces: but when tried trick 4 node graph (it straight , down) here got: digraph { vertex_1 [label="a"]; vertex_2 [label="b"]; vertex_3 [label="f"]; vertex_4 [label="g"]; vertex_01 [style=invis]; vertex_02 [style=invis]; vertex_03 [style=invis]; vertex_4 -> vertex_3 [label="left"]; vertex_3 -> vertex_1 [label="left"]; ver...

wordpress - Adding postmeta default values after adding post -

i using wordpress xmlrpc add posts blog. however, after running this. $data = array( 'title' => $title, 'description' => $content, 'post_type' => 'post', 'categories' => array($category), 'post_status' => 'publish' ); $addedpostreturn = $this->_client->query('metaweblog.newpost', array(0,$username,$password,$data,1)); this adds post fine doesn't add postmeta information. if open post, click update, default postmeta gets updated. however, add default postmeta information php script instead of manually (or else kinda defeats purpose). is there anyway, either xmlrpc or regular wordpress functions create postmeta custom fields using default values? if not, there way have list of custom fields need manually add using custom fields section of metaweblog.newpost f...