Posts

Showing posts from January, 2014

linux - How can I connect Open vSwitch port and virtual ethernet interface? -

what want send packet server through open vswitch in bare metal pc, not on vm. for doing that, i'm thinking of following structure. server pc ----------------------------- | ------ | | |server| | | ------ | | |veth2 (192.168.0.152)| | | | | |veth1 | | ----------- | | | ovs (br0) | | | ----------- | | |eth0 (192.168.0.157) | -------|--------------------- | -------|-------- | client pc | ---------------- for making above environment , did below commands. create ovs bridge ovs-vsctl add-br br0 make eth0 ovs port ovs-vsctl add-port br0 eth0 create veth link ip link add veth1 type veth peer name veth2 ifconfig veth1 ifconfig veth2 finally, set client arp table statically because ovs port (eth0) cannot send arp reply after that, tried tcp connection between client ,

terminals and C -

i reading book called "beginning linux programming". ask line of code (from page 204): if (output_stream) putc(char_to_write, output_stream); i can't understand line. appreciated. in if (output_stream) putc(char_to_write, output_stream); if(output_stream) condition. if output_stream not null , putc execute. the function putc declaration int putc (int char, file *stream) writes character (an unsigned char ) specified argument char specified stream , advances position indicator stream. in short, writes character(first argument) second argument.

refresh div using (only using) php without page reload -

is there way refresh div using php (no javascrip, jquery, ajax...). without reloading page. i tried reloads complete page. <?php $page = $_server['php_self']; $sec = "5"; ?> <meta http-equiv="refresh" content="<?php echo $sec?>;url='<?php echo $page?>'"> ?> it impossible refresh div without reloading of whole page (without using of form of javascript). ... , way, told me time ago, questions answer yes or no , deprecated.

Errors in c program -

so here code: #include <stdio.h> #include <stdlib.h> //funkcija dodavanja u red void add(cvor* red, int i, cvor broj){ //errors appear in line red[i] = broj; } // brise iz vadi iz reda clan koji je prvi usao cvor delete(cvor *red, int i){ cvor a; int e; = red[0]; (e = 1; e < i;e+=1){ red[e - 1] = red[e]; } return a; } //definiticja strukture cvora typedef struct temp{ double info; struct temp* levi; struct temp* desni; }cvor; // pravljenje novog cvora cvor *novi_cvor(cvor *levi_sin,cvor *desni_sin,double broj){ cvor *novi = malloc(sizeof(cvor)); novi->levi = levi_sin; novi->desni = desni_sin; novi->info = broj; return novi; } void main(){ int i=0,e,n; cvor *red; double broj; // definisanje reda kao dinamcikog niza red = calloc(50, sizeof(cvor)); // u red unosimo clanove liste redom printf("uneti broj clanova liste"); scanf_s("%d",

c++ - Is there a cross-platform library for windows manipulation? -

is there library has equivalents winapi findwindow , enumwindows , windowfrompoint , childwindowfrompoint , getwindowrect , getwindowtext , enumdisplaymonitors etc. supported on each platform: windows, x11, os x, ... ? there xgetwindowproperty , xfetchname, etc. functions on linux, nswindowlist, cgsgetwindowproperty(), etc. on mac. want wrapper library abstraction layer these functions, can use same code on platforms. those functions windows platform specific only. can't use them on other operating systems use libraries , dll files run on windows based systems only. if want make cross platform apps using c/c++, should consider api's qt or gtk. have functions run on platforms without changes.

javascript - Custom Directive not working in AngularJS error: $injector:modulerr -

i working jquery , html , found have write nav bar code each pages. decided add custom directive in file. have worked angularjs long time ago , in basic. appreciating. thank you. html file: <html ng-app="navmodule"> <head> <link rel="stylesheet" type="text/css" href="css/front.css"> <script src="js/angular.min.js"></script> <script src="js/customdirective.js"></script> </head> <body> <!-- custom directive--> <div> <nav-bar> </nav-bar > </div> <!-- custom directive --> </body> </html> angularjs code: (function(){ navmodule = angular.module("navmodule", []); navmodule.directive("navbar", function() { return { restrict: 'e', templateurl: "custom/navbar.html" }; }); })(); and navbar.html code: <h2> navigat

.htaccess not working on xampp localhost server -

.htaccess not working on xampp localhost server i tried lot of methods on stackflow still coudn't work.. should do? please.. i'm hosting on godaddy , it's working online not working on xampp localhost found problem! i added -multiviews .htaccess file when upload godaddy server, otherwise wouldn't work on godaddy.. had change -multiviews +multiviews before rewriteengine on options +followsymlinks -multiviews -indexes after rewriteengine on options +followsymlinks +multiviews -indexes

