Posts

Showing posts from September, 2014

c - GCC exiting with an error 1 even with -Wall. No explanation why? -

so tried recompile 1 of projects few weeks ago , surprise keep receiving error 1 on it. used mingw compile , eclipse cdt. have -wall flag enabled on gcc assumed if problem code have more useful information make error 1 being thrown. such, suspect issue lie in how formatted make file. luckily, did compile project when push commits last time , binaries still in repo. nevertheless, appreciate can continue improve project. edit: when -all, refuses compile. here makefile. hope simple me following incorrect syntax: cc=gcc -i../include -l..\lib override cflags+=-wall -o3 #$(shell pkg-config --cflags fftw3) #override ldflags+=#$(shell pkg-config --libs fftw3 glib-2.0) -lm .phony: clean all: lvdoenc lvdodec lvdoenc: lvdoenc.o lvdomain.o $(cc) $(cflags) -o $@ $^ $(ldflags) -i../include -l../lib -lfftw3 lvdodec: lvdodec.o lvdomain.o $(cc) $(cflags) -o $@ $^ $(ldflags) -i../include -l../lib -lfftw3 %.o: %.c $(cc) -c $(cflags) -o $@ $^ lvdoenc.c: lvdocommon.h lvdodec.c: ...

spring data - ElasticSearch and SpringData: FindAll and OrderBy -

i need documents, ordered fied ( parent in case). in itemrepository added following signature: public list<item> findallorderbyparent(); but invoking it, a org.springframework.web.util.nestedservletexception: request processing failed; nested exception org.springframework.data.repository.query.parameteroutofboundsexception: invalid parameter index! seem have declare little query method parameters! the same postponing asc or desc method name. somewhere read correct syntax should following (note by after findall ): public list<item> findallbyorderbyparent(); here a nullpointerexception caused by: java.lang.nullpointerexception @ org.springframework.data.elasticsearch.core.elasticsearchtemplate.count(elasticsearchtemplate.java:333) @ org.springframework.data.elasticsearch.repository.query.elasticsearchpartquery.execute(elasticsearchpartquery.java:54) ... i'm excluding other issues because declaring method public list<item>...

Android HttpURLConnection seems to post nothing? -

any idea why not posting data? php page $_post array(0){} or in other words nothing in $_post . getdata() string full of data. i'm trying switch deprecated defaulthttpclient . httpurlconnection conn = null; try { url u = new url(url); conn = (httpurlconnection) u.openconnection(); conn.setdooutput(true); conn.setdoinput(true); conn.setchunkedstreamingmode(0); conn.setconnecttimeout(10000); conn.setreadtimeout(10000); conn.setrequestmethod("post"); conn.setrequestproperty("content-type", "application/x-www-form-urlencoded"); //conn.setrequestproperty("content-type","application/json"); conn.getoutputstream().write(getdata().getbytes("utf-8")); conn.connect(); inputstream content = new bufferedinput...

SQlite WAL-mode in python. Concurrency with one writer and one reader -

i'm trying share sqlite3 database between 1 writer process, , 1 reader process. however, not work, , seems me nothing being written in example.db. reader.py import sqlite3 time import sleep conn = sqlite3.connect('example.db', isolation_level=none) c = conn.cursor() while true: c.execute("select * statistics") try: print '**' print c.fetchone() except: pass sleep(3) writer.py import sqlite3 time import sleep import os if os.path.exists('example.db'): os.remove('example.db') conn = sqlite3.connect('example.db', isolation_level=none) c = conn.cursor() c.execute('pragma journal_mode=wal') print c.fetchone() c.execute("create table statistics (stat1 real, stat2 real)") stat1 = 0 stat2 = 0.0 while true: stat1 += 1 stat2 += 0.1 cmd = "insert statistics values (%d,%f)" % (stat1, stat2) print cmd c.execute(cmd) #conn.commit() ...

html - Undefined Variable on this tutorial on PHP with Bootstrap -

