Posts

javascript - Js, document.getElementById("ID").innerHTML, error -

hello i'm new javascript, , i'm try write out code test site , i'm having problems, dow below code , keep getting error , can't figure out why. typeerror: null not object (evaluating 'document.getelementbyid("h3").innerhtml = "<h3>you date!</h3>"') this second method tried using. i'm trying have have version list first 1 had pull .js file , build table, didn't work thought try this, guess happened? not working my code i'm using below. if can amazing. thanks, dakmessier var current = "1.0"; function get_latest(){ document.getelementbyid("bob").innerhtml = current; } if (local != current){ document.getelementbyid("get").innerhtml = "<button><a href=\"bla\">get latest update!</a></button>"; } else if (local == current){ document.getelementbyid("h3").innerhtml = "<h3>you date!</h3>"; } else { document.g...

jquery - jqGrid update specific column data with out refreshing the entire column? -

i using jqgrid in project . want update/refresh specific column data out refreshing entire grid. please give me idea that. here possible solution. can use 'setcell' in jqgrid set value specific cell in column. see fiddle here: https://jsfiddle.net/99x50s2s/4/ i hope above fiddle give idea complete task. <table id="sg1"></table> <div id="psg1"></div> <br> <button type="button" id="setcolumnbtn">update 'amount' column</button> jquery("#sg1").jqgrid({ datatype: "local", gridview: true, loadonce: true, shrinktofit: false, autoencode: true, height: 'auto', viewrecords: true, sortorder: "desc", scrollrows: true, loadui: 'disable', colnames:['inv no','date', 'client', 'amount','tax','total','notes'], colmodel:[ {name:...

javascript - Create a java script function in c# -

i'm developing winform application , want use google api v3 calculate barycenter of polygon. , have lng , lat in database. want call java script function in c# i'm new found using htmlelement can me here code tried doesn't give result. webbrowser webbrowser1 = new webbrowser(); string url = ("c:\\users/guenafai/desktop/topapplication/topapplication/baryscripts.htm"); console.writeline("je suis laaaaaaaaaaaa"); webbrowser1.navigate(url); htmlelement head = webbrowser1.document.createelement("head"); htmlelement scriptel = webbrowser1.document.createelement("script"); scriptel.setattribute("src","https://maps.googleapis.com/maps/api/js?key=aizasyaxby6ydvnzou0tk2rkrdmbnebn3gn1svk"); ihtmlscriptelement element = (ihtmlscriptelement)scriptel.domelement; string script = @" function baryc(){ var boundss = new google.maps.latlng...

objective c - Is there a way in OCMockito to make stubs fail when an unknown method is called? -

when creating stub in ocmockito, use calls stub out method calls , return values: [given([stubobject mymethod]) willreturn:somevalue]; the problem have if don't define method method gets called during test, default seems to return nil . can lead sneaky bugs since real methods asserted never return nil , therefore return value not tested in code calling method. is there way change default behavior or maybe test if called on object apart few methods i'm stubbing? no, ocmockito stubs "nice". if want "strict" stubs, ocmock may suit better.

sql - Error using the DATEDIFF syntax -

i'm trying find age of employees sample database using code: select empno, firstnme, lastname, job, birthdate, datediff(hour,birthdate,getdate())/8766 age employee job '%r'; but keep getting error : "hour" not valid in context used.. sqlcode=-206, sqlstate=42703 this using ibm data studio 4.1. assuming you're using db2 , doesn't support datediff or getdate() . instead, subtract dates , use current date : select empno, firstnme, lastname, job, birthdate, (current date - birthdate)/365.25 age employee job '%r'

Pointers and recursive functions in C -

