Posts

Showing posts from April, 2015

jquery - javascript - ajax request null data -

i trying make ajax request server. request send successfully, parameters not appropriate in request body. parameters shown in body browser's network tool: {"name":"","message":"","time":1464807897670} the name <input> , message <textarea> fields empty, although should not be. here's html input fields: <div id="writepanel"> <p>your name</p> <input id="writename" type="text"> <p>message</p> <textarea id="writearea"></textarea> <div id="sendbutton">send</div> </div> here's js code: $(document).ready(function() { var data = { name: document.getelementbyid("writename").value, message: document.getelementbyid("writearea").value, time: new date().gettime() }; $("#sendbutton").click(function () {

sas - Selecting a random column from a group of columns of interest -

Image
i trying come code select random column group of columns on interest. group of columns change depending on values in columns each observation. each observation subject. let me explain more clear: i have 8 columns, names v1-v8. each column has 3 potential responses ('small','medium','high'). due circumstances in our project, need "combine" information 1 column. key factor 1: want columns per subject he/she selected 'high' (lots of combinations here). refer when columns of interest changes per subject. key factor 2: once have identified columns 'high' selected subject, select 1 of columns @ random. at end, need new variable (new_v) values v1-v8 (not 'small','medium','high') indicating column selected each subject. any advice great. have tried arrays , macro variables can seem tackle right way. this method uses macro variables , loop. there 3 main steps: first, find variables "high.&qu

sql - How to create trigger on update with condition based on old and new data? -

i want update field server_prev_level_xp when new.server_xp > old.server_prev_level_xp i use mariadb , documentation . i try doesn't work : create trigger level_update after update of server_xp on servers each row when (new.server_xp > old.server_prev_level_xp) begin set new.server_prev_level_xp = old.server_prev_level_xp + old.server_prev_level_xp >> 1; set new.server_level = old.server_level + 1; end; have error on line 4: when (new.server_xp > old.server_prev_level_xp) what doing wrong? the syntax used create trigger doesn't apply mariabd ( [of <trigger column list>] , for each row [when (search condition)] ). see create trigger . one option use if statement . remember: such set statement has no effect in after trigger because row change have occurred. . delimiter // create trigger `level_update` /*after*/ before update on `servers` each row begin if new.`server_xp` > old.`server_prev_level_xp` . . .

How to remove field from document which matches a pattern in elasticsearch using Java? -

