Posts

Showing posts from August, 2015

android - Get the bytes[] from a TotalCaptureResult -

i getting totalcaptureresults object camera, using camera2 api in android. using preview, not single image. there way bytes[] totalcaptureresults? thank you. short answer: no. all captureresults objects contain metadata frame capture, no actual pixel information. associated pixel data sent wherever designated target surface in capturerequest.builder . need check whatever surface set up, such imagereader give access image output camera, give access bytes[].

r - Fast read different type of data with same command, better seperator guessing -

i have ld data, raw output file plink below (notice spaces - used make output pretty, notice leading , trailing spaces, too): write.table(read.table(text=" chr_a bp_a snp_a chr_b bp_b snp_b r2 1 154834183 rs1218582 1 154794318 rs9970364 0.0929391 1 154834183 rs1218582 1 154795033 rs56744813 0.10075 1 154834183 rs1218582 1 154797272 rs16836414 0.106455 1 154834183 rs1218582 1 154798550 rs200576863 0.0916789 1 154834183 rs1218582 1 154802379 rs11264270 0.176911 ",sep="x"), "type1.txt",col.names=false,row.names=false,quote=false) or nicely tab separated file: write.table(read.table(text=" chr_a bp_a snp_a chr_b bp_b snp_b r2 1 154834183 rs1218582 1 154794318 rs9970364 0.0929391 1 154834183 rs1218582 1 154795033 rs56744813 0.10075 1 154834183 rs1218582 1 154797272 ...

Using DLL in C++ project -

have dll library documentation, has no header file. there simple way use functionality of library in c++ program? - how reference dll codeblocks? in advance. as long have documentation exported dll functions, don't need header file (or import library), need know aspects of function calling. the documentation should include function name function argument types return type calling convention ( __stdcall , __cdecl , etc.) once have information, have need call exported dll function(s). so example, let's 1 of exported functions returns long , takes arguments, 2 dword s. calling convention __stdcall . name of function "func1"; #include <windows.h> #include <tchar.h> typedef long (__stdcall *myfunc)(dword, dword); int main() { // load dll hmodule hmod = loadlibrary(_t("mydll.dll")); if ( hmod ) // check if dll loaded { dword arg1 = 10; dword arg2 = 20; long return_value; // f...

c array not assigning correctly -

i'm assigning array pointer, after assignment, print values of both different. also, pointer values change execution execution (and since values come static file, looks pointer not assigned , it's printing address directions). here's code: #include <stdio.h> #include <stdlib.h> struct machine { int neighborhood; int location; int* capacities; int* safety_capacities; int* moving_costs; }; struct resource{ int transient; int weight_load_cost; }; struct variables{ int resources_amount; int machines_amount; struct machine* machines; struct resource* resources; }; struct variables var; void read_resources(file *file){ int resources_amount, i; char * line = null; size_t len = 0; ssize_t read; getline(&line, &len, file); //printf("resources: %s", line); resources_amount = atoi(line); struct resource resources[resources_amount]; for(i = 0; i<resources_amoun...

javascript - changing src after page load / is executable? -

a. wondering how change src after page load using javascript <img src="http://example.com/image.png" /> <img src="http://domain.com/different.jpg" /> b. second question follow - the new src of image (domain.com/different.jpg) displayed? execute new network request? use jquery , write below code after document ready a. $('img').attr('src','http://domain.com/different.jpg'); b. yes, image display , yes, execute new network request

x86 - GNU Assembler: instruction meaning -

this x86 disassebly objdump. what instruction mean? how call address calculated? call *0x1bc(%eax) in particular, asterisk mean here? mean %eax + 0x1bc ? yes. branch addresses immediate or register operands prefixed asterisks. from this page : branch addressing using registers or memory operands must prefixed '*'.

php - Trying to get all column names in a table -

i found this answer says this: $columns = schema::getcolumnlisting('users'); but doesnt use, suppose should be: use illuminate\database\schema\builder schema; but when try it doesnt work: $columns = schema::getcolumnlisting("users"); i error: non-static method illuminate\database\schema\builder::getcolumnlisting() should not called statically, assuming $this incompatible context you can do: $columns = db::getschemabuilder()->getcolumnlisting('users'); and use db; import needed dependencies.

shell - Boolean circuit using basic arithmetic? -

according how perform arithmetic in makefile? , can perform basic arithmetic through posix shell in gnumakefile (see dominic's answer ). i got excited because have suffered lack of logical operators in past. coded following test on os x: gcc42_or_later = $(shell $(cxx) -v 2>&1 | $(egrep) -c "^gcc version (4.[2-9]|[5-9])") is_darwin = $(shell uname -s | $(egrep) -i -c "darwin") clang_compiler = $(shell $(cxx) --version 2>&1 | $(egrep) -i -c "clang") # below, building boolean circuit says "darwin && (gcc 4.2 or above || clang)" supports_multiarch = $$($(is_darwin) * $$($(gcc42_or_later) + $(clang_compiler))) ifneq ($(supports_multiarch),0) cxxflags += -arch x86_64 -arch i386 else cxxflags += -march=native endif a run on os x showed -arch x86_64 -arch i386 , , expected. i added is_darwin=0 before math, should have driven low. did not, , got -arch x86_64 -arch i386 again. what doing wrong in above code? ...

java - Creating patterns from SPIED -

is there way create patterns spied tool provided stanford? wonder if can extract patterns without running whole bunch of bootstrapping tool. you can @ allpatternsdir flag in properties file. format of file depends on whether using memory or lucene save patterns. if don't want run bootstrapping tool, can set learn=false. for more, checkout createpatterns class , java classes see what's format of file generated allpatternsdir

OrientDB ETL with self joined mysql table -

i'm trying (new orientdb) load old fashioned self joined mysql table orientdb. i'm kinda stuck, want create vertices , edges etl edges created empty vertices. spent many hours in documentation can't find missing. here oetl json file : { "config": { "log": "debug" }, "extractor" : { "jdbc": { "driver": "com.mysql.jdbc.driver", "url": "***", "username": "***", "userpassword": "***", "query": "select nid, pnid, label prod_arbo limit 500" } }, "transformers" : [ { "vertex": { "class": "noeud", "skipduplicates": true} }, { "field": { "fieldname": "titre", "expression": "label"}}, { "field": { "fieldname": "titre", "operation": "...

ios - Basic authentication with UIWebView -

i read lot of post on over how able apply basic authentication. i've produced code not show log on page, white page displayed. credentials use works in browser , not problem. delegates ok. i can't figure out code fails: override func viewdidload() { super.viewdidload() webview.delegate = self self.loadpage() } func loadpage() { let url = "mypage.com/auht/logon.do" let request = nsmutableurlrequest(url: nsurl(string: url)!, cachepolicy: nsurlrequestcachepolicy.reloadignoringlocalcachedata, timeoutinterval: 12) webview.loadrequest(request) } // mark: nsurlconnectiondelegate delegates func connection(connection: nsurlconnection, willsendrequestforauthenticationchallenge challenge: nsurlauthenticationchallenge) { if challenge.previousfailurecount == 0 { authenticated = true let credential = nsurlcredential(user: "m.rinaldi13", password: "299792,458km/s", persistence: nsurlcredentialpersistence.fo...

CakePHP 3 validation params -

is right in cakephp 3? $validator ->add('fieldname', [ 'rulename' => [ 'rule' => 'isunique', 'required' => true, 'allowempty' => null, 'on' => null, 'last' => false, 'message' => null ] ]); or should in following way $validator ->requirepresence('fieldname') ->notempty('fieldname', 'this field required') ->add('fieldname', [ 'rulename' => [ 'rule' => 'isunique', 'on' => null, 'last' => false, 'message' => 'this field required', ] ]) i need know if both forms correct. or right way , why? try this, generate cake public function validationdefault(validator $validator) { $validator ->integer('id') ->allowempty('...

mysql - Why Is My Variable Not Working As A Parameter In PHP Funtion -

at top of document created varible called $selectedid using $_get id of selected user(ill later switch encrypted string) url looks little profile.php?id=4. have function loops though database blog post same number $selectedid variable, inputted second parameter of function. the issue second parameter in function $selectedid supposed used number filter while looping through database, seems variable not being inserted function therefore loop not working properly this main page showing information <div id="blogfeed"> <ul> <!-- exicute fucntion functions.inc.php grabs feed articles database --> <?php $_result = display_blogs_profile($connect, $selectedid); // count how many rows in database $limit = count($_result); // loop through article...

bits - Binary Subtraction Borrowing Logic for 1000 - 0110? -

i having hardtime understanding borrowing logic 1000 - 0110 . know answer 0010 having trouble understanding borrowing part little. first step ok 0 - 0 = 0 1000 0110 ---- 0 second step 0 - 1 , need borrow . borrow 1 , result 10 - 1 = 1 ->1 1000 0110 ---- 10 but @ next step there nothing borrow, how work ? when borrow, carry on binary 10 lower bit, so: 0 ->1 0000 0110 ---- 0 then borrow again, , subtract 1 10, 1: 0 ->11 0000 0110 ---- 0 and finally: 0 ->11 0000 0110 ---- 0010

jquery focus on mobile field till reaches max length -

i need restrict mobile number field, not loose focus till reaches max length. suppose, if click on tab after entering numbers, example, 3 numbers, should not focus out. i tried in following way, working mobile number field blank , not able enter character in field jquery $(document).on('keydown','.mobile-verified', function(e){ if($('.mobile-verified').val().length>9 && e.which==9){ //working code } else{ $(this).focus(); return false; } }); template <input name="mobilenum" class="mobnum mobile-verified" maxlength="10" type="text"> prevent default tabbing behaviour if length of input value less maxlength property: $(document).on('keydown','.mobile-verified', function(e){ if (e.which == 9 && $(this).val().length < this.maxlength) { ...

mongodb - Qlik Sense Drawing multi line graph -

Image
i'm new qlik sense. i've data mongodb , trying visualize data using qlik sense. data: name time value sig0 1434443400061 0.78535046693984389 sig0 1434365571861 0.47410865876843988 sig0 1434367800061 0.52816115795111507 sig1 1434443400062 0.54981022370331589 sig1 1434365571862 0.48053196850949664 sig1 1434367800062 0.28258334531262386 how draw multi line graph? x axis - time y axis - line 1 - sig0 y axis - line 1 - sig1 currenty, im connecting qv source mongdbconenctor load data. any suggestions appriciated. the simple bit of splitting data sig0 , sig1 done if statement in measure expression. sum(if(name='sig0',value)) same sig1. draw graph. you'll have time normal date conversion yourself.

http live streaming - Unspecified or invalid track path/url - Roku with Livestream.com stream -

i'm developing custom roku channel , need use livestream.com video stream following live stream event: http://livestream.com/accounts/11222132/events/3665575 using json service i've been able obtain m3u8 stream. stream works fine on ios, android, , fire os can't work on roku. this code gets , attempts play stream: function displayvideo() print "displaying video: " p = createobject("romessageport") video = createobject("rovideoscreen") video.setmessageport(p) 'bitrates = [0] ' 0 = no dots, adaptive bitrate 'bitrates = [348] ' <500 kbps = 1 dot 'bitrates = [664] ' <800 kbps = 2 dots 'bitrates = [996] ' <1.1mbps = 3 dots 'bitrates = [2048] ' >=1.1mbps = 4 dots bitrates = [0] request = createobject("rourltransfer") request.seturl("http://livestream.com/api/accounts/11222132/events/3665575/...

c++ - What are the lowest possible latencies for a FIX engine to send a FIX message from client to server? -

i building fix engine in c++ don't have reference know considered performance number. taking account network time , fix parsing time, time in microseconds client send fix message server? know current lowest possible latencies expected simple fix-message-from-client-to-server operation? that depend on how fast fix engine can parse bytes fixmessage object , more importantly on how fast network code is. writing network stack too? writing fix engine looks simple outside complex task many corner cases , features have cover. going support retransmission? asynchronous audit-logging? fix session timers? repeating groups inside repeating groups? should consider using open-source or commercial fix engine. as latencies should expect, unaware of fix engine can go below 4.5 microseconds. that's one-way total time write fixmessage object bytebuffer , transfer bytebuffer on network server, server reads bytebuffer network , parses fixmessage object. if using descent fix engi...

sql - OVER ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW not working. Incorrect syntax near 'ROWS' -

select dtotalcharge, icarrierinvoicedetailsid, dtpickupdate, vctrackingnum, sum(dtotalcharge) on (partition icarrierinvoicedetailsid order dtpickupdate, vctrackingnum rows between unbounded preceding , current row) runningtotal tblcid getting error: msg 102, level 15, state 1, line 6 incorrect syntax near 'rows'. any idea wrong this. had problem before pivot before. these examples out of 70-461 training kit. confused.

oracle - Increasing number of mappers in sqoop command gives java heap space error -

i m using sqoop 1.4.5-cdh5.2.1 , oracle . i m importing small set of records of 115k oracle . sqoop command works fine on setting --num-mappers 5. when set more 5 , error of java heap space. can 1 tell ,that why happening so. log exception in thread "main" java.lang.outofmemoryerror: java heap space @ java.math.biginteger.(biginteger.java:394) @ java.math.bigdecimal.bigtentothe(bigdecimal.java:3380) @ java.math.bigdecimal.bigdigitlength(bigdecimal.java:3635) @ java.math.bigdecimal.precision(bigdecimal.java:2189) @ java.math.bigdecimal.comparemagnitude(bigdecimal.java:2585) @ java.math.bigdecimal.compareto(bigdecimal.java:2566) @ org.apache.sqoop.mapreduce.db.bigdecimalsplitter.split(bigdecimalsplitter.java:138) @ org.apache.sqoop.mapreduce.db.bigdecimalsplitter.split(bigdecimalsplitter.java:69) @ org.apache.sqoop.mapreduce.db.datadrivendbinputformat.getsplits(datadrivendbinputformat.java:171) @ org.apache.hadoop.mapredu...

extract date from timestamp in postgreSQL -

we have table of data looks like: |id|date1 |timestamp1 | ----------------------------- |1 |2015-06-23|2015-06-23 16:02:00| ----------------------------- |2 |2015-01-02|2015-01-02 11:32:00| i tried create function , trigger not working, looks this: create or replace function insert_date1_trg_func() returns trigger $body$ begin update schema.table set date1 = extract(date new.timestamp1) id = new.id; return null; end; $body$ language plpgsql volatile cost 100; trigger create trigger insert_date1_trg_func() after insert or update on schema.table each row execute procedure insert_date1_trg_func(); i getting error type date expression double precision. if want set "date1" in update trigger, should this: create or replace function insert_date1_trg_func() returns trigger $body$ begin new.date1 = date_trunc('day', new.timestamp1)::date; return new; end; $body$ language plpgsql stable; trigger: create trigger insert_date1_trg_fun...

ios - Objective C - Sketch Application will not draw long lines -

Image
i have iphone app provide sketch pad user save signature. uiimageview gets added main view , holds strokes. reason can draw short lines on pad following image. i have application ipad uses same code , works fine. i'm not sure causing it. i'm not using touch or gesture code interfere it. following of code use. update: if create uiviewcontroller same class , make root view controller works fine. in navigation hierarchy doing weird. -(void)setupsignaturepad{ //create frame our signature capture imageframe = cgrectmake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width + 23, self.view.frame.size.height + 7 ); //allocate image view , add main view mysignatureimage = [[uiimageview alloc] initwithimage:nil]; mysignatureimage.frame = imageframe; mysignatureimage.backgroundcolor = [uicolor whitecolor]; [self.view addsubview:mysignatureimage]; } //when 1 ...

amazon web services - what's in a node.js elastic beanstalk zip file and how do I get it to run a script on deploy? -

should zip file of application include node_modules folder? should zipping top-level folder contains application files or should not include top root folder instructions amazon lambda? do have set web application port environment variable in heroku? app start calling npm start , looking @ package.json or have have file called server.js in opsworks? how can have run small migration script before starts - can put in npm start? can run npm install on deployment rather copying on node_modules folders? quick answers: no, zip file not need include node_modules folder. eb run npm install you. there several ways run script @ start. npm start one, can run custom commands . yes, eb run npm start , see configuration options node.js the best answer take @ 1 of amazon's sample apps, such nodejs-example-express deploying express application elastic beanstalk .

c# - Unable to cast HttpRequestMessage.Properties["MS_RequestContext"] as OwinHttpRequestContext at build time but valid at runtime -

i'm trying manually fiddle property of ms_requestcontext during controller activation inside webapi's compositionroot. my create method receives system.net.http.httprequestmessage argument. i can drill down request grab request.properties["ms_requestcontext"] properties dictionary<string,object> object owinhttprequestcontext @ runtime. but whenever attempt cast, can access properties on requestcontext, nasty-gram visual studio (request.properties["ms_requestcontext"] owinhttprequestcontext).request.properties; the error comes is: type or namespace 'owinhttprequestcontext' not found (are missing using directive or assembly reference?) owinhttprequestcontext lives inside system.web.http.owin namespace. references set up. have added using statement measure. so crazy part if roll code attempts directly reference request.properties , instead set breakpoint inside create method, can -through watch- execute (request.p...

google chrome - Get The Data Of JavaScript Console With Error Message And Line number and send it to server through Ajax Call -

i want data through console window of browser 1) error messages 2) file name line number. tried lot. search cant find solution. tried many api's couldn't solution. error, stack trace, console , many other thing have tried couldn't data. want data browser console javascript errors. , want send server through ajax call.

java - Animation libGDX issue -

i created first animation class calls animation_ss. make class take code from: https://github.com/libgdx/libgdx/wiki/2d-animation . transformed code site class. dont know why after run program it's closed. use libgdx lib. here console output exception in thread "lwjgl application" java.lang.nullpointerexception @ animationdemo.animationdemo.render(animationdemo.java:78) @ com.badlogic.gdx.backends.lwjgl.lwjglapplication.mainloop(lwjglapplication.java:215) @ com.badlogic.gdx.backends.lwjgl.lwjglapplication$1.run(lwjglapplication.java:120) it shows render method. and here main class public class animationdemo extends applicationadapter { animation_ss walkguy; spritebatch batch; @override public void create () { walkguy = new animation_ss(6, 0.025f, true); walkguy.loadss("stickss.png"); walkguy.cropss(4, 2); } @override public void render () { gdx.gl.glclearcolor(1, 0, 0, 1); gdx.gl.glclear(gl20.gl_color_buffer_bit); walkg...

twitter bootstrap - css width % working incorrectly; longer than necessary -

i have set of images want stacked 1 on other. working bootstrap, , kept parent div @ center of jumbotron. div encloses image, , absolutely divs further contain images. however, when apply width:100% child divs, end being longer/ this js-fiddle code snippet: https://jsfiddle.net/yhl6tndn/ i led believe % measured respect parent container ( #major in example). width , height of #semimajor should equal, since width , height of #major equal. on checking actual sizes, find either the entire width of the parent of #major being used calculate width of #semimajor or the width of #major is being calculated margins. box-sizing properties set border-box . what should happen #semimajor should measure 150px 150px. cannot spot error in code though. edit 1: position: relative on #major removes issue, still not understand why must case. when used position: absolute , comes out of normal flow of document , positioned respect body , comes out of #major . not...

After Effects ram preview jumps to beginning of timeline -

this pretty simple issue, when play ram preview want stop @ end of work area playhead jumps beginning of timeline can't see animation complete. don't think ram issue because it's very small animation. how can make preview stop ad end? in ram preview box, near middle right of screen (if you're using default layout), there should loop button. click it, , should toggle between loop, bounce between playheads, , off.

jquery - JSTree check is selected nodes are leaf or make only leaves selectable -

i created jstree follows $('#js-tree').jstree({ 'core' : { 'data' : { 'url' : "${pagecontext.request.contextpath}/maketree", "plugins" : [ "types", "search"], 'data' : function (node) { return { 'id' : node.id }; } } } }); i want check if selected node leaf node while submitting information - var selectedleaves = $("#js-tree").jstree("get_selected"); but gives me array of id's only. how either use is_leaf method filter our leaf nodes selected nodes? referred post - force user select leaf nodes solution did not work me. i found solution on own using argument get_selected api filter out leaves folders - var nodes = $("#js-tree").jstree(true).get_selected("full", true); $.each(nodes,functi...

php - Mysql: Delete duplicate records based on minimum amount -

i need delete duplicate records based on minimum amount same order number . table has 100k records , structure this. tmp_id primary key in table. ------------------------------------ user_id order_number amount tmp_id ------------------------------------- 15 12364 25 1 20 454544 75 2 4 12364 100 3 6 45487 45 4 8 454544 330 5 i tried delete minimum amount of duplicate records using $qb_duplicate_data_query="select user_id,order_number,amount tmp_qbappraiser limit 10"; $qb_duplicate_data_sql=mysql_query($qb_duplicate_data_query) or die(mysql_error()); while($row=mysql_fetch_array($qb_duplicate_data_sql)) { $amount=$row['amount']; $order_no=$row['order_number']; $sql="select c1.tmp_id tmp_qbappraiser c1 inner join (select tmp_id tmp_qbappraiser order_number='$order_no' order amount asc) c on c.tmp_id=c1.tmp_id group c...

pass an array with unknown objects into string.Format in c# -

i output objects in array of strings length variable. example 1 : string id = a; string [] values = new string [] {"12","23"}; string output = string.format("{0}, {1}, id, values); //output should "a,12,23" example 2 : string id = a; string [] values = new string [] {"12","23","45","67","89"}; string output = string.format("{0}, {1}, id, values); //output should "a,12,23,45,67,89" is there way cover number of values or need convert values string , output it? you string.join(string, string[]) string.join(",", values) it add separator char , output in way want it an overview of methods use here: https://msdn.microsoft.com/en-us/library/system.string.join%28v=vs.110%29.aspx

asp.net - Way to delay/timeout postback in jQuery? -

is there way delay/timeout postback listview button in jquery? make fadeout animation before postback, firing when button clicked. ideas? my code: $(document).ready(function () { $('.btndown').click(function () { $('.imageset').animate({ 'opacity': 0 }, 1000); }); }); button markup, getting postback when it's clicked: <div class="btndown"> <asp:datapager id="datapager2" runat="server" pagedcontrolid="listview1" pagesize="3"> <fields> <asp:nextpreviouspagerfield buttontype="image" firstpagetext="" lastpagetext="" nextpageimageurl="~/images/arrowbtndown.png" nextpagetext="" previouspagetext="" showpreviouspagebutton="false"/> </fields> </asp:datapager> </div> button output: <input type="image" name="c...

How to set up a server that others on my work network can access using node.js? -

i'm new node.js, i've created server 2 ways. one way this: server.js: var connect = require("connect"); var servestatic = require("serve-static"); connect().use(servestatic(__dirname)).listen(8080); node.js cmd line: h:\> npm install connect serve-static h:\> node server.js and other way this h:\> npm install http-server -g http-server "c:\directory" but these create servers on computer @ http://localhost:8080 . how can adjust code make server accessible other people on work network? thanks in advance. the server accessible network already. use ip address or real hostname. http://203.0.113.1:8080/

c++ - Why only last thread executing? -

i need create console application counts files in folders. each folder executes parallel. directories paths .txt file , put them threads. i'm using std::thread , boost::filesystem. it works fine 1 directory, crashes or returns wrong results many. interesting last thread gets correct result, before wrong. here code: dirhandler.h #include <iostream> #include <fstream> #include <string> #include <thread> #include <windows.h> #include <boost/filesystem.hpp> using namespace std; using namespace boost::filesystem; class dirhandler{ public: dirhandler(); void getpaths(ifstream file); void output(); static void run_thread(pair<string, int> * dir, string cur_path, void *args) { dirhandler *prunnable = static_cast<dirhandler*>(args); prunnable->some_counting(dir, cur_path); } private: vector<thread> threads; vector<pair<string, int>> paths; // current directory name , files amount void some_count...

Excel VBA autofilter uncheck/exclude items -

quick question, how can exclude item in list through vba. have been working on sheet automatically prints out list without date on it. rows("2:2").select selection.autofilter activesheet.range("$a$3:$h$1000").autofilter field:=3, criteria1:="hans" activesheet.range("$a$3:$h$1000").autofilter field:=7, criteria1:="open" activesheet.range("$a$3:$h$1000").autofilter field:=6, criteria1:="<>1/0/1900", operator:=xlfiltervalues activewindow.selectedsheets.printout copies:=1, collate:=true, _ ignoreprintareas:=false rows("3:3").select selection.autofilter problem criteria not work date 0-1-1900 filter out. doing wrong? 0-1-1900 date not exist. might problem. just use criteria1:=">1/1/1900" and should word fine.

floating point - ActionScript: Number.toExponential returns incorrect results for some values -

i found @ least 2 numbers actionscript's number.toexponential(20) returns incorrect results. the obvious value 0. trace(number(0).toexponential(20)); // 0.00000000000000000000e-16 trace(number(0).toexponential(2)); // 0.00e-16 trace(number(0).toexponential(1)); // 0.0e-16 trace(number(0).toexponential(0)); // 1e-15 - worse! i've made class double playing around numbers (which ieee 754 double-precision binary floating point format numbers). takes number , extracts bits sign, bits , significand (the latter printed including implicit leading bit), or can generate number provided sign, bits , significand. there methods next , prior nearest representable numbers. here's 0 looks internally: [double number=0.00000000000000000000e-16 sign=1 exponent=-1023 iszero significand=00000000000000000000000000000000000000000000000000000] the other incorrect results nearest representable number greater number.max_value / 2 , number.max_value / 4. // number.max_value / 2. tr...

variables - TCL multiple assignment (as in Perl or Ruby) -

in ruby or perl 1 can assign more variable using parentheses. example (in ruby): (i,j) = [1,2] (k,m) = foo() #foo returns 2 element array can 1 accomplish same in tcl, in elegant way? mean know can do: foreach varname { j } val { 1 2 } { set $varname $val } foreach varname { k m } val [ foo ] { set $varname $val } but hoping shorter/ less braces. since tcl 8.5, can lassign {1 2} j lassign [foo] k m note unintuitive left-to-right order of value sources -> variables. it's not unique design choice: e.g. scan , regexp use same convention. i'm 1 of find little less readable, once 1 has gotten used it's not problem. if 1 needs ruby-like syntax, can arranged: proc mset {vars vals} { uplevel 1 [list lassign $vals {*}$vars] } mset {i j} {1 2} mset {k m} [foo] before tcl 8.5 can use foreach { j } { 1 2 } break foreach { k m } [ foo ] break which @ least has fewer braces in example. documentation: break , foreach , lassign , list , proc ,...

php - Flysystem local asset from outside public folder in Laravel 4 -

i have following method asset depending on cdn used: public function getasset($filename, $dir = null, $prefix = null) { $extension = file::extension($filename); $name = file::name($filename); $filename = $dir . $prefix . $name . '.' . $extension; if(flysystem::getdefaultconnection() == 'awss3') return flysystem::getadapter()->getclient()->getobjecturl('xxxx', $filename); if(flysystem::getdefaultconnection() == 'local') return flysystem::getadapter()->getclient()->getobjecturl($filename); } when 'local' storage selected (in config) want able asset app/storage/temp/media/ directory , display them image in tag, how can modify above work that? how asset outside public directory anyway?

indexing - Elasticsearch bulk manual index refreshing -

currently index has option: { "index" : { "refresh_interval" : "-1" } } which should mean index needs manually refreshed once data has been pushed make content searchable. my application, indexes data, refreshes index once bulk inserting done. is approach or there other recommended way that?

blueimp jQuery-File-Upload not working for laravel 5 -

i using , https://github.com/blueimp/jquery-file-upload plugin image upload using ajax call in laravel 5. refered article http://peterjolson.com/using-laravel-and-jquery-file-upload/ . getting following error error get http://localhost:8000/...../server/php/ 500 (internal server error) when use https://github.com/blueimp/jquery-file-upload/wiki/basic-plugin same error. can or please suggest working image uploader ajax call laravel 5 there main.js file, need adjust url there according path store it: url: '../../uploadimage/server/php/'

how do i get a list of nearby users in an android application? -

i building application ui gets list of nearby users connect minded people similar interests. know not new concept, apps grindr trying achieve in this. how go getting profile info on application phone , displaying on phone running same application? there web-server needed this? to illustrate user see: user has character bio written , artwork displayed, user b nearby , sees user on home page gridview. how user b getting info delivered phone? best practices in doing this? i looked , couldn't find solution posted if has been answered somewhere else appreciate links not contribute duplicate questions. new , needing guidance start getting deeper android programming , question seem keep coming to. you'd need have users upload current location via webservice every few minutes. store in database (using upsert). when user wants other nearby users, search database users within range , return list. use gis enabled database such postgres witht postgis extention, isn...

javascript - Redirecting to index.html after submit a form - How to show a message -

on form contact of site, when pressed submit button site open blank page (the php file), in order remove that, added header("location: ../index.html"); to php file, works, mantains same page after submit data, instantaneous goes index.html, having code show message of success or failure message doesnt show up. not sure why, because of method, saw many topics talking using ajax, find confusing me, must-use on site ? can me getting working site ? the site on free host: tential.co.nf html: <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="js/fixedbar.js"></script> <script src="js/slider.js"></script> <meta charset="utf-8"> <link href="http://fonts.googleapis.com/css?family=open+sans:400,300" rel="stylesheet" type="text/css"...

c++ - Tesseract False Space Recognition -

Image
i'm using tesseract recognize serial number. works acceptable, common problem false recognition of 0 , "o", 6 , 5, or m , h exists. beside tesseract adds spaces recognized words, no space in image. following image recognized "hi 3h" . this image results in " fbkhj 1r1" so tesseract added space, although there isn't space in image. there possibility parametrize spacing behavior of tesseract? edit i'm sorry, have forgot add, have serial numbers include spaces. cannot delete spaces inside recognized serial number. for example following image containing space in serial number results after tesseract recognition into: j4 f1583bb . beside recognition of characters false, space recognized correct image. my actual parameters tesseract are: tesseract::tessbaseapi tess; tess.init(null, "eng", tesseract::oem_tesseract_only); tess.setpagesegmode(tesseract::psm_single_block); tess.setvariable("tessedit_char_whitelis...

load balancing - Testing WSO2 ELB -

how check if wso2 elb working properly? have elb , 2 elb(1 manager , 1 worker) running, want check if elb doing work or not. want check using soap request, soap endpoint should point elb or esb? have configured elb according there in wso2's documentation. thanks. the wso2 elastic load balancer has been discontinued. can download nginx plus [1] - load balancer nginx - provide support. if using wso2 elb , need guidance, please visit our documentation page, spacially auto-scaling in load balancer in order set wso2 elastic load balancer 1 manager , 1 worker please refer document [1] in order check if wso2 elb working properly, can check autoscaling facilities in wso2 elb. please refer document [2] more information on autoscaling. if need send request esb first need point elb. [1] https://www.nginx.com/resources/admin-guide/ [2] http://blog.afkham.org/2011/09/how-to-setup-wso2-elastic-load-balancer.html

github - Git pull not working correctly? -

i had weird experience git today. project has database dump on github. today there changes made dump repo on github on develop branch. pulled changes ( git pull origin develop ) , updated local database changes. reason still had previous version of db rather new one. checked sha in git log , correct sha (the latest sha). when used vim inspect contents of file older file. i tried pull several more times each same result. ran git reset --hard origin/master (a different branch) did git pull origin develop and sha same (the latest sha) file correct file time (the latest file expected). i , still perplexed have caused this. can offer insight may root cause of issue? as thomas moulard mentioned in comments, if have local, uncommitted changes in working directory, , pull/merge changes in not touch files, local changes in file stay (otherwise, error). so if pulled something, , there no conflict, file still different, it’s possible these local changes. running gi...

c - struct pointer being optimized out using -O3 option -

it seems impossible debug optimized code. i've spent way long trying outsmart compiler. having hard time doing simple check if struct null or not due compiler optimizing code, don't me wrong want keep -o3 option if possible speed code, if keep getting many bugs due compiler optimizations might turn off. i have thread try dequeue struct entries array , put them database reason struct getting optimized out. void *queue_func(void *param){ logargs* largs; pthread_mutex_t *mx = (pthread_mutex_t*) param; initqueue(); while(!needquit(mx)){ if((largs = dequeue()) != null){ // boolean result true here interrupt_log(largs->event, largs->rawtime); // yet largs null here!!! } usleep(50000); } return null; } for reference here dequeue function , struct: logargs* dequeue(){ logargs* largs; if(isempty()) return null; else{ largs = &queue[++head % max_size]; return largs; } } h...

Getting custom calculated value in script field of Elasticsearch -

Image
i want multiplication of 2 values in script field in elastic search shown in image. how this? i using below aggregation code { "aggs": { "mention": { "terms": { "size": 20, "field": "username" }, "aggs": { "mention_hits": { "top_hits": { "sort": [ { "published_date": { "order": "desc" } } ], "_source": { "include": [ "klout" ] }, "size":...

javascript - Add new item in dropdown -

i want add option(add new item) if data not found while searching data in drop-down. i tried lot didn't got actual output. for reference can see example. (function($){ // case insensitive jquery :contains selector $.expr[":"].searchableselectcontains = $.expr.createpseudo(function(arg) { return function( elem ) { return $(elem).text().touppercase().indexof(arg.touppercase()) >= 0; }; }); $.searchableselect = function(element, options) { this.element = element; this.options = options; this.init(); var _this = this; this.searchableelement.click(function(event){ // event.stoppropagation(); _this.show(); }).on('keydown', function(event){ if (event.which === 13 || event.which === 40 || event.which == 38){ event.preventdefault(); _this.show(); } }); $(document).on('click', null, function(event){ if(_this.searchablee...