jquery - How can I I pass "12mca22@nirmauni.ac.in" in ajax data field? -

Image
i trying pass 12mca22@nirmauni.ac.in in ajax giving me such error 'unexpected token illegal.' how can pass such string in ajax? this code $.ajax({ url:'http://localhost/student', type: 'post', data: { data:"12mca22@nirmauni.ac.in" }, success: function(data) { alert(data); } }); your string fine, jquery's throwing fit because you've got comma. remove it: data: { data:"12mca22@nirmauni.ac.in" }, and should fine. jquery expects data field contain json object, comma there makes json syntax invalid , it's unexpected, error message says the below code executes fine. $.ajax({ url:'http://httpbin.org/post', type: 'post', data: { data:"12mca22@nirmauni.ac.in" }, success: function(data) { console.log(data); } }); <

oop - Php, inheritance, late static binding, unexpected calling chain -

consider code: class c { public function get() { echo 'c'; static::get(); } public function save() { self::get(); } } class b extends c { public function get() { echo 'b'; static::get(); } } class extends b { public function get() { echo 'a'; } } $x = new a(); $x->save(); it echoes ca while expected cba to work way want, reverse logic - save call static::get() start @ top of inheritence tree; , use calls parent::get() in each inherited class in tree (except base level) before echoing own output class c { public function get() { echo 'c'; } public function save() { static::get(); } } class b extends c { public function get() { parent::get(); echo 'b'; } } class extends b { public function get() { parent::get(); echo 'a';

arrays - PHP preg_split both slashes -

i have string this: "c:\users\jamie/desktop/test.txt" i want use preg_split split string array this, using code: $arr = preg_split("/(\\|\/)/", "c:\users\jamie/desktop/test.txt"); what expect is: array(0=>"c:",1=>"users",2=>"jamie",3=>"desktop",4=>"test.txt") but got is array(0=>"c:\users\jamie/desktop/test.txt") how can expected result using preg_split ? simple: $parts = preg_split('~[\\\\/]~', $filename); the ~ delimiters. regular expressions can use pretty delimiter. so, instead of /.../ can ~...~ . when working backslashes have double-escape them, \\\\ . regular expression engine come out \\ . in other words, both backslashes in \\ need escaped, hence \\\\ . you can use following, if prefer. $parts = preg_split('/[\\\\\/]/', $filename); edit. little confusing. maybe explain in way: in php \\\\ seen 2 escaped backs

c++ - Qmake copy multiple files while building -

i have list of files in qmake project. , want them copied in build directory @ build time. my qmake file below other_files += \ input1 \ input2 \ input3 \ i'm using linux. i've read few stack overflow questions , googled problem cannot find exact solution. can done using for() loop. may need adjust build_dir variable. "other" files takes current directory. other_files += \ input1 \ input2 \ input3 \ build_dir = build for(file, other_files) { eval($${file}.depends = $$file) eval($${file}.target = $$build_dir/$$file) eval($${file}.commands = cp $$file $$build_dir/) qmake_extra_targets += $${file} pre_targetdeps += $$build_dir/$$file }

c# - Image Field required when updating/Editing a table with EF and MVC -

i have abit of confusing issue here. creating blog in mvc. users of blog can post blog. have changed post table in enitity framework include ability upload picture (varbinary(max)) . i have handled in user create post controller action , can upload , display pictures on users posts . however problem comes when administrator has allow publishing of post (simple controller scaffolding edit) . (no user can post without approval) have field in post table called published (bit, not null) . when try edit post of user publish admincontroller, error when save changes: myblogger.models.post: picture field required. [httppost] [validateantiforgerytoken] public actionresult edit(post post) { try { if (modelstate.isvalid) { db.entry(post).state = entitystate.modified; db.savechanges(); return redirecttoaction("index"); } } the problem diffic

java - distinguishing string based on space between them -

i have text file generated application contains strings this: 26 50 597 424 561 499 849 283 76 115 81 4 26 public void listingcoord() throws ioexception{ file f = new file("coord.txt"); filewriter writer = new filewriter(f); for(string s: interationlist){ writer.write(s+"\n"); } writer.close(); } public void replay(){ bufferedreader br = null; try{ string line; br = new bufferedreader(new filereader("coord.txt")); while((line = br.readline())!=null){ system.out.println(line); } } catch (ioexception io){ io.printstacktrace();} try { br.close(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } the code listing string above. there list contains strings displayed, , list , replay methods write , read lines. what want reading integers, in different way. know how read text file

json - Android: Indeterminate progress bar for ServerCall routine. -

i'm working on simple i.m android app class makes queries server , displays results (i.e messages) on listview. 1 of requirements app display indefinite progress bar while query being made. means have set progressbar widget view.visible when query begins , view.invisible when query over. trouble i'm having query background function defined in different java class, while i'd this: progressbar pb = (progressbar) findviewbyid(r.id.progressbar); pb.setvisibility(view.visible); ... ... uploader.execute(mycallspec); ... ... pb.setvisibility(view.invisible); this doesn't work, because server call runs in background. using code, it's if progress bar never displayed. how set progress bar displayed when service call begins , invisible when call completed? go ahead asynctask class mytask extends asynctask<void, void, void> { private progressbar pb; public mytask(progressbar pb) {

How to get digital signature value from x509 certificate in C# -

does know how possible c# digital signature value x509 certificate (which in x509store , not validate file) , show example in textbox. know getrawcertdatastring() returns raw data entire x509 certificate includes digital signature on last rows can not find command returns digital signature. your best way asn.1 parser , extract digital signature, or p/invoke stuff. need use cryptdecodeobject function , pass x509_cert lpszstructtype parameter. function returns (in pvstructinfo ) pointer cert_signed_content_info structure. structure has signature field simple bit_blob structure byte array in cbdata , pbdata fields (use marshal.copy copy bytes unmanaged memory managed byte array).

html5 - how youtube produce different quality video for one uploaded video -

Image
i developing video sharing website. things 1 question in mind. example: upload video of 720p youtube. issue is: youtube shows different quality videos in player 360p 480p etc question: encode video while uploading different types? or question: there ability of flash/html5 player provide different resolution having different size same uploaded video? br they transcode video. need before user wants it, e.g. video uploaded, transcode (into different qualities , formats - might choose 360p, 480p, 1080p, 1440p , 4k in mp4, webm , ogg each), visitor loads page, , assessing hardware , network, choose right format them. a way use aws's elastic transcoder service , store videos in s3 - you'll need lot of storage quite quickly. aws's elastic transcoder deals setting up, , it's pretty reasonsable: "pay use. there no minimum fee. pricing depends on duration , resolution of content output." it looks charge $0.15 turn 10 minutes of vi

java - How to override a indirectly invoked method -

i not sure how title question properly, try describe clear can : . interface interfaceb { void methodb(); } class classb implements interfaceb { void methodb() { //... } } class classa { interfaceb methoda() { return new classb(); } } class myclass { public static void main(string[] args) { classa = new classa(); interfaceb b = a.methoda(); b.methodb(); // override guy } } i want override methodb, without change classa , classb. appreciate ideas. this can : classa = new classa() {//extend class interfaceb methoda() {//override methoda return new classb() {//extend class b void methodb() {//override methodb //... } }; } }; you have overidden methodb without changing either class or class b. being said, don't need extend classa. create factory , pass classa dependency , pass parameter methoda telling concrete implementation of classb should used call methodb

wordpress plugin - Upload progress bar on contact form 7 -

i have friend has website , has clients uploading big files contact form time. form not percentage of upload, people go away cause think website blocked. contact form url http://www.smalllinks.com/68g7 the way avoid build contact form has upload progress bar. programmed website in wordpress , have used contact form 7 (which hooked plugin database unfortunately cannot change). have looked on net make little hack form , have found fix https://wordpress.org/support/topic/how-to-add-progress-bar-in-file-upload-on-submit-form but unfortunately not seem work on current contact form 7 plugin (i think folder structure changed. anybody kindly me find quick solution it? small hack or something? need progress bar upload. thanks lot cheers the instructions in link provided still work minor modifications step 1... in /wp-content/plugins/contact-form-7/includes/contact-form.php after: $html .= '</form>'; add: $html .= '<div id="progressbox&q

postgresql - Writing SQL query to find ranking -

i'm trying determine given person how many people have better score do, , group different teams belong to. so, in tables below, i'm grabbing list of team_id team_person table person_id matches person care about. me of teams belong to. then need know each person_id in team belong can find out maximum score performances table. once have that, want determine, each team_id , how many people on team have better score do, better defined having larger value. i've gotten way beyond abilities sql @ point. have far, seems me maximum score people care about, (basically final "by team" requirement) this: select person_id, max(score) m performances category_id = 7 , person_id in ( -- find people on teams belong select distinct person_id team_person team_id in ( -- find teams belong select distinct team_id team_person person_id = 2 ) ) group person_

php - checkbox values not passed through JSON -

it working fine. i'm surprise find of sudden, checkbox values not passed through in $_post via json. can't seem understand why. me this.below checkbox in php. $subjects_id= $row['subid']; <td><input type="checkbox" name="sub['.$subjects_id.']" id="sub" value=""> </td>'; json $("document").ready(function(){ $(".form").submit(function(){ var data = { "action": "test" }; data = $(this).serialize() + "&" + $.param(data); $.ajax({ type: "post", datatype: "json", url: "response.php", //relative or absolute path response.php file data: data, success: function(data) { $(".the-return").html( "favorite beverage: " + data["favorite_beverage"] + "<br />favorite restaurant: " + data["favorite_res

visual c++ - How to compare 1 point cloud data with 1 or more point cloud data? -

i want compare point cloud data(.pcd , .ply file) 1 or more point cloud data , want similar points or patches. want know technique or algorithm has used? what want is: feature point detection: find points on surface of point cloud have unique , descriptive neighbourhood. feature estimation: these points , neighbours (usually in spherical radius r) compute descriptor. can histogram, simple value or multi dimensional vector. depends on descriptor you're using. find correspondences: both point clouds, compare these descriptors , find matching ones (these correspondences) , try find these correspondences in way 1 point cloud fits other. reject correspondences not match. if 2 clouds have set of matching correspondences can these 2 similiar. i'd suggest use point clouds library (pcl). there's pretty tutorial here: http://pointclouds.org/documentation/tutorials/correspondence_grouping.php#correspondence-grouping also there overview of feature algorith

mod rewrite - Apache httpd.conf - Link multiple domains to corresponding subfolders -

i need rule internally rewrite several domains, , without www: www.a.com --> /m/n/o/ b.c.org --> /x/y/z/ the setup apache running locally on windows (xampp). i've got hosts file set domains point localhost. i'd every page redirected, i.e. want point each domain it's own different root directory , have work there. e.g. / <-- top level folder, under here. /root/of/domain/a/ <-- www.a.com /root/of/domain/c/ <-- b.c.org you have 2 choices. (1) 1 asked ( with mod_rewrite ) <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{http_host} ^(?:www\.)?a\.com$ [nc] rewriterule ^/(.*)$ /root/of/domain/a/$1 [l] rewritecond %{http_host} ^b\.c\.org$ [nc] rewriterule ^/(.*)$ /root/of/domain/c/$1 [l] </ifmodule> note: don't forget replace example values real ones. also, make sure mod_rewrite enabled. (2) cleanest way: configure virtualhosts directly ( without mod_rewrite

c# - How to Update XML File in Windows Form -

i'm trying figure out how can go updating xml file. know how read , write, no idea how update existing record. my xml file looks like: <?xml version="1.0" standalone="yes"?> <categories> <category> <categoryid>1</categoryid> <categoryname>ayourvedic</categoryname> </category> <category> <categoryid>2</categoryid> <categoryname>daily needs</categoryname> </category> <category> <categoryid>3</categoryid> <categoryname>clothes</categoryname> </category> <category> <categoryid>4</categoryid> <categoryname>shops</categoryname> </category> <category> <categoryid>5</categoryid> <categoryname>daily use product</categoryname> </category> </categori

javascript - How to filter jQuery Tablesorter by multiple columns using OR logic -

i looking means of doing or filter against multiple columns in jquery tablesorter datatable multiple column or filter . upgraded 2.21.5. i have fiddle example . have tried filter_functions : filter_functions: { '.filter-or': function (e, n, f, i, $r, c) { /* manually check row columns class of filter-or */ } } but applying function classes overrides filter-availonly option. not sure how move forward this. if understanding request, maybe try ( demo ): $(function () { var $table = $('table'), // 'filter-or' column indexes orcolumns = $('.filter-or').map(function (i) { return this.cellindex; }).get(), filterfxn = function (e, n, f, i, $r, c) { var col, v, showrow = false, content = []; $r.children().filter(function (indx) { if (orcolumns.index

json - Trying to connect to the Dropbox API v2 using C# Receive 400 error on all attempts -

the new dropbox api documentation at: https://blogs.dropbox.com/developers/2015/04/a-preview-of-the-new-dropbox-api-v2/ i'm trying execute simple metadata call, having little success. here's code i'm using: private void go() { var httpwebrequest = (httpwebrequest)webrequest.create("https://api.dropbox.com/2-beta/files/get_metadata"); httpwebrequest.contenttype = "text/json"; httpwebrequest.method = "post"; httpwebrequest.headers.add("authorization: bearer xxxxxxxxxxxxxxxxxxx"); using (var streamwriter = new streamwriter(httpwebrequest.getrequeststream())) { string json = "{\"path\": \"/avatar_501.png\"}"; streamwriter.write(json); streamwriter.flush(); streamwriter.close(); } var httpresponse = (httpwebresponse)httpwebrequest.getresponse(); using (var streamreader =

python - Capture Heroku SIGTERM in Celery workers to shutdown worker gracefully -

i've done ton of research on this, , i'm surprised haven't found answer yet anywhere. i'm running large application on heroku, , have celery tasks run long time processing, , @ end of task save result. every time redeploy on heroku, sends sigterm (and eventually, sigkill) , kills running worker. i'm trying find way worker instance shut down gracefully , re-queue processing later can save required result instead of losing queued task. i cannot find way works have worker listen sigterm properly. closest i've gotten, works when running python manage.py celeryd directly not when emulating heroku using foreman, following: @app.task(bind=true, max_retries=1) def slow(self, x): try: x in range(100): print 'x: ' + unicode(x) time.sleep(10) except exceptions.maxretriesexceedederror: logger.error('whoa') except (exceptions.workershutdown, exceptions.workerterminate) exc: logger.error

java - How to bypass cloudflare server to get some site which using it? -

i tried bypass cf server amf (addmefast) site using java. i used httpurlconnecting amf site's response code 200 (normally must return 302 code) , when try amf's page, returns unreadable code! here tried: url obj=new url(url); httpurlconnection conn=(httpurlconnection)obj.openconnection(); conn.setrequestmethod("get"); conn.setrequestproperty("host","addmefast.com"); //...continue setrequestproperty... //... int responsecode=conn.getresponsecode(); system.out.println("response code: "+responsecode); bufferedreader in = new bufferedreader( new inputstreamreader(conn.getinputstream())); string inputline; stringbuffer response = new stringbuffer(); while ((inputline = in.readline()) != null) { response.append(inputline); } //...print page content on screen... in.close(); i'm trying create auto can login amf. can tell how bypass cf page? what getting response cloudflare? it quite possible whatever yo

RethinkDB - Left join where joined_table.identifier is null? -

i have 2 tables in rethinkdb database represent one-to-many relationship. consider following 2 tables: t1 parentid name 1 lorem 2 ipsum 3 dotor 4 sit 5 amet t2 childid parentid childname 1 1 2 3 random 3 5 here on t1, parentid primary key, , on t2, there secondary index on parentid. want find parents don't have child. operation in sql (mssql exact) looks this: select t1.* t1 left outer join t2 on t2.parentid = t1.parentid t2.childid null results: parentid name 2 ipsum 4 sit how can accomplish similar result in rethinkdb? thank you! i this: r.table('t1').filter(function(parent) { return r.table('t2').get_all(parent('parentid'), {index: 'parentid'}).count().eq(0); })

javascript - aws s3.copyObject return params with destination path -

i using aws' s3.copyobject moving file source destination. how can entire path of new destination. there callback params of s3.copyobject gives result? no such callbacks available. need find path follows var s3destinationpath = 'https://s3-'+region+'.amazonaws.com/'+bucket+ '/' + destinationfolder + '/' + filename ;

c++ - opencv findContours() crashes the program -

i new image processing, , i'm working on real time tracking but stuck findcountours function. cvtcolor(*pimg, *pimg, cv_rgba2gray); //convert gray image mask = pimg->clone(); //clone source mask.convertto(mask,cv_8uc1); //convert 8uc1 vector<vector<point> > contours; vector<vec4i> hierarchy; findcontours( mask, contours, hierarchy, cv_retr_tree, cv_chain_approx_simple, point(0, 0) ); contours.clear(); hierarchy.clear(); and when run program crashes, if comment findcountours function fine. i have checked documents there no clue happened. mask = pimg->clone(); //clone source mask.convertto(mask,cv_8uc1); //convert 8uc1 replace pimg.convertto(mask, cv_8u, arg); arg may different different types of input image. 255 float/double.

cordova - Viewport argument value "device-width;" error in iOS inspector -

i've been having issue mobile app redirecting blank white screen when try use azure's mobile service oauth. occurs when running on actual device. it's ionic/cordova app , i'm trying authenticate through azure's mobile services. error when inspect app running on phone through safari's page inspector: viewport argument value "device-width;" key "width" invalid, , has been ignored. note ';' not separator in viewport values. list should comma-separated. here's code, think semi-colons should comma's, i'm not sure how fix because authentication page generated when make call mobile service. <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"> any suggestions appreciated.

javascript - Any ideas to improve this UI architecture? -

Image
i using sapui5 develop ui similar 1 below: at first, thought structuring xml view this: <verticallayout> <hbox> field1 & field2 here </hbox> <hbox> field3 & field4 here </hbox> <image> image here </image> </verticallayout> however, little bit confused because need labels of input fields on top of input fields when viewing them in desktop , tablet (just in image above), have stack on top of each other when viewing page in smaller(smartphone) viewport: does has suggestions structuring of view or ideas making responsive? in advance! what searching "grid" layout. https://sapui5.hana.ondemand.com/sdk/explored.html#/entity/sap.ui.layout.grid/samples you able set "defaultspan" property string type represents grid's default span values large, medium , small screens whole grid. allowed values separated space letters l, m or s followed number of columns 1 12 container has take, example

python - Changing global variable from within a function? -

just practice, i'm trying recreate game dudo within python (i don't think knowledge of game affects question though). basically, 6 players have number of dice (represented count1, count2 etc.), , need know number of each kind of die (how many 1s, how many 2s etc.). created variable num1 (num1 = 0) represent number of 1s, , made function find number of 1s. def find_num1(): total = 0 in range(you_count): if you[i] == 1: total = total + 1 in range(count1): if enemy1[i] == 1: total = total + 1 in range(count2): if enemy2[i] == 1: total = total + 1 in range(count3): if enemy3[i] == 1: total = total + 1 in range(count4): if enemy4[i] == 1: total = total + 1 in range(count5): if enemy5[i] == 1: total = total + 1 num1 = total print total each player has list of 6 numbers represents each die have (enemy1, enemy2 etc.). used

bash - How to use functions for making decisions -

i porting 'choose own adventure' game linux. game took user input , used determine "path". how i'd on windows: echo turn left or right? set /p a= if %a%==left goto left if %a%==right goto right :left echo go left. echo now, continue down cave or... :right echo go right. echo now, you... ect. how do in linux? an 1:1 translation of code bash can written functions this #!/bin/bash left() { echo go left. echo now, continue down cave or... } right() { echo go right. echo now, you... ect. } echo -n "do turn left or right? " read [ $a = "left" ] && left [ $a = "right" ] && right

innodb - Google Cloud: MySQL queries very slow -

after deploy on google cloud app had big latency, on 5s. after searching problem, find out queries on mysql database problem , taking long execute. here examples same database compared on different servers. commands issued through ssh directly on sql server: select * tbl1; local - 54343 rows in set (0.14 sec) shared hosting - 54343 rows in set (0.89 sec) google - 54343 rows in set (26.73 sec) select * tbl2; local - 132 rows in set (0.00 sec) shared hosting - 132 rows in set (0.01 sec) google - 132 rows in set (0.20 sec) select * tbl3 inner join tbl4 on tbl4.tbl3_id = tbl3.id; local - 746 rows in set (0.00 sec) shared hosting - 746 rows in set (0.12 sec) google - 746 rows in set (0.95 sec) i using d1, tried d32 tier didn't better results. using default setup (flags etc.). think cause problem ? have tried async file system repc., turn off logging flags. given local query times short, large number of rows, suspect query cache may @ play here. try queries both lo

Make a variable based on a pattern for sas dataset -

i made dataset random numbers outcome , observation. want every other value 0 , other 1 i'm unsure how proceed. there way can tell sas either pattern or give evens value or something? id outcome trt 1 1 0 2 1 1 3 0 0 4 1 1 etc. looked @ maybe using mod understand take values out of dataset not create information treatment. mod function. functions have arguments, , return value. mod work you. n automatic variable counts how many times data step has iterated. try: data want ; set have ; trt = mod(_n_,2) ; run ;

php - Can't install PDO_SQLITE? Later version -

i trying pdo_sqlite extension because have read sqlite database. know miss module because error message "could not find driver". but when try install through "sudo apt-get install php5-sqlite" says have later version of , cannot install it. anyone know how can go around problem? tried aptitude , had 1 option not install it. this due sort of problem dependencies or weird third party repository. while i've never had issue myself, doing little bit of research shows might work. $ apt-get --purge remove php* $ sudo apt-get install php5 php5-sqlite php5-mysql $ sudo apt-get install php-pear php-apc php5-curl $ sudo apt-get autoremove you'll of course want backup special configurations you've put in place , keep note of php 'plugins' need have installed before doing this. you can try instead of purging of has php, doing sqlite $ sudo apt-get --purge remove sqlite3 $ sudo apt-get --purge remove php5-sqlite and trying install

clojure - On the 4Clojure website, how do you see your previous problems, so you can return to one of them? -

i'm doing problems @ 4clojure. how, when finished problem (around #22), link appeared jumped me problem #35. want problems skipped. when i'm logged in 4clojure, website shows me problems after last 1 completed, #34. is there way see problems (completed , uncompleted) @ 4clojure, can skipped ones? the headers on problem list page clickable change sort order. default sort order "sort first on whether you've solved it, , on how many other people have solved it", problems you've solved drift bottom (which on page 2). can click heading sort differently: example, click on solved heading see problems you've solved first. or, of course, can edit url, since urls predictable: http://www.4clojure.com/problem/22 problem #22.

scala - Why does immutable.ParMap.mapValues return ParMap instead of immutable.ParMap? -

in scala 2.11.6 application have defined immutable.parmap so: object foos { val foos: immutable.parmap[string, foo] = immutable.parmap( ... ) } later on, i'd create new immutable.parmap using same keys, use mapvalues : val fooservices: immutable.parmap[string, fooservice] = exchanges.exchanges mapvalues (_.fooservice) scala complains expression of type parmap[string, fooservice] not conform expected type parmap[string, fooservice]. as workaround can use comprehension, compiler permits: val fooservices: immutable.parmap[string, fooservice] = ((name, ex) <- foos.foos) yield name -> foo.fooservice but nice able use library functions designed exact task. why can't mapvalues infer specific type here? it's not matter of inferring specific type. it's instance of scala.collection.parallel.parmaplike$$anon$2 , view of underlying map (the created map forwards operations original). it have been created separately

java - StreamCorruptedException: invalid type code: AC -

my problem when tries read object second time, throws exception: java.io.streamcorruptedexception: invalid type code: ac @ java.io.objectinputstream.readobject0(objectinputstream.java:1356) @ java.io.objectinputstream.readobject(objectinputstream.java:351) @ client.run(basestainstance.java:313) java.io.streamcorruptedexception: invalid type code: ac @ java.io.objectinputstream.readobject0(objectinputstream.java:1356) @ java.io.objectinputstream.readobject(objectinputstream.java:351) @ client.run(basestainstance.java:313) the first time send exact same object message; however, when try doing same thing second time, throws error above. need re-intialize readobject() method? printed out message object being received line below , exact same first instance works ok. object buf = myinput.readobject(); i'm assuming there's problem appending, have no use appending. want read fresh line everytime. i'd appreciate in fixing bug. thank you. ======

linux - How to load device tree overlay on kernel 3.19+ -

kernel 3.19 (re-)introduced device tree overlays. on linux kernel 3.19.4 , via fedora ( 3.19.4-200.fc21.armv7hl ). i have overlay file overlay.dts described in documentation . overlay.c contains functions work overlays, including functions load overlay. does kernel check paths overlays load? if so, where? if not, how can load overlay? from experience (3.8-3.14), dtb loading jurisdiction of boot-loader, rather kernel itself. i've used u-boot - u-boot can load compiled device-tree file (man dtc) ext2-based filesystem known location in ram, specified in kernel command line. which boot-loader using?

function - Why is JavaScript code executed while condition is false? (Eloquent JavaScript - Deep comparison) -

question (eloquent js 2nd ed, chapter 4, exercise 4): write function, deepequal, takes 2 values , returns true if same value or objects same properties values equal when compared recursive call deepequal. test cases: var obj = {here: {is: "an"}, object: 2}; var obj1 = {here: {is: "an"}, object: 2}; console.log(deepequal(obj,obj1)); code: var deepequal = function (x, y) { if ((typeof x == "object" && x != null) && (typeof y == "object" && y != null)) { if (object.keys(x).length != object.keys(y).length) return false; (var prop in x) { if (y.hasownproperty(prop)){ if (! deepequal(x[prop], y[prop])) //should not enter!! return false; alert('test'); }else return false; // section do? } return true; } else if (x !== y) return false; else return true; }; or

swrevealviewcontroller - iOS : how can I fix slide out menu'issue in my app? -

i have implemented swrevealcontroller slide out menu , followed appcoda tutorial http://www.appcoda.com/ios-programming-sidebar-navigation-menu/ when run app , slide out menu doesn't work correctly... have searched other tutorials , other solutions dont find think resolve issue. in app have 2 other interface before menu , code reveal stepviewcontroller menu : [self.stepbarbuttonitem settarget: revealviewcontroller]; [self.stepbarbuttonitem setaction: @selector(revealtoggle:)]; [self.view addgesturerecognizer:revealviewcontroller.pangesturerecognizer];

Python 3.4 reading from CSV formats -

Image
ok have code in python im importing csv file problem there columns in csv file aren't basic numbers. there 1 column text in format "int, ext" , there column in o'clock format "0:00 11:59" format. have third column normal number distance in "00.00" format. my question how go plotting distance vs o'clock , basing whether 1 int or ext changing colors of dots scatterplot. my first problem having how make program read oclock format. , text formats csv. any ideas or suggestions? in advance here sample of csv im trying import ml int .10 534.15 0:00 ml ext .25 654.23 3:00 ml int .35 743.12 6:30 i want plot 4th column x axis , 5th column y axis want color code scatter plot dots red or blue depending if 1 int or ext here sample of code have far import matplotlib.pyplot plt matplotlib import style import numpy np style.use('ggplot') a,b,c,d = np.loadtxt('numbers.csv', unpack = true,

javascript - Open 1 modal with two different links -

so have page, modal. have table on page. want include link in each row of table opens same modal, , put different content in using jquery. the problem i'm having in modals. when give 2 links id code , , following in jquery: $(document).ready(function() { $("#code").click(function() { $("#codemodal").modal('show') }); }); only first link opens modal. i have tried data-toggle , resulted in no links being able open modal. is there way make possible? if so, how it? thanks. id must unique. can assign same class links , this: $(".code").click(function() { $("#codemodal").modal('show') });

matrix - Get words and values Between Parentheses in Scala-Spark -

here data : doc1: (does,1) (just,-1) (what,0) (was,1) (needed,1) (to,0) (charge,1) (the,0) (macbook,1) doc2: (pro,1) (g4,-1) (13inch,0) (laptop,1) doc3: (only,1) (beef,0) (was,1) (it,0) (no,-1) (longer,0) (lights,-1) (up,0) (the,-1) etc... and want extract words , values , store them in 2 separated matrices , matrix_1 (docid words) , matrix_2 (docid values) ; input.txt ========= doc1: (does,1) (just,-1) (what,0) (was,1) (needed,1) (to,0) (charge,1) (the,0) (macbook,1) doc2: (pro,1) (g4,-1) (13inch,0) (laptop,1) doc3: (only,1) (beef,0) (was,1) (it,0) (no,-1) (longer,0) (lights,-1) (up,0) (the,-1) val inputtext = sc.textfile("input.txt") var digested = input.map(line => line.split(":")) .map(row => row(0) -> row(1).trim.split(" ")) .map(row => row._1 -> row._2.map(_.stripprefix("(").stripsuffix(")").trim.split(","))) var matrix_1 = digested.map(row => row._1 -> row._2.m

c - Trouble with Bailey-Borwein-Plouffe formula -

i trying implement bbp formula. wrote following quick , dirty test code, based on paper paul h. bailey (that found here ): #include <stdio.h> #include <stdlib.h> #include <math.h> #include <gmp.h> #include <limits.h> long bin_exp_mod_k(int base, int exponent, int div) { long expmod = 1; long t; t = (long) pow(2, floor(log(exponent)/log(2.0))); while(42) { if(exponent >= t) { expmod = (base * expmod) % div; exponent -= t; } t = t/2; if(t >= 1) { expmod = ((long)pow(expmod, 2)) % div; } else break; } return expmod; } void bbp_part(mpf_t rop, int base, int index, int digit_index, int num_iter) { const int knum = num_iter; int k; long ldiv; mpf_t fbase; mpf_t fst_sum; mpf_t fst_sum_int; mpf_t snd_sum; mpf_t powval; mpf_t div; mpf_init(fst_sum); mpf_init(snd_sum); mpf_init(fst_sum_int

java - Android Google Map not showing my location? -

i working on google map current location application. , there no error detected. when run application, google map able load not showing current location. so put logcat here , please me. related "asset path '/system/framework/com.android.media.remotedisplay.jar' not exist or contains no resources." ? did research on not find solution. 1882-1882/com.example.yan.basicmap i/art﹕ not late-enabling -xcheck:jni (already on) 04-25 23:40:47.534 1882-1882/com.example.yan.basicmap i/zzx﹕ making creator dynamically 04-25 23:40:47.536 1882-1882/com.example.yan.basicmap w/resourcesmanager﹕ asset path '/system/framework/com.android.media.remotedisplay.jar' not exist or contains no resources. 04-25 23:40:47.536 1882-1882/com.example.yan.basicmap w/resourcesmanager﹕ asset path '/system/framework/com.android.location.provider.jar' not exist or contains no resources. 04-25 23:40:47.552 1882-1894/com.example.yan.basic