Posts

Showing posts from July, 2015

shell - filter file content to sorted tables -

i have file contains following lines of code. here file displays schedules sorted 1 one . at 12:00 schedule of james version1 : first_task:eating:nothing second_task:rest:onehour third_task:watching:nothing @ 12:00 schedule of james version2 : first_task:eating:fruits second_task:rest:twohour third_task:watching:manga @ 12:00 schedule of alex version1 : first_task:eating:fruit second_task:rest:halfhour third_task:watching:horrorfilm @ 12:00 schedule of alex version2 : first_task:eating:meal second_task:rest:nothing third_task:watching:nothing @ 18:00 schedule of james version1 : first_task:eating:fastfood second_task:rest:twohours third_task:watching:series @ 18:00 schedule of james version2 : first_task:eating:nothing second_task:rest:onehours third_task:watching:series @ 18:00 schedule of alex version1 : first_task:eating:vegetals second_task:rest:threehours third_task:watching:manga @ 18:00 schedule of alex version2 : first_task:eating:bread second_task:rest:fiv...

python - Performance of wsgi file important? -

i've built website using (awesome) python flask framework , i'm deploying on aws. create wsgi file looks this: import sys sys.path.insert(0, '/var/www/myawesomewebsite') app import app application since try avoid hardcoding strings code changed following: import sys, os sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) app import app application what wonder whether performance of wsgi file matters (with respect additional overhead of os.path.dirname(os.path.abspath(__file__)) ). is wsgi file parsed , executed every web-request, or loaded once when apache started? tips welcome! the wsgi file executed when application server loads app. using apache, happen once in while when apache recycles worker thread / process. same goes other application servers (e.g. gunicorn run wsgi file once per worker). you're fine.

java - App crashes if Games.API is added -

basically, googleapiclient able connect. if add games.api apiclient, uncaught exception occurs. searched everywhere, no 1 seems have problem. remove games.api builder, gets connected normally. need games.api include leaderboards in game. please can me? logcat: 07-09 00:43:19.709 14636-14636/? w/dalvikvm﹕ threadid=1: thread exiting uncaught exception (group=0x418c49a8) 07-09 00:43:19.709 14636-14636/? w/dalvikvm﹕ threadid=1: uncaught exception occurred 07-09 00:43:19.709 14636-14636/? w/system.err﹕ java.lang.illegalstateexception: fatal developer error has occurred. check logs further information. 07-09 00:43:19.724 14636-14636/? w/system.err﹕ @ com.google.android.gms.common.internal.zzi$zza.zzc(unknown source) 07-09 00:43:19.724 14636-14636/? w/system.err﹕ @ com.google.android.gms.common.internal.zzi$zza.zzr(unknown source) 07-09 00:43:19.724 14636-14636/? w/system.err﹕ @ com.google.android.gms.common.internal.zzi$zzc.zznq(unknown source) 07-09 00:43:19.724 14636-14636/?...

c++ - error: invalid types 'int[int]' for array subscript -

#include <iostream> using namespace std; int t,n,k,m,i,j; int l[100002],r[100002],c[100002],a[100002],total=0; int swap( int *a, int *b) { int temp=*a; *a=*b; *b=temp; } int pivot( int l, int h) { int x=c[h],i=l,j=l-1,temp; for(i=l;i<h;i++) { if(c[i]<x) { j++; swap(&c[i],&c[j]); swap(&r[i],&r[j]); swap(&l[i],&l[j]); } } j++; swap(&c[h],&c[j]); swap(&l[h],&l[j+1]); swap(&r[h],&r[j+1]); return j; } int quick( int l, int h) { int p; if(l<h) { p=pivot(l,h); quick(l,p-1); quick(p+1,h); } } int main() { cin>>t; while(t--) { total=0; cin>>n>>k>>m; for(i=1;i<=n;i++) { cin>>a[i]; total+=a[i]; } for(i=1;i<=m;i++) cin>>l[i]>>r[i]...

