Posts

Showing posts from April, 2011

matlab - Compare and find strings in 2 dimensional array -

i new matlab , stuck in efficiently solving following problem. i have 2 arrays (both of them 2d) , want check array1 col col know how many elements appear in each col of array2 (compare col col) for example array1 --------- 'a1' 'b1' 'c1' 'd1' 'e1' 'f1' array2 ---------- 'a1' 'a1' 'b1' 'b1' 'a1' 'd1' 'd1' 'c1' 'd1' 'c1' 'c1' 'c1' 'b1' 'd1' 'd1' i trying following output 2 elements array1 col1 appear in array2 col1 2 elements array1 col1 appear in array2 col2 0 elements array1 col1 appear in array2 col3 1 elements array1 col1 appear in array2 col4 2 elements array1 col1 appear in array2 col5 0 elements array1 col2 appear in array2 col1 0 elements array1 col2 appear in array2 col2 1 elements array1 col2 appear in array2 col3 1 elements array1 col2 appea...

solr - Converting a DSE Search node to a DSE Spark node -

i saw faq dse node can reprovisioned rt mode hadoop mode. similar supported dse search , dse spark? have existing 6-node dse search cluster. want test dse spark have limited time left development if possible, i'd skip bootstrap process restarting cluster analytics dc instead of adding new nodes in separate dc. update: i tried find answer on own. these closest found: http://www.datastax.com/wp-content/uploads/2012/03/wp-datastax-whatsnewdse2.pdf http://www.datastax.com/doc-source/pdf/dse20.pdf these documents old release of dse. both documents rt , analytics node can re-provisioned. second document explicitly says solr node cannot re-provisioned. unfortunately, there no mention re-provisioning in more recent documentations. can confirm whether still true dse 4.5.1? (preferably link reference) i saw forum thread explains why section re-provisioning removed in recent documentations. however, in case, plan re-provision of search nodes analytics node (in contrast re-pr...

gradle - zip dependencies to a file does not work any more -

basing on gradle : copy test dependencies zip file i created task zipdeps(type: zip) { configurations.testcompile.allartifacts.files configurations.testcompile exclude { details -> details.file.name.contains('servlet-api') } exclude { details -> details.file.name.contains('el-api') } exclude { details -> details.file.name.contains('jsp-api') } exclude { it.file in configurations.providedcompile.files } archivename "${rootprojectname}-runtime-dependencies_full.zip" dolast{ ant.copy (todir : "$builddir/libs/") { fileset(file:"$builddir/distributions/${rootprojectname}-runtime-dependencies_full.zip") } } } this worked fine until migrated gradle 2.0. if leave code was, task executed in beginning , nothing happens @ all. if add << task , make dependent war build task, @ end of war build claims up-to-date nothing has happened. one of problems seems ...

javascript - End a session so another session can begin when the user hits the browsers back button -

is possible end session session can begin when user hits browsers button? have 5 pages want button end there session. new of appreciated. <cfset structclear(session)> this fixed problem inserting on 5 of pages. if interested.

visual studio 2008 - Getting MSBUILD working with an ASP.Net website in Jenkins -

introduction my asp.net website c# builds (& publishes) on development machine. the solution uses .net framework 3.5 i use visual studio 2008 the website contains bin folder ajaxcontroltollkit dll the issue i attempting set jenkins continuous integration jenkins running on windows server 2008 r2 based machine i referencing svn repository , code appears checked out correctly. the build fails following error:- build started 10/09/2014 13:20:02. project "d:\dev\manzen_fx_35\manzen.sln" on node 0 (default targets). building solution configuration "debug|any cpu". manzen_fx_35: copying file "d:\dev\manzen_fx_35\bin\ajaxcontroltoolkit.dll" "..\manzen_fx_35\bin\ajaxcontroltoolkit.dll". copying file "d:\dev\manzen_fx_35\bin\ajaxcontroltoolkit.pdb" "..\manzen_fx_35\bin\ajaxcontroltoolkit.pdb". aspnetcompiler : error aspruntime: precompilation target directory (d:\dev\manzen_fx_35\p...

android - Funny things happening with putExtra and getIntExtra -

i'm developing game, on menu screen have series of buttons take player different levels of game. i've used putextra , getintextra take int menu activity game activity, sets play level. this working nicely, problem having when using "back" button go menu activity have hit twice menu instead of once. if hit once takes level corresponds default int of getintextra function. i'm not sure why it's doing this. any advice appreciated. -- edit -- in menu activity public void ongotogame1click(view view) { intent getnamescreenintent = new intent(this, gameactivity.class); final int result = 1; startactivityforresult(getnamescreenintent, result); getnamescreenintent.putextra( "int", 1); startactivity(getnamescreenintent); } in game activity @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.game_layout); leveltv = (textview) findviewby...

ubuntu - Web Server is Down, only have SSH access -

my unbuntu webserver down , client going nuts!! unfortunatley cannot hold of guy manages our servers. have full ssh access, can far: user:~ me$ ssh user@webserver.com -vvv openssh_6.2p2, osslshim 0.9.8r 8 dec 2011 debug1: reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: applying options * debug2: ssh_connect: needpriv 0 debug1: connecting webserver.com [ip.address] port 22. debug1: connection established. debug1: identity file /users/james/.ssh/id_rsa type -1 debug1: identity file /users/james/.ssh/id_rsa-cert type -1 debug1: identity file /users/james/.ssh/id_dsa type -1 debug1: identity file /users/james/.ssh/id_dsa-cert type -1 debug1: enabling compatibility mode protocol 2.0 debug1: local version string ssh-2.0-openssh_6.2 but hangs here , goes no further. there command can send force server reboot? many thanks

