Posts

Showing posts from July, 2010

javascript - Change Graph in the div using Drop Down List. -

here html code generate drop-down list - <form method="post" action="abc.php"> <select name="daterange" id="myselect" size="1" onchange="window.location=this.options[this.selectedindex].value"> <option value > select duration </option> <option value="/abc.php/?daterange=1d">last 24 hours</option> <option value="/abc.php/?daterange=2d">last 2 days</option> <option value="/abc.php/?daterange=1w">last week</option> <option value="/abc.php/?daterange=2w">last 2 weeks</option> <option value="/abc.php/?daterange=1m">last month</option> <option value="/abc.php/?daterange=3m">last 3 months</option> <option value="/abc.php/?daterange=6m">last 6 months</option> <option value="/abc.php

javascript - How to know how much time a user has our webpage open -

i'm trying guess how time user expend on website in php. that, thinking every new action on web, difference between $_server['request_time'] , current. planning stats of current hosting don't know if can these values via php request. point of view using first , second method, in advice should i'm not happy first option, cause server collapsed if amount of petitions high..., otherwise don't know other way if me, wonderful. on website i'm using html5, css3, php, javascript, jquery, ajax , mysql database. supposed i'd store , count time users stay logged in webpage. in advice. there few ways of doing this, 1 way accurate readings. php time difference this method talking checking time difference. mark time user visited page. when visitor navigates page, subtract 2 times , have duration user looking @ previous page. to make myself little more clear, below basic layout of actions need perform make php time difference method work. log cur

math - strange behavior when calculating numbers in PHP -

when run following php script calculating discount of 30% 11.5. i'll strange result. expect condition false when testing calculated result. instead true. whats wrong php in case? <?php $_discount = 30; $_price = 11.5; $_qty = 1; echo $_result = ((1-$_discount / 100) * $_price); // result 8.05 echo $_result; // prints 8.05; echo gettype($_result); // prints double echo $_result !== 8.05; // returns 1 instead of 0 ?> try use this : <?php $_discount = 30; $_price = 11.5; $_qty = 1; echo $_result = ((1-$_discount / 100) * $_price); // result 8.05 echo $_result; // prints 8.05; echo gettype($_result); // prints double echo (double)$_result !== 8.05; ?>

How to handle duplicate tags when creating tag in Asana API -

i using ruby wrapper "asana" create integration asana api. 1 problem when test tag creation through curl seems asana doesn't take care of duplicating tags. i.e. when following command twice. generate 2 tags different tag id. can asana detect duplicate tags , merge tasks together? curl -u <my_api_key>: https://app.asana.com/api/1.0/tags \ -d "name=test tag" \ -d "workspace=123123123" 1st response: {"data":{"id":11800363445095,"created_at":"2014-04-22t10:03:19.888z","name":"test tag","notes":"","....:[]}}% 2nd response: {"data":{"id":11800365867646,"created_at":"2014-04-22t10:03:27.501z","name":"test tag","notes":"","....:[]}}% note although tags have same name, have different ids. want if task created same tag name, fall on previous tag id. tags, p

html - How to use JQuery to auto reload div content every X seconds? -

i have been doing web page, , encountered problem on reloading div content. i have done research, , of examples found on has "script.php" on .load(), not need... ( example ) is there way use .load() load specific div content again? (btw, sry bad english etc... , hope explanation makes sense) code: <head> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script> function update(){ $('#div1').load("index.html #div1"); } setinterval( 'update()', 1000 ); </script> </head> <body> <div id="div1"> <script language="javascript"> <!-- date=date() document.write(date) //--> </script> &

jquery - jqXHR Status Code Mismatch -

Image
i seeing status code of 302 on network tab of chrome dev tools getting 200 within error callback of ajax request. how possible 200 success inside error ? someone clear air please.

mysql - Previous/next button in PHP -

i´m pretty entirely new php, please bear me. i´m trying build website running on cms called core. i'm trying make previous/next buttons cycle through tags rather entries. tags stored in database core_tags. each tag has own tag_id, number. i've tried changing excisting code thep previous/next buttons, keeps giving me 'warning: mysql_fetch_array() expects parameter 1 resource, null given in /home/core/functions/get_entry.php on line 50'.' any appreciated. get_entry.php: <?php $b = $_server['request_uri']; if($entry) { $b = substr($b,0,strrpos($b,"/")) . "/core/"; $id = $entry; $isperma = true; } else { $b = substr($b,0,mb_strrpos($b,"/core/")+6); $id = $_request["id"]; } $root = $_server['document_root'] . $b; $http = "http://" . $_server['http_host'] . substr($b,0,strlen($b)-5); require_once($root . "user/configuration.php"); require_once($root