c# - Single Row Table in Entity Framework 6 -

i couldn't find solution problem title makes clear want. is possible create single row table (i need store boolean value in table)? , how can configure constraint fluent api? you make 1 of columns primary , allow 1 value. unfortunately fluent api doenst support default value public class statusidentifer { [defaultvalue("1")] [key] public int id {get; set}; //set can removed here? public bool status {get:set;} //your boolean value } the trick not expose set methods id. at database level can still break paradigm. answer here tells how create check constraint public void initializedatabase(myrepository context) { if (!context.database.exists() || !context.database.modelmatchesdatabase()) { context.database.deleteifexists(); context.database.create(); context.objectcontext.executestorecommand("create unique constraint..."); context.objectcontext.executestorec...

post - Wordpress infinite previous next looping in same category -

i have code can me make work in same category in custom post = 'project' <?php /** * infinite next , previous post looping in wordpress */ if( get_adjacent_post(false, '', true) ) { previous_post_link('%link', '&larr; previous post'); } else { $first = new wp_query('posts_per_page=1&order=desc'); $first->the_post(); echo '<a href="' . get_permalink() . '">&larr; previous post</a>'; wp_reset_query(); }; if( get_adjacent_post(false, '', false) ) { next_post_link('%link', 'next post &rarr;'); } else { $last = new wp_query('posts_per_page=1&order=asc'); $last->the_post(); echo '<a href="' . get_permalink() . '">next post &rarr;</a>'; wp_reset_query(); }; ?> // set current category $categories = get_the_category(); $category = $categories[0...

c - How to add array in multidimensional array? -

my question simple, still can't manage things right because not used c language. i have array looks this: char *itemarr[] = { "gpgga", "193914.00", "5312.983745", "n", "00206.32143", "e", "4,17", "0.6", "43.48", "m", "47.46", "m", "1.0", "0000", "gpgll,4916.45,n,12311.12,w,225444,a,m" }; and add itemarr new multidimensional array, when try copy content of itemarr protocols array this: int index = 0; char *protocols[100][total_items]; memcpy(&protocols[index++], &itemarr, sizeof(itemarr)); it copy first item of itemarr , not rest. can see first item following code: printf("itemarr copy in protocols - index 0: %s\n", protocols[0][0]); for example, not work: printf("itemarr copy in protocols - index 1: %s\n", protocols[0][1]); pl...

Soft Back button for Android Activity -

as per design rule idea introduce button activity in android? i believe every device, days, or running android os has hardware button. what suggestion on implementing software button? how can enable it, if @ hardware button support not present? @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //enable soft button actionbar ab =getsupportactionbar(); ab.setdisplayhomeasupenabled(true); } //handle click event @override public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); if(id==android.r.id.home){ onbackpressed(); return true; } return super.onoptionsitemselected(item); } hope helps you!

android - capturing image and displaying -

i trying click images camera , displaying them in gridview. using below code getting "unfortunately camera has stopped working" error. please suggest logcat:beginning of crash **07-09 01:14:01.734 3873-3873/? e/androidruntime﹕ fatal exception: main process: com.example.sakshi.intel, pid: 3873 java.lang.runtimeexception: unable start activity componentinfo{com.example.sakshi.intel/com.example.sakshi.intel.mainactivity}: java.lang.nullpointerexception: attempt invoke interface method 'int java.util.list.size()' on null object reference @ android.app.activitythread.performlaunchactivity(activitythread.java:2298) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2360) @ android.app.activitythread.access$800(activitythread.java:144) @ android.app.activitythread$h.handlemessage(activitythread.java:1278) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.a...

javascript - Get the full value of a style attribute conatining invalid css -

