Posts

Showing posts from June, 2010

routing - Creating actor per domain object -

i have been trying use router consistenthashingpool create actors on fly consume messages on basis of object id, in simple case unique string. i want actor per domain aggregate , seemed simple way of doing it. but hashing seems doing odd things , sending messages actors have been spawned different hash mapping value. actorsystem.actorof( props.create(() => new myaggergateactor()).withrouter( new consistenthashingpool(10) .withhashmapping(o => (o myevent)?.myaggregateuniqueid ?? string.empty) .withresizer(new defaultresizer(1, int.maxvalue))), "myaggregaterouter"); also tweaking values nrofinstances seems break things well, meaning hash maybe works across set of initial instances , no new actors being spawned? thought resizer supposed me here? please forgive naivety, have started using akka. the key here understand routers do. consistent hashing means, given range of possible consistent hash values, each of actors...

java - How to split element in an ArrayList in multidimensional arrayList -

i have following: [[statistics (ph)], [ upright normal recumbent normal total]] i want split first element of second element on whitespace end with: [[statistics (ph)], [upright,normal,recumbent,normal,total]] my code far: for (arraylist<list<string>> row2 : statsph) { row2.get(1).get(0).split("\\s"); } but nothing happens java strings are immutable , need store return value of split("\\s") in correct list . i recommend like for (arraylist<list<string>> row2 : statsph) { list<string> stats = row2.get(1); // remove() returns object removed string allstats = stats.remove(0); collections.addall(stats, allstats.split("\\s")); } note we're removing original string first, adding of 'split' values.

c# - How to create a List<int> basead on two properties from another list? -

problem i need create list<int> basead on 2 properties list. example i have class has 2 fields need. public class myclass { //other fields int? valueid int? valuetwoid } above code it's example, not focus there. i want retrieve properties like: myclasslist.elementat(0).valueid = 1; myclasslist.elementat(0).valuetwoid = 2; myclasslist.elementat(1).valueid = 3; myclasslist.elementat(1).valuetwoid = 4; list<int> resultlist = myclasslist.where(x => x.valueid != null && x.valuetwoid != null).select(x => ??).tolist()); desired output resultlist.elementat(0) == 1 resultlist.elementat(1) == 2 resultlist.elementat(2) == 3 resultlist.elementat(3) == 4 there's way achieve using .select(x => ).tolist() , without using code like: list<int> resultlist = new list<int>(); foreach(var item in myclasslist) { resultlist.add(item.valueid); resultlist.add(item.valuetwoid); } thanks in advance, sorry poor engli...

javascript - can not get json from php to html (sometimes works and sometimes not..) -

i need help... i have 2 files: form.html contains html form register.php- gets post request form, registers user in database , returns json contains registered users (i want display them in form.html right after successful registration). my problem: i catched submit event , made post request register.php. register file works fine , regiters users db. problem json registers users register.php form.html. can see tried alert json alert(json) in callback function check if came ok. when run code surprised see line alert(json) works , somtimes not no rational reason... want clear: line alert("inserting") , actual user registration db works fine. problem in callback function... perhaps problem related end of register file (the creation of json). thanks advance! form.html $( "#myform" ).submit(function( event ) { if(!validateform()) //there error { event.preventdefaul...

c++ - boost::asio::async_read get end of file error -

i've written program uses boost:asio library, transfers data between 2 tcp servers. 1 server uses following code send data: std::shared_ptr<std::string> s = std::make_shared<std::string>(message); boost::asio::async_write(socket_, boost::asio::buffer(*s), std::bind(&tcpserver::handlewrite, shared_from_this(), s, _1, _2)); in tcpserver, when use async_read_until data, works fine, if replace async_read_until async_read, gives end of file error: boost::asio::streambuf input_buffer; boost::asio::async_read_until(socket_, input_buffer, match_condition(), std::bind(&tcpserver::handleread, shared_from_this(), _1)); //boost::asio::async_read(socket_, input_buffer, boost::asio::transfer_all(), // std::bind(&tcpserver::handleread, shared_from_this(), _1)); if use boost::asio::transfer_at_least(1) in async_read, can expected result. why did happen? an eof error indicates writer side closed connection. data sent before should still availa...

python - implementation of an orientation map for fingerprint enhancement -

i'm implementing function orientation map of fingerprint image using opencv , python wrong don't know code def compute_real_orientation(array_i, w=17, h=17, low_pass_filter=cv2.blur,filter_size=(5,5),blur_size=(5,5),**kwargs): row, col = array_i.shape array_i = array_i.astype(np.float) ox = array_i[0:row-h+1:h,0:col-w+1:w].copy() ox[:] = 0.0 vx = ox.copy() vy = vx.copy() oy = ox.copy() angle = vx.copy()#array contain 17*17 blocks's orientatons c = r = -1 in xrange(0, row-h+1, h): r+=1 j in xrange(0, col-w+1, w): c+=1 dx = cv2.sobel(array_i[i:i+h,j:j+w],-1,1,0)#gradient component x 17*17block dy = cv2.sobel(array_i[i:i+h,j:j+w],-1,0,1)#gradient component y 17*17 block k in range(0,h): l in range(0,w): vy[r][c] += ((dx[k][l])*(dy[k][l]))**2 vx[r][c] += 2*(dx[k][l])*(dy[k][l]) angle[r][c] = 0.5*(math.atan...

javascript - Angular - Making String Safe for URL - Is Route this correct? -

to make app seo friendly/easier users read urls i'm appending title of page clicked on each url. so example if user clicks on story 'asia stocks climb' sent url: mysite.com/story/34324/asia-stocks-climb in routes.js specify url containing text @ end exist ignore it: .when("/story/:id/:pagetitle", { templateurl: "views/story.html", controller: 'story' , controlleras: 'story' } ) so questions: 1 - ok (for seo) append end of urls when clicked? 2 - text story 'asia stocks climb' become url friendly 'asia-stocks-url' i'm using own code: textcontent.trim().tolowercase().replace(/ /g,'-').replace(/[^\w-]+/g,'') i've tested , seems ok there angular method this? thanks. that's 100% correct, use this: $scope.slugify = function (text) { if (text == null || text == 'undefined') return ""; return text .tolowerca...

android - ImageButton in Linear Layout not clicked. Setting Listener from service -

this different other post of nature because in service cannot name onclicklistener through xml have programatically. i have imagebutton in xml file (it @ bottom): <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <horizontalscrollview> ... </horizontalscrollview> <view android:layout_width="match_parent" android:layout_height="3dp" android:background="@color/light_grey" /> <framelayout> ... </framelayout> <view android:layout_width="match_parent" android:layout_height="3dp" android:background="@color/light_grey" /> <linearlayout android:layout_width="match_parent" android:layout_h...

meteor - Client side pagination is slow -

for record set of 10000 rows window of few hundred rows subscribed via start row,stop row, takes on 10 seconds show "ready" ? should records removed before moving window ? why meteor slow ? firstly, make sure publishing keys need , not don't. example: meteor.publish('querydata',function(queryid,startrow,stoprow){ return querydata.find({ ... query ...},{ fields: {name: 1, description: 1}}); }); this important if documents big. secondly, @ websocket traffic in browser's inspector see how data sending on in publication. thirdly, make sure collection indexed on keys searching on not doing collection scans. meteor pretty fast simple mistakes can make feel slow.

c++ - Is sort() automatically using move semantics? -

isocpp.org states that: move-based std::sort() , std::set::insert() have been measured 15 times faster copy based versions[...] if type has move operation, gain performance benefits automatically standard algorithms. does mean if call sort() on user-defined type has no move constructor or move assignment operator, there no move semantics used? in other words, many benefits of c++11 performance improvements, should edit existing code add move operations explicitly? further, if sorting, container or type inside container, or both, must have move operations defined? does mean if call sort() on user-defined type has no move constructor or move assignment operator, there no move semantics used? correct. if class not moveable fall copying in other words, many benefits of c++11 performance improvements, should edit existing code add move operations explicitly? if can sure, doesn't more performance. note depending on class may automatically g...

c# - Import data into Excel from SQL Server query -

i find ways import data sql server query excel below none of them seem work insert openrowset('microsoft.jet.oledb.4.0', 'excel 8.0;database=d:\testing.xls;', 'select * [sheetname$]') select * tblname error: ole db provider 'microsoft.jet.oledb.4.0' cannot used distributed queries because provider configured run in single-threaded apartment mode. as indicated error message, sql server not able transfer data excel using method. 1 possible solution not require programming: open excel, click data tab, other sources, sql server. window open prompting server name, provide server name , instance name separated backslash. example: localhost\sqlexpress (if running sql server express edition on pc, otherwise whatever server installed sql server on, along instance name). authenticate providing user id , password defined in sql server or clicking windows authentication. have opportunity select table name. data transferred excel ...

Magnific Popup close button placed in invalid html? -

using magnific popup, when gallery displays, i'm seeing generated code nests <button> close gallery within <img> that's being displayed, so: <img><button></img> . according mdn's img tag details , permitted content isn't allowed, it's empty element. result, close button isn't displaying in gallery. there way fix this? in gallery initialization object, you're passing along array of markup snippets. markup <img> tag, fixed wrapping <img> in <div> .

dynamic - Meteor: Handling events generated from objects wrapped with #each? -

so i'm new meteor, i'm wondering if it's possible catch event dynamically created element: {{#each appl}} <div class="col-sm-4"> <div class="panel panel-default"> <div class="panel-heading text-center"><b>{{demuser}}</b></div> <div class="panel-body"> <img class="imh-responsive img-rounded col-sm-6 col-sm-offset-3" src="/images/faces/face-1.jpg"> </div> <div class="panel-footer"> <div class="row"> <button class="btn btn-success">hire</button> <button class="btn btn-info">rdv</button> <button class="btn btn-danger">reject</button> </div> </div> </div> </div> {{/each}} because using each , context ( this ) in event map appl (applican...

git - Bitbucket CRLF issue? -

issue: bitbucket shows entire file has changed though dont see differences. , there no merge conflicts in these files. details: created sprint branch (named "sprintbranch") , developers created feature branch(named "featurebranchx") sprint branch. started merging feature branches sprint branch , when features implemented. there 2 scenarios face issue: developer creates pull request merge featurebranch1 sprintbranch if there merge conflicts, developer merges sprintbranch featurebranch1 , creates pull request merge featurebranch1 sprintbranch. both times bitbucket shows entire file has changed. , there no merge conflicts. when happens, cannot code review since dont know specific lines have been modified developer. lose history @ point - looking wont able figure out implemented or merged sprint branch. my guess issue line endings. crlf. when commit work see appropriate line endings being used automatically (either git or tool smartgit) how resolve...

python - Are these statements equivalent?: import package vs from package import * -

this question has answer here: 'import module' or 'from module import' 13 answers are these statements equivalent?: import math , from math import * import math means have put math (name of module) before use it, e.g. print(math.pi) . with using from math import * , python loading functions , variables math (or specified in __all__ exact) local namespace , can use them without module name prefix: print(pi) . hope helps!

Android : Error Initilazing the Youtube player -

i implementing youtube player in app using youtubeandroidplayerapi play videos add app. working fine till 2 days when error started show suddenly. have been trying solve this, have failed. please me out. oncreate @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.youtube_lightbox); final relativelayout relativelayout = (relativelayout) findviewbyid(r.id.relativelayout_youtube_activity); relativelayout.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { onbackpressed(); } }); final youtubeplayerview playerview = (youtubeplayerview) findviewbyid(r.id.youtubeplayerview); if (savedinstancestate != null) { millis = savedinstancestate.getint(key_video_time); } final bundle extras = getintent().getextras(); if (extras != null &...

Java: how to convert unicode string Emoji to Integer -

i received unicode string contain emoji code, example: "u+1f44f" (from emoji table : http://apps.timwhitlock.info/emoji/tables/unicode ). i want convert string integer how can ? i tried this, crashs: int hex = integer.parseint(unicodestr, 16); thanks guys! the comment of flkes gives correct answere. u+ indicates following codepoint (or hex number) unicode. value want convert integer codepoint, have omit 2 first characters .substring(2) you wil obtain following code: int hex = integer.parseint(unicodestr.substring(2), 16);

android - Set String Array to ImageView -

i want set string array contain images position imageview. string array passed activity activity b , set imageview in activity b. how should set? below codes : from activity : string[] outputstrarr = new string[selecteditems.size()]; (int = 0; < selecteditems.size(); i++) { outputstrarr[i] = selecteditems.get(i); //log.i(galleryactivity.tag,outputstrarr[i]); } intent intent = new intent(getapplicationcontext(), mainactivity.class); // create bundle object bundle bundle = new bundle(); bundle.putstringarray("griditem", outputstrarr); // add bundle intent. intent.putextras(bundle); // start mainactivity startactivity(intent); from activity b: public void onresume() { super.onresume(...

google oauth - How to change the icon of the Auth0 LockActivity for android? -

i'm using auth0 manage security of android app , need customize login activity. i use default lockactivity of lock.android library. how can change icon of lockactivity? you can customize lockactivity implementing style inherits lock.theme , overrides auth0.title.icon style attribute own app logo. here code example: <style name="apptheme.lock.theme" parent="lock.theme"> <item name="auth0.title.icon">@style/exigo.lock.theme.title.icon</item> </style> <style name="apptheme.lock.theme.title.icon" parent="lock.theme.title.icon"> <item name="android:src">@drawable/ic_login_main</item> </style> then in android manifest file need change style of lockactivity customized style. <activity android:name="com.auth0.lock.lockactivity" android:launchmode="singletask" android:screenorientation="portrait" ...

angularjs - How does ng-repeat rendering work under the hood? -

i angularjs rookie. reading guide in angularjs website , confusion. in angularjs api document ngrepeat , says: if working objects have identifier property, should track identifier instead of whole object. should reload data later, ngrepeat not have rebuild dom elements items has rendered, if javascript objects in collection have been substituted new ones. large collections, improves rendering performance. if don't have unique identifier, track $index can provide performance boost. i don't understand content: should reload data later, ngrepeat not have rebuild dom elements items has rendered, if javascript objects in collection have been substituted new ones. what sentence mean? can give me example? thank much! ngrepeat behavior changes , without track by . when collection changes: without track by : angular rebuild dom (destroy , create again each dom element). with track by : angular retrieve dom element of each item , update values. ...

regex - python group(0) meaning -

what exact definition of group(0) in re.search? sometimes search can complex , know supposed group(0) value definition? just give example of confusion comes, consider matching. printed result def . in case group(0) didn't return entire match. m = re.search('(?<=abc)def', 'abcdef') >>> m.group(0) def match_object.group(0) says whole part of match_object chosen. in addition group(0) can be explained comparing group(1), group(2), group(3), ..., group(n). group(0) locates whole match expression. determine more matching locations paranthesis used: group(1) means first paranthesis pair locates matching expression 1, group(2) says second next paranthesis pair locates match expression 2, , on. in each case opening bracket determines next paranthesis pair using furthest closing bracket form paranthesis pair. sounds confusing, that's why there example below. but need differentiate between syntax of paranthesis of '(?<=abc)'....

Sending form data to restful web service @POST method using jquery and ajax -

i have looked everywhere hours , cannot find solution work me. have simple html form gets 3 form inputs , needs send data @post method of web service. after creation, web service show updated list. can tell me doing wrong? poll.html <script> function myfunction() { data = $(this).serialize(); $.ajax({ url: 'http://localhost:8080/places3/resourcesc/create', method: 'post', datatype: 'text', data: data, success: function() { alert("worked"); }, error: function(error) { alert("error"); } }); } </script> </head> <body> <form onsubmit="myfunction()"> <p>city: <input type="text" name="city" /> </p> <p>poi1: <input type="text" name="poi1" /> </p> ...

javascript - Pushing array of objects data via service for multiple controllers angularjs -

new angularjs , trying figure out how pushing array of objects data (not input strings) between controllers. currently, code pushes data 1 controller('choosetabctrl') want push controller ('listtabctrl') list displays on page. i'm confused b/c examples show when user enters string of text. project adds fave clicking button. appreciated. you can create service this. like: .service('favoritesservice', function(){ var favorites = []; this.getfavorites = function(){ return favorites; }; this.setfavorite = function(favorite){ favorites.push(favorite); }; }); set favorites: ... if (!$scope.myfaveitems.some(isalreadypresent)) { $scope.myfaveitems.unshift(item); favoritesservice.setfavorite(item); } ... use in listctrl: .controller('listtabctrl', function($scope, favoritesservice) { $scope.myfaveitems = favoritesservice.getfavorites(); });

jsp - Java Servlet how to get a specific value from a session attribute -

ok, i'm kind of inept @ explaining problems, i'll try detailed, yet concise possible. i have 2 servlets; newcustomerservlet , loginservlet i have 1 java bean; user the user has bunch of fields. username, firstname, password, etc... my index.jsp automatically directs user newcustomerservlet, user can create "account" once finish filling in fields user bean created , saved in session. then, user able "login" the problem i'm having validating username "user" session login.jsp fields using session. how access sessions "username" or "password" field. can seem access name of session, "user"? referencing javadoc httpsession , you realize httpsession stores attributes key, hashmap , place objects in session (any serializeable object) like: string username = "something";// session.setattribute("username", username); then can out using: string un=(string)session.getattri...

subprocess - parallel execution of multiple system commands on a single unix host from windows -

i need execute multiple system commands in parallel on remote unix machine(only through ssh) windows machine. have used paramiko module ssh remote machine. in same script, have used python subprocess module fire commands in parallel on remote machine. unable . please let me know how achieve scenario using subprocess module? or other way problem? my line of code not working : processes.append(popen(task,shell=true)) ----> task getting executed on own windows machine , not getting executed on remote unix machine. gives me error windows error. don't know whether subprocess code work achieving parallel runs here. but successful in achieving parallel runs same piece of code using subprocess module if copy code unix machine , run script locally. problem comes when executing code windows machine , doing ssh remote machine. what fabric ? http://docs.fabfile.org/en/1.10/usage/parallel.html i use such purposes.

javascript - Show loader after click on link -

is possible show loading bar when click on link? example: i click on h ref , need wait 5/8 second before download start, possibile detect when start , stop page load? the a href starts download, not change page. nope it's not possible. statements executed line line if have loader comes after clicking link it'll disappear immediately. code function clicklink(){ showloader(); download(); hideloader(); } if download function takes long... page hang. hideloader called immediately. way work make request wait response. can hide loader whenever response received

batch file - How to call the `dir` command by Visual C++ properly? -

Image
i trying use command dir /s c:\ /b > temp.txt in program. have tried in command line, , works, yet when try in program, program's files , folders. i using visual c++ , command system("dir /s c:\ /b > temp.txt"); . know going wrong program, don't know what. not clear you're asking actually, 1 thing know sure need escape backslash character in character array literal: system("dir /s c:\\ /b > temp.txt"); // ^ alternatively provide raw string literal : system(r"x(dir /s c:\ /b > temp.txt)x");

symlink - c++ - resolve all symbolic links defined in a file path -

short version how resolved path path 1 of dirs symbolic link: example: say path = /x/y/d/f1 y symbolic link /a/b so result of resolved file path be: /x/a/b/d/f1 long version i'd write c++ function copy files dir1 dir2 (of course not actual issue reduction of bigger , more complex problem). prior copy process i'd remove files in dir2 going copied dir1. have: dir1 = /a/b/c/d dir2 = /x/y/d/ assume have file 'f1' in dir1 , file 'f1' in dir2, process do: remove /x/y/d/f1 copy /a/b/c/d/f1 /x/y/d/f1 my problem following: say dir 'y' symbolic link /a/b/c/. when remove /x/y/d/f1, removing /a/b/c/d/f1. (my example may have holes in it, hopw idea) i'd avoid this, meaning, when come remove /x/y/d/f1 want able know i'll removing /x/y/d/f1 , skip remove i tried using posix readlink() function works when file 'f1' symbolic link not work when 1 of parent dirs symbolic link. any ideas? following link give ...

Scala Play reading XML string -

i sending xml(text/xml) content-type , in controller getting string as `anycontentasxml(<sometag>....</sometag>)` which should like '<?xml version='1.0' encoding='utf-8'?><sometag>....</sometag>` so how can convert anycontentasxml xml string? play has builtin xml body parser, can use like def someendpoint = action(parse.xml) { request => val elementopt = request.body \\ "someelement" headoption } notice that, request.body nodeseq , can used xml releated thing.

visual studio - How to pair a Windows 10 phone with PC for debugging? -

i code on phone - enter it? i tried connecting usb, entering wifi url pc's browser ("insecure connection"),... edited (may2016): with later win10 mobile possible debug phone running windows 10 mobile via wifi. follow guidance here: https://msdn.microsoft.com/en-us/windows/uwp/debug-test-perf/device-portal-mobile

ios - Image in ImageView issue Swift -

i have uicollectionviewcontroller class code : class viewcontroller1: uicollectionviewcontroller , uicollectionviewdelegateflowlayout{ override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. self.collectionview?.backgroundcolor = uicolor(white: 0.95, alpha: 1) self.collectionview?.alwaysbouncevertical = true collectionview?.registerclass(cell.self, forcellwithreuseidentifier: "cellid") } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } override func collectionview(collectionview: uicollectionview, numberofitemsinsection section: int) -> int { return 1 } override func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell { return collectionview.dequeuereusablecellwithreuseidentifie...

mysql - Pull SKU, Manufacturer and custom attribute from Magento database -

i'm trying pull full list of products database sku, manufacturer , custom attribute called 'gtin'. i'm struggling custom attribute part. this statement works pull manufacturer , sku select cpe.sku, m1.manufacturer, catalog_product_entity cpe inner join exportview_manufacturer m1 on cpe.entity_id = m1.entity_id my mysql poor , can't seem custom attribute. i've found following statement online know has details need make work far i've been getting head in mess trying implement it select e.entity_id product_id, var.value product_name catalog_product_entity e, eav_attribute eav, catalog_product_entity_varchar var e.entity_type_id = eav.entity_type_id , eav.attribute_code = 'gtin' , eav.attribute_id = var.attribute_id , var.entity_id = e.entity_id i need first statement include 'gtin' column, joining i'm falling short. can please assist? you need create 1 php script product , it's attribute. first create all_produc...

python - Return stock symbol in quantopian -

Image
i working on algo in quantopian , ran problem. i calculated z-score's weighted % price change group of etf's , trying find ten best stocks. when run code print(context.zscore) it gives me data in 2 columns, symbol , zscore. however, when index no longer gives me symbol, zscore print(context.zscore[0]) here's screenshot of output, first line indexed , second through nth line not. i want return equity(14516 [ewa]) -.679217 or better ewa -.679217 does know how this? to solve problem it's pretty simple. use [[]]

python - Parsing all zero sparse vectors with pyspark SparseVectors -

in pyspark, if generate sparse vector represents 0 vector , stringify it works expected: >>> res = vectors.stringify(sparsevector(4, [], [])) '(4,[],[])' but parse method fails load back: >>> sparsevector.parse(res) traceback (most recent call last): file "<stdin>", line 1, in <module> file ".../spark-1.5.2-bin-hadoop2.4/python/pyspark/mllib/linalg/__init__.py", line 545, in parse raise valueerror("unable parse indices %s." % new_s) valueerror: unable parse indices . anyone knows of way solve this? this bug described spark-14739 . simplest workaround use ast module instead: import ast pyspark.mllib.linalg import sparsevector def parse_sparse(s): return sparsevector(*ast.literal_eval(s.strip())) parse_sparse("(1, [], [])") ## sparsevector(1, {}) parse_sparse("(5, [1, 3], [0.4, -0.1])") ## sparsevector(5, {1: 0.4, 3: -0.1})

css - How do I get rid of a Google custom search snippet hover border? -

Image
i'm trying restyle google custom search page , having...mixed results. thing that's bothering me hover border. come , how can rid of it? picture below. see? 1px black line. edit: meant include following, somehow didn't: here's link public url similar google search engine . lines in full effect there. enter search term. the element appears have hoverborder has mess of inline javascript. <td onclick="if (this.classname == 'gsc-table-cell-snippet-close gsc-collapsable') { this.classname = 'gsc-table-cell-snippet-open gsc-collapsable'; } else if (this.classname == 'gsc-table-cell-snippet-open gsc-collapsable') { this.classname = 'gsc-table-cell-snippet-close gsc-collapsable'; };" class="gsc-table-cell-snippet-close"> so, anyone? p.s. plan b here go different google search theme (they don't have hoverborder) have current theme looking way want , customizing google search isn't fun, we'd...

reactjs - Can I dispatch an action in reducer? -

is possible dispatch action in reducer itself? have progressbar , audio element. goal update progressbar when time gets updated in audio element. don't know place ontimeupdate eventhandler, or how dispatch action in callback of ontimeupdate, update progressbar. here code: //reducer const initialstate = { audioelement: new audioelement('test.mp3'), progress: 0.0 } initialstate.audioelement.audio.ontimeupdate = () => { console.log('progress', initialstate.audioelement.currenttime/initialstate.audioelement.duration); //how dispatch 'set_progress_value' now? }; const audio = (state=initialstate, action) => { switch(action.type){ case 'set_progress_value': return object.assign({}, state, {progress: action.progress}); default: return state; } } export default audio; dispatching action within reducer anti-pattern . reducer should without side effects, digesting action payload , r...

python - Getting an internal server error on flask web server -

i'm newbie raspberry pi , python coding. i'm working on school project. i've looked tutorials , examples maybe i'm missing something. want build web server based gpio controller. i'm using flask this. going this, i've started example. turning on , off led refreshing page. so problem is, can't see response value on web server side. it's turning on , off led. want see situation online. couldn't. i'm getting , internal server error. i'm giving python , html codes. can me solving problem. from flask import flask flask import render_template import rpi.gpio gpio app=flask(__name__) gpio.setmode(gpio.bcm) gpio.setup(4, gpio.out) gpio.output(4,1) status=gpio.high @app.route('/') def readpin(): global status global response try: if status==gpio.low: status=gpio.high print('on') response="pin high" else: status=gpio.low print(...

c# - Import Accounts and Contacts Zip File via the Dynamics CRM SDK -

Image
i need automate dynamics crm import wizard lets zip accounts , contacts files , import them crm @ once per screen shot below. we have quite few zip files import thought might wise automate using dynamics crm sdk. looking in sdk can find example of importing entity files 1 1 such here no examples of importing them in zip file? possible , if there examples of this? instance sdk code below looks @ "import accounts.csv" file need handle "import accounts , contacts.zip". // create import file. importfile importfile = new importfile() { content = bulkimporthelper.readcsvfile("import accounts.csv"), // read contents disk. name = "account record import", isfirstrowheader = true, importmapid = new entityreference(importmap.entitylogicalname, importmapid), usesystemmap = false, source = "import accounts.csv", sourceentityname = "account_1", targetentityname = account.entitylogicalname, impo...

How can I watch multiple files/socket to become readable/writable in Haskell? -

how watch several files/sockets haskell , wait become readable/writable? is there select/epoll/... in haskell? or forced spawn 1 thread per file/socket , use blocking resource within thread? the question wrong: aren't forced spawn 1 thread per file/socket , use blocking calls, get spawn 1 thread per file/socket , use blocking calls. cleanest solution (in language); reason avoid in other languages it's bit inefficient there. ghc's threads cheap enough, however, not inefficient in haskell. (additionally, behind scenes, ghc's io manager uses epoll-alike wake threads appropriate.)

C# getting a jagged array from a method call -

i have jagged array , works fine in main if try put in method i'm unsure call. i've tried load(data) , return statements haven't had luck. public static void load() { try { string[][] data = new[] { file.readalllines(@"data\month.txt"), file.readalllines(@"data\year.txt"), file.readalllines(@"data\ws1_af.txt"), file.readalllines(@"data\ws1_rain.txt"), file.readalllines(@"data\ws1_sun.txt"), file.readalllines(@"data\ws1_tmin.txt"), file.readalllines(@"data\ws1_tmax.txt"), }; console.writeline("files have been found, press key continue"); console.readkey(); } catch (exception) { console.writeline("unable find files... exiting"); exit(); } } simply return array method , change return type of load method same type array ...

php - Reorder multidimensional array -

i have a script reads form db table current output: { ["id"]=>"1" ["name"]=> "user 1" ["parentid"]=>"0" } { ["id"]=>"7" ["name"]=> "user 7" ["parentid"]=>"1" } { ["id"]=>"3" ["name"]=> "user 3" ["parentid"]=>"1" } { ["id"]=>"6" ["name"]=> "user 6" ["parentid"]=>"3" } { ["id"]=>"2" ["name"]=> "user 2" ["parentid"]=>"3" } { ["id"]=>"5" ["name"]=> "user 5" ["parentid"]=>"4" } { ["id"]=>"8" ["name"]=> "user 8" ["parentid"]=>"5" } { ["id"]=>"9" ["name"]=> "user 9"...

java - multiple method invocation in EJB2.0 session bean -

i have 1 session bean following method /** * method used update voucher expiry date , voucher status voucher service * @ejb.interface-method * @ejb.facade-method invalidate="true" * @ejb.transaction type="supports" * * @return resulobject, contain success or error code response code * */ public resultobject updatevoucherdetails(voucherservicedata voucherservicedata){ ipinsessionbeanlocalhome pinsessionbeanlocalhome=getpinsessionbeanlocalhome(); ipinsessionbeanlocal pinsessionbeanlocal = pinsessionbeanlocalhome.create() pinsessionbeanlocal.changevoucherstatus(voucherstatuschangedata,sessioninfo); } /** * method used change voucher status * @ejb.interface-method * @ejb.facade-method invalidate="true" * @ejb.transaction type="supports" * @return resulobject, contain success or error code response code * */ public resultobject changevoucherstatus(voucherstatuschangedata voucherstatuschan...

css3 - Print Email that will Fit in a Single Page -

Image
i want print email , fit 1 page. want remove header , footer. want via @media print is possible? solution you can achieve adding class display:none; elements wish hide. @media print { .noprint { display:none; } } support please aware has limited support. you can find more information here - https://www.campaignmonitor.com/blog/email-marketing/2006/06/can-i-include-a-print-styleshe/ although rather old article things haven't moved on great deal.

android - GMT date and time to convert Local device Date Time? -

hi got web service result 6/26/2013 12:00:00 gmt how make convert local device time.please give me solution i have implement code not working public static string datetime(date date) { simpledateformat dateformat = new simpledateformat("mm/dd/yyyy hh:mm a"); return dateformat.format(date); } set timezone formatter before parsing date. public static string datetime(date date) { simpledateformat dateformat = new simpledateformat("mm/dd/yyyy hh:mm a"); timezone tz = timezone.getdefault(); //will return device current time zone dateformat.settimezone(tz); //set time zone simple date formatter return dateformat.format(date); }

javascript - Keybinding a button that triggers its onclick function -

i left , right arrow keys trigger , next button clicks in javascript. feel i'm not quite implementing correctly since buttons work keystrokes not. function init() { flashmovie = document.getelementbyid('flashmovie'); document.getelementbyid('back').onclick = function () { if (c == 0) { c = paths.length; } c-- displayfiles(); } document.getelementbyid('next').onclick = function () { if (c == paths.length - 1) { c = -1; } c++; displayfiles(); } document.keypress(function (e) { if (e.which == 37) { $("#back").click(); } }); document.keypress(function (e) { if (e.which == 39) { $("#next").click(); } }); } you want keydown event. function ...

android - Xaramin SDK path in settings different from one in SDK Manager -

Image
edit: i'm idiot , if you're looking answer sdk in setting , sdk manager same , sdk in setting must incorrect. how can fix this. have changed sdk path in setting multiple times , can't download because it's says sdk path incorrect. same incorrect sdk path in manager , correct 1 in settings when in visual studio. ahead of time. the paths same. c:\progra~2\android\android~1 is silly way of using paths in windows file systems avoid having spaces, special characters , long path names. so progra~2 means program files (x86) second occurance of folder starting progra . middle part of path obvious. androi~1 translates android-sdk first folder starting androi in folder. so in end have path: c:\program files (x86)\android\android-sdk

Javascript regex, replacing numbers with manipulated number -

i have following string: "4/7/12" and replace each number formula: (25 - x) 'x' number string. for example: "4/7/12" translated into: "21/18/13" how can using 'replace()' , regex ?? var player_move = "5/7/9"; var translated_pm = player_move.replace(/\/\*?/, 25 - /$1/); thank you! try this var translated_pm = player_move.replace(/\d+/g, function (x){return 25 - parseint(x)});

vb.net - Value of type '1-dimensional array of String' cannot be converted to '1-dimensional array of Integer' because 'String' is not derived from 'Integer' -

i getting error while trying use linear search name entered user array. here when declare array , input. public const size_array = 9 public sub cmdstart_click(sender object, e eventargs) handles cmdstart.click dim myarray(size_array) string dim index integer public sub cmdstart_click(sender object, e eventargs) handles cmdstart.click dim count integer = 0 me.index = 0 size_array myarray(index) = inputbox("enter name, enter name") count = count + 1 next if count = 10 lblinstructions.visible = false cmdstart.visible = false lblinstructions2.visible = true txtsearch.visible = true lbloutput.visible = true cmdsearch.visible = true end if end sub here use linear search. public sub cmdsearch_click(sender object, e eventargs) handles cmdsearch.click dim found boolean dim name string name = txtsearch.text found = linearsearch(myarray, val(name)) if found lblout...

ruby on rails - What does exception and null_session mean in protect_from_forgery -

i'm trying implement token based api , saw snippets google however, it's hard understand meaning literal meaning. any direction or basic knowledge this, ~~ class applicationcontroller < actioncontroller::base protect_from_forgery with: :exception, if: proc.new { |c| c.request.format != 'application/json' } protect_from_forgery with: :null_session, if: proc.new { |c| c.request.format == 'application/json' } end rails's document null_session here http://api.rubyonrails.org/classes/actioncontroller/requestforgeryprotection/protectionmethods/nullsession.html#method-i-handle_unverified_request , if check source code of it's handle_unverified_request method: def handle_unverified_request request = @controller.request request.session = nullsessionhash.new(request.env) request.env['action_dispatch.request.flash_hash'] = nil request.env['rack.session.options'] = { skip: true } request.env['action_dispatch...

bigcommerce - I'm trying to specify the reply-to address in the template "return_notification_email.html" -

can edit template or check box or allows return request notification sent email specified in store profile have reply-to address of customer submits request? this way it'll it's coming user , can reply normally. you can't unless use custom form rather builtin forms. can build using javascript, prebuilt resource, or app bc app store.

vb.net - How Can I Fix Reflected XSS Clients in Asp.Net -

how can fix reflected xss client problem on asp.net? can me? the problem below: reflected xss client method : row:563 private shared function bindsitemenu(tsql string) data.datatable .... 563. drow.item("sortby") = dt1.rows(i).item("sortby").tostring 564. dtall.rows.add(drow) .... 569. return dtall method : public shared function frontsitemenuforsmap(byval siteid long) data.datatable .... 529. return bindsitemenu(tsql) method : protected sub sitemap(sitid long) .... 27. dim dt data.datatable = sitemenuobj.frontsitemenuforsmap(sitid) .... 29. setnodes(dt, sitid, 0, 0, "") method : row:77 protected sub setnodes(byval dttree data.datatable, byval siteid long,byval parentid long, byval level integer, byval treenumber string) .... 33. protected sub setnodes(byval dttree data.datatable, byval siteid long, byval pare...

makefile - failed to make the source of android 6.0 , -

working_dir/frameworks/base/docs/html/guide/topics/ui/drag-drop.jd:-980: error 101: unresolved link/see tag "android.view.view.dragshadowbuilder#view.dragshadowbuilder()" in [null] working_dir/frameworks/base/docs/html/guide/topics/ui/drag-drop.jd:-980: error 101: unresolved link/see tag "android.view.view.dragshadowbuilder#view.dragshadowbuilder(view)" in [null] frameworks/base/core/java/android/app/job/jobscheduler.java:22: error 101: unresolved link/see tag "android.app.job.jobinfo.builder#jobinfo.builder(int,android.content.componentname)" in android.app.job.jobscheduler frameworks/base/core/java/android/view/view.java:19490: error 101: unresolved link/see tag "#view.dragshadowbuilder()" in android.view.view.dragshadowbuilder frameworks/base/core/java/android/view/view.java:19490: error 101: unresolved link/see tag "#view.dragshadowbuilder(view)" in android.view.view.dragshadowbuilder droiddoc ...