Posts

Showing posts from August, 2012

javascript - Changing div background on audio play -

i'm trying setup clicking on div plays audio (this working), , changes background image of div (not working). audio pauses if button clicked again during playing, , background image needs keep up, it's similar pause/play visual. what've got wrong here isn't working? <!doctype html> <html> <head> <meta charset=utf-8/> <title>janice's button</title> <style type="text/css"> * { margin: 0; padding: 0; } #button { position: absolute; height: 100%; width: 100%; overflow: hidden; background-size: contain; } #clicker { z-index: 1000; position: absolute; left: 30%; top: 10%; width: 40%; border: 1px solid red; border-radius: 100%; } .unpressed { background:

Linux: Cannot load foo.so: Invalid ELF Header. Observations -

trying run linux binary b loads shared library /lib/libfoo.so. getting error 'cannot load /lib/libfoo.so: invalid elf header. program ran fine while, failed. failures repeatable. managed dd first block (512 bytes) of libfoo.so. apparently elf header starts 7f 45. file had first byte value 0 rather 7f. second byte fine 45. upon reboot, program b ran fine, no complaints link loader locating libfoo.so. offset 0 of libfoo.so had reverted correct 7f. mod time of file 2012 throughout, suggesting no filesystem operation had changed byte. at time, put down filesystem corruption suspicious of crazy linux kernel page cache bug, buffer overrun 1 byte, writing 0 unrelated cached file happens trash cached libfoo.so. reasons speculation of this: 1 dd result of 0 @ offset 0 in file may have got result page cache , not disk @ all? .so file heavily used in system have been cached. 2 issue went away on re-boot, page cache history. 3 many posts linux 'invalid elf header&

Java: method return type as array error -

public provinceterritory[] getprovincewhosenamecontains(string substring){ string[] names; names = new string[13]; int j=0; for(provinceterritory ptt:provinces){ if(ptt.getname().contains(substring)){ string singlename=ptt.getname(); names[j]= singlename; j++; } } return names; \\this error points } why return type giving error though provinceterritory , names both of datatype arrays ? "incompatible types:java.lang.string[] can not converted provinceterritory[]" they both array. array of different type. cannot pass string[] provinceteritorry[] . change method's return type public string[] getprovincewhosenamecontains update and if want return provinceteritorry[] can following public provinceterritory[] getprovincewhosenamecontains(string substring){ provinceterritory[] names = new provinceterritory[13]; int j=0; for(provinceterritory ptt:provinces){

http - Postman/ElasticSearch: Difference between results of curl vs one sent via postman -

following query not return correct data when fired postman. intention search data contains host == host-2 post - {{server}}/elasticsearch/{{index}}/_search { "query": { "query": { "query_string": { "query": "host:host-2", "analyze_wildcard": true } } } } while curl command works fine: curl -k -xpost 'https://{{server}}/elasticsearch/{{index}}/_search' -d '{ "query": { "query": { "query_string": { "query": "host:host-2", "analyze_wildcard": true } } } }' also, following call returns correct results postman !!: {{server}}/elasticsearch/{{index}}/_search?q=host:host-2 is because of '-d' sent via curl wasn't sent via postman ? there other http format required sent postman ? ok - following works (prefixing server call https:// ). surprisin

java - How to download a CSV file stored in server at location Temp/hello.csv -

i want download csv file @ server on location temp\hello.csv using java code i have data. populating data csv file, hello.csv this file saving/storing in server under \temp folder the csv file gets stored @ location temp\hello.csv folder in server. i want download file don't know how using java code this should work (from https://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-ann-async-output-stream ): @requestmapping("/download") public streamingresponsebody handle() { return new streamingresponsebody() { @override public void writeto(outputstream outputstream) throws ioexception { file file=new file("temp\hello.csv"); fileinputstream stream =new fileinputstream(file); ioutils.copy(stream, outputstream); } }; } but there many other capabilities. ( spring boot service download file , downloading file spring controllers , ...)

I want to add an element to array after matching pattern found using perl -

i've copied lines of file array , looping array pattern matching once pattern matches, want add lines same array , print in file. my @lines = <file_in>; foreach $line (@lines){ if($line =~m/\s(\w*)_region\s/){ print $line; } i tried till pattern matching, , want add element after search. open $ifile,'<:encoding(utf-8)', '/path/to/file.txt' || die $!; while (my $line = <$ifile>) { chomp $line; if ($line =~m/\s(\w*)_region\s/x) { print $line } } close $ifile;

node.js - how can I write file to windows system folder? -

i want add new fonts windows system folder electron, failed, how this? here code can work in app folder.i want put file in 'c:\windows\fonts', thank u. var request = http.get("http://www.mysites.com/newfont.ttf", function(response) { if (response.statuscode === 200) { var file = fs.createwritestream("app/font.ttf"); response.pipe(file); } }); in error can see http not defined, tell you forget require http module. way have same thing fs module no ?