javascript - AngularJS filter by two fields -

i trying use analogously code filter tasks, doesn't work properly. if i'm using 1 filter it's ok ( no matter 1 i'm using ). when try filter second input doesn't work. moreover: when delete string first input , try filter second doesn't work @ all. <div> filters: <br /> company: <input ng-model="search.project.company.name_company"> <br /> project: <input ng-model="search.project.project_name"> <br /> </div> <table> <th>lp.</th> <th ><a href="" ng-click="sortby='project.company.name_company'">company</a></th> <th><a href="" ng-click="sortby='project.project_name'">project</a></th> <th><a href="" ng-click="sortby='time_start'">time start</a></th> <th><a href="" ng-click=&quo

python - Scipy.sparse multiplication error -

i attempting multiply 2 relatively large scipy.sparse matrices. 1 100000 x 20000 , other 20000 x 100000. machine has sufficient memory handle operation no means fast. have tried multiple times , same error (source code found here ): valueerror: last value of index pointer should less size of index , data arrays i life of me cannot figure out causing error. seems index pointer not getting scaled correct size when multiplied cannot find error originating from. on how solve error, or of other packages can handle operation? was using scipy version 0.13.0. upgraded current development version (0.15.0dev) , issue appears have been fixed.

ios - Automate copying resources from dependency project -

i have static library creates .a file exports public headers creates .bundle containing resources i have workspace containing project depends on lib. library part of workspace. able work out build dependencies on .a file , public headers. bundle, have manually add/update bundle applications copy bundle resources build phase. i want automate such bundle created in $(built_products_dir) gets copied in application bundle. is there way this, may run script? appreciate help. figured out. i added run script phase application. script copy generated bundle application, cp -r ${built_products_dir}/mybundle.bundle ${built_products_dir}/${product_name}.app/mybundle.bundle hope helps!

c++ - Destructor vs member function race again -

i've seen similar question: destructor vs member function race .. didn't find answer following. suppose have class owning worker thread. destructor of class can like: ~ourclass { ask_the_thread_to_terminate; wait_for_the_thread_to_terminate; .... do_other_things; } the question is: may call ourclass's member functions in worker thread sure these calls done before do_other_things in destructor? yes can. destruction of member variables willonly start after do_other_things completes execution. safe call member functions before object gets destructed.

c# - String to double with 0 tail -

this question has answer here: formatting doubles output in c# 10 answers storing double 2 digit precision 4 answers i don't know how remove tail of 0 on "double" conversion generic currency string in c#. this code double reddito = math.round(convert.todouble("12500,245"), 3); the expected result reddito = 12500.245 the real result reddito = 12500.245000000001 what matter? for currencies best use decimal type rather double. doubles , floats approximations of real number , can trouble financial calculations. recommended practice not test floats , doubles equality allow small tolerance around value particular reason.

How to create kendoNumericTextBox in kendo grid cell? -