i trying string value of style attribute in html element. problem facing if style property has invalid value property omitted result. example: <article id="contact" style="margin: 10px; padding: 10px; color:{color};"> </article> var contact = document.getelementbyid("contact"); var style = contact.getattribute("style"); console.log(style); //prints "margin: 10px; padding: 10px;" i want print "margin: 10px; padding: 10px; color:{color};" https://jsfiddle.net/wybdl7xk/2/ is there anyway can whole value in internet explorer? *chrome works pointed below maybe use ajax request read css document. way not getting children of dom, rather text file. $.when($.get("document.css")).done(function(response){ console.log(response); // response text }):

powershell - Not showing Table of Objects until after Pause -

have tried searching interwebs, majority of results show when people accidentally hit key when powershell console active. the issue i'm facing store hyper-v object in variable , call variable. the following snippet script. $listdisks = get-vmharddiskdrive -vmname $vmname -controllertype scsi "the following table show disks have been attached vm!" | write-host $listdisks pause so when script executes runs , shows output it's supposed to. issue occurs when hit pause portion of script. get-vmharddiskdrive output doesn't appear until after hit "press enter continue..." output: the following table show disks have been attached vm! press enter continue...: vmname controllertype controllernumber controllerlocation disknumber path ------ -------------- ---------------- ------------------ ---------- ---- some-vm scsi 0 0 15 disk...

javascript - Knockout computed write not firing -

i have simple grid, checkable rows. each row represents object: function person(name, ischecked, isdisabled) { this.name = name; this.ischecked = ko.observable(ischecked); this.isdisabled = ko.observable(isdisabled); }; there's check all checkbox in grid header, should check non-disabled rows or un-check them (depending on state). should work other way around, meaning when check rows within grid (clickin on each row's checkbox), header checkbox should checked. the problem is, computed bound check all checkbox fails execute. see example: http://jsfiddle.net/eww5dn8q/ . notice when check them all, alert within write function executed. however, when uncheck, no longer works. consider version comment if statement (lines 30 , 32): http://jsfiddle.net/qws3f7js/ . in version, seems run whether it's check or uncheck, @ cost of not taking account disabled rows. i'm pretty sure there's minor thing i'm missing there.....

core bluetooth - Launching iOS BLE Central application on iPhone reboot -

i planning develop ios application using corebluetooth framework monitors pedometer peripheral continuously , counts footsteps. i know if backgroud execution mode set ble central, application continue receive ble events in background. apple documentation states in case app gets terminated due low memory, system can keep track of ble events particular central manager if state preservation , restoration adopted. assume have ios application operates in central mode. app subscribed receive notification pedometer when ever footstep characteristic changes. i have adopted following in app. ble central background mode ble state preservation/restoration central manager i start app, scan, pair , connect pedometer , app starts receiving footsteps. my questions: now if iphone reboots, continue receive ble events app launched in background without user having manually launch application again , connect pedometer? if app terminated user explicitly using multitasking gesture...

Java ME: transform basic JDK 1.5 "enum" object into Java ME CLDC-1.1/IMP-NG (JDK 1.4) -

i'm translating java (jdk 1.5) "enum" java me (jdk 1.4). many people have suggested retroweaver parse jdk 1.5 libraries jdk 1.4 i've got lot of problems using , want full control of project due hw limitations. what's best way translate or find equivalent? /** authentication enumerates authentication levels. */ public enum authentication { /** no authentication used. */ none, /** low authentication used. */ low, /** high authentication used. */ high, /* * high authentication used. password hashed md5. */ high_md5, /* * high authentication used. password hashed sha1. */ high_sha1, /* * high authentication used. password hashed gmac. */ high_gmac; /* * integer value enum. */ public int getvalue() { return this.ordinal(); } /* * convert integer enum value. */ public static authentication forvalue(...

C - Creating endless socket connection between server and client (Linux) -