please me fix undefined variable copy , pasted code on create.php , when hit create button on home page this: notice: undefined variable: fnameerror in c:\xampp\htdocs\testcrud\create.php on line 70 notice: undefined variable: lnameerror in c:\xampp\htdocs\testcrud\create.php on line 75 notice: undefined variable: ageerror in c:\xampp\htdocs\testcrud\create.php on line 80 notice: undefined variable: gendererror in c:\xampp\htdocs\testcrud\create.php on line 89 <?php if ( !empty($_post)) { require 'db.php'; // validation errors $fnameerror = null; $lnameerror = null; $ageerror = null; $gendererror = null; // post values $fname = $_post['fname']; $lname = $_post['lname']; $age = $_post['age']; $gender = $_post['gender']; // validate input $valid = true; if(empty($fname)) { $fnameerror = 'please enter first name'; ...

javascript - How can addCls to Button with ViewModel binding in ExtJS5 -

i want change css class after binding. possible in extjs5? i added comments. fiddle: https://fiddle.sencha.com/#fiddle/olc you have several problems in code: cls cannot bound there no setcls method - can bind iconcls if want you cannot add index after string such iconcls:'{rating}'[0] - syntactically incorrect if define rating formula have run function - get() try code ext.define('fiddle.view.foomodel', { extend: 'ext.app.viewmodel', alias: 'viewmodel.fiddle-foo', data: { val: 1 }, formulas: { rating: function(get) { get(); return 'hello-world'; } } }); ext.define('fiddle.view.foo', { extend: 'ext.panel.panel', xtype: 'fiddle-foo', viewmodel: { type:'fiddle-foo' }, layout: 'hbox', height: 50, width: 250, items: [{ xtype: 'button', text: ...

python - New(ish) requirements for Instagram API POST endpoint -

i wrote python script (automatically likes mediaids given user-defined list of hashtags) accesses instagram api endpoint post /media/media-id/likes using python-instagram library. program has been running year, many friends (and others) have used since. so tried set person today registering new instagram client. ran this on developer landing page. states instagram requiring users request access post endpoints. here snippet of code fails: for mid in mediaids: #rate limit 30 requests/hour time.sleep(121) api_sub2 = iglogin_api() try: api.like_media(media_id=mid.id) like_count +=1 userids.append(mid.user) liked_mediaids.append(mid) img_urls.append(mid.images['standard_resolution'].url) except: e = sys.exc_info()[0] print "already liked %s or %s" % (str(mid),str(e)) the exception raised: c:\users\andrew\desktop\pygram>python ig_like.py likedmedia: 1006563954514666042_16433...

Laravel 5 : php artisan route:list Illuminate\Container\BindingResolutionException] -