i have crawled few documents , created index in elasticsearch. using sense query: this query in elasticsearch: post /index/_update_by_query { "script": { "inline": "ctx._source.remove(\"home\")" }, "query": { "wildcard": { "url": { "value": "http://search.com/*" } } } } this java program: client client = transportclient.builder().addplugin(reindexplugin.class) .build().addtransportaddress(new inetsockettransportaddress( inetaddress.getbyname("127.0.0.1"), 9300)); updatebyqueryrequestbuilder ubqrb = updatebyqueryaction.instance .newrequestbuilder(client); script script1 = new script("ctx._source.remove" +fieldname); bulkindexbyscrollresponse r = ubqrb.source("index").script(script1) .filter(wildcardquery("url", patternvalue)).get(); fieldname(where

In xcode -- how to easily switch editor view from 'swift-like' generated representation of header to underlying objective-c header -

xcode has "helpful feature" (in quotes because not helpful me) of generating swift-syntax representation of objective-c headers. when using shortcuts open .h file (cmd-shift-o type foo.h) -- taken swift representation of foo.h , objective-c representation. the vast majority of time, want objective-c representation -- there way switch keyboard shortcuts when xcode dumps in swift version? as far know, if in swift file , open header, you'll see swift-generated header. if want see objective-c version, can open .m file first, open header file.

Drag-drop in vb.net -

i new in visual basic , followed 1 article write code drag , drop images. but want add if statement control drag-drop, if picture 1 goes picture box 2, give message it's in wrong place. my code: public class form1 private source picturebox = nothing private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load each pb picturebox in me.controls.oftype(of picturebox)() pb.allowdrop = true addhandler pb.mousemove, addressof pbs_mousemove addhandler pb.dragenter, addressof pbs_dragenter addhandler pb.dragdrop, addressof pbs_dragdrop addhandler pb.dragover, addressof pbs_dragover next end sub private sub pbs_mousemove(byval sender object, byval e system.windows.forms.mouseeventargs) dim pb picturebox = directcast(sender, picturebox) if not isnothing(pb.image) andalso e.button = windows.forms.mousebuttons.left source = pb pb.dodragdrop(pb.image, dragdropeffects.copy or

hadoop - Does Apache Pig FOREACH require GENERATE? -

i have never seen example of foreach in pig latin without generate. foreach statements require generate? from syntax of foreach , generate block part of foreach, , have choice of simple block or nested block. answer yes, foreach require generate. alias = foreach { gen_blk | nested_gen_blk } [as schema];

javascript - Button first action on click and second action on click -

the animated search box expanding @ click on button input. after entering text , second click on icon should send form method get. i not know doing wrong , happy if can help. <form action="navi.php" method="get"> <div class="search-wrapper"> <div class="input-holder"> <input type="text" class="search-input" placeholder="type search" /> <button class="search-icon" onclick="searchtoggle(this, event);"><span></span></button> </div> </div> </form> the javascript function function searchtoggle(obj, evt){ var container = $(obj).closest('.search-wrapper'); if(!container.hasclass('active')){ container.addclass('active'); evt.preventdefault(); } else if(container.hasclass('active')){ container.removeclass

c# - JSON Deserialize fails when linker is set to Link All -

Image
i getting argumentnullexception when trying deserialize json on device. here exact error: and here calling code: private tmetadata readobject(string path) { var data = file.readalltext(path); var obj = jsonconvert.deserializeobject(data, _settings); return (tmetadata) obj; } i read through this thread , realized linker problem. project set link when building device, , changing don't link not feasible due size constraints. i inspected json text , found type trying deserialize, went class , marked preserve(allmembers = true)]. added same attribute user defined class being used in class. still same error, however. added --linkskip=assemblyname additional mtouch arguments , had no luck. does have tips? there @ least way can more useful information xamarin? when exception happens takes me seemingly random line - event declaration in unrelated class - , clicking on methods in stack nothing. have no idea "method" parameter is. here's stack st

javascript - Waypoints and infinite scrolling -

i'm building infinite scroll page on wordpress using ajax load more plugin. can make scroll forever, but, have 1 problem: use waypoints show , hide sticky navbar title of post , share buttons. it's same waypoints: #capa , #sigaandbotoes . on first post, runs ok. but, when next called via ajax, not. reading, should refresh or destroyed / recreated, on again when next #capa , #sigaandbotoes appear. i tried lot of things read around internet, couldn't find solution this. help? this waypoints.js code i'm using: $(document).ready(function(){ $('#capa').waypoint(function(direction) { $('#barra').css('display', 'block'); if (direction === 'down') { $('#barra').addclass('fadeindownbig').removeclass('fadeoutupbig'); } else if (direction === 'up') { $('#barra').addclass('fadeoutupbig').removeclass('fadeindownbig'); } }, { offset: '-1

java - How to adjust accelerometer data for phones held in different positions. -

i'm making libgdx game using android studio alien ufo has avoid incoming asteroids, , ufo moves using accelerometer data. //gets , smoothens accelerometer data. values x , y switched because game played in landscape mode. currentaccelerometerx = gdx.input.getaccelerometery(); currentaccelerometerx = currentaccelerometerx * alpha + lastaccelerometerx * (1 - alpha); currentaccelerometery = gdx.input.getaccelerometerx(); currentaccelerometery = currentaccelerometery * alpha + lastaccelerometery * (1 - alpha); //moves alien alien.alienx += (currentaccelerometerx * 5); alien.alieny -= (currentaccelerometery * 5); lastaccelerometery = currentaccelerometery; lastaccelerometerx = currentaccelerometerx; this code works when phone being held of phone parallel floor, such position can uncomfortable play in after while. wondering how take account current rotation of device , adjust movement of ufo accordingly. the problem seems y position of

objective c - Load images to cache- make the iPad crash -

i loading many images cache, worked great in simulation till now, have tried on device - ipad2 , , crash, if after default screen loading sprites cache . app crash before starts . so , have tried load on background , , happen that, not crash now, some-how see black rects instead of images have loaded cache , means maybe havnt loaded anyway . this in init method of first class : [self performselectorinbackground:@selector(loadspriteframes) withobject:nil]; //than -(void)loadspriteframes { //pre load effects [[simpleaudioengine sharedengine] preloadeffect:@"badeffect.mp3"]; [[simpleaudioengine sharedengine] preloadeffect:@"hearteffect.mp3"]; [[simpleaudioengine sharedengine] preloadeffect:@"rewardbig.mp3"]; [[simpleaudioengine sharedengine] preloadbackgroundmusic:@"backgroundtraffic.mp3"]; //preload images needed animations [[cctexturecache sharedtexturecache] addimage:@"stopanim.png&quo

php - How would I interconnect a server with a game launcher in Java? -

i'm working on game in java. creating launcher game , wrapping .exe wrapper. need getting game connect sort of server , check if credentials user true: username real. password matches listed username. user has bought game (true/false) aka user premium? it has work website uses php , html. when user creates account, stored both in website, , in game server itself. also, if there's update game, automatically updates getting files server. the concept rather similiar games minecraft , planetside 2. depending on complexity or level of interaction require, done simple making request particular page on web server, , supplying necessary information in query string (alternatively use post). // construct query string proper username , password url url = new url("http://www.yoursite.com/verify.php?username=happy&password=pants"); try (bufferedreader in = new bufferedreader(new inputstreamreader(url.openstream()))) { stringbuilder sb = new stringb

algorithm - How to calculate time of passing the discrete path of cells? -

Image
let's have field of descrete cells (2d array or table). have finite path inside of no self-crossings , no diagonal connections. particle starts way in point , follows pattern point b. 1 step can done in finite amount of time = t. time whole path t = t * l, l = number of cells in path. but! have cells in field marked 'h' , 'v'. if particle hit 'h' cell divides 3 particles. 1 continue moving path. second starts move left 'h' cell left border of field. third starts move right 'h' cell right border of field. analogically 'v' cell, instead of left/right, 2 particles start move up/down. particles moving simultaneously same speed. additional particles can collect 'h' , 'v' , can divided , spawn more particles. need write function in lua calculates time moment of first particle starts way moment of particles finished ways. see related illustation. note once 'h' or 'v' cell have been collected becomes simple

rubygems - Running Ruby gem exe file from outside the gem -

i'm having trouble figuring out how run executable i'm building gem. i've been able make progress, feels i'm doing wrong. have following structure. my_gem |__ exe |__ foo |__ lib |__ commands |__ foo |__ actions.rb my exe/foo file has following #!/usr/bin/env ruby require 'commands/foo/actions' mygem::commands::foo.start(argv) while inside my_gem directory, if execute bundle exec exe/foo , seems work fine. particular command generates rails app inside my_gem/the_app . works, i've noticed subtle problems command , newly generated rails app. i'd run command outside of gem directory. if execute my_gem/exe/foo , following error though: /home/me/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- commands/foo/actions (loaderror). i same error if execute exe/foo inside my_gem folder well. i've been able around running rake build , ra

c# - Xamarin SocketIO PCL Token -

i trying make socket connection , pass token in headers of connection. keep getting a "error initializing handshake https://webpage:8080/ " the code have is: namevaluecollection headers = new namevaluecollection(); headers.add("token", "xxxtoken"); client = new client("https://supersecurepage:8080", headers); client.connect(); what wrong? thank you! the version of nugget is: 1.0.2 , socketio server is: 1.3.7 thank you, michael matias

reactjs - ReactDnD: "Invariant Violation: addComponentAsRefTo" Error -

dear people of stackoverflow, i trying implement drag , drop functionality in react-rails app. however, add dragdropcontext top level component, see error in browser console: 'react.self-0f0e88a….js?body=1:1087 uncaught error: invariant violation: addcomponentasrefto(...): reactowner can have refs. might adding ref component not created inside component's render method, or have multiple copies of react loaded' this code have app: var app = react.createclass({ render: function() { return ( <div> hello </div> ); } }); components.app = dnd.dragdropcontext(html5backend)(app); adding 1 line of code causing of our phantomjs integration tests fail. appreciated. thanks! edit: requested, here our index.html.erb render app. <%= react_component 'components.app' %> after little digging react version, discovered had 2 versions of react being used @ same time. 1 hidden i

sql - Substring in postgres -

i have 2 tables in postgres trying compare , having trouble accessing substring 1 , comparing one. i'm new postgres (specifically sql through pgadmin), suggestions helpful. i trying count number of id numbers similar between 2 tables, 1 set of numbers longer other due concatenated fips code. don't want trim data if don't have to, right have: select count(id_a) server.table1 where(id_a not null , id_a in (select (substring(id_b 3 8) server.table 2))) i answer because little catch on query. if typo delete after update original question. select count(id_a) server.table1 ( id_a not null , id_a in (select (substring(id_b 3 8) server.table2) ) ^ ) |_ parenthesis in wrong place note either missing parenthesis or excessive one. the right query be: select count(id_a) server.table1 id_a not null , id_a in (select substring(id_b 3

c# - EPPlus - Named Range is there but not working -

similar epplus - named range not populated in case, ranges @ workbook level looking @ worksheet level. ep code shows count of 0 ranges @ workbook level , 15 @ sheet level, should be. opening worksheet.names shows 15, proper names. retrieve range, , formula correct with "offset(sheet1!$a$33, 0, sheet1!_currentmonth, 1, 55 -sheet1!_currentmonth)", else returns exception on evaluation. reports 1 column, incorrect. , 'fulladdress' looks correct "'sheet1'!_fund1projected", 'fulladdressabsolute' gives "$#ref!$-1" lastly, i'm using template, xltm, create spreadsheet, xlsm. public static void createchart() { var excelfullpath = "c:\\users\\username\\documents\\excel\\templates\\"; var excelfilename = "lowcashbalancechart.xlsm"; fileinfo newfile = new fileinfo(excelfullpath + excelfilename); if (newfile.exists) newfile.delete(); fileinfo temp

rust - Get the last element of a vector and push it to the same vector -

what trying do: enum test { value1, value2, value3 } fn main() { let mut test_vec: vec<test> = vec::new(); test_vec.push(test::value2); if let some(last) = test_vec.last() { test_vec.push(*last); } //wanted output: vector [test::value2, test::value2] } i understand when call last() , return option<&test> borrow test_vec till end of if-let block. i tried following without success: if let some(last) = test_vec.last().map(|v| v.clone()) { test_vec.push(*last); } //and let last = test_vec.last().unwrap().clone(); test_vec.push(*last); when trying figure out why borrow checker complains can useful identify types involved. if type out: let _: () = test_vec.last().map(|v| v.clone()); you error complaining () , core::option::option<&test> not same type. what's going on? put, if clone &test &test , calling .map(|v| v.clone()) on option<&test> gives option<&t

ios - How can I change the color of the UITabBar top border by creating a UIImage programmatically? -

Image
from understanding, way change color of top border set background image (320x49, pixel line @ top). seems me way (please correct me if i'm wrong). is there way without using image file? example, helped me change navigationbar bottom border creating uiimage code: uinavigationbar.appearance().shadowimage = uiimage.colorfornavbar(uicolor.redcolor()) extension uiimage { class func colorfornavbar(color: uicolor) -> uiimage { let rect = cgrectmake(0.0, 0.0, 1.0, 1.0) uigraphicsbeginimagecontext(rect.size) let context = uigraphicsgetcurrentcontext() cgcontextsetfillcolorwithcolor(context, color.cgcolor) cgcontextfillrect(context, rect) let image = uigraphicsgetimagefromcurrentimagecontext() uigraphicsendimagecontext() return image } } this solution works well; changes color of bottom border. i tried apply tabbar, nothing changes @ all. uitabbar.appearance().shadowimage = uiimage.colorfornavba

scala - Using ReduceByKey to group list of values -

i want group list of values per key , doing this: sc.parallelize(array(("red", "zero"), ("yellow", "one"), ("red", "two"))).groupbykey().collect.foreach(println) (red,compactbuffer(zero, two)) (yellow,compactbuffer(one)) but noticed blog post databricks , it's recommending not use groupbykey large dataset. avoid groupbykey is there way achieve same result using reducebykey? i tried it's concatenating values. way, case, both key , value string type. sc.parallelize(array(("red", "zero"), ("yellow", "one"), ("red", "two"))).reducebykey(_ ++ _).collect.foreach(println) (red,zerotwo) (yellow,one) use aggregatebykey : sc.parallelize(array(("red", "zero"), ("yellow", "one"), ("red", "two"))) .aggregatebykey(listbuffer.empty[string])( (numlist, num) => {numlist += num

rows - remove IDs that occur x times R -

i have df , remove people have less x amount of rows in df. e.g., in toy example, retain people have >= 5 rows. df names fruit 4 john kiwi 7 john apple 9 john banana 13 john orange 14 john apple 2 mary orange 5 mary apple 8 mary orange 10 mary apple 12 mary apple 1 tom apple 3 tom banana 6 tom apple 11 tom kiwi example output df names fruit 4 john kiwi 7 john apple 9 john banana 13 john orange 14 john apple 2 mary orange 5 mary apple 8 mary orange 10 mary apple 12 mary apple thanks in advance! you can use table this: df[df$names %in% names(table(df$names))[table(df$names) >= 5],]

ios - Push Notification for a pass added to the default Wallet Application -

this question has answer here: how make push notification pass 1 answer i've built ruby on rails application create passes , interact apple manage pass registration , updates. part, followed tutorial: https://www.sitepoint.com/whats-in-your-wallet-handling-ios-passbook-with-ruby/ i've watched these apple videos apple passbook ( https://developer.apple.com/videos/play/wwdc2012/301/ ) , have setup app's api according passkit documentation ( https://developer.apple.com/library/ios/documentation/passkit/reference/passkit_webservice/webservice.html ). right now, i'm able create passes in ror application , add them iphone (either via email or download link). however, after updating pass , triggering push notification apns don't push notification in device. device correctly registered application when add first time. , pass gets updated expected if g

2sxc - Data.In.Add creates General Exception Error related to DNN Search indexing -

i'm using faq categories demo on site, , i'm getting constant general exception errors in dnn log viewer. of these related "_all questions (sorted) of selected category.cshtml" template, line 13: data.in.add("qanda", sorted["default"]); the exception error inner message "an item same key has been added." , below entire error copy/pasted in full: absoluteurl: defaultdataprovider:dotnetnuke.data.sqldataprovider, dotnetnuke exceptionguid:819672a9-e438-40cf-9e8e-c834b7f1cebb assemblyversion: portalid:-1 userid:-1 tabid:-1 rawurl: referrer: useragent: exceptionhash:pklgsjcpamgkl0ycv8+1+q== message:search: error while indexing module 724 on tab 202, portal 0 stacktrace: innermessage:an item same key has been added. innerstacktrace: at system.collections.generic.dictionary`2.insert(tkey key, tvalue value, boolean add) @ asp._page_portal

html5 - Issues with drawing images using multiple canvas's -

Image
drawing working fine, until decided use multiple canvas's. have stage canvas, entity canvas, , object canvas. i'll end combining object , entity canvas's, though. anyway, can see below, hero class draws fine. tried make entity class same draw function, won't let me draw when call function. have same issue background canvas. don't have class background yet, will. try drawing image stage's context, , breaks code. (i tried setting jsfiddle, wouldn't able images on there.) update half of issue fixed marke. issue have, entitiesctx the context can draw images/rectangles. other ctx's can't draw anything. help, please! updated code. var stage = document.getelementbyid('stage'); var ctxstage = stage.getcontext('2d'); var entitiesstage = document.getelementbyid('entities'); var ctxentities = entitiesstage.getcontext('2d'); var bg = document.getelementbyid('bg'); var ctxbg = bg.getcontext('2d'); var pla

pthreads - C: Producer / Consumer -

one of task @ school fix code. producer , consumer thread should alternatly increment local variable , print out, have no idea how fix it. it should possible producer , consumer thread can indefinitely, if start executable stops arbitrarily. it great if explain me behavior. here code: #include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <pthread.h> static pthread_mutex_t mutex; static pthread_cond_t cond_consumed = pthread_cond_initializer; static pthread_cond_t cond_produced = pthread_cond_initializer; static void *producer( void *arg ) { unsigned long count=0; while( 1 ) { printf("producer: wait...\n"); pthread_mutex_lock( &mutex ); // enter critical section pthread_cond_wait( &cond_consumed, &mutex ); printf("producer: produce %ld...\n", count++); pthread_cond_signal( &cond_produced );

Why java += get wrong result, and how can I prevent this? -

why java += wrong result, , how can prevent problem? (for example way show warning in ide?) i tried eclipse & intellij both not show warning. sample code: { long = 20000000000000000l; double b = 90.0; += b; system.out.println(a); // 20000000000000088 ng } { long = 10000000000000000l; double b = 90.0; += b; system.out.println(a); // 10000000000000090 ok } { long = 20000000000000000l; double b = 90.0; += (long) b; system.out.println(a); // 20000000000000090 ok } according jls, compound assignment expression a += b; is equivalent to a = (long) (a + b); since b double , binary numeric promotion occurs before addition happens. both operands converted double values , addition happens floating point arithmetic. the value 20000000000000090 cannot represented double , therefore lose precision, getting 20000000000000088 instead. gets c

c++ - Error: does not name a type (using auto) -

i studying auto c++ primer 5th edition. gave me examples such as: auto item = val1 + val2; from understand auto tells type forms expression make. did own: int test1 = 69, test2 = 72; auto test3 = test1 + test2; but got error: " 'test3' not name type" what mean? though test3 become same type test1,test2 int. i run example without --std=c++11 , fails same error message. try configure codeblocks again this suggests. or can run code hand g++ --std=c++11 code.cc . to see if c++11 enabled, can type more c++11 code, declaring nested vector vector<vector<int>> vv; see if deals >> well. how can add c++11 support code::blocks compiler?

Gradle project vs module dependency? -

i'm familiar compile project(':a') syntax 1 submodule of multi-module project declares compile dependency on submodule. came across compile module(':a') (sorry, don't have reference). how's 2nd 1 different 1st? straight docs: 23.4.2. client module dependencies client module dependencies allow declare transitive dependencies directly in build script. replacement module descriptor in external repository. example 23.8. client module dependencies - transitive dependencies build.gradle dependencies { runtime module("org.codehaus.groovy:groovy:2.4.4") { dependency("commons-cli:commons-cli:1.0") { transitive = false } module(group: 'org.apache.ant', name: 'ant', version: '1.9.6') { dependencies "org.apache.ant:ant-launcher:1.9.6@jar", "org.apache.ant:ant-junit:1.9.6" } } } see documentatio

java - Android Memory -- Temporary Files in Cache or Put on Disk, Delete When Done -

i writing app records , plays audio using temporary file on device , longer-term storage on cloud, needs available on physical device when directly in use. it allows user record , review recording, either delete or upload backend , delete phone. later, user downloads file backend server, listens it, , should deleted off phone. these recordings may 10-15 minutes long, can large. i made program work 2 different ways, i'm not sure 1 manages memory , cache. first calling temporary cache file following code: string filename = uuid.randomuuid().tostring().replaceall("-", ""); file tempfiledir = this.getcachedir(); file tempfile = file.createtempfile(filename, ".3gp", tempfiledir); this file used never directly deleted. the other option saving non-cache file memory , deleting when no longer needed: if (utils.isexternalstoragewritable()) { string filename = getrandomfilename(); string outputfile = environment.getexternalsto

javascript - How to insert multiple data in one textbox usingJjavaScript and MVC? -

i have inserted multiple values 1 textbox data not inserted table. how solve problem? <input id="txtlocname" placeholder="location name" type="text class="form-control"> $('#txtlocname').selectize({ delimiter: ',',` persist: false, create: function (input) { return { value: input, text: input } } }); check correctly add dependencies of jquery plugin correctly @ 1 of examples in repository examples link has depended on jquery.js , selectize.js,index.js files , stylesheet.css files

c++ - Benchmark exceeding CPU frequency -

i'm using benchmark.js clock 2 versions of function, 1 in js , 1 in c++ (a node.js binding). the c++ version loop single compiler intrinsic (2 cycle latency + 0.5 cycle throughput): for (size_t = 0; < arrlen; i++) { #if defined(_msc_ver) (*events)[i] = _byteswap_ushort((*events)[i]); #elif defined(__gnuc__) (*events)[i] = __builtin_bswap16((*events)[i]); #endif } i expect fast ... it's clocking faster cpu frequency (4.0 ghz). how can happening? (i have tested function works outside of benchmark suite.) native: 17,253,787,071 elements/sec (10k elements in array * 1,725,379 calls/sec) js: 846,298,297 elements/sec (10k elements in array * 84,630 calls/sec) // both ~90 runs sampled hard without more context, 1 or more of following: the compiler using instructions such pshufb byte-swap more 1 element @ time. (pshufb can potentially swap 16 words @ time on processors avx2 support.) pipelining effects allowing processor handle multiple iterations

visual c++ - error LNK1104: cannot open file 'boost_date_time-vc80-mt-1_55.lib' -

i have been trying calculate number of days between 2 dates using visual c++. using visual studio 2005 , boost 1.55.0 gregorian date_time library got stuck in error. #include "boost/date_time/gregorian/gregorian.hpp" error 32 fatal error lnk1104: cannot open file 'boost_date_time-vc80-mt-1_55.lib' licensemac after doing research in project properties, added boost library path in both c++ >> general >> additional include directories , linker >> . have 2 dates generated system::datetime.now , stored in text file example 6/30/2016 0:0:0 5/8/2016 0:0:0 would please suggest me specific solution depending upon system environment? there other simple method in visual c++ visual studio 2005 calculate duration of days between above 2 days. in advance :) where can find file boost_date_time-vc80-mt-1_55.lib in system? try using full path of file. later find out file exists relatively boost library. if file doesn't exist, didn't b

.net - Best way to send and receive messages between a Windows service and form application -

i'm attempting implement ipc, i'm doing different documentation i've seen. i need asynchronously send, receive, , respond service , form application. //service1.cs serverpipe = new namedpipeserverstream(@"testpipe", pipedirection.inout, 1, pipetransmissionmode.message, pipeoptions.asynchronous); //loginform.cs clientpipe = new namedpipeclientstream(@".", @"testpipe", pipedirection.inout pipeoptions.asynchronous); i believe sets both sides. to write 1 other: //in service1.cs , login.cs private void pipewriter() { streamwriter write = null; write = new streamwriter(clientpipe); if (clientpipe.isconnected) { write.write(clientpipe); write.flush(); } } ... , read: //in service1.cs , login.cs private void pipereader() { try { while (true) { using (streamreader sr = new streamreader(clientpipe)) { string message;

html - CSS Margin is showing on different places between browsers -

i have simple object display @ location of page. code: .downloadbtn { height:35px; width:150px; background:#09f; display:block; position:absolute; margin:280px 60px; } <a href="/products.html" class="downloadbtn">download now</a> this displays download button @ perfect location on firefox. however, on google chrome, slides more on left side. on ie, slides more on left side. so basically, it's kind of this: firefox: --------downloadnow-------- chrome: ----downloadnow----------- ie: --downloadnow------------------- is there way can have @ sec location browsers? help! you can load ie specific stylesheets using <!--[if ie]> <link rel="stylesheet"href="ie.css" /> <![endif]-->

javascript - Displaying an image on Chromecast Custom Receiver -

i have downloaded sample custom receiver available here . works audio , video, can't seem cast images. added image type ' sampleplayer.type ' enum , tried adding tag in html file of player ( 1 video ), every time try display image ' load metadata error: [object object] '. i tried making custom skin receiver since images displayed one, can't seem find differences between player.js have , 1 loaded custom skin. can give me hint must in order display image? have handled video? or what? the receiver mentioned doesn't support images. have option of using default receiver or styled receiver (which means don't need code on receiver side) or if prefer have own receiver, need write own custom receiver; can @ our documentations , guides , reference receiver see how things working; in case, need add image element dom show image , wire receiver sdk. might easier use 1 of 2 receivers had mentioned if don't need custom behavior.

Android Studio/Intellij Idea: "Table of Contents" for a class -

Image
i have been messing around android studio , far of have seen. 1 thing has been annoying me though lack of "table of contents" class. apologize not knowing call it. referring dropdown menu in eclipse lists methods, interfaces, classes , on in class file. allows jump position. view when in "package explorer" , click arrow left of class. 1 thing makes me miss eclipse. know can search ctrl+f inside document forget method names. tried looking through here no avail. wondering if knows way handle this. idea has tab called "structure", shows methods, fields, etc. of currently-open class.

javascript - JS turning dot seperated strings into hierarchical objects -

i'm trying convert list of strings hierarchical tree. an example of json be: { "log_names": [ "one", "one.one", "one.two", "one.three", "one.three.one", "two", "three", "three.one", "three.one.three.two", "four.one.some.more.stuff" ] } output here, each level object, , each sublogger child of it's parent. each logger object, might contain other objects subloggers. , moreover, three.two in three.one.three.two , because there isn't logger under three.one.three , considered single logger , not father logger. example four.one.some.more.stuff . because there no other loggers under four , single logger under same logic before { "one": { "one": { }, "two": { }, "three": { "one" : { }

Visual studio 2010 Express- how does one copy project properties? -

i found strangely question asked decided bring up: how 1 copy project properties existing one? tried project manager way doesn't work. saved old properties somewhere , "add existing property sheet" nothing happened. presumably added sdl files not show in configurations. , somehow after hours of struggling old project lost property decided give , seek here. but don't understand why intuitive function made difficult. meant configuration text file why difficult copy file? ok figure out...the "add new..." gives me blank property sheet , have modify again , save , can share around projects. oh my, bit speechless.

java - Cannot send AES encrypted messages of over 47 characters -

ello mates! creating aes encrypted chat program have ran issue; whenever message on 47 characters, displays "javax.crypto.illegalblocksizeexception: input length must multiple of 16 when decrypting padded cipher". understand error message can't seem figure out how fix it. here full code: chatclient.java package chat.application; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.io.printwriter; import java.net.socket; import javax.swing.jframe; import javax.swing.joptionpane; import javax.swing.jscrollpane; import javax.swing.jtextarea; import javax.swing.jtextfield; import javax.swing.text.*; import java.security.*; import java.util.logging.level; import java.util.logging.logger; import javax.crypto.*; import javax.crypto.spec.secretkeyspec; import sun.misc.*; import java.net.inetaddress; /* * known bugs: * message size limited 47