Posts

Showing posts from March, 2015

Force Rails Heroku App from subdomain.herokuapp.com to apex domain? -

what proper way send subdomain.herokuapp.com apex domain of application? avoid multiple domain names same content. https://github.com/tylerhunt/rack-canonical-host seems perfect choice this. leaving here else has same question.

android - Starting activity from static method -

i've problem starting activity's. i'm trying start new activity whithin static method. this code that: static dialog dialog=null; public static void nextlevel(context c,string title,string message){ alertdialog.builder alertbox = new alertdialog.builder(c); alertbox.settitle(title); alertbox.setmessage(message); alertbox.setpositivebutton("volgende level", new dialoginterface.onclicklistener() { public void onclick(dialoginterface arg0, int arg1) { } }); alertbox.setnegativebutton("terug naar menu", new dialoginterface.onclicklistener() { public void onclick(dialoginterface arg0, int arg1) { startactivity(new intent(main.this, mainmenu.class)); } }); alertbox.show(); } the startactivity doesn't work because can't start activity static method. can't seem figure out way solve problem because can't create context myself start it.

bluej - Java Incompatible Types Error Arraylists -

i'm using bluej ide , whenever try compile java code gives me error: incompatible types highlighting brackets of: s.getcourtsportarraylist() why happening? public void showcourtbookings() { for(sport s : sportlist) { for(court c : s.getcourtsportarraylist() ) { system.out.println("court: " + c.getcourt); int i; i=1; for(booking b : c.getbookings()) { system.out.println("booking: " + + "start time: " + b.gettimestart() + "end time :" + b.getendtime()); = + 1; } } } } this class club , contains 2 arraylists; private arraylist<member> memberlist; private arraylist<sport> sportlist; the sport class has following arraylist: private arraylist<court> courtlist = new arraylist<court>(); the court class has these arraylists: private arraylist<booking> listbooking; hopefully can point me in right direction. thanks! edit: code, p

How to get user's google api version on android? -