when use command "php artisan route:list" have error [illuminate\container\bindingresolutionexception] unresolvable dependency resolving [parameter #0 [ <required> $methods ]] in class illuminate\routing\route the command works nicely when have route::get('/', 'welcomecontroller@index'); route::get('home', 'homecontroller@index'); but add other routes, have exception i found problem : i'm doing ioc in controller , inject illuminate\routing\route. delete injection works. i have basecontroller extends controller. the basecontroller is class basecontroller extends controller { /** * @var array options used pages */ protected $options; /** * @param route $route */ public function __construct(route $route) { $this->options = option::getautoloaded(); // load options named route page $this->options = array_merge($this->options, option::getbypage($route->getaction()['as'])); $t...

xcode - Can we push the digital crown using the Apple Watch 2.0 Simulator? -

simple question: using watchos 2, , simulator in xcode 7, possible simulate pressing digital crown? can scroll using track pad, i’ve not yet found way press it. can done? instance, can see apps screen on watch simulator yet? cmd+shift+h sends same event simulated runtime pressing crown on device.

c# - Cannot have multiple items selected in a DropDownList Error -

im trying value of dropdownlist called ddlbrand moment selcted can use dynamically change items in dropdownlist called ddlsubbrand in same form. this 2 drop down list in addproduct.aspx <asp:dropdownlist id="ddlbrand" runat="server" onselectedindexchanged="ddlbrand_selectedindexchanged" autopostback="true" ></asp:dropdownlist> <asp:dropdownlist id="ddlsubbrand" runat="server"> </asp:dropdownlist><br /><br /> as code behind file, have page load bind data sql drop down list , have method selectedindexchanged i'm trying value select it. protected void page_load(object sender, eventargs e) { brandmanager brandmanager = new brandmanager(); categorymanager categorymanager = new categorymanager(); if (page.ispostback == false) { ddlbrand.datasource = brandmanager.getallbrand(); ddlbrand.datatextfield = "brandname...

javascript - Does this attach a click even to an anchor tag? -

i need add click event anchor google analytics event tracking. have main event tracking code in head section. i've done in head section: <script type='text/javascript'> window.onload=function() { document.getelementbyid("btn_2_3a4z711fbd39d2fc9634f0yt66b45ht9").addeventlistener("click", "_gaq.push(['_trackevent', 'webinar', 'register', 'webinar-july-15']);"); } </script> when inspect anchor tag, don't see event there. i'm going off of example: http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_element_addeventlistener . event doesn't show in example either when inspect it. i don't see event coming through in ga. tried modifying code testing don't see alert: .addeventlistener("click", "_gaq.push(['_trackevent', 'webinar', 'register', 'webinar-july-15']);alert('popup');"); any ideas i'm doing wro...

c# - File upload control in asp.net mvc -

i have written fileupload control in asp.net mvc.but of logic doing is, downloading excel file in server locally , processing data , pushing in oracle database.but servers due permission issues , not able retrieve data downloaded server or download in server in either way. have logic convert uploading files in stream or ever rather downloading in server locally .i dont know whether can implement httppostedfilebase.inputstream if how can implement here? view @using (html.beginform("upload", "mnis", formmethod.post, new { enctype = "multipart/form-data" })) { @*<div> <label for="file">filename:</label></div> <div class="uploadfirst"> <input type="file" name="file" id="file" /></div> @html.label("lbl", "psite_slno"); <input id="text1" name="txtsln" type="t...

java - Why does + operator on parameterized types in scala always result in string -

consider class follows: import scala.collection.mutable.{hashmap => mutablehashmap} class customhashmap[k,v](hashmap: mutablehashmap[k,v], initval: v) { def addmaps(first: mutablehashmap[k, v], second: mutablehashmap[k, v]): mutablehashmap[k, v] = { second.foreach(pair => { first += (pair._1 -> (first.getorelse(pair._1, initval) + pair._2)) } ) //the above line throws compile time error first } //other functions } upon adding 2 parameterized types there compile time error saying expected (k,v) recieved (k,string) i want know why scala implicit conversion? since operator overloading not allowed in java seemed logical in case of scala v class have method + defined it. here way how implement kind of thing manually: since looks trying define monoid i'll take liberty move initval addmaps definition of operation. this can done common typeclass pattern in scala, you'll have define manually + means each type, want use in map. ba...

c - How can child kill parent process while parent process waits until child process to terminate? -

i not understand following code: pid_t pid; int counter = 0; void handler1(int sig) { counter++; printf("counter = %d\n", counter); fflush(stdout); kill(pid, sigusr1); } void handler2(int sig) { counter += 3; printf("counter = %d\n", counter); exit(0); } int main() { signal(sigusr1, handler1); if ((pid = fork()) == 0) { signal(sigusr1, handler2); kill(getppid(), sigusr1); while (1) { }; } else { pid_t p; int status; if ((p = wait(&status)) > 0) { counter += 2; printf("counter = %d\n", counter); } } } how can child process kill parent process while parent process waits until child process terminates? note first kill() syscall misnamed, general-purpose function sending signal process. killing target process 1 of several possible results. more generally, however, signal handling is interrupt mechanism. great many library functions, including wait() can interrupted ...

Boot2Docker Image (Ubuntu) Download Very Slow on Windows 8.1 -

i've installed boot2docker on windows 8.1 trying run : docker run ubuntu /bin/echo 'hello world' download ubuntu image takes long time. have 9 mbps download speed after waiting 10 mins, still downloaded following : 4.324 mb/ 65.77 mb 1.621 mb/ 65.77 mb 1.080 mb/ 65.77 mb 540.2 kb/ 65.77 mb pulling fs layer tried many times, exits giving error untar finished status 1. unexpected eof i don't know do. not many questions seems have same error on windows. appreciated. :)

jquery - Is there a way to position divs on top of each other without using position absolute? -

so have structure(ignore russian text): .sliders-container { position: relative; width:100%; float:left; } .slider{ position: relative; overflow: hidden; float: left; } #prev, #next{ cursor: pointer; z-index: 100; } #prev{ float:left !important; } #next{ float:right !important; } <div class="sliders-container"> <a id="prev">prev</a> <a id="next">next</a> <div class="slider"> <p class="container-text"> <h1>join us</h1> </p> <p class="container-text"> <strong>Можно ли присоединиться?</strong> Да, конечно. Но сначала <a href="#">прочитайте наши базовые ожидания</a> — что мы ждем от каждого вступающего в utg. </p> </div> <div class="slider"> <p class="container-text"> <h1>Пре...

actionscript 3 - AS3 Array 1 to 100 -

i'm having trouble finding way array doesn't make me type numbers , example : (i found code online) var array:array=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] var odds:array=[], evens:array=[], odds_sum:int=0, evens_sum:int=0 ; for(var i:int = 0; < array.length; i++){ if(array[i] % 2 == 1){ odds.push(array[i]); odds_sum += array[i]; } else { evens.push(array[i]); evens_sum += array[i]; } } trace(odds); trace(odds_sum); trace(evens); trace(evens_sum); i wanted code trace numbers between 1 , 100 (including 1 , 100) don't have type them down. solving appreciated your question ambiguous , if need numbers between 1 , 100 for(var i:int = 1; <= 100; i++){ trace(i); } or if want them in array var arr:array = new array(); for(var i:int = 1; <= 100; i++){ arr.push(i); } or if want odd , numbers in separate array var odds:array = new array(); var evens:array = new...

javascript - minicart js - applying discount when buying multiple items -

i have implemented minicart js website, , can add items cart , works properly. do, when user adds 2 items @ particular price (say 11.99) discount down 20. i know there discount function minicart js documentation isn't clear. know best way achieve this? here code i'm working with: <?php // connect mysql database include "store_scripts/connect_to_mysql.php"; $dynamiclist = ''; $sql = mysqli_query($dbc, "select * products category = 'rings'"); $productcount = mysqli_num_rows($sql); if($productcount > 0) { while($row = mysqli_fetch_array($sql)) { $id = $row['id']; $product_name = $row['product_name']; $price = $row['price']; $date_added = strftime("%b %d, %y", strtotime($row["date_added"])); $dynamiclist .= ' <div id="floatedimage"> ...

google maps - efficient way to geocode huge amount of twitter user location -

i'd geocode around 2m strings representing cities or states or countries of whole world every day. theses strings not clean, (you have make distinction between "paris,france" , "paris,tx" instance, have have geocode "paris" french city !) that's why i'm looking use gmaps api or osm nominatim api. the brute force solution dump osm data on computer , process locally, hope can find easier way it. obviously, can reduce amount of strings geocoded, store results not have query twice string, still have hundred thousands strings geocode... thanks ! to comply usage policy when using osm's nominatim instance have wait 1 second between each request. geocoding 100.000 requests take around 28 hours feasible you. alternatively can use 1 of other nominatim instances (after checking usage policy!) or try install locally.

android - How to make a swipe view navigation? -

i have problem made right in program swipping of tabs isnt working showing pages. main activity.java public class mainactivity extends fragmentactivity implements tablistener { viewpager vp; actionbar actionbar; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); vp=(viewpager)findviewbyid(r.id.pager); vp.setadapter(new myadapter(getsupportfragmentmanager())); actionbar=getactionbar(); actionbar.setnavigationmode(actionbar.navigation_mode_tabs); actionbar.tab tab1=actionbar.newtab(); tab1.settext("mp3"); tab1.settablistener(this); actionbar.tab tab2=actionbar.newtab(); tab2.settext("mp4"); tab2.settablistener(this); actionbar.addtab(tab1); actionbar.addtab(tab2); } @override public void ontabreselected(tab arg0, fragmenttransaction arg1) { log.d("gul", "ontabreselected"+"postion...

java - Why is this showing wrong answer on codechef, its working on my ide -

pooja withdraw x $us atm. cash machine accept transaction if x multiple of 5, , pooja's account balance has enough cash perform withdrawal transaction (including bank charges). each successful withdrawal bank charges 0.50 $us. calculate pooja's account balance after attempted transaction . input positive integer 0 < x <= 2000 - amount of cash pooja wishes withdraw. nonnegative number 0<= y <= 2000 2 digits of precision - pooja's initial account balance. output output account balance after attempted transaction, given number 2 digits of precision. if there not enough money in account complete transaction, output current bank balance. import java.util.scanner; class hs08test { public static void main(string[] args) { scanner s =new scanner(system.in); double x = s.nextdouble(); double y =s.nextdouble(); if( x>=0.00 && x<=2000.00 &&y>=0.00 && y<=2000.00){ if(x==0...

Translating a list to another list in prolog -

i tried write simple code in prolog translate list list. instance, if call listtrans([a,b,c],l) , l become [1,2,3] . (a,b,c replaced 1,2,3). faced syntax error in last line. problem? here code: trans(a,1). trans(b,2). trans(c,3). listtrans([],l). listtrans([h|t],l1):- trans(h,b), append(b,l,l2), listtrans(t,l2). the error because in code: listtrans([h|t],l1):- trans(h,b), append(b,l,l2), listtrans(t,l2). the variable l1 declared in head, not referenced anywhere: mispelled something? anyway, code not going work. moreover, using append/3 kind of tasks defined recursion considered terrible (also because of bad performance out of it). applying function list straightforward. know in prolog don't write y = f(x) rather declare functional relation between x , y as: f(x, y). . (that's did trans(x,y) ). now (easy) recursive formulation: the transformed empty list empty list the transformation of [x|xs] [y|ys] if trans(x,y) , re...

Change locale in android app (onto Hindi) -

creating multi languages support app possibility change language in app settings. as works fine english, spanish, franch, russian languages, doesn't work hindi , chineese. 1) specify language name in original language in app instead of हिन्दी can see "hindi". \res\values-hi\arrays.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="languages"> <item name="english">english</item> <item name="russian">Русский</item> <item name="spanish">espagnol</item> <item name="russian">français</item> <item name="chineese">中国</item> <item name="hindi">हिन्दी</item> </string-array> <string-array name="languagesvalues"> <item name="english">en</item> <it...

Google Calendar API with PHP – Service Account -

i've been trying several days google calendar api , running absolutely no luck. i'm using php , service account authentication. have followed tutorial ( http://www.daimto.com/google-calendar-api-with-php-service-account/ ) , code below tutorial. i have setup developers console allow calendar api, , have added developers email address calendar share section. when run code, blank page - no error, no text of kind, blank white page. i'm lost - appreciated. cheers <?php require 'vendor/autoload.php'; session_start(); $client_id = '123456789-qwertyuiop.apps.googleusercontent.com'; $email_address = '123456789-qwertyuiop@developer.gserviceaccount.com'; $key_file_location = 'path_to_key/key.p12'; $client = new google_client(); $client->setapplicationname("client_library_examples"); $key = file_get_contents($key_file_location); // separate additional scopes comma $scopes ="https://www.goog...

multithreading - How to debug multi-threaded Python 2.7 app? -

the problem debug multi-threaded python 2.7 app on machine slow ide pycharm. remote debugging ability more desired. i tried use pdb python library seems break on main thread. find (via ctrl+f) word thread in documentation page. saw in other questions , answers debugging may enabled altering source code it's not convenient solution. writing single-threaded solution it's not cheap , simple well. is there other ways?

php - Fatal error: Cannot redeclare parse_external_url() -

i write piece of code in order parse url in web site given input(i choose web site : www.tunisie-web.org ) ,and determinate if there external script php: crawl.php 's contents <?php set_time_limit(10000); include_once('../phpcrawl_083/phpcrawl_083/libs/phpcrawler.class.php'); class mycrawler extends phpcrawler { function handledocumentinfo(phpcrawlerdocumentinfo $docinfo) { // detect linebreak output ("\n" in cli-mode, otherwise "<br>"). if (php_sapi == "cli" ) $lb = "\n"; else { $lb = "<br/>"; function parse_external_url( $url) { echo "0"."<br/>"; // abort if parameter url empty if( empty($url) ) { echo "l'url est vide"."<br/>"; } echo "1"."<br/>"; // parse home url , parameter url $link_url = parse_url( $url ); $home_url = pa...

Excell 2007 Calculations -

Image
i have excel sheet, 1 date column different description , values. how can calculate sum of values each dates using formula not pivot table. kindly arrange reply qtn possible. i need summary shown below: date jun-15 jul-15 1 175.00 200.00 2 100.00 75.00 3 200.00 175.00 4 60.00 70.00 5 20.00 225.00 6 80.00 50.00 you can use simple sumif() formula:

java - Converting h2 database from h2.db to mv.db -

i converting old h2 databases (with h2.db extension) newer mv database engine. in tables of database have problem stricter engine. just select * error, latest h2-1.4.187.jar... cannot open data anymore... the error in timestampvalue: general error: "java.lang.illegalargumentexception: timenanos out of range 86400656000000"; sql statement: select * purchases_divided [50000-187] i using embedded way. now try find rows using old jar (h2-1.3.173.jar) but cannot quite resolve way how find troubled rows.. because query in old database seem work, , no errors catched... anybody clue how solve this? i thought of select troubled rows old jar in db table, , fix timestamp field there.... , open new jar.... but need find way select them... i found 'best of worse' solution: when use recover function, can create sql dump file, , load in new database. (with new version jar well). it generate errors on rows cannot read, rest done. corrupted rows ge...

c# - Rows cannot be programmatically added to the datagridview rows collection when the control is data-bound -

this question has answer here: rows cannot programmatically added datagridview's rows collection when control data-bound 3 answers i'm new winform c#.so have problem when trying add row datagridview public void sourcefordatagridview(string str) { try { sqldataadapter da = new sqldataadapter(str, cnn); datatable dt = new datatable(); da.fill(dt); bindingsource bsource = new bindingsource(); bsource.datasource = dt; datagridview1.datasource = bsource; da.update(dt); } catch (exception ex) { messagebox.show(ex.message); } } that's source datagridview1, sourcefordatagridview("select tenthuoc,dvtinh,sl,dongia,thanhtien,hsd ctnhapthuoc join thuoc on ctnhapthuoc.mathuoc = thuoc.mathuoc join nhapthuoc o...

Java polymorphism through injection at runtime -

i hear in java can achieve polymorphism through injection @ runtime. can please show simple example of how done? search online can't find anything: maybe searching wrong. know polymorphism through interface , and extension such as class myclass extends parent implements naming in such case achieving polymorphism twice: myclass @ once of type parent , naming . don't how injection works. idea not using @override keyword during injection. hope question clear. thanks. so end result here, per understanding, change behavior of method through injection instead of @override during development. so know polymorphism through interface , and extension such as class myclass extends parent implements naming this known inhertiance , not polymorphism. myclass is parent , myclass naming . being said, inheritance allows achive polymorphism . consider class other than myclass implements naming : class someotherclass implements naming { @override ...

c - How can I determine the length, in seconds, of a Vorbis stream? -

how can determine length, in seconds, of ogg vorbis stream libvorbis and/or libvorbisfile? as far can tell, there's nothing in vorbis_info structure tells me length of stream. using lower level api, can ov_time_total .

php - How To Make Featured Image/Post Thumbnail to be the background image of a DIV? -

so have code: <?php $background = wp_get_attachment_image_src( get_post_thumbnail_id( $page->id ), 'full' ); ?> <div class="imgholder" style="background-image: url('<?php echo $background[0]; ?>');"> the first line (php) , enable featured image/post thumbnail background image of specified div container. the second line div container css style of background assigns featured image/post thumbnail. to summarize, code works make featured image/post thumbnail ( in its default size ) background image. the codes works charm, hands down person coded that! my situation, want modify fit needs. i have function below tasked crop , resize image. add_theme_support('typeoneimage'); set_post_thumbnail_size( 726, 525, true ); add_image_size( 'typetwo', 726, 525, true ); my problem is, how can integrate 2 codes one. what i'm trying achieve here make featured image/post thumbnail attachment 'typeon...

c# - Implementing scroll bar along x-axis -

i trying implement scroll bar along x-axis, failed , can 1 please......this code: namespace windowsformsapplication2 { public partial class form1 : form { chart chart2 = new chart(); chart chart3 = new chart(); int[] rand; int[] rand1; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { chart2.width = 1000 ; chart2.height = 200; this.controls.add(chart2); this.controls.add(chart3); chart2.mousemove += new mouseeventhandler(chart2_mousemove); //chart2.gettooltiptext += new eventhandler<tooltipeventargs>(chart2_gettooltiptext); chart2.chartareas.add("area"); chart2.chartareas[0].cursorx.autoscroll = true; chart2.chartareas[0].cursorx.interval = 1; chart2.chartareas[0].axisx.labelautofitstyle = labelautofitstyles.none; chart2.chartareas[0].axis...

Python 3 bytes vs strings -

this may duplicate can't solve problem. line gives me error typeerror: 'str' not support buffer interface . unescaped = html.replace(r'\""', '"') does mean have write unescaped = html.replace(bytes(r'\""', 'utf-8'), bytes('"', 'utf-8')) each time need replace string? thank in advance. you using literal values use bytes literal string, b prefix: unescaped = html.replace(rb'\""', b'"')

php - How to share data between clients using JavaScript? -

i have variable json, want make on php page able see same variable contents. this code should explain more of situation. (i trying make page won't reload) var chats = []; var j = jquery.noconflict(); j(document).ready(function() { setinterval(function(i){ var txt = ""; var x; (x in chats) { txt += chats[x] + " <br />"; } document.getelementbyid("json").innerhtml = json.stringify(chats); }, 1000) }); j(document).ready(function() { j('#post_button').click(function() { $text = $('[name=message]').val(); $sender = $('#texta').val(); chatstuff = { "sender" : $sender, "message" : $text, }; chats.push(chatstuff); $('[name=message]').val(""); }); }); ...

d3.js - Display CSV data - 1 row, several bars with d3/dimplejs -

as example i've got short csv file 1 row of data: id,amountx,amounty,amountz 1,2,1,7 now chart should display 3 bars - 1 2 units tall, 1 one unit tall , 1 7 units tall. can't working @ .. that's code: <head> <script src="http://d3js.org/d3.v3.min.js"></script> <script src="http://dimplejs.org/dist/dimple.v2.1.2.min.js"></script> </head> <body> <div id="chartcontainer"> <script type="text/javascript"> var svg = dimple.newsvg("#chartcontainer", 590, 400); d3.csv("tester.csv", function (data) { var mychart = new dimple.chart(svg, data); mychart.setbounds(60, 30, 510, 305) mychart.addcategoryaxis("x", ["amountx", "amounty", "amountz"]); mychart.addmeasureaxis("y", "amountz"); mychart.addseries(null, dimple.plot.bar); mychart.addlegend(65, 10, 510,...

c# - Databinding a Datagrid -

after being unsuccessful in databinding observable collection datagrid ( another question in same forum ), tried reduce scope. project has 1 datagrid, 1 observablecolection , 1 class. still databinding failing.. please help.. using system.collections.objectmodel; using system.windows; namespace testdatagrid { /// <summary> /// interaction logic mainwindow.xaml /// </summary> public partial class mainwindow : window { public mainwindow() { initializecomponent(); } } public class mainviewmodel { public observablecollection<optionstrike> oos = new observablecollection<optionstrike>(new optionstrike[] { new optionstrike("put", 7500.00, 12345), new optionstrike("call", 7500.00, 123), new optionstrike("put", 8000.00, 23645), new optionstrike("call", 8000.00,99999) ...