i have simple socket program created in c (using ubuntu), connection works fine, server compiles , client provides ip , port number. but when connection established, client can send 1 message , connection closes . when client sends message, server receives , program ends itself . i tried use while loop , gives me error on binding . there way make infinite, when user enters exit or specific key/command , program ends. server.c updated while loop #include<stdio.h> #include<stdlib.h> #include<sys/types.h> #include<sys/socket.h> #include<netinet/in.h> #include<string.h> int main(int argc, char *argv[]) { int sockfd, newsockfd, portnum, clien, n; char buffer[256]; struct sockaddr_in serv_addr,cli_addr; if (argc < 2) { fprintf(stderr, "\nno port provided"); exit(1); } sockfd = socket(af_inet,sock_stream, 0); if (sockfd < 0) printf("\nprovide valid po...

Mips recursion sum of digits -

so understand logic behind how calculate sum of digits. wondering whether recursive function correct. assume user entered number or wants digit sum , stored in $v0. sum2: li $s0, 0 move $a1, $v0 li $s1, 0 li $s2, 10 # adjusting stack frame size store 3 words addi $sp, $sp,-12 # these sum value, return address, , number sw $s1, 0($sp) sw $ra, 4($sp) sw $a1, 8($sp) loop2: bne $s0, $a1, sum3 move $a0, $s1 li $v0, 1 syscall lw $s1, 0($sp) lw $ra, 4($sp) lw $a1, 8($sp) addi $sp, $sp 12 jr $ra sum3: div $t0, $a1, $s2 mfhi $t0 add $s1, $s1, $t0 div $t1, $a1, $s2 mflo $a1 j loop2 if logic isn't clear first checking see if number doesn't equal 0 , if doesn't modulus of number divided 10 , add sum 0 , divide user input number 10 , continue call function till number becomes zero. had 1 quick last question. in mips recursive function or iterative function execute faster? your implementation corresponds this: int sum_di...

javascript - media print is not supported by following js code used to print table -

i want add css media format (add page-break-inside... )the page print, following code pops new window , prints the table without supporting media print css. here code got following link: how use html print header , footer on every printed page of document? <script> function printdiv() { var divtoprint=document.getelementbyid('tabletoprint'); newwin= window.open(""); newwin.document.write(divtoprint.outerhtml); newwin.print(); newwin.close(); } </script>

ruby - calabash-automate the app which gets opened by hitting a link from browser -