i'm facing rare problem. have device running on android api 14. anytime try use mapactivity same error - java.lang.noclassdeffounderror: android.security.messagedigest . on other 99% devices works perfect. after digging, i've found root of problem. the error result of device manufacturer or rom creator using older maps library new version of android. (more @ what 'android.security.messagedigest''? ) the functionality of mapactivity isn't required application, want check if user has such device. how can user's google api version on android? use google map v2 . you want use google map console register sha-1 signing key in google api console. the complete tutorial can found here .

java - Offer foreground download to user with possible dialog -

i'm fighting usability design. let's have application has 1 permission, android.permission.internet . i want download image remote url (where cannot control server-side), download user can choose whether , download file. displaying dialog process approval and/or choosing final destination. i have considered these solutions: downloadmanager using setdestinationinexternalpublicdir two bugs, don't want add write_external_storage permission, , user cannot decide whether download or not using intent.action_view launch browser standalone display image user, not initiate download automatically using intent.action_view , custom proxy script server not mine, , don't want provide server-side proxy download forcing script replacing http(s) ftp, , let user decide does not work, images on server not available through ftp providin compatibility download applications (such "download files", various "file managers", ...) how achieve

Directly accessible data structure Java -

i have following situation: a data structure can ever extended ( ever add things in tail) i need able keep track of elements have seen (i have index, , ideally want able start traversing list again particular element) i reads never blocking, , addition of new element ever lock tail of queue rather whole queue this structure heavily modified multiple threads. what best data structure this? arraylist . ideal able directly access last element seen using index, leads concurrent modifications exceptions. make synchronised, avoid locking (or locking apart last element, 1 there might concurrent writes add new elements) concurrentlinkedqueue . solve concurrency problem, has problem have store current position of iteration rather integer index. has problem returns weakly consistent iterator not guaranteed return new objects have been added list since iterator created (source: javadoc) concurrenthashmap index keys. has benefit can access data corresponding correct index dire

c# - Threading in a Windows Service -

i've created app uses observable lists. i've made observablelist class threadsafe (i think) , it's working fine in application. now i'm trying install application service. works fine well, untill point gets added list. think thread there dies. i've got following code: /// <summary> /// creates new empty observablelist of provided type. /// </summary> public observablelist() { //assign current dispatcher (owner of collection) _currentdispatcher = dispatcher.currentdispatcher; } /// <summary> /// executes action in right thread /// </summary> ///<param name="action">the action should executed</param> private void dodispatchedaction(action action) { if (_currentdispatcher.checkaccess()) action.invoke(); else _currentdispatcher.invoke(dispatcherpriority.databind, action); } /// <summary> /// handles event when collection has changed. /// </summary> /// <param name=&q

asp.net - Oracle Dual vs Sys.Dual -

i using oracle end asp.net project. have user named test. sequence worked fine (select seq_name.nextval dual;) cannot access dual directly (the sequence work when select seq_name.nextval sys.dual .so have use sys.dual. caused function ora_aspnet_createuser function (asp.net membership) become invalid since guess uses dual rather sys.dual. any clues?

gnu make - automake-ing in bison which works fine with handwritten makefile -

friends, i trying create makefile via gnu-autotools flex+bison+c code (toy code, ma say). handwritten makefile works fine cc=gcc #-g -wall flex=flex bison=bison libs=lfl prog=parse ${prog}:bib.y scan.l main.c ${bison} -d bib.y ${flex} -i scan.l ${cc} -wall main.c lex.yy.c bib.tab.c `pkg-config --cflags --libs gtk+-3.0 glib-2.0` -${libs} -o $@ clean: rm -f lex.yy.c bib.tab.h ${prog} bib.tab.c touch scan.l bib.y main.c only giving warnings unused variables: $ make -f makefile bison -d bib.y flex -i scan.l gcc -wall main.c lex.yy.c bib.tab.c `pkg-config --cflags --libs gtk+-3.0 glib-2.0` -lfl -o parse main.c: in function ‘main’: main.c:35:8: warning: type defaults ‘int’ in declaration of ‘yy_create_buffer’ [-wimplicit-int] main.c:35:8: warning: unused variable ‘yy_create_buffer’ [-wunused-variable] lex.yy.c:1120:17: warning: ‘yyunput’ defined not used [-wunused-function] lex.yy.c:1161:16: warning: ‘input’ defined not used [-wunused-function] bib.y: in

How to highlight several countries using Google Chart API by country code? -

i have simple request selects country on map code (e.g. fr france) in google chart: http://chart.apis.google.com/chart?&cht=t&chs=440x220&chtm=europe&chco=f5f5f5,edf0d4,6c9642,13390a&chld=fr&chd=s:fr i know can extended selecting several countries cannot construct proper request. can give example of how (e.g. highlighting fr , it)? i think got syntax more or less: http://chart.apis.google.com/chart?&cht=t&chs=440x220&chtm=europe&chco=f5f5f5,edf0d4,6c9642,13390a&chld=fr|it|cz|de&chd=s:afhx so 1 should use "|" separate countries , provide enough color using alphanumeric encoding (1 char per country)

PHP: Best practice regarding "public" visibility in OOP -

do add public beside methods , properties inside classes? or leave out? 1. option 1, without public: <?php class simpleclass { // property declaration $var = 'a default value'; // method declaration function displayvar() { echo $this->var; } } ?> 2. option 2, public: <?php class simpleclass { // property declaration public $var = 'a default value'; // method declaration public function displayvar() { echo $this->var; } } ?> personally think adding public adds little more clarity code, though considered best practice? best practice pick coding standard , follow (and put info somewhere in code). i guess psr commonly used in php: https://github.com/php-fig/fig-standards/tree/master/accepted and according psr-2: "visibility must declared on properties." so second option way go. you can check this: http://www.phptherightway.com/

java - liferay portlet soap client, proxy authentication -

i have portlet deployed in liferay portal (windows) somewhere makes call soap service like: url url = new url("https://walter.dia.fi.upm.es:8443/integrate_collaborative_tools/services/semanticinteroperabilitylayer?wsdl"); string namespace = "http://queryengine"; string servicename = "semanticinteroperabilitylayer"; qname serviceqn = new qname(namespace, servicename); service service = service.create(url,serviceqn); qname qn = new qname(namespace,"semanticinteroperabilitylayerhttpssoap11endpoint"); semanticinteroperabilitylayerporttype porttype=service.getport(qn,semanticinteroperabilitylayerporttype.class); now, need deploy test server behind proxy. how going alter liferay, os or code configuration in order authenticate proxy?

python - copy.deepcopy or create a new object? -

i'm developing real-time application , need create instances new objects same data. first, did instantiating them, realised maybe copy.deepcopy faster. now, find people deepcopy horribly slow. i can't copy.copy because object has lists. my question is, know faster way or need give , instantiate them again? thank time i believe copy.deepcopy() still pure python, it's unlikely give speed boost. it sounds me little classic case of optimisation. suggest writing code intuitive which, in opinion, instantiating each object. can profile , see savings need made, if anywhere. may in real-world use-case different piece of code bottleneck. edit: one thing forgot mention in original answer - if you're copying list, make sure use slice notation ( new_list = old_list[:] ) rather iterating through in python, slower. won't deep copy, however, if lists have other lists or dictionaries you'll need use deepcopy() . dict objects, use copy() method. if

What do I need to modify from the default squid.conf to make it work as a transparent proxy server? -

i have router dd-wrt , forwarding router seems work following script: #!/bin/sh proxy_ip=192.168.77.77 proxy_port=3128 lan_ip=`nvram lan_ipaddr` lan_net=$lan_ip/`nvram lan_netmask` iptables -t nat -a prerouting -i br0 -s $lan_net -d $lan_net -p tcp --dport 80 -j accept iptables -t nat -a prerouting -i br0 -s ! $proxy_ip -p tcp --dport 80 -j dnat --to $proxy_ip:$proxy_port iptables -t nat -i postrouting -o br0 -s $lan_net -d $proxy_ip -p tcp -j snat --to $lan_ip iptables -i forward -i br0 -o br0 -s $lan_net -d $proxy_ip -p tcp --dport $proxy_port -j accept now if run default squid.conf file, following page on web broweser: error requested url not retrieved following error encountered while trying retrieve url: /questions/ask invalid url as can see, 'stackoverflow.com' truncated url: stackoverflow.com/questions/ask now if change append transparent following line: http_port 3128 -> http_port 3128 transparent none of pages show in web browser , following e

Git clean branch to save only my changes and changes from master -

i have branch, did changes, i'd mistaken , create wrong branch, have many different changes don't want have in it. how can clean have changes i've done , changes master branch? you can create new branch master , cherry-pick changes have made new branch. find commit hashes every commit want save. then: git checkout master git checkout -b <new branch name> git cherry-pick <commit hash> # every commit want save cherry-pick ing single commits can tedious, when have lot of them. since git 1.7.2+ cherry-pick can handle commit ranges. git cherry-pick <first commit save>^..<last commit save> as eol pointed out in comments, cherry-pick applies each patch in turn , waits user commit it, if there conflicts. in case, resolve conflicts , git cherry-pick --continue automatically move next commit. or use git cherry-pick --abort abort whole operation. now inspect current branch. if worked well, can delete previous messed-up branch: git

css - How to create a flexible leader line in div after a label field -

Image
<div class="titelcontent"> <div class="name">name</div> <div class="hzline"></div> </div> i want name div , hzline div auto fit 100% in titelcontent . the label (for example, name) vary in length , want red underline span remainding space of titlecontent div. how achieve following? easy using tables can't figure out how via span or div . updated allow background images show through you can make mark-up bit tighter using pseudo-element follows: <div class="wrapper"> <div class="inner">photoshop</div> </div> and use following css styling: div.wrapper { color:#82439a; font-size: 16px; font-weight: bold; font-family: tahoma; line-height: 180%; background: red url(http://placekitten.com/1000/500) no-repeat left top; overflow: hidden; } div.inner { position: relative; display: inner; color: yellow;

android - Caused by: java.lang.NumberFormatException -

in application trying display latitude , longitude of multiple points on google map coordinates stored in sqllite database. here map.class display point. public class map extends mapactivity { private mapview map = null; private mylocationoverlay me = null; list<overlay> mapoverlays; boolean flag; public static context context; arraylist<article> marticles; edittext search; dbhelper helper; geopoint point; mapview mapview; drawable marker; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.aproximite); helper = dbhelper.getinstance(this);// <= data mysqllitedatabase map = (mapview) findviewbyid(r.id.mapview); map.getcontroller().setcenter(getpoint(40.76793169992044, -73.98180484771729)); map.getcontroller().setzoom(17); map.setbuiltinzoomcontrols(true); mapoverlays = map.getoverla

How to get a value of a property in JSON array from extjs store? -

i have been trying dynamically generate check box value in json array json store. {"modulecatogery":[{"menu":"msu"},{"menu":"schedule"},{"menu":"market_dashboard"},{"menu":"fe_reference"},{"menu":"qc_tools"},{"menu":"quickqc_voice"},{"menu":"quickqc_data"},{"menu":"marketqc_voice"},{"menu":"marketqc_data"},{"menu":"surgery"},{"menu":"file_inventory"},{"menu":"market_tracker"},{"menu":"drive_route_tracker"},{"menu":"tickets"},{"menu":"ticket_tracker"},{"menu":"assets"},{"menu":"metrics"},{"menu":"daily_status"},{"menu":"daily_processing"},{"menu":"weekly_workflow"},{"menu&q

c# - Count of Text in RichtextBox (Line and Column?) -

Image
im working on code-editor , want know how codes in counting lines , columns in richtextbox . particularly 1 in actual code-editor . lets count transfer in listbox is there fast way can it? need , lot in advance! godbless! this it, have call code inside timer: int line = 1 + richtextbox1.getlinefromcharindex(richtextbox1.getfirstcharindexofcurrentline()); int column = 1 + richtextbox1.selectionstart - richtextbox1.getfirstcharindexofcurrentline(); label1.text = "line: " + line.tostring() + ", column: " + column.tostring();

pexpect prompt for blank space in python -

can 1 please tell me, prompt have give expecting blank space python script.i need execute command execute after sees expect prompt.on doing manually got prompt blank space,and has expect same prompt via script also. import pexpect import pxssh import time import os,re,sys def ssh(ipaddr,password): try: ss = pexpect.spawn(ipaddr) print ipaddr ss.logfile = open("/tmp/mynewlog", "a") print "ssh connecting" print except: print "connection refused" print #sys.exit() try: print password ss.expect (':') ss.sendline (password +"\n") print "connected" time.sleep(30) ss.expect (">") print "connection established" print except: print "permission denied, please try again." print sys.exit() tr

javascript - click event on li its not work perfect -

this xml file:- <?xml-stylesheet href="b.xsl" type="text/xsl"?> <root> <child_1 entity_id = "1" value="game" parent_id="0"> <child_2 entity_id="2" value="activities" parent_id="1"> <child_3 entity_id="3" value="physical1" parent_id="2"> <child_6 entity_id="6" value="cricket" parent_id="3"> <child_7 entity_id="7" value="one day" parent_id="6"/> </child_6> </child_3> <child_4 entity_id="4" value="test1" parent_id="1"> <child_8 entity_id="8" value="test @ abc" parent_id="4"/> </child_4> <child_5 entity_id="5" value="test2" parent_id="1"> <child_9 entity_id="9" v

sql server - FOR XML EXPLICIT - Generating &#163; -

i have issue when using xml explicit. basically (our company) use document printing company send xml to. in process of developing new document , 1 of sentences needed is: "pays £98 each month 12 months in claim." the printing company cant process £ sign have asked in format of &#163; though easy achieve. have built string in sql when output generated, xml explicit generates &amp;#163; company doesn't want either. please can me output literal string &#163; thanks in advance :) you should use modificators (element, xml). see this select 1 tag, null parent, '£' [a!1!b!xml], '&#163;' [a!1!c!xml], '&#163;' [a!1!d!element] xml explicit

java - Event-triggering in Spring -

i need trigger event-triggered task using spring. task should triggered when specific jms message comes, in example : @override protected void processmessage(messageclass mymessage) { event event = (event) (mymessage.tostring()); if (event.gettype() == type.keepalive) { // trigger task } } my plan use taskscheduler spring seems events not supported there.

Typescript AMD implementation bad with Javascript / RequireJS -

if have ts module: export function say(){ console.log("said"); } and compile amd option can use quite ts client : import foo = module("tsmodule") foo.say(); export var x = 123; however if have javascript equivalent ts module: define(["require", "exports"], function(require, exports) { function say() { console.log("said"); } exports.say = say; }) there no way use easily. simplest possible solution: // of course can use .d.ts requirejs beside point declare var require:any; // fail error module has not been loaded yet context // http://requirejs.org/docs/errors.html#notloaded var useme = require("jsmodule") useme.say(); export var x = 123; import foo = module("tsmodule") foo.say(); fails because of error http://requirejs.org/docs/errors.html#notloaded . since "jsmodule" not passed define call in generated typescript. the 2 workarounds have don't use impo

jsf - Programmatically register taglib reference -

is there way programmatically, in java code, register custom taglib reference? using jsf 1.2_09, rich faces 3.3.3, jsf-facelets 1.1.14. specifically: in code, jsf expression language used job us, concatenation of 2 results in 1 field or similar stuff.. facescontext ctx = facescontext.getcurrentinstance(); application app = ctx.getapplication(); expressionfactory ef = app.getexpressionfactory(); elcontext elcontext = ctx.getelcontext(); valueexpression valueexpression = new overridevalueexpression(singleresult.getclass(), singleresult); elcontext.getvariablemapper().setvariable("row", valueexpression); (int = 0; < jsfdisplayvalue.size(); i++){ object value = ef.createvalueexpression(elcontext, jsfdisplayvalue.get(i), object.class).getvalue(ctx.getelcontext()); //do value... } e.g., elements of jsfdisplayvalue can be: "#{row.name} #{row.surname}", "#{row.age}", "#{tagfoo:foofunction(row.age)}" ... problem occurs when express

c++ - Connect to Gtk::Window signal_delete_event -

i want connect signal window.signal_delete_event, fails following error messages: no match call ‘(sigc::bound_mem_functor0) (_gdkeventany* const&)’ opticalinput return-statement value, in function returning 'void' [-fpermissive] void value not ignored ought be that code line causing error: window.signal_delete_event().connect(sigc::mem_fun(this,&guiwindow::onexitclicked)); the pointed member function one: void guiwindow::onexitclicked() { *state = false; gtk::main::quit(); } any ideas on how fix this? your method must match signature of signal. in gtkmm documentation signal_delete_event() , following prototype given: bool on_my_delete_event(gdkeventany* event) using naming, method must defined follows: bool guiwindow::onexitclicked(gdkeventany* event) { ... } the return value used indicate whether or not have handled event. if return true, other handlers event not see it.

assembly - Data alignment in store instruction -

in arm assembly, have data across registers r3 - r9 . want store them memory using stm instruction starting address have in r0 instruction stm r0,{r3-r9} put data registers right next each other. want have 16-byte gap between stored values, e.g like: str r3,[r0] str r4,[r0,#16] str r5,[r0,#32] str r6,[r0,#48] ... is possible stm instruction or there shortcut trick? the stm instruction lets specify whether destination address should grow downwards or upwards , not stride should (it'll size of register, i.e. 1 word). you'll have use alternative solution 1 suggested yourself. for example: str r3,[r0] str r4,[r0,#16] str r5,[r0,#32] .... or ; simpler since it's obvious stores spaced 16 bytes apart, ; altough doesn't preserve original value of r0 above version str r3,[r0],#16 str r4,[r0],#16 str r5,[r0],#16 ....

c++ - Why does the address of a function change with every run? -

i'm struggling mapping addresses symbols debugging purposes (getting callstack). ms dbghelp.dll can tell symbol address (see symfromaddr , msdn ). however, doesn't work , wonder how ever work, because addresses seem change every run of program: #include <iostream> void foo() {} int _tmain(int argc, _tchar* argv[]) { const long unsigned int addr = reinterpret_cast<long unsigned int>(&foo); std::cout << "address: " << std::hex << addr << std::endl; return 0; } output: d:\dev\sandbox\debug>sandbox.exe address: 901320 d:\dev\sandbox\debug>sandbox.exe address: ce1320 d:\dev\sandbox\debug>sandbox.exe address: 3a1320 d:\dev\sandbox\debug>sandbox.exe address: 3f1320 how different program ever read address stacktrace , map functions? sounds magic me. didn't find in linked documentation says have subtract address or whatever. in understanding since overcome real-mode every process has virtual mem

python - Adding extra properties to the User class in App Engine datastore? -

i working on app using flask , app engine, requires information stored in user object apart nickname, email , user_id. possible extend user class in datastore? if not, there workaround? planning have own user model. so, once user logs app(using google authentication), collect user info using users.get_current_user() function , add other fields require. these information stored in own user model. right way handle situation? as explained in other question, need separate class. user not model, , not stored in datastore. it's combination of user_id , email obtained google's accounts system when log in. if want store user, need create own model class, , use store user_id and/or email fields compare against logged-in user.

java - What is the difference between a standard MBean and dynamic MBean? -

what different between: standard mbeans dynamic mbeans what pros , cons of each , when should choose either of these 2 components manage resource? a standard mbean has fixed meta-data not change during lifetime of mbean. dynamic mbeans define meta-data on fly , can modify , re-publish meta-data. think [badly] contrived analogy java: let's wrote class listed number of files in directory. standard class method might like: public int getfilecount(string directoryname) on other hand, dynamic mbean version of class start no methods, when starts up, scans directories available, , creates new method each directory found: public int getfilecountdir1(); public int getfilecountdir2(); .... public int getfilecountdirn(); so that's not useful setup, suppose wanted create mbean displayed jvm's system properties. well.... system properties change... , there's no reasonable way of knowing property keys defined ahead of time, better representation of dynami

php - Merging preg_match_all and preg_replace -

i have code running finds out hashtags in string , turns them links. have done using preg_match_all shown below: if(preg_match_all('/(#[a-z_]\w+)/', $postlong, $arrhashtags) > 0){ foreach ($arrhashtags[1] $strhashtag) { $long = str_replace($strhashtag, '<a href="#" class="hashlinks">'.$strhashtag.'</a>', $postlong); } } also, search script, need bold searched keywords in result string. similar below code using preg_replace : $string = "this description search demo"; $searchingfor = "/" . $searchquery . "/i"; $replacepattern = "<b>$0<\/b>"; preg_replace($searchingfor, $replacepattern, $string); the problem having both have work , should thrown combined result . 1 way can think of run resultant string preg_match_all preg_replace code if tags , searched string same? second block bold tag not desired. update code i'm running based on answer given be

c# - Session login not logging out on button click -

i have site stores variables on user login, db. 1 such variable (on successful login) sitesession.current.isloggedin = true . when click logout button, method tells set false , proceed session.clear() , session.abandon() . up now, have click logout button twice before changes made. tested response.write(sitesession.current.isloggedin); in logout() method. the first click doesnt show anything, second click shows false . could tell me i;m going wrong? /// <summary> /// logs user out, , destroys session /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkaccountlogout_click(object sender, eventargs e) { sitesession.current.isloggedin = false; sitesession.current.rollid = "-1"; session.clear(); session.abandon(); response.write(sitesession.current.isloggedin); } ~ login opposite that, whilest storing few more variables. edit: if reload p

css - Jqgrid: Multiselect in toolbar filter -

i want add multiple select toolbar filter, since not supported natively jqrid. best , easiest reuse ui.multiselect plugin comes together, however, im not able succeed that. my idea render comes searchoptions (i did simplified example make more clear): searchoptions:{multiple:true, value:'true:true;false:false', defaultvalue:'false'} and run multiselect rendering on given column: $("#gs_example").multiselect() but instead of expected dropdownbox got ugly picture: http://i38.tinypic.com/2zgvuh3.jpg i cannnot bring mutliselect frame foreground or whatsoever... <div class="ui-multiselect ui-helper-clearfix ui-widget" style="width: 146px;"> <div class="selected"> <div class="actions ui-widget-header ui-helper-clearfix"> <span class="count">1 items selected</span> <a class="remove-all" href="#">remove all</a> </div> <ul class=&qu

python - test for membership in a 2d numpy array -

i have 2 2d arrays of same size a = array([[1,2],[3,4],[5,6]]) b = array([[1,2],[3,4],[7,8]]) i want know rows of b in a. so output should : array([ true, true, false], dtype=bool) without making : array([any(i == a) in b]) cause , b huge. there function 1d arrays : in1d what we'd use np.in1d ... except np.in1d works 1-dimensional arrays. our arrays multi-dimensional. however, can view arrays 1-dimensional array of strings : a = a.ravel().view((np.str, a.itemsize*a.shape[1])) for example, in [15]: = np.array([[1, 2], [2, 3], [1, 3]]) in [16]: = a.ravel().view((np.str, a.itemsize*a.shape[1])) in [17]: a.dtype out[17]: dtype('|s8') in [18]: a.shape out[18]: (3,) in [19]: out[19]: array(['\x01\x00\x00\x00\x02', '\x02\x00\x00\x00\x03', '\x01\x00\x00\x00\x03'], dtype='|s8') this makes each row of a string. matter of hooking np.in1d : def innd(a, b, assume_unique=false): = np.asarray

email - Local SMTP Server -

i used iis5.1 prior virtual smtp server send internal mail. however, we've been upgraded iis7.5 , there no smtp server reason microsoft doesn't have fit explanation for. there comparable local smtp server use (i need send-only, not full mail server, if makes difference)? in short, can still use iis6 smtp server on iis7.5, or can use free smtp server alternative listed below. iis6 smtp : is smtp virtual server deprecated in iis 7? http://www.chrislazari.com/2011/04/iis-75-installing-smtp-service-securing.html http://forums.iis.net/p/1157046/1901343.aspx popular alternatives: mailenable http://www.mailenable.com/standard_edition.asp smartermail http://www.smartertools.com/smartermail/mail-server-software.aspx hmailserver http://www.hmailserver.com/ search more: google

visual studio 2012 - How to update TFS workspace after computer name changes? -

i renamed computer name, , tfs workspace broken in visual studio 2012. when type: tf workspaces /computer:abotonjic-pc /owner:* /format:detailed workspace : abotonjic-pc owner : wrongowner@test.com computer : abotonjic-pc comment : collection : netuse.visualstudio.com\defaultcollection permissions: private location : local file time : current but need have : owner : realowner@test.com computer : new-pc then try: tf workspaces /updatecomputername:abotonjic-pc /collection:netuse.visualstudio.com/defaultcollection no workspace matching *;wrongowner@test.com on computer new-pc found in team foundation server netuse.visualstudio.com/defaultcollection. so question : how update computer name in workspace? why tfs still shows "wrongowner@test.com" in workspace although there new email registered "realowner@test.com"? install team foundation sidekicks . it's free. open workspace sidekick, click search, , sele

c# - Windows 8 App - Pass Data to MainPage -

i want pass data child page of mainpage in app. problem, can tell there splash loading screen navigates mainpage , want write "if navigated child page" block include in onnavigatedto. here mainpage.xaml.cs code: protected override void onnavigatedto(navigationeventargs args) { if (base.onnavigatedfrom(args) = childpage) { // code for: if navigated child page returndata returndata = args.parameter returndata; this.mynewstring = returndata.mystring; } base.onnavigatedto(args); } i found out cannot return data way used passing data page windows 8 apps. cannot return data way pass i.e. this.frame.navigate(typeof(mainpage), passdata); for solution, created 'completed' event , and called mainpage c# code behind. mainpage.xaml.cs : protected override void onnavigatedfrom(navigationeventargs args) { if (args.sourcepagetype.equals(typeof(childpage)))

Java statically defined dictionary / HashMap -

i have block of static data need organize array containing hash maps. specifically, want have static object in app contains time zone information this: https://gist.github.com/pamelafox/986163 seeing how clean definition looks in python, , knowing how clean definition can created of other languages know, hoping there cleaner approach in java running map.put(...) repeatedly. have seen question: how give static value hashmap? wondering if there better way it? one solution store data normal string in whatever format can think of , convert string representation map (static, non-static or one-time initialized instance). an improvement of method store data in file , load (can included in .jar package, when use jar). solution have advantage data can updated.

list operation in C# -

i have 2 lists lista ={'a','b','c','d','e'}; listb ={'a','c','d','f'} i need listc lista , listb , such listc= {'b','e'} is possible , how listc ? var lista = new list<char> { 'a', 'b', 'c', 'd', 'e' }; var listb = new list<char> { 'a', 'c', 'd', 'f' }; var listc = lista.except(listb).tolist(); // ^^ has 2 items; 'b' , 'c'

Hadoop streaming with python on Windows -

i'm using hortonworks hdp windows , have configured master , 2 slaves. i'm using following command; bin\hadoop jar contrib\streaming\hadoop-streaming-1.1.0-snapshot.jar -files file:///d:/dev/python/mapper.py,file:///d:/dev/python/reducer.py -mapper "python mapper.py" -reducer "python reduce.py" -input /flume/0424/userlog.mdac-hd1.mdac.local..20130424.1366789040945 -output /flume/o%1 -cmdenv pythonpath=c:\python27 the mapper runs through fine, log reports reduce.py file wasn't found. in exception looks hadoop taskrunner creating symlink reducer mapper.py file. when check job configuration file, noticed mapred.cache.files set to; hdfs://mdac-hd1:8020/mapred/staging/administrator/.staging/job_201304251054_0021/files/mapper.py#mapper.py it looks although reduce.py file being added jar file, it's not being included in configuration correctly , can't found when reducer tries run. i think command correct, i've tried using -file pa

selenium webdriver - How to click a button without id using FluentAutomation SeleniumWebDriver? -

i using fluentautomation library wraps selenium web driver calls site can navigated in more behavioral manner. as long elements have id or other distinct properties, works straightforward: i.open(site.baseurl); i.waituntil(() => i.expect.exists("#name-search")); i.click("#applicationhost a"); but need driver click on buttons identified following xpath expressions: //div[@id='questions']/div/div/div[4]/label/span[2] //div[@id='questions']/div/div/div[2]/label/span[2] etc. @ least xpath returned selenium ide recorder. don't seem able find right way of referencing these buttons. see, difference index of 1 of divs (div[4], div[2]). there common convention refer elements such xpath? update: here's html extract page inspector. <div class="small-12 large-10 columns large-centered" data-bind="foreach: currentquestion.alternatives"> <div class="valg">

gcc - Using LD_PRELOAD to overload call to a C function of a shared library -

i'm following this answer override call c function of c library. i think did correctly, doesn't work: i want override "dibopen"-function. code of library pass ld_preload environment-variable when running application: dibstatus dibopen(void **ctx, enum board b) { printf("look @ me, wrapped\n"); static dibstatus (*func)(void **, enum board) = null; if(!func) func = dlsym(rtld_next, "dibopen"); printf("overridden!\n"); return func(pcontextaddr, boardtype, boardhdl); } the output of nm lib.so | grep dibopen shows 000000000001d711 t dibopen when run program this ld_preload=libpreload.so ./program i link program -ldl ldd program not show link libdl.so it stops with symbol lookup error: libpreload.so: undefined symbol: dlsym . can debug further? mistake? when create shared library (whether or not used in ld_preload ), need name of libraries it needs resolve dependencies. (und