performance - Efficient implementation of Damerau-Levenshtein distance -

i'm trying implement efficient clojure function compute damerau-levenshtein distance . i've decided use this algorithm (attached source should c++) computing levenshtein distance , add lines make work dld. here i've created in common lisp (i hope help): (defun damerau-levenshtein (x y) (declare (type string x y) #.*std-opts*) (let* ((x-len (length x)) (y-len (length y)) (v0 (apply #'vector (mapa-b #'identity 0 y-len))) (v1 (make-array (1+ y-len) :element-type 'integer)) (v* (make-array (1+ y-len) :element-type 'integer))) (do ((i 0 (1+ i))) ((= x-len) (aref v0 y-len)) (setf (aref v1 0) (1+ i)) (do ((j 0 (1+ j))) ((= j y-len)) (let* ((x-i (char x i)) (y-j (char y j)) (cost (if (char-equal x-i y-j) 0 1))) (setf (aref v1 (1+ j)) (min (1+ (aref v1 j)) (1+ (aref v0 (1+ j))) ...

Custom compass on android google maps api v2 -

i add custom compass map or replace current icon , items. possible? map not give functionality replace compass custom image. but 1 way disable default compass via setcompassenabled , draw own. use sensors make point in right direction. you can use following example point right direction. see below link. http://android-er.blogspot.in/2010/08/simple-compass-sensormanager-and.html

c# - WP8 How to add my app to the lock screen settings -

i'm trying find out if there way programmatically add app allowed lock screen notifications list on windows phone 8 / 8.1? seems bit of pain ask user themselves. as far know can't set them programmatically. it's must user add app lockscreen settings to show text notification or icon. lock screen notifications windows phone 8

Pass Print messages in Python to email -

i've written python script has several print statements in it. i'd pass these print statements email script send me after has finished running. possible? below attempt, errors out @ deleted = import arcpy, os arcpy.deleterows_management(r"c:\gis_work\streetstesting\lake george.shp") deleted = print "the rows have been deleted lake george" # send email when script complete server = "my.mailserver.com" = "from@email.com>" = "to@email.com>" subject = "the script has completed" msg = deleted # prepare actual message message = """\ from: %s to: %s subject: %s %s """ % (from, ", ".join(to), subject, msg) # send mail server = smtplib.smtp(server) server.sendmail(from, to, message) server.quit()

java - HQL Parameter not in Attribute -

i have 2 entities manytomany relation. role core: @entity @table(name = "role") public class rolecore extends baseentity { @id @generatedvalue(strategy = generationtype.auto, generator = "role_seq_gen") @sequencegenerator(name = "role_seq_gen", sequencename = "role_seq", initialvalue = 100, allocationsize = 1) @column(name = "role_id", nullable = false) private long id; @column(name = "name", length = 255) private string name; @column(name = "is_admin") private short isadmin; @manytomany @jointable(inversejoincolumns = @joincolumn(name = "fk_right", referencedcolumnname = "right_id"), joincolumns = @joincolumn(name = "fk_role", referencedcolumnname = "role_id")) private list<rightcore> rights; } right core: @entity @table(name = "right") public class rightcore extends baseentity { ...

java - How to click a button from a table where all classes have the same name -

<tbody> <tr class="b"> <td class="t_l">betmatrix</td> <td class="t_l"> <td class="t_r">dsdfsf</td> <td class="t_r">none</td> <td class="t_r">all</td> <td class="t_r">none</td> <td class="t_r">all</td> <td class="t_r">all</td> <td class="t_r">none</td> <td class="t_r">all</td> <td class="t_r">not required</td> <td class="t_r">1.11</td> <td class="t_r">all user</td> <td class="t_r">0.00</td> <td class="t_r">2014-09-05</td> <td class="t_r">2014-09-15</td> <td class="t_r">2014-09-05</td> <td class="t_r">1-admin<...

python - scipy.stats.pearsonr with lists of Decimals? -

trying run scipy.stats.pearsonr 2 lists of decimal making scipy unhappy: print type(signals) print type(signals[0]) print type(prices) print type(prices[0]) <type 'list'> <class 'decimal.decimal'> <type 'list'> <class 'decimal.decimal'> correlation = stats.pearsonr(signals, prices) traceback (most recent call last): file "commod.py", line 74, in <module> main() file "commod.py", line 69, in main correlation = stats.pearsonr(signals, prices) file "/home/.../venv/local/lib/python2.7/site-packages/scipy/stats/stats.py", line 2445, in pearsonr t_squared = r*r * (df / ((1.0 - r) * (1.0 + r))) typeerror: unsupported operand type(s) -: 'float' , 'decimal' anybody run solution this? as error suggests, problem arises because pearsonr function trying run arithmetic operations on float , decimal, , python doesn't that. can, however, convert dec...

Understanding how the distribution of a python script is achieved with setuptools -

i'm looking distribute few python scripts. scripts use few separate packages such docopt , of course utilise various libraries. id able package script along needs function correctly. from have read best way use setuptools , use of setup.py script. id know is, setuptools able identify packages , libraries being used in script , automatically copy relevant packages current location directory used 'new package' creation. or have manually find package installations on system , copy them relevant folder 'new package' creation? ive read setuptool docs have read seems though need manually? if how know relevant packages , libraries on system? could let me know if im understanding correctly? ok got working. just in case else comes across post , wants know simply. the idea have script share, script uses various other modules, packages etc. last thing wants start scrapping them create nonworking manual package. by creating setup.py file , specifying pa...

node.js - Getting node-gyp dependent modules on windows without building -

there many important node-gyp -dependent nodejs modules, install them on windows requires amount of software preinstalled (python, visual studio). it's crude , time-consuming solution: just proper python + vs version specific windows version challenge worthy of sherlock holmes skills installing whole ide , python , never use it, module locally once? crazy. distributing such nodejs apps may require consumer have gyp-related bloatware installed, , means loosing 99% consumers. so possibilities of reducing issue zero? are there services provide pre-built platform modules? and why developers of modules can't distribute built modules major windows versions? there project addressing issue called node-pre-gyp . require package developer opt-in using node-pre-gyp figuring out how host binaries somehow. when works it's pretty nice. i have similar project electron-updater-tools supports electron compatible pre-built binaries. there has been talk node fo...

.NET Setting Thirdparty dll version dependencies with manifest file -

i developed .net dll depends on third party dll version 10.1.2 , has publickeytoken etc. now, third party dll release new version 11.0. , want make use of new version .net dll. dont want recompile against new version of third party dll. instead can have manifest xml file dll dynamically define third party dll version? is purpose of manifest files? basically, added following app.config <dependentassembly> <assemblyidentity name="microsoft.analysisservices.adomdclient" publickeytoken="89845dcd8080cc91" culture="neutral" /> <bindingredirect oldversion="10.0.0.0" newversion="11.0.0.0" /> </dependentassembly> and took care.thanks hans.

excel - select the row with number most close to certain value -

Image
i have set of data 3 column (example shown in figure). second column (height) starting 1 , increased ~80 , starting 1 again. need select row second column close 50. shown in figure below, need select 3 rows. can 1 suggest how find out rows in excel? many thanks! =match(50, b1:b80, 1) will find element has largest value less or equal 50 in range (choose ranges accordingly). believe b1:b80 must in ascending order.

angularjs - Angular Js Security Issues Role Based Authorisation -

i creating new enterprise application in angular company. excited angular handling roles on client side not working out me. basically saving token when ever user log's in , before user view page authorisation request sent server role , user details based on token. after authorisation request data page server returns entire data irrespective of role of user, after use ng-switch , render templates according role. now problem here trying show , hide data on client side after recieve user information have keep role in scope variable or local storage anywhere on client side. point here if keep on client side can change role , access data want. so should assume angular not fit app trying display data on client side according roles server because feel if user can see logic , data can play it. this view <div ng-switch="user.data.role"> <div ng-switch-when="admin"> <h1>hello seeing dashboard admin</h1> ...

python - Importing a local variable in a function into timeit -

i need time execution of function across variable amounts of data. def foo(raw_data): preprocessed_data = preprocess_data(raw_data) time = timeit.timer('module.expensive_func(preprocessed_data)', 'import module').timeit() however, preprocessed_data not global variable. cannot imported from __main__ . local subroutine. how can import data timeit.timer environment? pass callable time, rather string. (unfortunately, introduces function call overhead, it's viable when thing time swamps overhead.) time = timeit.timeit(lambda: module.expensive_func(data))

java - How to handle close tab in eclipse RCP 4 -

i want make validation when pulse close button of tab in eclipse rcp 4 application , if validation fails prevent de close. if don't want use part.setdirty(true) isavehandler greg-449 montioned, listen model events , correct things there. in direction of this: public class preventcloseaddon { @postconstruct public void init(final ieventbroker eventbroker, final epartservice partservice) { eventhandler tbrhandler = new eventhandler() { @override public void handleevent(event event) { if (!uievents.isset(event)) return; object element = event.getproperty(uievents.eventtags.element); if (element instanceof mpart) { mpart part = (mpart) element; if (!part.istoberendered()) { // ... validate here ... part.settoberendered(true); partservice.activate(part);...

c# - Wrap a DataGrid in XAML -

i have datagrid being populated datatable. problem datatable has 12 columns 9 show in datagrid thats fit on page. anyone know how wrap datagrid rest of columns show further down page? or other ideas of how solve this? thanks i don't think there way wrap data grid object instead put datagrid inside scrollviewer , enable horizontalscroll. scrollviewer class http://msdn.microsoft.com/en-us/library/system.windows.controls.scrollviewer%28v=vs.110%29.aspx

javascript - Optimize comparing huge amounts of data with itself in NodeJS -

i have big multidimensional object in nodejs , 50 mb worth of json . contains variations of biological data. think can sufficiently simplify so: { lads : { // lad lad4515643 : { brains : { // brain brain1256251 : { var01 : 'lala', var02 : 'jaja', var99 : 'haha', }, // brain brain3567432 : {}, brain4867321 : {}, brain5145621 : {} // etc }, var01 : 'foo', var02 : 'bar', var99 : 'baz' }, // lad lad4555672 : {}, lad5625627 : {}, lad7457255 : {} // etc } } i need compare combinations of lads brains lads brains see ones "better", in order make kind of hierarchy. parent lads keys weigh in on brains comparison. i figured, using i...

SendGrid - Curl php external file attachment broken -

i'm using sendgrid customer project curl method. all works fine the(ir) file(s) attached on email sending sendgrid broken. here code : $documentlist = array( "doc1.php" => "http://www.customerdomain.com/my/path/where/my/attachment/file/is/myfile.pdf" ); $params = array( 'api_user' => $user; 'api_key' => $pass, 'x-smtpapi' => json_encode($json_string), 'from' => $from, 'to' => $to, 'subject' => $subject, 'html' => $mailhtml, 'text' => $mailtext ); if(count($documentlist)>0){ foreach($documentlist $filename=>$documentpath){ $params['files['.$filename.']'] = $documentpath; } } $request = $url.'api/m...

android - Fatal signal 11 code 1-Schedule-Cocos2dx -

i have gamemodesimple class inherits layer class.this wrote class: void gamemodesimple::schedulebreaks() { float dt = getbreakgeneratedeltatime(); layer->schedule(schedule_selector(gamemodesimple::generatebreaks), 3); } void gamemodesimple::generatebreaks(float dt) { repetitioncount--; cclog("name %i", layer->gettag()); } into "generatebreaks" function,when remove "cclog" works when write crashes.this stack trace: ********** crash dump: ********** build fingerprint: 'samsung/delos3gxx/delos3geur:4.1.2/jzo54k/i8552xxamk2:user/r elease-keys' pid: 7737, tid: 7761, name: thread-23546 >>> com.game.breaker <<< signal 11 (sigsegv), code 1 (segv_maperr), fault addr 00000000 stack frame i/debug ( 4687): #00 pc 00162ebe /data/data/com.game.breaker /lib/libcocos2dcpp.so (gamemodesimple::generatebreaks(float)+17): routine gamemo desimple::generatebreaks(float) @ d:\gamefile\cocos\breaker\proj.androi...

count unique values for each column per ID in R -

i have dataset quite big (140000 obs * 125 attributes). each ob associated id (which can unique or not). want count unique values each attribute (columns) per id. i tried aggregate(. ~ id, mydata, function(x) length(unique(x)) . doesn't work. given size of data frame, feel works may take long it. knows better way it? the dataset: id attr1 attr2 attr3 attr125 1 x y 123 1 b z y 345 1 b x y 134 2 z y abc 2 c y y def 3 d y n xyz 4 b z y 789 the result want: id attr1 attr2 attr3 attr125 1 2 2 1 3 2 2 2 1 2 3 1 1 1 1 4 1 1 1 1 i hesitated posting because similar @mgriebe's answer, different way use data.table . find data.table useful these operations (however, aggregate call worked fine me): # load data.table package require( data.table ) # first copy data.frame data.table dt <- data.table( mydata ) # count length of id unique id values each column us...

How to check if a service is running on Android? -

how check if background service (on android) running? i want android activity toggles state of service -- lets me turn on if off , off if on. i had same problem not long ago. since service local, ended using static field in service class toggle state, described hackbod here edit (for record): here solution proposed hackbod: if client , server code part of same .apk , binding service concrete intent (one specifies exact service class), can have service set global variable when running client can check. we deliberately don't have api check whether service running because, without fail, when want end race conditions in code.

Facebook Graph V2.1 How to Filter News Feed or /home without FQL? -

fql being deprecated , use lot query filtering news feed. how supposed covert graph api calls? "select {columns} stream source_id=me() , type=xxx , app_id=xxxx" i tried following: /v2.1/me/home?filter=application(xxxxx) i don't it.. if use: /v2.1/me/home?filter=app_xxxx the result inconsistent , how suppose translate source_id=me() ?? filter app_xxx not documented anywhere on fb.. on page https://developers.facebook.com/docs/graph-api/reference/v2.1/user/home/ the documentation said modifiers filter "retrieve posts match particular stream filter. " valid filters used here can retrieved using fql stream_filter table. isn't fql being deprecated??? or how suppose use stream filters in graph? full of questions pardon me. hoping give me answers or clues...

powershell - How can I use Psconsole.psc1 -Command Get-{anything} -

i working powershell scripts executed way: ps c:\long\path\to\psconsole.psc1 -command {get-whatever...} they generate error: you must provide value expression on right hand side of value '-' operator. * here's example: ps c:\> "c:\program files\common files\microsoft shared\web server extensions\14\config\powershell\registration\psconsole.psc1" -command "get-service" same error message: `you must provide value expression on right hand side of value '-' operator.` ... @ line 1... - <<< command "get-service" + categoryinfo: pasererror: (:) [], parentcontainserrorrecordexception + fullyqualifiederror: expectedvalueexpression can tell me way -command working? by enclosing path in quotes, you're telling powershell string , - before "-command" interpreted operator not parameter. to around this, prefix statement "call" operator "&": & ...

ruby - RVM showing 'clr' and bash errors with every command -

my os osx 10.9.4, , every time run ruby version manager command seeing bunch of errors, though command still seems run, warning @ end. these messages appear on every command: rvm_error_clr=: no such file or directory rvm_warn_clr=: no such file or directory rvm_debug_clr=: no such file or directory rvm_notify_clr=: no such file or directory rvm_reset_clr=: no such file or directory -bash: eval: line 8: syntax error near unexpected token `(' -bash: eval: line 8: `ssh-agent __rvm_awk() { \awk "$@" || return $?; }' -bash: eval: line 8: syntax error near unexpected token `(' -bash: eval: line 8: `ssh-agent __rvm_cp() { \cp "$@" || return $?; }' -bash: eval: line 8: syntax error near unexpected token `(' -bash: eval: line 8: `ssh-agent __rvm_date() { \date "$@" || return $?; }' -bash: eval: line 8: syntax error near unexpected token `(' -bash: eval: line 8: `ssh-agent __rvm_find() { \find "$@" || return $?; }' -ba...

html - How to make Div expand width with 100% -

i had make container , make middle width margin: 0 auto, had face problem make content width fit window width 100% width? any way make it? if using padding:0 400px , margn-left:-200 ? here working code. css html, body {width:100%; height:100%; background:lightblue} * { margin:0; padding:0} #container { width:1024px; min-height:100%; background:red; margin:0 auto; position:relative; } header { width:100%; height:80px; background:skyblue; } header ul {list-style-type:none; float:right} header ul li {display:inline-block; padding: 10px; 20px;} #content { width:100%; height:200px; background:yellow; padding:0 300px; margin-left:-200px; } http://codepen.io/jaminpie/pen/chrif thansk help.. move content div outside of container, give absolute positioning 80px top falls right below header. #content { width:100%; height:200px; background:yellow; padding:0 300px; position:absolute; top:80px; } updated pen

javascript - V8 crash when accessing persistent function -

can see why call persistent function pfunc_on_open crashes ? locker lock(isolate); handlescope scope(isolate); v8::local<v8::context> context = v8::local<v8::context>::new(isolate, p_context); context::scope context_scope(context); handle < v8::object > global = context->global(); handle < value > args[1]; if (event.compare(event_onopen) == 0) { args[0] = v8::string::newfromutf8(isolate,message.c_str()); v8::local<v8::function> processonopen = v8::local<v8::function>::new(isolate, pfunc_on_open); processonopen->call(global, 1, args); } the function associated javascript method via following code : void websocket::exposewebsocket(handle<objecttemplate> globaltemplate) { globaltemplate->set(string::newfromutf8(isolate,"websocket"), functiontemplate::new(isolate,websocketconstructor));} void websocketconstructor(const v8::functioncallbackinfo &args) { logd(log_tag, "in websoc...

java - Hibernate: mapping nested objects -EDITED- -

for example, have following tables: user: | userid | username | usertypeid | usertype: | usertypeid | usertypename | so usertypeid foreign key user use refer usertype. java implementation such: i have class user , class usertype, looks like: public class user { private int id; private usertype ut; .... } public class usertype { ... } in user.hbm.xml: <hibernate-mapping> <class name="com.pretech.user" table="user"> <meta attribute="class-description"> class contains employee detail. </meta> <id name="id" type="int" column="userid"> <generator class="native"/> </id> </class> </hibernate-mapping> so questions follows: 1) should put map usertype here , indicate usertype foreign key? 2) in case of user includes list of usertype (may not conceptually true want use example), s...

sqlalchemy - Authorization error: migrating db for Google cloud SQL -

i've been trying make db using google cloud sql, got error when migrating db. python manager.py db init works well: folder named migrations made. however, python manager.py db migrate produces error: file "/usr/local/google_appengine/google/storage/speckle/python/api/rdbms.py", line 946, in makerequest raise _todbapiexception(response.sql_exception) sqlalchemy.exc.internalerror: (internalerror) (0, u'end user google account not authorized.') none none it looks kind of authorization errors. how should solve it? former authentication information saved in file, '.googlesql_oauth2.dat', if had been authorized different id. in case, have remove file before authentication process performed. mac: ~/.googlesql_oauth2.dat windows: %userprofile%\.googlesql_oauth2.dat ref: http://jhlim.kaist.ac.kr/?p=182

What, if anything, do you need to add to a dependent type system to get a module system? -

dependent type systems seem support of uses of ml module system. out of module system not out of dependent records? module ~ record signature ~ record type functor ~ function on records module abstract type component ~ dependent record type field i'm interested in how works module system, , if , how integrate features such applicative functors , mixins.

javascript - get an array to print on two lines but its going on one -

i trying teach myself html n javascript dont think i'm doing badly trying array print on 2 lines going on 1 below. my javascript looks this: var abc = function(foo, bar) { this.foo=foo; this.bar=bar; } var def = new abc("foo", ["foo", "bar"]); var ghj = new abc("bar", "foo"); var klm = [def, ghj]; for(var = 0; < klm.length; i++) { var testpara = document.createelement("p"); var testnode = document.createtextnode(klm[i].foo); testpara.appendchild(testnode); document.getelementbyid(foobar).appendchild(testpara); var testpara1 = document.createelement("p"); var testnode1 = document.createtextnode(klm[i].foo); testpara.appendchild(testnode); document.getelementbyid(foobar).appendchild(testpara1); } my html this: <section id="foobar"></section> what want print out on page is foo foo bar bar foo but getting is: foo foo,bar bar ...

sql server - Filtering Query with NOT EXISTS -

i attempting query database using sql server in visual studio. database in question contains payment information, identifying transactions , resulting software licenses via orderid , license id. ocassionally, these licenses revoked due misuse. right now, i'm attempting run query returns customers based upon this: select [order].lastname, [order].firstname, [order].companyorganization, [order].emailaddress, [order].country, [license].licenseid, [license].instancecount [order], [license] [license].orderid = [order].orderid , [order].status = 1 , not exists (select licenseid [licenserevocation]) order [license].instancecount desc; the query returns no results, , know it's because of "not exists" portion. however, i'm not sure why. can clear how "exists" works , how implement query? you need define condition on check values if there exist or not, also use on clause syntax joins. select [order].last...

Rails 4 - ActionMailer Send Shipping Confirmation Email -

i'm building marketplace app sellers can list items sell. i've set actionmailer send out order confirmation email triggered on order.save . i'm trying set shipping confirmation email, triggered when seller clicks on button indicate item has been shipped. i'm getting stuck on data being passed through actionmailer. undefined method 'buyer' error on @order.buyer.email in mailer method below. how pass buyer info mailer? i'd pass listing data mailer can use listing details in email content. model info: have user model, listing model , order model. order model has buyer_id column foreign key user model , listing_id foriegn key listing model. users email stored in user model. here code: #route 'shipconf' => "orders#shipconf" #order_controller def shipconf autonotifier.shipconf_email(@order).deliver end #autonotifier.rb def shipconf_email(order) @order = order mail(to: @order.buyer.email, bcc: "ashfaaqmoosa@gmail...

ios - Converting Parse Signup and Login Tutorial to Swift from Obj-C -

so have been searching few days solution this, trying use parse signup , login tutorial in swift project. problem don't have swift version of tutorial , running error can't fix. in project, in objective-c .h header file specify protocol defaultsettingsviewcontroller: uiviewcontroller <pfloginviewcontrollerdelegate,pfsignupviewcontrollerdelegate> and have tried many different ways implement keep getting errors 'cannot specify non-generic type' when try , call way in class declaration. has converted tutorial or able problem? in order extend superclass, while implementing/adhering number of protocols, list them (comma-separated), starting superclass: class defaultsettingsviewcontroller: uiviewcontroller, pfloginviewcontrollerdelegate, pfsignupviewcontrollerdelegate { ... }

Force split action bar on Android for large screen? -

is there way force action bar split on large screens? i way ui looks split action bar. can use uioptions="splitactionbarwhennarrow" small screens. want way screens. http://developer.android.com/guide/topics/ui/actionbar.html

what's the difference between ring and polygon in boost geometry? -

i'm new boost geometry , confused ring , polygon. in documentation, there's no figure showing ring, , polygon. can draw figure explaining difference between 2 concepts? thanks in advance. in boost.geometry polygon defined areal geometry containing exterior ring , number of interior rings (holes). ring represents 1 of polygon's rings. it's different ogc linearring because it's areal geometry. when used alone can seen polygon without holes.

xml - Xpath test with namespace -

in following example 1 access value vdd units of ds2438 can use following syntax: (//*[local-name() = 'vdd'])[2] find 5.550000 and (//*[local-name() = 'vdd'])[1] find 4.280000 . each <owd_ds2438> linked physical captor, each 1 of identified unique id <romid> . position in xml file can change. question : how can find same value in 2 following examples specific <romid> using xpath? example 1: <?xml version="1.0" encoding="utf-8"?> <devices-detail-response xmlns="http://www.embeddeddatasystems.com/schema/owserver" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <devicename>owserver_v2-enet</devicename> <hostname>edsowserver2</hostname> <macaddress>00:04:a3:f8:62:7b</macaddress> <datetime>2014-09-06 01:02:39</datetime> <owd_ds2438 description="smart battery monitor"> <name>ds243...

sockets - how to send/inject packet into local network interface (linux) -

i working on c program on linux (kernel 2.6.18). need send/inject ip packets (e.g., on socket) in linux systems, make same linux "think" these packets incoming host. creat datalink socket , use faked source mac/ip packets sent on socket. destination mac/ip set ones in local linux. however, whether send these packets in user-space program or in kernel module, local linux doesn't think these packets coming outside. example, if create datalink socket send icmp request destined local linux, expect local linux think icmp request coming outside, , respond icmp reply, local linux not so. (however, same program can send faked icmp request host, , host respond icmp reply.) i did research on topic online, , seems related solution suggest using tap. this virtualbox article says: ... tap no longer necessary on linux bridged networking, ... i interested know how possible. thanks.

android - Change DateFormat depending on Days passsed -

essentially have string contains files last modified date. i'm using: date lastmoddate = new date(file.lastmodified()); simpledateformat formatter = new simpledateformat("k:mm a"); string formatteddatestring = formatter.format(lastmoddate); the end result 6:12 am. want each time period of time passed, dateformat must change. e.g. after 1 day has gone by, last modified date = ("format1"); after week has gone by, last modified date = ("format2"); after 2 weeks have gone by, last modified date = ("format3"); does make sense? if please able show me how it's done. example native messaging app. when message created, show it's time after days gone format changes date created month etc... i'm trying that. calculate difference in time between last modified date , now: long duration = lastmoddate.gettimeinmillis() - current.gettimeinmillis(); long sec = timeunit.milliseconds.toseconds(duration); boolean infut...

java - Why is my count that is being returned a wrong value? -

public static int countneighbors(boolean[][] bb, int r, int c) { int countalive = 0; (int = r -1;i<=r+1; i++) { (int j = c -1; j<c+1;j++) { if (bb[i][j]) { countalive++; } } } return countalive; } matrix being read. oooooooo o###oooo o####o#o ooo##o#o o#o#o##o oooooooo i noticed wrong printed out portion of code. when ran specifications countneighbors(mynewmatrix,1,1) i returned value of 2, when should in face 3. it counting number of tiles true(#) around it. this "game of life" assignment. there 3 neighbors of (1,1) @ (1,2), (2,1), , (2,2). code wrong on 2 accounts: you counting cell (1,1). makes count 1 high. introduce if avoid counting (r,c) location itself. you stopping in j for loop, before gets c + 1 . makes count 2 low (missing 2 matches). change condition j<=c+1 , consistent i for loop condition. the combined effects of 2 errors (+1 , -2)...

c# - Windows Phone - Decode ASCII in string -

i have ascii encoding characters in string. this: %7b%22video%22%3a%7b%22jsoninfo%22%3a%7b%22id%22%3a212096%2c%22title how can decode "normal" string? i've tried find answer find solutions byte[] of ascii characters , so. have idea can replace characters starts % character represents think there better aproach. , 1 more thing, solution must works windows phone. thanks use httputility.urldecode(). example, string have given, result "{"video":{"jsoninfo":{"id":212096,"title"

python - Cartopy subplot ticks & axes box line formatting -

i'm using cartopy plot several areas of different sizes in different subplot arrangements (1x2, 3x4 etc.), makes quite difficult find consistent layout parameters. 1 issue longitude tick labels overlapping small areas. there way rotate them? i'm creating grid , ticks follows: gridlines = map.gridlines(crs=crs, draw_labels=true, linewidth=linewidth, color='black', alpha=1.0, linestyle=':', zorder=13) the other issue downscaling geoaxes in subplot arrangement, bounding box' line thickness appears wide. there way set explicitely? here's command i'm using add each geoaxes subplot: map = fig.add_subplot(nrows, ncols, 1 + nth_col + (ncols * nth_row), projection=ccrs.mercator()) unfortunately, don't think there control provided either of these. regarding rotated ticks: care can add axis ticks, , rotate usual "axes.set_ticklabels(... rotation=x)". gridline labels not ticks, , can't -- can control position , formatting...

Adding a cookie to an existing Javascript external CSS file swap -

i created function swap css files, works until comes reloading page or going page on website. figured while might able away not adding cookie, might clients close site , return later without having swap 'site theme' of choice. here's existing function: function changecss(cssfile, csslinkindex) { var oldlink = document.getelementsbytagname("link").item(csslinkindex); var newlink = document.createelement("link"); newlink.setattribute("rel", "stylesheet"); newlink.setattribute("type", "text/css"); newlink.setattribute("href", cssfile); document.getelementsbytagname("head").item(0).replacechild(newlink, oldlink); } so, can cookie use existing newlink variable , attributes, or need create variable in 'set cookie' function determine newlink variable? i wouldn't swap css, instead make "base theme" same users , apply "skin" on ...

Limit number of records in Dynamics CRM 2013 online -

i want limit number of records can added specific entity (custom entity ) in crm 2013 online. trying create custom entity such 4 (for example) records can added it. once limit exceeded must no allow open form add record. you need use synchronous plugin. inside plugin check how many records there custom entity, if count reached limit throw invalidpluginexecutionexception advise user limit , stop creation of record.

sql - sonata admin bundle for an entity with keywords columns -

i used sonata admin bundle generate office entity have 2 columns sql keywords : from , to , forms , entities generated , works fine except adding new entity cos sql generated cannot accept from , to syntax in insert sql. is there way avoid problem without changing columns names ? here mapping /** * @var \datetime * * @orm\column(name="`from`", type="datetime", nullable=false) */ private $from; /** * @var \datetime * * @orm\column(name="`to`", type="datetime", nullable=false) */ private $to; and here snippet code configureformfields method ->add('from', 'datetime', array('label' => 'du')) ->add('to', 'datetime', array('label' => 'au')) the error : an exception occurred while executing 'insert event (titre, ville, description, from, to, lat, lng, adresse, total, votes, isactive, refsouscategorie) values (?, ?, ?, ?, ?, ?, ...

ruby - All possible products -

i'm trying find possible product of 2 3-digit numbers. when work small ranges, i'm able output in short amount of time when ranges big, seems take long time. there way to shorten time result? the problem i'm working on is: "a palindromic number reads same both ways. largest palindrome made product of 2 2-digit numbers 9009 = 91 × 99. find largest palindrome made product of 2 3-digit numbers." a = [] x in 100..999 y in 100..999 num = (x * y) unless a.include? num a.push num end end end p looking @ code quick optimization can make use set rather array store computed products. since a array, a.include?(num) have iterate through entire list of elements before returning true / false. if a set, a.include?(num) return in sub linear time. example: require 'set' = set.new x in 100..999 y in 100..999 num = (x * y) unless a.include? num a.add(num) ...

php - How to insert Laravel Project into Apache Tomcat servelet? -

i new web development , stuck on how insert project apache tomcat. before created simple website , inserted code web apps folder , routed url location. tried same thing laravel , routed public/index.php , shows file index.php doesn't pull site. apologies if i've misunderstood question -- words makes sense order you've put them in not. apache tomcat running java applications. laravel php framework. php web applications work using apache web server, or fast cgi implementation in other web server light nginx. have nothing tomcat. setup apache treat laravel public folder document root, , configure apache sue mod_rewrite , .htaccess files. that's basic laravel (and php) setup.

android - Vimeo iframe in webview -

how possible view video vimeo embed code in webview in android? hear audio video stays black. wb.getsettings().setjavascriptenabled(true); wb.setwebviewclient(new webviewclient()); wb.setwebchromeclient(new webchromeclient()); wb.loaddatawithbaseurl(wb.geturl(), "<iframe src=\"http://player.vimeo.com/video/**********?title=0&amp;byline=0&amp;portrait=0\" width=\"500\" height=\"281\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>", "text/html", "utf-8", null); way late party here, didnt use did , works me. webview.loadurl("http://player.vimeo.com/video/" +"insert video id here"+ "?player_id=player&autoplay=1&title=0&byline=0&portrait=0&api=1&maxheight=680&maxwi...

c# - How stop string.Contains() picking out a word that is within another word. Better explanation below -

i using speech recognition in program , make easier writing out every possible combination of words execute command, using .contains function pick out keywords. example... private void speechhypothesized(object sender, speechhypothesizedeventargs e) { string speech = e.result.text; if (speech.contains("next") && speech.contains("date")) { messagebox.show(speech + "\nthe date 11th"); } else if (speech.contains("date")) { messagebox.show(speech + "\nthe date 10th"); } } as can see, if speech recognized, display text box saying hypothesized , date. however, when @ speech displayed in text box, things "next update". so, program looking 1 word within i.e. "date" inside of "update". not want happen otherwise won't accurate, how can make .contains method pick out word on it's own, , not inside other words? thanks alternative solution, sp...

android - Programatically added Views not behaving -

i've created many custom views , trying add them fragment. added can't seem them go want. there should 2 columns , 3 rows ends 1 column of custom views stacked on top of 1 another. here code add views , set layout params fragment layout: relativelayout fm = (relativelayout) view.findviewbyid(r.id.fragmentlayout); relativelayout.layoutparams params = new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); params.addrule(relativelayout.align_parent_left, relativelayout.true); customimages cs = new customimages(getactivity()); cs.setid(r.id.one); cs.setlayoutparams(params); params = new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); params.addrule(relativelayout.align_parent_right, relativelayout.true); params.addrule(relativelayout.right_of, cs.getid()); customimages2 cs2 = new customimages2(getactivity()); ...

matlab - Rearranging symbolic expression -

i have function in mupad in terms of various variables z = f(x,y,...) . rearrange equation express x in terms of z . have not found suitable command so. use solve . example: syms x y z x = solve('z = x^3 + y^3 - 1', x);

c++ - What possible choices do I have to implement a high-performing low-level Linux TCP/IP Socket client for 5 concurrent connections? -

i have scenario i'm trying research (and utilise) best available c++ library fulfill following requirements: develop low-level linux based tcp/ip socket client application, that, a) can connect 3rd party server via 4-5 sockets b) poll every 200 milli seconds (with small piece of data) - via 5 sockets c) and. based on reply gets, occassionally send xml-formatted request(a rather important one). the important factor in design performance , latency + minimal development time(for me) i have (past) background doing these things in c(and c++), have done research , come short=list of possible ready-made socket libraries use. a) boost::asio b) http://www.alhem.net/sockets/index.html - c++ sockets library c) other possible "small scale" , minimally functional libraries or, design , write self , using bsd sockets , multi-threading options(which original plan) anyone ideas on best , time-saving route take ?? thanks folks. i believe poco ...

Calling Control-M from Fitnesse -

need regarding calling control-m fitnesse. can use ctmorder that? able execute .sh, .com , db scripts straight forward. appreciated. thank you!!! you can use command line tools control-m (ctmorder, ctmpsm, ...). google "control-m utility_guide.pdf". if use command line tools call them remote via ssh library https://github.com/hierynomus/sshj or http://www.jcraft.com/jsch (we use sshj). there java api , web service api, part of "business process integration". see https://communities.bmc.com/message/482038#482038 , https://communities.bmc.com/community/bmcdn/enterprise_scheduling_workload_automation/blog/2013/11/25/my-control-m-tech-tips-volume-1 more information.

binaryfiles - C++ why does the binary file read skips to the end -

i have 178 mb fortran unformatted binary file reading c++ , storing in eigen matrix. have read file fortran , matlab confirm understand values in file. first record in file size of matrix. after each record begins 3 integers. these integers contain column , row data begins , number of numbers read. followed single precision numbers themselves. here code: std::ifstream infile("msfile", std::ios::in | std::ios::binary); if(!infile) { std::cout << "mode shape .f12 file (msfile) not found\n"; exit(1); } int r_size1; // size of each record read int r_size2; // size after reading comparison int cols, rows; infile.read(reinterpret_cast<char *> (&r_size1), 4); infile.read(reinterpret_cast<char *> (&cols), 4); infile.read(reinterpret_cast<char *> (&rows), 4); infile.read(reinterpret_cast<char *> (&r_size2), 4); if (r_size1 != r_size2) { std::cout << "error reading msfile\n"; exit(1)...