is there way create widgets in kendo grid cell template? here sample code. columns: [{ field: "name", title: "contact name", width: 100 }, { field: "cost", title: "cost", template: "<input value='#: cost #'> </input>",// input must numerical down. }] i want create numerical down cost column. here demo use "editor" property in field definition. have specify function append widget row/bound cell. here's example put drop downlist in each of rows of grid: $('#grdusers').kendogrid({ scrollable: true, sortable: true, filterable: true, pageable: { refresh: true, pagesizes: true }, columns: [ { field: "id", title: "id", hidden: true }, { field: "username", title: "username" }, { field: "firstname",

java - Installing two grails app on Tomcat causes exception -

i need have tomcat 2 grails applications installed. both applications should using 8080 follows: localhost:8080/app1 localhost:8080/app2 i tried put 2 war files in webapps folder , upload server. while server uploading, got exception in catalina.out log file: apr 23, 2014 1:27:27 pm org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["http-bio-8080"] apr 23, 2014 1:27:27 pm org.apache.coyote.abstractprotocol init severe: failed initialize end point associated protocolhandler ["http-bio-8080"] java.net.bindexception: address in use :8080 @ org.apache.tomcat.util.net.jioendpoint.bind(jioendpoint.java:410) @ org.apache.tomcat.util.net.abstractendpoint.init(abstractendpoint.java:640) @ org.apache.coyote.abstractprotocol.init(abstractprotocol.java:434) @ org.apache.coyote.http11.abstracthttp11jsseprotocol.init(abstracthttp11jsseprotocol.java:119) @ org.apache.catalina.connector.connec

javascript - ActiveXObject Number of rows counter -

i have piece of code: function getdata(evt){ var adresses = new array(); var j = 0; var excel = new activexobject("excel.application"); var fil = document.getelementbyid("file"); var excel_file = excel.workbooks.open(fil.value); var excel_sheet = excel.worksheets(1); for(var i=2;i<500;i++){ var morada = excel_sheet.range("e"+ ); var localidade = excel_sheet.range("c"+ ); var pais = excel_sheet.range("a"+i); adresses[j] = (morada + ", " + localidade + ", " + pais); j++; } for(var k = 0; k<j; k++) { codeaddress(adresses[k]); } } it receives excel file , processes data want. thing is, hard coded. for instant, in for: for(var i=2;i<500;i++) i using 500, use number of rows in sheet. have tried few things rows.count , whatever , gave alerts s

eclipse - Java resolve project path -

i trying return project's file path create file in said path. created file in path used static path project rather resolving programatically need do. using docs i've tried creating file: path path = paths.get("c:\\folder\\folder\\folder\\folder\\folder\\report\\"); string filepath = path.tostring() + "filename.pdf"; createfile(filepath, data, moredata); question: what if else uses d: drive or other? how resolve report folder if case? use relative path file, rather absolute path. path path = paths.get("reports/filename.pdf"); string filepath = path.tostring() + "filename.pdf"; createfile(filepath, data, moredata);

java - Printing objects work but drawing it won't? -

so every time try draw list of objects won't draw it. have draw methods under class , seems works since while loop under update() method works should. if iterates through list , prints out correctly how can implement read same list under paintcomponent? seems if when try gives me null pointer exception means must empty. update: public void update(iobservable o, object arg){ gwp = (gameworldproxy) o; gameobjects = gwp.getcollection().getiterator(); while(gameobjects.hasnext()){ gameobject gameobj = (gameobject) gameobjects.getnext(); system.out.println(gameobj); } this.repaint(); } paintcomponent: public void paintcomponent(graphics g){ super.paintcomponent(g); while(gameobjects.hasnext()){ gameobject gameobj = (gameobject) gameobjects.getnext(); gameobj.draw(g); } }

flash - Actionscript 3: How do I have a button that allows a group of buttons to rotate 90 degrees at a time? -

i'm new actionscript in adobe flash. have cluster of buttons navibar , want rotate 90 degrees @ time after each press of button. i've done research , i've found out rotating button impossible. of course, can try using movie clip instead of button, keep if possible. you buttonname.rotation = 90 what's impossible that? or if want rotate cluster (as in "...rotate it..." in question?), instead of individual buttons, put buttons inside of movieclip , rotate movieclip.

objective c - Is there a way to register custom accept headers to parse as JSON in AFNetworking 1.3? -

i have server sending json using following accept header: [self setdefaultheader:@"accept" value:@"application/vnd.com.test.v1+json"]; in success block of api calls, response data coming nsdata object. i read in following question issue retrieving json afnetworking need set @"application/json" if want json parsed nsdictionary automatically, otherwise have manually each call using nsjsonserialization . is there way can @"application/vnd.com.test.v1+json" recognized json , automatically json deserialization each request? add desired content types afhttprequestoperation using addacceptablecontenttypes: : [afjsonrequestoperation addacceptablecontenttypes:[nsset setwithobject:@"application/vnd.com.test.v1+json"];

Facebook feed dialog - customizing lower left icon/text -

Image
how customize text in lower-left hand corner in facebook feed dialog, shown in attachment? or text part of icon? if so, upload icon in facebook? haven't had luck finding directions. you have use actions parameter in feed dialog code make such text appear below icon have mentioned. check out feed dialog parameters here you have not mentioned anywhere in question, language using, if using- javascript sdk- actions: { name: 'join dropbox', link: 'http://url.com' } php sdk- 'actions' => json_encode( array( 'name' => 'join dropbox', 'link' => 'http://url.com' )) hope helps! :)

mysql - SQL Query for datewise data -

Image
i've situation need find sum of columns defined particular date. plese refer below table: in this, need find sum of numbers date wise i.e. 15 march 15 june (in above table months denoted number e.g. 5 may , on.) i did particular month each task below query: select (d1+d2+d3+d4+d5+d6+d7+d8+d9+d10+d11+d12+d13+d14+d15+d16+d17+d18+d19+d20+d21+d22+d23+d24+d25+d26+d27+d28+d29+d30+d31) hoursum table1 month='<given month>'; i don't want query idea sum half or less of column values addition. thanks. try d1 , d2 select sum(d1)+sum(d2) hoursum table1 group month,year refer "group by" https://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html updated answer: i think table structure strange should have 1 column name date rather having 31 columns(d1-d31). anyway, considering same table structure , data if want query data 15 march 2014 15 june 2014 need write query below: -- total sum of d1 d31 select sum(d1) +sum(d2) +sum(d3)

javascript - How to send an HTML form POST request using the HTML button tag? -

as of now, have user-input structure user provides username/password clicks either "login" or register" ends post request information. <form action="{% url 'users:login' %}" method = "post"> username: <input type="text" name="username"><br> password: <input type="password" name="passwd"><br> <input type="submit" name="login" value="log in"> <input type="submit" name="adduser" value="add user"> </form> what want replace 2 submit buttons tags, i.e.: <form class="control-group" action="{% url 'users:login' %}" method = "post"> <input type="text" placeholder="username" name="username"> <input type="password" placeholder="password" name="passwd">

performance - Need help/suggestions on android play music synchronously on multiple devices -

this question has answer here: android group play music synchrounously on multiple devices 1 answer i working on android app should play music synchronously on multiple android devices galaxy s4's group play how can achieve this. suggestions appreciated. finally got demo project on github. here's a link ! demo project play music synchronously on multiple android devices. bryan.

sony remote camera api to to do (Exposure) Bracketing with RAW pictures -

i happy nex-6 user, is... because remotely bracketing sequence in raw files hdr processing. first purchased ir remote, can either activate remote control or bracketing in shooting mode on camera.... then saw in-camera apps ... no raw support then found playmemories app on sony xperia z1.. no solution either. there camera remote api, v1 basic v2 better , develop java program (currently on windows planned develop android) take pictures. i see methods change exposure compensation, error 403 ... is there chance 1. api available 2. playmemories app add bracketing function on raw files 3. in-camera app save raw pictures ? best regards, nicolas thank feedback. can shoot raw+jpeg picture using api when set still quality setting raw+jpeg in camera body setting menu. raw file stored in memory card. api not fetch raw file, fetches jpeg. best regards, prem, member of developer world team @ sony

c++ - How to make array ( with a datatype of a class ) with undefined size -

my question: i have file following: input(1) input(2) input(3) input(6) input(7) output(22) output(23) 10 = nand(1, 3) 11 = nand(3, 6) 16 = nand(2, 11) 19 = nand(11, 7) 22 = nand(10, 16) 23 = nand(16, 19) now, read file , try find word nand . if find word nand want push id (which 10 first line) array. problem: array in want push id of nand should of class node type. how do that? ps: need array of node type because call method processing on 2 nodes e.g. wire(node* a, node*b); that's easy: include header vector: #include <vector> declare vector, of type node : std::vector<node> nodes; and when have created new node object: nodes.push_back(my_new_node); also, can have vector of node* if want manage memory on own. please note, possible address of object ( node ) vector have careful not trust between operations on vector.

typeface - setTypeface to all the layout at one time ...android -

is there away set type face views(including list view) @ 1 time, instead of doing each view.thank you can use following method set typeface layouts public void setfont(viewgroup group, typeface font) { int count = group.getchildcount(); view v; (int = 0; < count; i++) { v = group.getchildat(i); if (v instanceof textview || v instanceof edittext || v instanceof button) { ((textview) v).settypeface(font); } else if (v instanceof viewgroup) setfont((viewgroup) v, font); } }

javascript - How to fade animate background images (full size) -

i'm looking script ! want footer of website ( animation between background images it's written '' don't miss update '') : https://getgoldee.com/ does know similar script or able website ? thank answers ! this how couple of jq lines: var $bg = $('#bg'), $bgdiv = $('div', $bg), // cache elements n = $bgdiv.length, // count them (used loop % reminder) c = 0; // counter (function loopbg(){ $bgdiv.eq(++c%n).hide().appendto($bg).fadeto(3000,1, loopbg); }()); // start fade animation *{margin:0; padding:0;} body{ width:100%; height:100%; } #bg{ position:absolute; top:0; width:100%; height:100%; } #bg:after{ content:""; position:absolute; top:0; left:0; z-index:1; width:100%; height:100%; background:url(//i.stack.imgur.com/d0az1.png); } #bg > div{ position:absolute; top:0; width:100%; height:100%; bac

python - Check to see if file is open before doing anything -

i've created script rename files in folder based on conditions. if len(self.toloc.get()) == 0: searchrev = "_r" + newrev filename in os.listdir(app.pdfdir): try: filepath, fileextension = os.path.splitext(filename) sep = searchesri rest = filename.split(sep, 1)[0] + searchrev + fromlocation + fileextension if fileextension == '.pdf': shutil.move(os.path.join(app.pdfdir, filename), os.path.join(app.pdfdir, rest)) elif fileextension == '.xlsx': shutil.move(os.path.join(app.pdfdir, filename), os.path.join(app.pdfdir, rest)) except ioerror: print ("errror") i trying use try , except see if file open before doing renaming. of right now, if file open, program spits out "error" message , renames file keeps copy of original in directory. hoping there way check

sockets - c++ winsock - server communicates only with single client while it should communicate with every client -

i writing single chat program gui. wanted write server accept many clients. every client can connect successfuly. there strange problem sending , receiving data. use select() , thread handle many sockets @ same time. if client sends data server, receive , send client (the client written without "prediction"). server won't send further clients (like every client had own private conversation server). here's code: // rewritten beej's tutorial little , insignificant changes /* in thread */ fd_set mainfd; fd_set readfd; // sin-size, newfd, maxfd - int while(true) { readfd = mainfd; if(select(maxfd+1, &readfd, null, null, null) == -1) { messageboxa(null, "error while trying accept incoming connections (select)", "error", 16); itoa(getlasterror(), buf, 10); messageboxa(null, buf, buf, 0); break; } for(int = 0; <= maxfd; i++) { char* psr; char srmsg[256]; if(fd

sql - Postgres: Update all columns from another table -

i need update table one, , need update columns, questions that, besides list every column in set , there way update them this: update tablea set * = tableb.* tableb tablea.id = tableb.id i tried in psql, doesn't work.. have list every column this: update tablea set c1 = tableb.c1, c2 = tableb.c2, ... tableb tablea.id = tableb.id tableb created use create..like tablea. identical. , reason i'm doing need load .csv data temp table tableb , update tablea based on new data in tableb. tablea needs locked little possible , tablea needs keep integrity. i'm not sure 'delete insert' option? thanks! you delete , re-insert, if 2 tables have same columns in same order. assuming records in tableb match tablea: delete tablea id in (select id tableb) insert tablea select * tableb; (if records not match, use temporary table keep necessary ids.) generally, oppose doing insert without column list. in cases, tolerable -- such when tableb cr

javascript - Using jQuery to hide other similar class elements -

i developing web page jquery , want if click , elements focus .toggle(),but want hide other elements same class name here code: <html> <head> <title>prueba</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $( document ).ready(function() { $(".part").click(function(){ $(".title",this).toggle(1000); }); }); </script> <style> html, body { font-family: arial, helvetica, sans-serif; background-image: url("img/plano.jpg"); height: 100%; padding: 0; margin: 0; } .part { width: 25%; height: 50%; float: left; } .part:hover { background-color: rgba(68, 168, 255, 0.60); } .title { display: none; width:100%; text

javascript - Three.js/3D models - calculating few volumes of object -

Image
i work 1 project in three.js , must solve 1 problem fast possible. need calculate few volumes of 3d object. first need same here: how calculate volume of 3d mesh object surface of made triangles and calculate in same way. entire object volume. that enough if object doesn't need additional material when goes 3d printing. example if glass (an open cylinder) need calculate volume of additional material, used in printing of model. material "inside" glass , prevent floor of glass falling inside model. i don't know how calculate that, less math knowledge think. there way calulate this? or maybe there way calculate "closed-mesh volume" even, when open 1 (like glass)? edit: not have glass model, have model of box. box printed open side on bottom. need know "inside" volume. sorry english, hope it's understandable. here how calculate volume of object (exactly in link in 1st post): function volumeoft(p1, p2, p3){ var v321 = p3.x*

email - Response from SMTP server with Rails -

how response smtp server in ruby on rails using actionmailer, when send email mailer.deliver method? i found actionmailer smtp server response answer doesn't work... idea? i need because aws ses return message id through, , it's way message linked bounce or spam report provide after. if smtp in way this response = mail.your_mail().deliver and isn't getting response need, try deliver_now! response = mail.your_mail().deliver_now! pp response.message this show result: 250 2.0.0 ok: queued 3lg8s16khmz6zhxq i configured smtp settings on mail.rb delivery_options = { user_name: 'email@server.com.br', password: 'mypassword', authentication: :login, address: 'smtp.mycompany.com.br', port: 2525, domain: 'mycompany.com.br', return_response: true }

collections - mongodb mapreduce doesn't return right in a sharded cluster -

very interesting, mapreduce works fine in single instance, not on sharded collection. below, may see got collection , write simple map-reduce function, mongos> db.tweets.findone() { "_id" : objectid("5359771dbfe1a02a8cf1c906"), "geometry" : { "type" : "point", "coordinates" : [ 131.71778292855996, 0.21856835860911106 ] }, "type" : "feature", "properties" : { "isflu" : 1, "cell_id" : 60079, "user_id" : 35, "time" : isodate("2014-04-24t15:42:05.048z") } } mongos> db.tweets.find({"properties.user_id":35}).count() 44247 mongos> map_flow function () { var key=this.properties.user_id; var value={ "cell_id":1}; emit(key,value); } mongos> reduce2 function (key,values){ var ros={flows:[]}; values.foreach(function(v

Perl read a line into hash keys and other line into values -

i trying plot stat using external command, , output of external command of 2 lines, like insert query update delete getmore command flushes mapped vsize *0 961 *0 *0 0 4|0 0 42.2g 85.2g i trying hash, can later call keys insert/query give corresponding values 0/961 read each line array, as foreach $line (@qps_raw){ chomp $line; @stats_raw=split("\n ", $line); push (@stats, @stats_raw); print dumper @stats; } but have no idea how push each element of first line hash keys , each element of second line values. pointers appreciated. use hash slice: #!/usr/bin/perl use warnings; use strict; use data::dumper; @names = split ' ', <>; @values = split ' ', <>; %hash; @hash{@names} = @values; print dumper \%hash;

WSO2 ESB Service Integration -

in service integration sample, output coming 805 oakley seaver drive 28.7 clermont, fl clermont cboc 352-536-8200 or 877-469-9037 and not response according ot proxy service wsdl response "gethccenterinfo" third call in proxy service,how can map output actual proxy service output in out sequence. 2nd question if want center record in 1 output.. here giving 1 center although after aggregating have 5 record ... want in 1 output multiple record... please me achieve desire output, in advance

arraylist - Java 2d game finding correct enemy for fighting -

i making simple 2d game in java , trying fighting work. going pokemon-style fighting, doing when press spacebar, checks if colliding enemy, finds enemy in arraylist, , executes fight method using enemy. works of time, can't seem find enemy in arraylist. code checking is: if (space) { (rectangle collideable : enemy.ens) { if (intersects(playerr, collideable)) { system.out.println("colliding enemy!"); x = locx; y = locy; playerr.setlocation(x, y); (int = 0; < game.enemies.size(); i++) { if (enemy.ens.get(i).equals(collideable)) { system.out.println("can't find enemy fight"); system.out.println(game.enemies.get(i).getname()); fightquestion(game.enemies.get(i), i); break; } } break;

c++ - Cannot compile c code on netbeans windows -

Image
i not able complile c code in netbeans getting following error. cannot run program "c:\cygwin64\bin\makeinfo" (in directory "c:\users\prjwl\documents\netbeansprojects\hearts"): createprocess error=5, access denied i have followed netbeans intallation guidelines , cygwin seems working command line. i have checked missing dll's , checked settings in tools->options->c++ see if build tools set if knows doing wrong, me makeinfo not part of c compilation process, documentation generator, used in conjunction gnu autools. you should able install installing texinfo cygwin package. note makeinfo not make , far. if need make , install cygwin package well, , set "make command" c:\cygwin64\bin\make.exe (in case).

C++: convert TCHAR array to std::string -

i want convert tchar array std::string . after searching internet, did way: tchar filename[260]; getprocessname( reinterpret_cast<dword>(processid), filename, max_path ); std::wstring tmpwstring( filename ); std::string result( tmpwstring.begin(), tmpwstring.end() ); std::cout << "the length of tmpwstring is: " << tmpwstring.length() << std::endl; this gives me tmpwstring of length 0 . however, pure coincidence, added sleep function before conversion, goes smoothly, , can conversion result properly: tchar filename[260]; ::sleep(500); getprocessname( reinterpret_cast<dword>(processid), filename, max_path ); std::wstring tmpwstring( filename ); std::string result( tmpwstring.begin(), tmpwstring.end() ); std::cout << "the length of tmpwstring is: " << tmpwstring.length() << std::endl; std::cout << "this resulted string: " << result << std::endl;

plot - R graphics: add labels to clustered/dodged bar chart -

Image
this basic plotting question: i need add labels clustered/dodged bar chart. have looked @ several examples using text() , cannot seem position labels correctly. teachers <- c("a", "b","c", "d", "e") mean_pre_scores <- c(10, 11, 12, 10,9) mean_post_scores <- c(12,15,17,13,12) pre_post <- data.frame(mean_pre_scores, mean_post_scores) pre_post <- as.matrix(pre_post) barplot((t(pre_post)), beside = t, names = teachers, legend = c("pre", "post"), ylim = c(0,20), args.legend = list(x="bottomright"), axes = t, main = "unit 1 test", col=c(26,51)) i want modify plot values displayed above bars. helpful know how show values inside bars. i think you're after: z <- barplot((t(pre_post)), beside = t, names = teachers, legend = c("pre", "post"), ylim = c(0,20), args.legend = list(x="topright"), axes = t,

javascript - Defer, Async and the PageSpeed Insights -

i try optimize page speed load using recommendations of pagespeed insights about, particularly, deferring javascripts, in order not block page content render. so, appears html5 introduced preatty cool feature, async attribute, permits load scripts asynchronously in "chaotic" mode. there attribute, defer one, loads them asynchronously, in "ordered" mode (as understood that article ). so, concluded always use (for every <script src='my.js'> ) defer attribute. in case if script not "load critical" (like jquery, or jquery-ui) async attribute can used. is right conclusion ? ps. complimentary question: fact of adding scripts at end of document , automatically "unblocks" rendering of document? understand, scripts blocks rendering, without difference of location in document (the <head> or before </body> )... 1. use (for every <script src='my.js'> ) defer attribute. you shou

Hazelcast: Multiple Hazelcast Nodes are created in response to a single newHazelcastInstance call -

i have small hazelcast cluster under medium sized , constant load. when scale cluster adding new server interesting , unexplained result. part of creation of new server call hazelcast.newhazelcastinstance(hzconfig);. call creates single hazelcast node in cluster (as verified using management console). in of test cases, call creating many hazelcast nodes in cluster (testing has shown many 7 new nodes being created). has else seen behavior? there way control this? why happening? can number of nodes spawned predicted? does logging of members members show different result, because see there truth. it there bug in management center. so can post logging of members? it should this: members [2] { member [192.168.1.104]:5701 member [192.168.1.104]:5702 }

css - Inline-block divs fitting 100% width of page if available -

having 2 divs, first image, second text. both divs have display:inline-block. text div has min-width. if image width + text min-width fit on page both divs should on same line. otherwise (as in mobile browser) text div should go next line. this working far, can't make text div use 100% of page width , still right of image div. what need text div stretch full browser width. <div style="display:inline-block;vertical-align:top;"> <img src="http://www.acasa.org.br/ensaio/grande/506.jpg" style="xmax-width:500px; width:100%; height:auto;"> </div> <div style="display:inline-block;vertical-align:top;min-width:200px;max-width:500px;background-color:red;"> text here </div> use display:block; float:left; instead of display:inline-block;

java - How to format XML ResponseBody output without or with minimal configuration in SpringMVC -

in spring mvc project have small use-case need expose data in xml format. don't need xsd our project. since jaxb2 included in jdk (up version 6), did not need configure anything: nice! before, presented link followed. xml output automatically formatted (i.e. indented , new-lined nicely) browser. however, needed change link have xml file automatically downloaded. problem here file contents not formatted. the question is: possible format file output minimal configuration? examples can find start out configuring view resolvers, hope that not needed. elegant :) current setup follows. in controller: @requestmapping(value = "/{filename}.xml", produces = "application/xml") public @responsebody xmldata downloaddataasxml(httpservletresponse response) { xmldata xmldata = somelogic(); response.setheader("content-type", "application/octet-stream"); response.setheader("content-disposition", "attachment"); re

asp.net mvc - Deploying an ASP MVC application to Windows 2008 server running IIS 7.5 -

i've been digging around trying solid information how go doing this. of info i've found talks web deploy visual studio 20xx, i'm not sure if preferred method. want able "install" mvc website/web application staging, after testing/defecting fixing cycle, build , install on production environment. how going doing this? seems rather strange documentation loose , limited. isn't asp.net dev companies do? can explain me best approach rolling out , updating web apps win2008 iis 7.5? i'm looking nicely packaged installer. there multiple ways publish web site. solution depends on many factors, such whether publishing internally, or externally. if creating install third parties install on own servers, etc.. if have direct file system (ie network share) access web servers, , aren't concerned formal build process separate build servers, etc.. using built-in web publishing functionality of visual studio simplest method. publish directly filesystem

java - Lenient SimpleDateFormat acting strange -

i understand that, in order validate date strings, 1 must make dateformat instances non-lenient parseexceptions malformed dates. consider string dubiousdate = "2014-04-01"; dateformat sdf = new simpledateformat( "yyyymmdd"); date d; try { d = sdf.parse( dubiousdate); system.out.println( dubiousdate + " -> " + d); } catch ( parseexception e) { e.printstacktrace(); system.err.println( dubiousdate + " failed"); } this give 2014-04-01 -> wed dec 04 00:00:00 cet 2013 now can understand lenient calendars try nice , accept funny negative numbers, interpretation looks -01 considered month, though appears last, days are. , -04 months become 04 days, minus ignored. in leniency, why make sense anyone? i see possible interpretation: in pattern yyyymmdd month part limited exact 2 chars because there no separators between different numerical fields. "-0" seen month 0 , 1 month behind january yielding d

ios - UIPageViewController didFinishAnimating without user interaction -

i have problem can't solve. i need call method every time move between pages in uipageviewcontroller. recently found -(void) pageviewcontroller:(uipageviewcontroller *)pageviewcontroller didfinishanimating:(bool)finished previousviewcontrollers:(nsarray *)previousviewcontrollers transitioncompleted:(bool)completed{... but called if swipe pages (gesture) or second , subsequent times switch page. is there way trigger event every time switch pages?. tried inner viewcontrollers (pages) viewdidload, it's called first time. you should add code inner view controllers' viewdidappear , called whenever these view controller presented page view controller.

How to convert terminal window chat application (built using socket programming, written in python) into a web application? -

so, wrote chat application works in terminal windows: github source now want convert web chat application friends can connect/chat/test network. but, clueless how proceed! please me. suggest me technologies can use make available on website? it looks you've written python server handle python chat clients, , you'd extend web clients. i recommend using real-time network such pubnub relay data between chat clients , server. using real-time network means can spend less time worrying low-level socket issues such concurrency , more time building application. in case of pubnub, python sdk allow server subscribe chat channels, while javascript sdk web-based clients. can build simple javascript-based web client using code in blog post: build real-time chat apps in 10 lines of code . enter chat , press enter <div><input id=input placeholder=you-chat-here /></div> chat output <div id=box></div> <script src=http://cdn.pubnub.co

opencv - data table detection in an image using descriptors? -

Image
is there anyway detect statistical table in image using descriptors? have trained haar classifier using opencv already. there other way or technique detect whether there table in given image ? edit 1: find hough line transfrom did table below. what conceptual ways detect objects in image?

c++ - How to loop over Blowfish Crypto++ -

i running crypto++ doing speed tests on encryption algorithms. trying time how long takes encrypt, decrypt data(eventually more file sizes , different algorithms). running problem cannot loop on code. in following code, using blowfish, when encryption part, gives me error: hashverificationfilter: message hash or mac not valid what can fix this? need put in function? if so, how that? /** * g++ encryption_tests.cpp -o encryption_tests -lcryptopp -lpthread -l. */ #include <iostream> #include <string> #include <iomanip> #include <fstream> #include <ctime> #include "cryptoplusplus/osrng.h" using cryptopp::autoseededrandompool; #include "cryptoplusplus/cryptlib.h" using cryptopp::exception; #include "cryptoplusplus/hex.h" using cryptopp::hexencoder; using cryptopp::hexdecoder; #include "cryptoplusplus/modes.h" #include "cryptoplusplus/aes.h" #include "cryptoplusplus/filters.h" using cr

php - Check if geolocation is within boundaries -

Image
i'm trying generate geolocations within borders of area right i'm trying generate geo locations within these boundaries $bounds = array( array(55.4024447, 13.1656691), array(56.1575776, 15.8350261), array(68.0410163, 17.4600359), array(58.9380148, 11.3501468), array(67.6820048, 16.1964251) ); and right checking follows if ( ($bounds[0][0] < $lat && $bounds[0][1] < $lng) && ($bounds[1][0] < $lat && $bounds[1][1] > $lng) && ($bounds[2][0] > $lat && $bounds[2][1] > $lng) && ($bounds[3][0] > $lat && $bounds[3][1] < $lng) && ($bounds[4][0] > $lat && $bounds[4][1] > $lng) ) { however gets locations within square in middle not in entire area have idea of how check within full area instead? the following php code uses point in polygon algorithm. in fig 1 point in polygon , line drawn crosses perimeter of polygon odd number