i have created list numbers. example: -3 4 -2 -1 4 5 the products of 2 continuous nodes -14 -8 2 -4 21 . want check if product of 2 nodes bigger product of following ones. used recursive function , in example treaty unsuccessful because 2>-4 . i want print message showing first node causes problem. in case -1 4th node. how return pointer showing wrong node? see questionmarks :) struct node* findnode(struct node *junc) { //success if(junc->link->link==null){ printf("success"); return null; } //failure if (((junc->content)*(junc->link->content))>=((junc->link->content)*(junc->link->link->content))) { printf("fail."); printf("\nfail because of numbers:%d %d.",junc->link->content,junc->link->link->content); return junc; } return(findnode(junc->link)); } i want check if product o...

c++ - Why does the slash key "/" not have an ASCII value of 47? -

i have reassigned hotkey in our game use slash key "/", according ascii table should have value of 47. it's not firing. fires other standard keys. when step through code see keyeventrecord shows key value 191 or 111 if use slash on numeric keyboard. why so? need convert somehow? just clarification, store key value int. keyboards not know ascii. know scan codes , vendor-specific ids actual keys. when processed, scan codes normalized in vendor-independent virtual key codes . 191 vk_oem_2 (used /? key in keyboards) , 111 vk_divide . when dispatched ui windows, virtual key codes converted character codes in wm_char , wm_unichar messages. these human-readable characters, such ascii characters (though wm_char presents characters in ansi/utf-16 encoding, , wm_unichar in utf-32 encoding). so, processing keyboard events, such wm_keydown/up or readconsoleinput() , reporting virtual key codes when expecting character codes instead. for many ascii...

android - How to transfer string data from main activity to another Activity -

this question has answer here: pass string 1 activity activity in android 5 answers i need make fragment (dialog box, whatever) content changes depending on user selects. means need transfer string data main activity activity responsible fragment. how do this? you can add extras intent use when starting activity inside of another. so, example, wherever handle users selection in first activity (let's call activity a) can send string activity b this: intent intent = new intent(activitya.this, activityb.class); intent.putextra("stringkey", "stringvalue"); startactivity(intent); the first parameter key used reference need, , value whatever string want passed next activity. then, somewhere in activity b can read string so: if(getintent().getextras().containskey("stringkey"){ string passedstr = getintent().getstringe...

Batch File execution on remote windows server via batch file on another windows server -

i trying call batch file placed on remote windows server windows server. have freesshd installed on remote server. tried using putty/plink of no result. syntax of command using is: putty: start e:\putty.exe -ssh user12@serverip -pw "abcd12" call sample.bat plink: start e:\plink.exe -ssh user12@serverip -pw "abcd12" cmd.exe -m e://sample.txt i tried variants of above 2 commands "-m file.txt" etc. able execute batch file via login putty console not via calling batch file placed on windows server. this how start remote programs in windows. wmic /node:servername process call create "cmd.exe c:\\somefolder\\batch.bat" files executed way invisible on remote computer. for help wmic /? wmic process /? wmic process /? wmic process set /? wmic process call /? wmic process call create /? wmic process /node /? wmic process /user /? wmic process /password /?

c# - regex gets stuck with this call -

i'm working on movie scraper / auto-downloader iterates on current movie collection, finds new recommendations, , downloads new goods. there part scrape imdb metadata , seems stuck in 1 spot , can't seem figure out why.... has run same code different imdb pages fine (this 29th iteration of new page) i using c#! the code: private string match(string regex, string html, int = 1) { return new regex(regex, regexoptions.multiline).match(html).groups[i].value.trim(); } regex parameter string contents: <title>.*?\\(.*?(\\d{4}).*?\\).*?</title> html parameter string contents: big paste here, literally html string representation of http://www.imdb.com/title/tt4422748/combined if in chrome, can view with: view-source:http://www.imdb.com/title/tt4422748/combined i have paused execution in visual studio , stepped forward, continues run hangs (it doesn't let me step, runs). if hit pause again return same spot same parameter values...

html - Auto resizing div with max width -

Image
i'm trying create div text resizes width depending on how text in div, has maximum width, splitting text multiple lines if exceeds max-width. text resize 1 line of text , split when there's much, when there's more 1 line large space appears inside div between right edge of text , border. html: <div class="balloon"> sample text. second sentence. </div> css: .balloon { background: #fff; border: solid 2px; display: inline-block; max-width: 225px; } here's demo demonstrate mean: http://jsfiddle.net/oft3n5wg/ any ideas how fix this? your updated fiddle this because first word on 2nd line large fit in space have highlighted in red. replace word "second" "seco" , you'll see fits you can add text-align: center space doesn't bad if want, or letter-spacing: 1px there's more space between letters , fill white spaces bit more

MySQL Find and Replace for Tablepress Plugin for WordPress -

i'm using tablepress plugin wordpress. i'm trying find/replace of 'http://' replace 'https://'. i've used search , replace plugin, not touch tablepress content. i know can write sql command search find/replace in phpmyadmin, not sql expert not sure how structure command. can help? thanks in advance!! update your_table set your_column = replace( your_column , 'http://', 'https://')

javascript - How to capture a click event on a shape or group in two.js? -

i have drawn shape using two.js , want write code handle click events on shape. not canvas, on shape itself. front_left.domelement = $('#two-' + front_left.id) .css('cursor', 'pointer') .click(function(e){ alert("hello world!"); }); this code taken answer seems should work: circle.domelement = $('#two-' + circle.id) .css('cursor', 'pointer') .click(function(e) { circle.fill = getnonmainrandomcolor(getrandomcolor()); }); but doesn't work me using latest jquery , latest two.js, , doesn't seem work in the example , since code reads if clicking on circles supposed make colour changes nothing happens on browser or computer i've tried. so, how can capture , respond click events of shapes/groups drawn two.js? thanks message. reason answer doesn't work anymore because two.js has changed since then. i've added example here . gist of that: use svg renderer when...

media player - How to play Video on background with Android MediaPlayer? -

i creating program play video. first, created activity play video url using android mediaplayer . my issue when android's home button pressed, want play audio continuous (audio only), , when program, video must play continuous. have solution resolve issue?

git - Create a developer fork of non-Github repository -

i'd create developer fork (not checkout) of non -github repository. setup: main repository on machine x in /export/git/foo.git main repository has many branches. new bare repository created in /home/me/fork.git on machine x. want bring not branches main repository new repository. bring on branch histories new repository. want able bring new commits main new repository. bonus points spelling out how push commits new repository main without using patches. i searched site , internet did not see use case solved. git commands needed above? machine x linux box. here steps: clone new local repo of remote repo wish fork: git clone [source url] source_repo change created directory (source_repo). for every branch wish fork, do: git branch --track [branch name] add new remote repository: git remote add [dest repo name] [dest repo url] now push branches forked repository: git push --all [dest repo name] answer derived this .

csv - Google Chart data export -

when using google charts there's toolbar concept, seems work google drive spreadsheets (through 'datasource' parameter). there similar functionality allow export data when it's retrieved database in general? i've looked @ this , this , inconclusive.

Dynamically allocated string arrays in C -

i'm trying understand how dynamically allocated arrays work in c 99. anyways, have following code: int main() { char** members=malloc(4*sizeof(*members)); *members=malloc(5); *members="john"; *(members+1)="shouldn't work"; printf("%s \n",*members); printf("%s",*(members+1)); return 0; } i thought run time error because didn't allocate (members+1), did print both "john" , "shouldn't work", also, apperas the *members=malloc(5) line wasn't necessary. why? your assignments aren't doing think they're doing. when assign *members or *(members+1) , you're assigning char* each string literal, not copying allocated (or not allocated) heap memory. if instead replaced assignments strcpy , i.e.: strcpy(*members, "john"); strcpy(*(members+1), "shouldn't work"); then access violation on second assignment not first. likewise, reason ...

PHP, Shorthand, If..Else using Ternary Operators -

is there oneliner this? nice ternary op? $f_name = $_session['usr']['f_name']; if(isset($_post['f_name'])) {$f_name = $_post['f_name'];} basically "if post sent, show that, if post empty, otherwise grab value session, if post not set or empty" really splitting hairs here... looking this: $f_name = ? ($f_name ? isset($_post['f_name']) : $_session['usr']['f_name']); its supposed be: (conditions) ? true : false satisfies <--^ ^----> did not satisfy so equates into: $f_name = isset($_post['f_name']) ? $_post['f_name'] : $_session['usr']['f_name'];

java - Adapters not output image(android) -

sorry english. using adapter, , may wrong somthing using it. trying show image , textview output. textview coming in output, image not. please me, try many many times fix it. load image in downloadimagetask . in downloadimagetask have class imageloader , have used this tutorial . don't have error, have nothing( arraylist<news> arraylistnews; int resourse; context context; layoutinflater vi; public newsadapter(context context, int resource, arraylist<news> objects) { super(context, resource, objects); arraylistnews = objects; resourse = resource; this.context = context; vi = (layoutinflater) context.getsystemservice(context.layout_inflater_service); } @override public view getview(int position, view convertview, viewgroup parent) { viewholder holder; if(convertview == null) { convertview = vi.inflate(resourse, null); holder = new viewholder(); holder.imageview = (imageview) convertview.findviewbyid(r.id.ima...

javascript - node.js C++ addon runing differently in Linux and Windows -

i started learning node.js , particularly c++ addon. modified hello world example little bit see how works. found out runs differently in linux , windows. basically, added internal function used cout output console. in linux, output is worldtest yes but in windows, is yes worldtest basically orders of outputs different. seems windows output expected be. ideas i'm missing here? thanks! hello.cc: #include <node.h> #include <v8.h> #include <string> #include <iostream> using namespace v8; using namespace std; string changestring(string tmp); void method(const v8::functioncallbackinfo<value>& args) { isolate* isolate = isolate::getcurrent(); handlescope scope(isolate); string tmp=changestring("world"); const char * c=tmp.c_str(); args.getreturnvalue().set(string::newfromutf8(isolate, c)); } void init(handle<object> exports) { isolate* isolate = isolate::getcurrent(); exports->set(string::newfrom...