i have calabash android set there working fine. have add scenario in android emulator need open default browser navigate url ( i.e https://def/l/abc ) open app assuming app installed. can login app , move on. how can automate through calabash . particularly open browser , click link . assume emulator opened. found like require 'selenium-webdriver' caps = selenium::webdriver::remote::capabilities.android client = selenium::webdriver::remote::http::default.new client.timeout = 480 driver = selenium::webdriver.for( :remote, :http_client => client, :desired_capabilities => caps, ) driver.navigate.to "http://www.google.com" element = driver.find_element(:name, 'q') element.send_keys "hello webdriver! however giving error ruby test.rb /.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:878:in `initialize': connection refused - connect(2) (errno::econnrefused) /users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http...

javascript - How can I stop fancybox from resizing? -

i beginner, have limited knowledge on coding. trying create website uses fancybox2 image galleries. added facebook button , facebook comment box each photo. here's code: $(".fancybox").fancybox({ beforeshow: function () { if (this.title) { currenthref = this.href; this.title += '<br /> <br/>'; // line break after title this.title += '<div class="fb-like" style="margin:0; padding:0" data-href="' + currenthref + '" data-width="400" data-layout="standard" data-action="like" data-show-faces="false" data-share="false"></div>'; this.title += '<br />'; // line break after title this.title += '<div class="fb-comments" data-href="http://mundonimona.com/' + currenthref + '" data-num-posts="2" data-width="400"></div>'; } }, aftershow: f...

mlab - MongoLab Scientific Notation in Table view -

i'm having trouble finding documentation on how format table view definitions. here's have: what see on document in collection: { some_number: 1111111111 } view definition: { "number": "some_number" } what see in table view: number 1.111111111e9 while they're technically equivalent, wondering if there's way stop mongolab form turning scientific notation? thanks! according mongolab support of july 14th, 2015, not support user formatting numbers. have since fixed scientific notation issue , numbers show commas (eg 6000546 show 6,000,564.0000 or of likes). workaround problem store data values strings rather numbers.

python - Remote server setup: nuclide-start-server command doesn't work -

i'm not able connect remotely using atom's new nuclide package. ran npm install -g nuclide-server , followed the trouble shooting instructions nuclide docs http://nuclide.io/docs/remote/ keep getting errors. when run nuclide-start-server on server, end error: traceback (most recent call last): file "scripts/nuclide_server_manager.py", line 25, in <module> nuclide_server import log_file file "/usr/local/lib/node_modules/nuclide-server/scripts/nuclide_server.py", line 18, in <module> import utils file "/usr/local/lib/node_modules/nuclide server/scripts/utils.py", line 16, in <module> pkg_resources import resource_string in atom when try connect, error pretty summarized above: bad stdout remote server: synsyn synsyn stderr:bash: cannot set terminal process group (-1): invalid argument bash:no job control in shell traceback (most recent call last): file "scripts/nuclide_server_manager.py", line 25, in n...

unity3d - How to import C4D Animations Into Unity? -

the following post collection of replies on unity forums. is familiar possible ways import c4d animation emitter/metaball or besides rigged bones unity? tried import flame-looking animation based on ej hassenfratz's tutorial http://www.eyedesyn.com/2015/05/07/creating-2d-cartoon-fire-effects-in-cinema-4d/ . used nitrobake bake animation keyframes , exported .fbx, when imported unity no animation show. told there ways overcome such problems using unity extensions person busy thought should ask here on unity forums. edit: should mention have imported bone animations before or simple rotation/position/scale keyframed animations. if wants test how import share c4d project. a person suggested megafiers unity extension (megacache more accurate) my following 2 responses: i might go fuc*ing crazy trying import animation i'm positive i'm gonna @ least manage it. felt need update thread in case else searching around. c4d doesn't support .pc2 or .mdd file ...

ios - FetchRequest - NSArray element failed to match the Swift Array Element type - Swift 2.0 -

Image
i want nsfetchrequest display data uicollectionview : import uikit import coredata let appdelegate: appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let context: nsmanagedobjectcontext = appdelegate.managedobjectcontext class garageviewcontroller: uiviewcontroller, uicollectionviewdelegate,uicollectionviewdatasource { @iboutlet weak var backgroundview: uiimageview! @iboutlet weak var collectionview: uicollectionview! var voitures: [voiture] = [voiture]() override func viewdidload() { super.viewdidload() collectionview.reloaddata() let fetchrequest = nsfetchrequest(entityname: "voiture") fetchrequest.resulttype = .dictionaryresulttype { try voitures = context.executefetchrequest(fetchrequest) as! [voiture] } catch let fetcherror nserror { print("voiturefetch error: \(fetcherror.localizeddescription)") } if (voitures.count > 0) { voiture in voitures [voiture] { ...

task - Show RadBusyIndicator during Frame Navigation WPF -

for our application, need display busy indicator during navigation since controls taking time load. long running operation create separate task , trigger busy indicator in ui thread in case couldn't that. once busy indicator started spin, got disturbed frame.source or frame.navigate executes in ui thread. busy indictor hidden away . the below piece of code have used navigation. executed separate task . public virtual void navigateto(string pagekey, object parameter) { frame frame = null; action actiontoexecuteonuicontext = () => { frame = getdescendantfromname(application.current.mainwindow, "contentframe") frame; if (frame != null) { frame.loadcompleted -= frame_loadcompleted; frame.loadcompleted += frame_loadcompleted; frame.source = ...

symfony - Symfony2 - Dynamically modify form using user inputs -

a little bit of background first. learned in past how use "pure" php, , have more started using symfony. have been following several guides (cookbook, lynda & openclassrooms) many of inquiries, haven't been able find answer current question. i have 2 entities, let's name them user , player. user entity contains player property can null. so, during user creation, 3 possibilities : leave player field empty, select already-existing player, or create new player. @ first wanted add "create new" option in player dropdown list, have gone "create new player" checkbox. the idea is, if checkbox checked, remove player dropdown list , add embedded form create new player. have tried several events (pre_set_data, pre_submit & co), none seem trigger according user input. this have done in jscript, seeing how symfony's different animal pure php, don't know how it. or advice appreciated ! you're on right track there pre_set_...

The Onload Deception...Javascript JQuery function not defined? -

works: <div onclick="updateattributes();">update</div> <script> function updateattributes() { alert(1); } <script> doesnt work: (updateattributes not defined) <div onclick="updateattributes();">update</div> <script> $(function(){ function updateattributes() { alert(1); } }); <script> why happening here? thought old onload safest bet declaration? thanks! in second example, updateattributes visible closure of ready callback function. it works in first because function globally visible. second example, working, can modify to $(function(){ $('div').click(updateattributes); function updateattributes() { alert(1); } }); since updateattributes visible within callback itself. also, remove inline onclick handler in div itself.

php - establishing a loop that sometimes can be continuous and sometimes not -

you can suggest me title after reading so have database name id1 id2 carl 1154 0 mary 4592 0 jake 5820 4592 john 6495 0 shannon 1047 6495 kalsey 2281 5820 scarlet 4419 2281 i gonna tell want above since english not good. please give me notice if dont it. carl's id2 = 0 mary's id2 = 0 jake's id2 != 0 ----> right there want find jake's id2 inside id1 sections. (jack id2= 4592 , mary's id1). want mary's id2 again 0 means can next name (if mary's id2 not equal 0 want continue through loop) john's id2 =0 shannon's id2 = 6495 ----> 6495 john's id1 , john's id2 = 0 ----> loop ends kalsey's id2 = 5820 -----> 5820 gives me jake—--> jake's id2 not equal 0 agian(its 4592)--->continue loop—--> 4592 gives me mary ---> marry's id2 = 0 ---> loop ends scarlet's id2 = 2281 ----> takes kalsey -----> kalsey takes jake ----> j...

c# - How to add a Default text on Drop Down List? -

i'm having hard time adding default text drop down list. want have default "select department..." text drop down list. text has no value @ , never add database when selected. display, instruction user. void getusertypes() { con.open(); sqlcommand cmd = new sqlcommand(); cmd.connection = con; cmd.commandtext = "select typeid, typename types"; sqldatareader dr = cmd.executereader(); ddltypes.datasource = dr; ddltypes.datatextfield = "typename"; ddltypes.datavaluefield = "typeid"; ddltypes.databind(); con.close(); } <!--department--> <div class="form-group"> <label class="control-label col-lg-4"> department</label> <div class="col-lg-8"> <asp:dropdownlist id="ddltypes" runat="server" class="form-control" /> </div> </div> i h...

javascript - global variable in jquery function doesn't work -

i´ve defined global variable in function, doesn't work. if define variable in function works, want global. var currentpage = 1; $(document).ready(function(){ function checkpage(currentpage) { if (currentpage == 1) { $(".text_nav").html("some text"); }; } checkpage(); }); why want it? because want decrease variable on click something $( "#button" ).click(function() { currentpage += 1; }); //check currentpage variable again (who?) if (currentpage == 2) { $(".text_nav").html("some other text"); }; it work, didn't send function, this: checkpage(currentpage); the currentpage in function parameter, it's local variable function , separate global variable. or remove parameter if don't need it: function checkpage() { // other 'checkpage(currentpage)' ... }

javascript - Is there an event to detect focus and blur on my window/tab -

is there way detect whether user focused page? or possible detect whether page opened not in current tab focused? read up globaleventhandlers.onfocus globaleventhandlers.onblur window.focus() javascript window.onfocus = function() { console.log('yeah, got focus'); } window.onblur = function() { console.log('yeah, lost focus'); } demo try before buy

Neo4j Unmanaged Extension unit testing for version 2.2.3 -

i create unit tests unmanaged extension wrote small neo4j project. graphdatabaseservice db = new testgraphdatabasefactory() .newimpermanentdatabasebuilder() .setconfig(graphdatabasesettings.pagecache_memory, "512m") .setconfig( graphdatabasesettings.string_block_size, "60" ) .setconfig( graphdatabasesettings.array_block_size, "300" ) .newgraphdatabase(); i want use approach similar code above in @before test class - understand new way write unit tests. i ask: how can turn automatic authentication off using config settings how can register our extension i manage achieve goal code below bunch of deprecated warnings. impermanentgraphdatabase db = new impermanentgraphdatabase(); serverconfigurator config = new serverconfigurator(db); config.configuration().setproperty("dbms.security.auth_enabled", false); config.getthirdpartyjaxrspackage...

php - How do I display multiple image filenames from MySQL on page -

i'm working on small php program stores/retrieves information mysql db , have hit roadblock in displaying images. can single image display , can see images returned in array don't know go there. background info: my db schema pretty simple table i'm using images named img_data , contains following: id (primary) serialnum (holds serial of item image belongs to) file_name file_size file_type please take @ following related snippet of code: <?php $file_path = "http://localhost/test/image_uploads/$serial/"; $sql= "select img_data.file_name img_data serialnum=:serial"; $query = $db->prepare( $sql ); $query->bindparam(':serial', $serial, pdo::param_str); $query->execute(); $results = $query->fetchall(); ?> <?php foreach( $results $row ) $gimmenewval = str_replace(' ', '%20',$row['file_name']); $src=$file_path.$gimmenewval; $gimmeurl = "<img src=".$src....

static analysis - How do you include subroutine calls in a control flow graph? -

i idea of control flow graph ; involves nodes basic blocks (sequences of operations occur), connected edges represent jumps. but how represent subroutine call? if have 2 functions this: int tweedledee(void) { int x = 16; return x + do_something(); } int tweedledum(int n) { if (n < 0) return n; else return n + do_something(); } with both functions calling do_something() , need way allow jump block in tweedledee do_something , jump tweedledee , , jump block in tweedledum do_something , tweedledum , there's never jump tweedledee do_something , tweedledum . (or tweedledum → do_something → tweedledee ) seems plain directed graph wouldn't suffice define these relationships... maybe i'm missing something. procedures make cfgs , static analysis in general quite complicated. there different approaches representing routine calls in control flow graphs. one first , common solution create cfg each routine, , split "c...

java - Spring @Controller Method Returning Strange Download Exception -

Image
i have strange error gets returned in spring mvc application. when attempt save user via @restcontroller method, browser seems interpret action request download application. info issue: it returned when application deployed onto remote server (works expected locally) this happens in internet explorer here error: details... operation progress status * [7/8/2015 6:56:16 pm] : activation of mysite.com/myapp/saveuser/100 has started. error details following errors detected during operation. * [7/8/2015 6:56:17 pm] system.deployment.application.deploymentdownloadexception (unknown subtype) - downloading mysite.com/myapp/saveuser/100 did not succeed. - source: system.deployment - stack trace: @ system.deployment.application.systemnetdownloader.downloadsinglefile(downloadqueueitem next) @ system.deployment.application.systemnetdownloader.downloadallfiles() @ system.deployment.application.filedownloader....

Reliable way to get Windows Version from registry -

i'm checking windows version in installer (made nsis) checking following registry key: hklm "software\microsoft\windows nt\currentversion" "currentversion" according this post , this page msdn, currentversion number windows 10 should 10.0. i installed windows 10 pro insider preview , version number given in registry still 6.3, instead of 10.10 should. is there reliable way in registry detect windows 10? instead of reading value currentversion , read new values currentmajorversionnumber (which 10) , currentminorversionnumber (which 0) under windows 10. 2 keys new in windows 10 detect windows version registry .

c# - System.TypeLoadException: Access is denied when using MessagePack -

i'm trying use messagepack serialize objects, whenever try run serialization i'm getting unhandled exception error. here's code: cscdp_tcpclient.cs using system.text; using system.threading.tasks; using system.net.sockets; using system.diagnostics; using system.io; using msgpack; using msgpack.serialization; namespace cscdpapp { class cscdp_tcpclient { public void connect(string server, int portno, script script) { var serializer = messagepackserializer.get<script>(); var tempstream = new memorystream(); serializer.pack(tempstream, script); tempstream.position = 0; var deserializedobject = serializer.unpack(tempstream); debug.writeline("same object? {0}", object.referenceequals(script, deserializedobject)); } } } script.cs: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.t...

jvm - Are there any advantages of using Chronicle Map for java.util.String over .`intern` method for the purpose of lowering heap usage? -

intention reduce old gen size in order lower gc pauses. in understanding chronicle map store objects in native space , (starting java 8) string#intern same because interned string in metaspace. i curious whenever need use chronicle map, or it's ok stick intern method. chroniclemap couldn't serve direct replacement of string.intern() because java.lang.string instances on-heap. won't win anything, storing strings in chroniclemap, because before using them deserialize them on-heap object. chroniclemap data structure, (not java implementation, maybe c++) indeed used sort of caching textual data, inter-process. suspect far seeking. example on java side, require separate value class (not string , not stringbuilder ), implementing charsequence @ best. also, don't need intern , deduplication more effective, see java.lang.string catechism talk, "intern" section.

python - Django attempting to load binary data as String -

when accessing django site, attempting load png image string. causing error? exact error , traceback follows: unicodedecodeerror @ /home/ 'utf8' codec can't decode byte 0x89 in position 0: invalid start byte request method: request url: http://localhost:8080/home/ django version: 1.5.5 exception type: unicodedecodeerror exception value: 'utf8' codec can't decode byte 0x89 in position 0: invalid start byte exception location: /usr/lib/python2.7/encodings/utf_8.py in decode, line 16 python executable: /home/michael/bin/python python version: 2.7.9 python path: ['/home/michael/code/schoolapp/projectschoolapp', '/home/michael/code/schoolapp/projectschoolapp/djangoappengine/lib', '/home/michael/code/appengine/google_appengine', '/home/michael/code/appengine/google_appengine', '/usr/lib/python2.7', '/usr/lib/python2.7/lib-dynload', '/home/michael/code/appengine/google_appengine/lib/protorpc-1....

c++ - Cracking the coding interview. 4.1 Min Depth formula -

in ctci, there give formula minimum depth binary tree , confused it. here code: public static int mindepth(treenode root) { if (root == null) {     return 0; } return 1 + math.min(mindepth(root.left), mindepth(root.right)); } the definition of minimum depth leaf node shortest path root correct? if definition wrong please correct me. dilemma: made bst root 15. proceeded add 5, 7, 10, 20, 25, 30, 35 tree. using code output the min 2. if have added 10 , 25, output min 2. suppose correct? i translated code c++ here please tell me if made mistake in code mess up int findmin(node* root) { if (root == null) return 0; return 1 + std::min(findmin(root->left), findmin(root->right)); } void addnum(node*& root, int n) { if (root == null){ node* temp = new node(n); root = temp; return; } if (n > root->num){ ...

javascript - Knockout calculate container height from custom element after rendering items -

i writing custom binding amongst other things, needs know height before running display logic. contents rendered in foreach binding. normally, ko call binding init before of these items rendered, meaning height incorrect. i used { controlsdescendantbindings: true } , manually bound child items before using height; works fine in init . the problem is, i'd have binding fire update , recalculate height when items updated, , above pattern gives me you cannot apply bindings multiple times same element if change init update , understandably enough. here cut down code: html: <a href="#" data-bind="click: rerun">re-run</a> <hr/> <div class="container" data-bind="test: true"> <!-- ko foreach: items --> <div class="item" data-bind="text: id"></div> <!-- /ko --> </div> <hr/> <b id="res"></b> css: hr { clear:...