ios - Temporary nw_socket_connect connect failed after delete request -

i have table view, calling function deletes entry remotely after deleted in table view. however, after delete entry , navigate away view, 20 seconds after, navigating table view gives me following error: nw_socket_connect connect failed: [64] host down the other data being requested on table view being loaded correctly, know host not down. here code. let url:url = url(string: urlstring)! let session = urlsession.shared var request = urlrequest(url: url) request.httpmethod = "delete" let task = session.datatask(with: request urlrequest) { ( data, response, error) in guard let data = data, let _:urlresponse = response, error == nil else { print("error") return } let datastring = string(data: data, encoding: string.encoding.utf8) print(datastring) } task.resume() this code called in: tableview(_ tableview: uitableview, commit editingstyle: uitablevie

apache - Field grouping in case worker dies in Storm -

i have use case using local cache maintain counters ids. did fieldsgrouping("spout", new fields("id")) in topology class. let's id1 getting processed in processingbolt on worker1 , id2 getting processed in processingbolt on worker2 . if worker2 dies , id2 start getting processed on worker1 ? yes. storm used abstraction of tasks internally. if use fieldsgrouping, each id mapped task, , task executed bolt instances. if 1 bold instance fails, storm move task other bolt instances.

apache poi - How to insert a table into a cell in poi word? -

i want insert table cell,i did demo failure, can give advice? xwpfdocument document = new xwpfdocument(); xwpftable tabletwo = document.createtable(1,1); xwpftablerow tabletworow1 = tabletwo.getrow(0); tabletworow1.getcell(0).settext("aaaaaaaaaa"); xwpftable tableone = document.createtable(2,2); xwpftablerow tableonerow1 = tableone.getrow(0); xwpftablerow tableonerow2 = tableone.getrow(1); tableonerow1.getcell(0).settext("test"); tableonerow1.getcell(1).settext("test"); tableonerow2.getcell(0).settext("test"); tableonerow2.getcell(1).inserttable(0, tabletwo); fileoutputstream fos = new fileoutputstream("d:\\2.docx"); document.write(fos); fos.close(); the xwpftable created using xwpfdocument.createtable belongs document. cannot later taken document , putted cell. for doing this, xwpftablecell.insertnewtbl needed. the following code works using actual apache poi

reactjs - React material-ui MenuItem containerElement not working -

i have following code: <menuitem primarytext="home" containerelement={<link to="/" />} /> but doesn't work explained in other topics/threads menuitem discussed here material ui menu using routes . once add containerelement prop menuitem i'm getting exception: uncaught error: element type invalid: expected string (for built-in components) or class/function (for composite components) got: undefined. forgot export component file it's defined in. check render method of `enhancedbutton`. it looks no longer works (will need find change log.) to fix did npm install react-router-dom --save , used following snippet: import react, { component } 'react'; import { navlink } 'react-router-dom' import menu 'material-ui/menu'; import menuitem 'material-ui/menuitem'; import drawer 'material-ui/drawer' <drawer docked={false} open={this.state.open} onrequestcha

python - how to Install Pip under /usr/local/lib/python2.7/site-packages in Linux -

i have 2 version of python in linux system /usr/bin/python2.6 /usr/local/bin/python2.7 i want install pip under python2.7 getting automatically installed under /usr/lib/python2.6/site-packages instead of /usr/local/lib/python2.7/site-packages. **[root@sandbox site-packages]# pip /usr/bin/pip [root@sandbox site-packages]# pip -v pip 7.1.0 /usr/lib/python2.6/site-packages (python 2.6)** i think there issue 2 version of python present in linux. how can forcibly install pip under python2.7 ? can me resolve ? you can try this: /the/path/to/your/python2.7 -m pip install *your-packages* regards, ed

sass - How to lint for a harry robert's BEM convention with stylelint? -

postcss bem linter plugin needs component definition each block time consuming thing in legacy project. is there way use stylelint check classes pattern , show error in stylesheets (.scss in case) of project without needing component definition in each file/block? https://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/ .block {} .block__element {} .block--modifier {} you can use stylelint's selector-class-pattern rule enforce pattern class selectors using regular expression. however, if you're writing bem-like css stylelint-selector-bem-pattern , wraps postcss bem linter , more powerful understands concept of components, elements, modifiers , utility classes. there an option implicitly define components based on filename, removing need component definitions within each file.

how to add new row in table using jquery -

i trying add new row in table on button click, adding row no binding dropdown i have tried $("#btnaddrow").click(function () { debugger; var value = $("#tnoofrows").val(); (var = 0; < value; i++) { $('#example').clone().appendto('<tr><td><select class="form-control ddlclient" /></td><td><input type="text" class="form-control dtpicker" /> </td><td><input type="text" class="form-control amount" /></td><td><button class="btn bg-teal-400 addinvoice" title="add invoices" data-toggle="modal" data-target="#mymodal"><i class="icon-plus2"></i></button>&nbsp<input type="button" class="form-control" value="delete" /></td></tr>') } });

linux - Use Netfilter to write kernel module to modify source IP error, computer crash -

i want write kernel module uses netfilter modify source ip "100.100.100.100" whiche packet destination ip "192.68.4.103" , protocol tcp. write .c file when install module ,it cause computer crash. how should rewrite it? system ubuntu16.04 . here code wrote: #include <linux/init.h> #include <linux/module.h> #include <linux/netfilter.h> #include <linux/netfilter_ipv4.h> #include<linux/inet.h> #include<net/ip.h> #include<net/tcp.h> #include <linux/netdevice.h> #include <linux/inet.h> #include <linux/socket.h> #include <linux/skbuff.h> module_license("gpl"); module_author("linhos"); #define if_name "eno1" //network name got command "ifconfig" struct nf_hook_ops nfho; static unsigned int checkip( unsigned int hooknum, struct sk_buff *__skb, const struct net_device *in, const struct net_device *out, int(*okfn)

using variable n regex c# -

this question has answer here: c# regex issue “unrecognized escape sequence” 3 answers var d = new date(); string[] weekday = new string[10]; weekday[0] = "söndag"; weekday[1] = "mÃ¥ndag"; weekday[2] = "tisdag"; weekday[3] = "onsdag"; weekday[4] = "torsdag"; weekday[5] = "fredag"; weekday[6] = "lördag"; int day = (int)datetime.now.dayofweek; var n = weekday[day]; var match = regex.match(item.innertext, @"\b" + n + "\s(.*)\s(.*)\s(.*)", regexoptions.multiline); response.write(match.value); i "unrecognized escape sequence" error on \s(. )\s(. )\s(. ) when put in variable. works fine when it's @"\bmÃ¥ndag\s(. )\s(. )\s(. )", regexoptions.multiline);

xml - Build & keep file into memory and encrypt (C#, WPF, LINQ) -

during creating xml file i'm doing encrypt fields. it's working ok. below code: create xml class: private void btnsave_click(object sender, routedeventargs e) { xmltextwriter xwriter = new xmltextwriter("test.xml", encoding.utf8); xwriter.formatting = formatting.indented; xwriter.writestartelement("root"); testviewclassdatacontext dc = new testviewclassdatacontext(); list<test_view> tvq = (from tt in dc.test_views select tt).tolist(); var propertiestestview = typeof(test_view).getproperties(); var testviewvalues = new list<string>(); looppropxml(tvq, propertiestestview, testviewvalues, xwriter); xwriter.writeendelement(); xwriter.close(); } public void looppropxml<t>(ienumerable<t> queryresult, propertyinfo[] properites, list<string> addedvalues, xmltextwriter xwriter) { foreach (var qrl in queryresult) { var values = new list<objec

php - CURL returns full string response instead of xml -

Image
i'm trying pull data using curl in php this $ch = curl_init(); $headers = array('content-type: text/xml',"openapikey:da21d9s56ekr33"); curl_setopt($ch, curlopt_url, "http://api.test.co.un/rest/cateservice/category"); curl_setopt($ch, curlopt_httpheader, $headers); curl_setopt($ch, curlopt_failonerror,1); curl_setopt($ch, curlopt_followlocation,1); curl_setopt($ch, curlopt_returntransfer,1); curl_setopt($ch, curlopt_timeout, 15); $return = curl_exec($ch); print_r($return); print_r(gettype($return)); //prints string but got response in full string when response supposed in xml format, , when print type of response variable prints string. tried using postman check response , returns correct format in xml mode: and when change preview mode in postman, showed same result curl response in php shows, full string: most likely, you're getting correct response, browser not rendering way expected to. happens if, @ top of code, add header

html - minus "-" sign not working css content '\f117' is not working recently -

how make old version fontawesome3 work i using css content show - symbol in page. have used below code , working fine before. noticed content: "\f117"; not show symbol. why happening now? has unicode representing character changed? have not included additional css file. .test-thiselemtn:before { content: "\f117"; } update1:- updating question. how make old version fontawesome 3.2.1 work, is, -ve sign of unicode content '\f117' displayed correctly. also, has eot woff , ttf files? update2:- how make 2 versions of fontawesome v3.2.1 , v4.. work together? the unicode - symbol in font awesome \f068. if doesn't load too, use font-family: fontawesome in css. .test-thiselemtn:before{ content: "\f068"; font-family: fontawesome;} if don't want use font awesome can use .test-thiselememtn:before{ content: "\2012";}

whem i am trying to call JavaScript method in html if methods parameter is null my result is method's caller scripts -

i have html code , print string js method <div class="commentdiv">{{ commentsubstring(item.commentlist[0].content) }} </div> here js method $scope.commentsubstring = function(fullcomment) { var substring; if(fullcomment.length<16 && ullcomment.length>0) { substring=fullcomment; } if(fullcomment.length<=0 || !fullcomment) { substring=""; } if(fullcomment.length>=16) { substring = fullcomment.substring(0,15); } return substring; } if methods argument not null result correct, if not initialized result methods caller script {{ commentsubstring(item.commentlist[0].content) }} like in picture enter image description here change code this: <div class="commentdiv">{{ commentsubstring(item) }} </div> and: $scope.commentsubstring = function(ite

get result for 2 different tables in mysql -

i new mysql. have requirement, please see tables below grand_score_master autoid | user_id | package_id | grand_level | timestamp | timestring 55 | cbs_00002 | s78c_e4vt6 | 1 | ... | ... 58 | cbs_00002 | d47kndffqc | 3 | ... | ... 64 | cbs_00002 | d47kndffqc | 1 | ... | ... 65 | cbs_00002 | d47kndffqc | 2 | ... | ... mega_score_master autoid | user_id | package_id | mega_level | timestamp | timestring 1 | cbs_00002 | d47kndffqc | 1 | ... | ... expected result user_id | package_id | max_grand_leve | max_mega_level cbs_00002 | s78c_e4vt6 | 1 | 0 cbs_00002 | d47kndffqc | 3 | 1 package_id , user_id in both tables. i trying make query pass user_id 'cbs_00002' , query return max(grand_level) , max(mega_level) matching/grouping common package_id both table user. i tried select max(grand_score_master.grand_level), grand_sc

Is there a shorter way in JavaScript to trigger a function before and on resize? -

here example of mean. function x() { return ($(window).width() < 768) ? $('body').addclass('z') : $('body').removeclass('z') } function y() { x() $(window).on('resize', function() { x() }) } if don't invoke function before attached window resize event can manually invoke resize during attachment: $(window).on('resize', x).trigger('resize'); but downside of approach not fire x function create fake resize event (it can problematic in scenarios).

c# - How to bind a list item to gridview -

i retrieving bunch of strings after doing comma separation. next want bind gridview. but, throws error: a field or property name _barcodes not found on selected data source. below code: private void retrievescannedbarcodes() ////code retrieve barcodes foreach (var item in scannedbarcodes) { _barcodes.addrange(item.split(',')); foreach (var b in _barcodes) { gvscannedbarcodes.datasource = b; gvscannedbarcodes.databind(); } } and gridview code: <asp:gridview id="gvscannedbarcodes" runat="server" allowsorting="true" autogeneratecolumns="false" pagersettings-mode="numericfirstlast" pagesize="25" width="741px"> <columns> <asp:boundfield datafield="_barcodes" headertext="barcodes" itemstyle-horizontalalign="center" headerstyle-width="50" /> </colu

Trouble making a JSON string -

i'm trying upgrade existing json structure more complex one. the original idea bunch of x animals , each 1 having bunch of caracteristics: animals animal 1 claws:4 eyes:2 animal 2 claws:0 eyes:6 etc. the json this: { "animals":[ {"claws":"4", "eyes":"2"}, {"claws":"0", "eyes":"6"}, etc. ] } so can see, don't name each animal object, caracteristics of animal element of array. can use them in loop animals[x].claws now want add nest each animal, like: animals animal 1 head eyes:2 ears:2 body claws:4 tails:1 legs:4 animal 2 head eyes:6 ears:0 body claws:0 tails:0 legs:8 but didn't manage without naming each animal object (with same name "animal") , using arrays what's in animal: { "animals":[ {"animal":[ {"head":

multithreading - C# TCP Client sends a message, but Server is not receiving the message -

this question has answer here: cross-thread operation not valid: control accessed thread other thread created on 16 answers this error : ** exception thrown: 'system.invalidoperationexception' in system.windows.forms.dll additional information: cross-thread operation not valid: control 'displaytext' accessed thread other thread created on. ** i created multi threaded client , server application using on c#. researched error not find relevant answer. know comes when 2 or more threads started on program...but server side has 1 thread...i don't know why comes.......... here server side: private void handler() { try { byte[] b = new byte[100]; int k = s.read(b, 0, b.length); //int k = s.receive(b); string szreceived = encoding.ascii.

linux - Move all folders except one -

this question has answer here: how move files , directories excluding 1 specific directory directory 3 answers i have 2 directories dir1 , dir2. need move content of folder dir1 dir2 except 1 folder dir1/src. i tried mv !(src) dir1/* dir2/ but dosn't work, still displays error bash: !: event not found maybe looking this ? the answer question there states trying to achievable using extglob bash shell option. can turn on executing shopt -s extglob or adding command ~/.bashrc , relogin. afterwards can use function. to use example of moving dir1 except dir1/src dir2 , should work: mv -vt dir2/ dir1/!(src) example output: $ mkdir -pv dir1/{a,b,c,src} dir2 mkdir: created directory 'dir1' mkdir: created directory 'dir1/a' mkdir: created directory 'dir1/b' mkdir: created directory 'dir1/c' mkdir: created

mysql - Laravel migration works in strange way -

i've dropped test database want create new database using saved migrations: 2017_03_01_000000_create_api_table.php 2017_03_06_000000_create_beeline_calls.php 2017_03_13_000000_modify_beeline_emails.php 2017_03_14_000000_interactive_forms.php 2017_03_16_000000_model_instances.php 2017_03_24_000000_create_objects.php 2017_03_24_000001_create_objects_tables_v2.php 2017_03_24_000003_make_comments_without_users.php 2017_03_27_000000_add_processed_to_announcements.php 2017_03_29_000000_create_ads_channels.php 2017_03_29_000001_announcement_client.php 2017_04_06_000000_create_filters.php 2017_04_07_000000_create_new_input_types.php when run php artisan migrate --pretend [doctrine\dbal\schema\schemaexception] there no column name 'creator_id' on table 'application_model_instance_announcement_comments'. but first migration file run 2017_03_01_000000_create_api_table.php why run not start? dat

android:appCategory in Android O. Which values? -

Image
android o introduces concept of app categories. these categories used cluster apps of similar purpose or function. developer declares in androidmanifest.xml using android:appcategory according android o features , apis documentation. what documentation isn't clear on what values can attribute be? i'm guessing discrete set of values rather string. upon installing android studio 2.4 (preview 4) , amending androidmanifest.xml , context revealed... as preview release of environment, above may not finalised , correct. still need proper documentation how attribute should used.

Excel VBA - Auto FIlter and Advanced filter usage error -

i have requirement in, need use auto filter filter data first , using advanced filter unique values alone. advanced filter doesn't take auto filtered value alone. how use them together? here goes code, colmz = worksheetfunction.match("rsdate", sheets("rs_report").rows(1), 0) activesheet.listobjects("rs").range.autofilter field:=colmz, criteria1:="yes" activesheet.range("b1:b65536").advancedfilter action:=xlfiltercopy, copytorange:=sheets("csrs").range("b14"), unique:=true kindly correct me , share suggestions. i stick unique values in array - it's faster , less break - sub uniquearray() colmz = worksheetfunction.match("rsdate", sheets("rs_report").rows(1), 0) activesheet.listobjects("rs").range.autofilter field:=colmz, criteria1:="yes" call creatary(curary, sheets("rs_report"), letter(sheets("rs_report"), "rsdate")):

drupal modules - DRUPAL8 node alter form - options unset field not able to save data manually> -

Image
i alter form(monthlytraining document) my code: function mymonthlytrainingdocument_form_node_form_alter(&$form, \drupal\core\form\formstateinterface $form_state, $form_id) { //kint($form); if($form['#form_id'] === 'node_monthly_technical_documents_form' || $form['#form_id'] === 'node_monthly_technical_documents_edit_form') { $fas = good; $form['title']['widget'][0]['value']['#default_value'] = $fas; $form['field_document_name']['widget'][0]['value']['#default_value'] = 'nodealter'; unset($form['field_document_domain']['widget']['#options']); // $fsad = array('yes'=>'yes','no'=>'no', 'ohter' => 'other'); $form['field_document_domain']['widget']['#options']= _load_chkstate(); $form['actions']['submit']['#submit'][] = 'm

bash - linux dialog --checklist error -

i working on following linux dialog box. not able understand it's behavior. works correctly i.e. correctly displays 3 checkboxes. #!/bin/sh dialog --backtitle "test" \ --title "checkbox test " \ --checklist "choose following" 0 0 0 \ apple "the apple green" on \ mango "the mango golden" on \ pappaya "the pappaya brown" on \ 2> /tmp/optional.out optional=`cat /tmp/optional.out | \ sed -e "s/\"//g" -e "s/ /|/g" -e "s/|$//"` echo 'optional :'$optional after execution following output as. optional :apple|mango|pappaya however want show user 2 options. made following changes. #!/bin/sh dialog --backtitle "test" \ --title "checkbox test " \ --checklist "choose following" 0 0 0 \ apple "the apple green" on \ mango "the mango golden" on \ #pappaya "the pappaya brown" on \ 2> /tmp/optional.out optiona

javascript - Uncaught TypeError: Cannot read property 'prototype' of undefined (inherits_browser.js) -

Image
after porting our app newer version of create-react-app following error started occurring: seems reffering inherits_browser.js coming npm module can't pinpoint. line error refers in file ctor.prototype = object.create(superctor.prototype, , seems used webpack somehow. has experienced issue before / can suggest problematic areas can occur in? edit digging deeper issue seems coming file (cipherbase.js) i had exact problem today. guess had outdated package in project's node_modules folder, because removing , reinstalling fixed problem. rm -rf node_modules dist npm install webpack --config ./webpack_prod.config.js notice in case webpack installed locally devdependency . doing rm -rf node_modules , npm install reinstalled webpack , dependencies. for reference, i'm running webpack 2.2.1, node.js 7.7.4 , npm 4.1.2.

tomcat - Optimizing Camel HTTP4 with KeepAlive -

i want able post messages https server using camel @ pretty fast rate ( > 1500/sec) using 1 connection server. i tried setting keepalive true, still cant see improvement in speed. took tcpdump while sending 5 messages, , find 5 syn/ack packets on wireshark. possibly ssl certificate being sent on each post. (102 packets captured tcpdump, sending 5 "helloworld" strings) is there way can speed things up? code used: camelcontext context = new defaultcamelcontext(); final httpcomponent http = (httpcomponent) context.getcomponent("https4"); http.setconnectionsperroute(1); http.setmaxtotalconnections(1); httpconfiguration httpconfiguration = new httpconfiguration(); http.sethttpconfiguration(httpconfiguration);; context.addcomponent("fcphttpcomponent", http); template = context.createproducertemplate(); headers.put(exchange.content_type, "application/json"); headers.put(exchange.http_method, http

javascript - Reset or Clear Cubism Graph -

i'm trying reset or clear d3.js cubism graph starts fresh. here code : $(function(){ // create new cubism.js context render var graphcontext = cubism.context() .serverdelay(1000) // allow 1second delay .step(1000) // 1 second steps .size(650); // 50px wide // create new metric // allows retrieve values source // data-source agnostic, not matter. var graphmetric = graphcontext.metric(function(start, stop, step, callback) { var values = []; start = +start; stop = +stop; while (start < stop) { start += step; values.push(math.random()); } callback(null, values); }); // here create new element , append our // parent container. call d3 select newly created // div , can create chart var graphelement = document.createelement("div"); $("#insertelement").append(graphelement); d3.select(graphelement).call(funct

angularjs - angular Routing: when I call controller the second will be executed -

im uning angular make page login, use template login.html , controller login.html, problem when call login controller main controller executed automatically ! and found : warning: tried load angular more once. this js: trainingapp.config(['$routeprovider' ,function($routeprovider){ $routeprovider .when('/login',{ templateurl: 'login.html', controller: 'loginctrl' }) .when('/',{ templateurl: 'index.html', controller: 'mainctrl' }) .otherwise({ redirectto : "/" }); }]); trainingapp.controller('loginctrl',['$scope', function($scope){ $scope.alertt = function(){ // console.log("ok"); alert("okkkkkkk"); } }]); trainingapp.controller('mainctrl', ['$scope','$timeout', 'apiservice','$location', function ($scope,$timeout, api

excel - Connect VBA to MySQL -

Image
i know has been asked many times, none of them helped in case. so here piece of code: dim oconn adodb.connection sub macro1() set oconn = new adodb.connection oconn.connectionstring = "driver={mysql odbc 5.2 ansi driver};" _ & "server=server;" _ & "database=db;" _ & "uid=user;pwd=pw; option=3" oconn.open what wrong?

rest - How to get Register Graph API results in XML format? -

at register graph api documentation site ( https://developers.ir.ee/graph-api ) there examples getting request responses rest service in json format. there support xml? add suffix .xml end of requests such in following (if basic query https://graph.ir.ee/organizations/ee-10722958/members ): curl -d- -x -h "authorization: basic xxxxx" -h "content-type: application/xml" https://graph.ir.ee/organizations/ee-10722958/members.xml

apache spark - Read JSON with odd format -

i testing skills easy data . apparently data comes serious challenge, data comes in property called data in array of arrays, not in array of jsons. troublesome because examples spark's json support i've found require data comes in series of jsons. { ... "data" : [ [ 1, "5dc7f285-052b-4739-8dc3-62827014a4cd", 1, 1425450997, "714909", 1425450997, "714909", "{\n}", "2013", "gavin", "st lawrence", "m", "9" ] , [ 2, "17c0d0ed-0b12-477b-8a23-1ed2c49ab8af", 2, 1425450997, "714909", 1425450997, "714909", "{\n}", "2013", "levi", "st lawrence", "m", "9" ] , [ 3, "53e20da8-8384-4ec1-a9c4-071ec2ada701", 3, 1425450997, "714909", 1425450997, "714909", "{\n}", "2013", "logan", "new york", "m

c - Why does the kretprobe of the _do_fork() only return once? -

when write small script fork, syscall returns twice processes (once per process): #include <stdio.h> #include <unistd.h> int main(int argc, char *argv[]) { int pid = fork(); if (pid == 0) { // child } else if (pid > 0) { // parent } } if instrument systemtap, find 1 return value: // fork() in libc calls clone on linux probe syscall.clone.return { printf("return clone\n") } ( systemtap installes probes on _do_fork instead of clone, shouldn't change anything.) this confuses me. couple of related questions: why syscall return once? if understand _do_fork code correctly, process cloned in middle of function. ( copy_process , wake_up_new_task ). shouldn't subsequent code run in both processes? does kernel code after syscall run in same thread / process user code before syscall? creation of child can fail, errors have detected , handled the child has different return value , has handled

java - Spring named "IN" query producing error when given more than one entry -

Image
i'm using spring's named queries access data , came upon issue. have rather long named query in spring data repo: list<landscapelocationentity> findbyidcustomeridandidproductgroupandidproductidandidlocationidinandactiveflag(string customerid, string productgroup, string productid, list<integer> locationid, boolean activeflag); the query works fine long provide list<integer> 1 entry. there entry throw java.sql.sqlexception: borrow preparestatement pool failed . as can see in screenshot, call different actual query (locationid(?,?) vs. locationid(?)). have workaround executes queries separately that's not way want have in long term. if need further information please tell me. update: prove point removed other attributes , still same error: query now: list<landscapelocationentity> findbyidlocationidin(list<integer> locations);

c - cat breaks the program, manual stdin input doesn't -

i have small program: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> int main() { int orig = 1; (int = 0; (i != 3) && orig; ++i) { orig = orig && fork(); } if (orig) { (int = 0; != 3; ++i) { wait(null); } } else { int num; scanf("%8d", &num); printf("%d\n", num*num); } } which supposed square 3 numbers reads stdin . , if type numbers in myself, works: akiiino$ ./out.out 12345678 12345678 12345678 260846532 260846532 260846532 but if use cat same purpose, not work expected: akiiino$ cat in.txt 12345678 12345678 12345678 akiiino$ cat in.txt | ./out.out 260846532 0 0 what reason behind weird behavior , fixable? i've assumed cat ing files no different typing them stdin . the difference when type 3 numbers by hand , reading terminal , low level reads terminated on newlines. let

jquery - how to submit form and stop submit form based on ajax response -

i using form onsubmit tag. , in onsubmit function call ajax , return true in success function , false in error section. form has been submitted. html <form action="/" method="post" onsubmit="return formsubmit()"> script function formsubmit() { "use strict"; var isbasic = $(".test").val() //this hidden element if (isbasic === "true") { return true; } if (isbasic === "false") { $.ajax({ type: "post", url: "/", data: "sample", success: function (data) { if (data.success) { return true; } if (!data.success) { return false; } }, error: function () { } }); } } } this doesnt work me. form submitted. please me resolve this.

javascript - ReferenceError: Can't find variable: exports -

question: why getting following error? did forget include script in html? referenceerror: can't find variable: exports generated javascript typescript causes it: "use strict"; object.defineproperty(exports, "__esmodule", { value: true }); /* more code */ extra: tsconfig.json { "compileonsave": true, "compileroptions": { "target": "es5", "noimplicitany": true, "rootdir": ".", "sourceroot": "../../../", "outdir": "../../../js/dist/", "sourcemap": false }, "exclude": [ "node_modules" ] } requirejs included before js files in html there similar questions typescript , not ember/babel/etc.

reactjs - react native Map not update details, when zoom -

i have problem in react native maps. want add google map in application & when zoom map, map detail show more detail road.. google maps in website. the problem is, when zoom map. map zoom, not re render component, map detail still same. change state when longitude & latitude changed, map still same. have idea solving problem? thank you import react, { component } 'react' import { view, text, stylesheet, touchableopacity, dimensions } 'react-native' import { connect } 'react-redux' import mapview 'react-native-maps' import * actiontypes '../actions/constant.js' import sampledata '../helper/sampledata.js' // import mapstyle '../helper/mapstyle.json' const { width, height } = dimensions.get('window') const aspect_ratio = width / height const latitude_delta = 0.0922 const longitude_delta = latitude_delta * aspect_ratio class getgeolocation extends component { constructor (props) { super(props) th

How to use angularjs and mustache -

i found directive , want use display variable angularjs , compile mustache. var myapp = angular.module('demoapp', []); myapp.directive('jnhmustache', [function () { var declaration = {}; declaration.restrict = 'e'; declaration.scope = { data : '&', watch : '=' }; declaration.transclude = false; declaration.link = function (scope, element, attrs) { function render () { var html = mustache.render(scope.template, scope.data()); element.html(html); }; scope.template = element.html(); element.html(''); scope.$watch(function () { var result = scope.data()[scope.watch].length; return result; }, function () { render(); }, false); }; return declaration; }]); myapp.controller('exampleco

GWTP Tab and Dialog -

i have gwtp application i create popuppresenter dialog https://dev.arcbees.com/gwtp/core/presenters/popups.html one of widgets mush contains tabpanel do need add tabcontainerpresenter each popuppresenter tab or enough popuppresenter ???? applicaticationpresenter call popuppresenter popuppresenter call tabcontainerpresenter or applicaticationpresenter call popuppresenter tabpanel has 3 fixed tabs

Opening a page by code in Xamarin.iOS -

below code navigates page in swift . how can run code in xamarin.ios ? let storyboard : uistoryboard = uistoryboard(name: "main", bundle:nil) let nextviewcontroller = storyboard.instantiateviewcontrollerwithidentifier("nextview") nextviewcontroller self.presentviewcontroller(nextviewcontroller, animated:true, completion:nil) here's translation: var storyboard = uistoryboard.fromname("main",null); var nextviewcontroller = storyboard.instantiateviewcontroller("nextview") nextviewcontroller; presentviewcontroller(nextviewcontroller, true, null); or if using async await: var storyboard = uistoryboard.fromname("main",null); var nextviewcontroller = storyboard.instantiateviewcontroller("nextview") nextviewcontroller; await presentviewcontrollerasync(nextviewcontroller, true);

c# - Retrieve order of open windows as ordered in the Alt-Tab list? -

this entire code of c# application, simple goal. want retrieve open windows on system, ordered how opened, in alt-tab list. alt-tab list lists programs last opened, pressing alt-tab , releasing once take last window had opened. code windows 10. code below information need, not in right order. should information need? using system; using system.collections.generic; using system.diagnostics; using system.linq; using system.runtime.interopservices; using system.text; using system.threading.tasks; namespace getopenwindowname { class program { static void main(string[] args) { process[] processlist = process.getprocesses(); foreach (process process in processlist) { if (!string.isnullorempty(process.mainwindowtitle)) { console.writeline("process: {0} id: {1} window title: {2}", process.processname, process.id, process.mainwindowtitle); }

mingw - Portaudio library not working with Qt -

i have installed , used portaudio library real time sound output on ubuntu, c++ code. main project on windows under qt creator. have tried build portaudio mingw seems have worked because when run example "bin/paex_sine" outputs sine, can't use in qt. i have linked library adding libs += -lc:/mingw/lib/ -lportaudio.dll as advised there , errors of type : undefined reference mingw_initcharmax crtexe.c i tried use flag "--enable-cxx" when running ./configure, make returns following error : c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwtype:89:11: error: '::iswblank' has not been declared using ::iswblank; ^ i don't know did wrong , how should proceed...

sitecore - Resolve ISitecoreService using SimpleInjector -

isitecoreservice accepts database name string parameter in constructor (web or master) isitecoreservice service = new sitecoreservice("master"); //or isitecoreservice service = new sitecoreservice("web"); is possible dynamically send database name parameter ioc , resolve it? example send web/master string parameter , new instance of isitecoreservice like this? container.register<isitecoreservice>(() => new sitecoreservice("master"));

javascript - save and display image captured from input type=file -

i have webpage capture image available camera feature. web version places video capture onto canvas. phone, using <input class="btn btn-info" type="file" accept="image/*" id="cameracapture" capture="camera"> capture picture. asks user either capture image using phone's camera or upload filesystem/gallery etc. once image clicked places image's name next button. there way access image , display in same page. thanks in advance you can js using filereader object. take @ answer: preview-an-image-before-it-is-uploaded i hope helps

c++ - Using gRPC with MFC in a shared DLL gives memory leaks -

i integrating grpc in windows application uses third party libraries need mfc in shared dll vs2015. build multi-threaded dll (/md) version of libprotobuf.lib , grpc++.lib , helloworld example. when set use standard windows libraries helloworld server grpc example works fine. when set use mfc in shared dll helloworld server grpc example works, exits lot of memory leaks. dumping objects -> {1475} normal block @ 0x00000259f0cb9070, 22 bytes long. data: <g r p c _ t r > 47 00 52 00 50 00 43 00 5f 00 54 00 52 00 41 00 {1398} normal block @ 0x00000259f0cb7d70, 30 bytes long. data: <g r p c _ v e r > 47 00 52 00 50 00 43 00 5f 00 56 00 45 00 52 00 ... also running piece of code, not start server, gives memory leaks. looks static allocation in grpc code , not runtime issue. int main(int argc, char** argv) { //runserver(); return 0; } is grpc+mfc combination possible?