Posts

Showing posts from July, 2014

Why does Rails start GETs only on page reload? -

in console, when loading page, usual list of executed commands so: started "/employees" ::1 @ 2015-07-14 10:36:25 -0400 processing employeescontroller#index html employee load (0.2ms) select "employees".* "employees" rendered employees/index.html.erb within layouts/application (7.7ms) rendered layouts/_shim.html.erb (0.1ms) rendered layouts/_header.html.erb (0.9ms) rendered layouts/_footer.html.erb (0.1ms) completed 200 ok in 438ms (views: 433.9ms | activerecord: 2.4ms) but when reload page, same previous block, huge list of started get commands so: ... started "/assets/static_pages.self-877aef30ae1b040ab8a3aba4e3e309a11d7f2612f44dde450b5c157aa5f95c05.js?body=1" ::1 @ 2015-07-14 10:38:32 -0400 started "/assets/sessions.self-877aef30ae1b040ab8a3aba4e3e309a11d7f2612f44dde450b5c157aa5f95c05.js?body=1" ::1 @ 2015-07-14 10:38:32 -0400 started "/assets/users.self-877aef30ae1b040ab8a3aba4e3e309a11d7f2612f44dde45...

javascript - Add Cookie in Bootstrap collapsible sidebar navigation -

my html code: <div class="collapse navbar-collapse" id="bs-sidebar-navbar-collapse-1"> <div id="sidebar-wrapper"> <ul class="sidebar-nav navbar-nav" id="sidebar"> <li class="dropdown"><a href="#" class="dropdown-toggle brd-top" data-toggle="dropdown" aria-expanded="false" title="eai system">eai system<i class="fa fa-desktop sub_icon"></i></a> <ul class="dropdown-menu foranimate relative" role="menu"> <li><a href="#" title="service catalog">service catalog<i class="fa fa-cogs sub_icon"></i></a></li> <li><a href="#" title="environment">environment<i class="fa fa-cloud sub_icon"></i>...

How to connect specific attributes over polar coordinates in R? -

Image
i have highlighted specific activities (feeding,resting , sleeping) dataset in plot. want connect these highlighted points in sequence on polar coordinates. here's dataset: activity latitude longitude feeding 21.09542 71.06014 resting 21.09564 71.06064 sleeping 21.09619 71.06128 walking 21.09636 71.06242 walking 21.09667 71.06564 resting 21.09483 71.06619 can me out in this? ok starting scratch: original answerwas bulky , inflexible. just add following paths each activity without filtering. + geom_path(aes(colour=activity,x=latitude,y=longitude)) if want plot selected activities: + geom_path(data=data[data$activity %in% c("sleeping","resting"),],aes(colour=activity,x=latitude,y=longitude)) the selected activities listed in c(...) vector each name quoted. update: op clarified wants connect stationary point, achieved running following: + geom_path(data=data[data$activity!="walking",],colour="...

c# - How to access ObservableCollection nested in view model -

i have simple single window wpf app using mvvm. xaml binded mainviewmodel.cs class, contains observablecollection sites. sitemodel class has property named owners, contains second observablecollection companies. i need bind companies property combobox in xaml. combobox nested in datagrid. situation described below. <datagrid name="uxsitegrid" dockpanel.dock="top" itemssource="{binding sites, source={staticresource viewmodel}}" autogeneratecolumns="false" margin="5,5,5,0" canuseraddrows="false" canuserdeleterows="true" canuserresizerows="false" canuserreordercolumns="false"> <datagrid.columns> <datagridtextcolumn binding="{binding name}" header="name"/> <datagridtextcolumn binding="{binding vseid}" header="vse id"/> <datagridtextcolumn binding="{binding imo}...

web - How to fetch multiple column from mysql using go lang -

i trying fetch multiple columns in mysql database using go language. modify script, , work fetching 1 column, , printing using http print function. however, when fetches 2 things script no longer works. don't have idea need fix it. know sql fine have tested out in mysql terminal, , has given me expected result wanted. conn, err := sql.open("mysql", "user:password@tcp(localhost:3306)/database") statement, err := conn.prepare("select first,second table") rows, err := statement.query() rows.next() { var first string rows.scan(&first) var second string rows.scan(&second) fmt.fprintf(w, "title of first :"+first+"the second is"+second) } conn.close() you using wrong variable names assume that's "typo" in sample code. then correct syntax is: var first, second string rows.scan(&first, &second) see this on scan(dest ...interface{}) mean...

linux - C++ libcurl set proxy from a configuration file -

i use libcurl make http tests , managed configure proxy settings code: curl_easy_setopt(curl, curlopt_proxy, _proxy); curl_easy_setopt(curl, curlopt_proxyuserpwd, userpass); i testing on linux , want know if can use configuration file configure proxy settings.

solving binary linear equation in matlab -

consider binary linear equation of form x*a = b . want solve x , efficiency way avoiding using x = b*inv(a) , instead using x= b/a .but command results not in binary form. tried command x = mod(b/a ,2) but still result not in binary. how fix this? example ` x = 1 0 1 1 0 0 0 1 1 0` and matrix `0 1 0 1 0 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 1 1 1 0 1 1 0 1 0 0 0 1 1 0 0 0 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 0 0 1 1 0 0` full rank. then >> b = mod (x*a,2) b = 1 0 1 1 1 0...

How to or can I start up virtual host on vmware esxi directly, not from vsphere client? -

now, have installed desktop operating system(as windows 8.1) on vmware esxi, can start directly on vmware esxi, not vsphere client? thanks! of course, can start vm via esxi directly. first, must access ssh esxi host. and start vm vm-cli. refer vm cli document in vmware.com.

javascript - None of the jstree plugins are functioning -

this frustrating problem, 1 cannot seem find documentation for. i'm relatively new jquery (although grasp on developing), , new jstree plugin. the problem cannot of plugins work. attracted because of drag , drop, context menu, , checkbox functionality, aren't happening. not getting errors, i'm getting no check boxes , default chrome context menu. , can't drag , drop anything. the jstree populates using ajax: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>jstree test</title> <link rel="stylesheet" href="styles/style.min.css" /> <script src="scripts/jquery-2.1.4.min.js"></script> <script src="scripts/jstree.min.js"></script> <script> $(document).ready(function () { $('#jstreetest').jstree({ 'core': { 'check_callback' : true, 'data':...

rust - Matching with less boilerplate -

i have nested structures of enums , ie. enum x has variant contains enum y etc. there way access fields eg x.y.z runtime error if x.y.z doesn't exist (eg, x of wrong variant). furthermore reasonably moral thing do, or there better alternative, without match statements everywhere? efficiency not important, though make cheap possible. it not possible access nested enums dots syntax, can use if let : pub enum x { a(y), b(z) } pub enum y { c, d(u32) } pub enum z { e } fn main() { let x = x::a(y::d(12)); if let x::a(y::d(n)) = x { println!("got it: {}", n); } else { println!("nope"); } } (try here ) if let makes code arguably more concise match . naturally, efficient match .

indexing - How does a data merge between indexed tables work? -

recently had start working sas indexed tables. problem trying sort indexed table, not it, unless deleted index. understood problem, because when sorting indexed table rid index changes , sas cannot locate anymore row. but cannot understand why merge works perfectly, keeping index , updating it. in full outer join between 2 tables rows changed, sas it’s able keep index. thought possibilities when making merge, 2 sorted tables, when inserting row has add 1 rids bellow. know if this. sorry explanation, making myself clear not stronger gift. thanks time. try setting options msglevel = i; before running code - sas print diagnostic messages in log showing when , isn't using indexes, , when created or removed. if want more specific answer, please post specific code.

git - How can I see which branch contains a certain commit, when working with atlassian jira and stash -

we switched feature branch workflow git. our infrastructure based on atlassian tools jira, bamboo , stash. works pretty smooth , 3 tools share status. can create branch named jira ticket , trace complete workflow through jira , bamboo until released. but there seems 1 important missing feature: have situation jira ticket has plenty of subtasks or linked tickets. there no seperate branch referened tickets, commits go directly parent branch. lose traceability of subtasks; there seems no way in jira see in branch referenced ticket has been resolved. need know branch contains commits tickets. when have information, can deploy branch qs , present list of new features/fixes have been resolved in branch. do have similar problems or how solve this? i'm not sure follow question entirely, list branch(es) contains commit, git branch --contains <commit> .

objective c - Attaching a sheet the first time -

Image
i'm writing application needs read data off smartcard. due way smartcards work, operation take few seconds during time updates display it's read far, isn't going responsive yet until everything's read; so, avoid confusion, want show sheet spinner , text "reading data card..." user knows what's going on. in xib, i've created new window containing spinner , nstextfield. when try show sheet, following: [[nsoperationqueue mainqueue] addoperationwithblock:^{ [_spinner startanimation:self]; [nsapp beginsheet:_cardreadsheet modalforwindow:_window modaldelegate:self didendselector:@selector(endsheet:returncode:contextinfo:) contextinfo:nil]; }]; and later on, when state machine indicates we've finished reading, do: [[nsoperationqueue mainqueue] addoperationwithblock:^{ [nsapp endsheet:_cardreadsheet]; [_spinner stopanimation:self]; }]; there a - (void) endsheet:(nswindow*)sheet returncode:(nsinteger)returncode co...

shell - UNIX: redirect some commands with pipe -

i'm new unix. following command i'm executing. $ time ls | wget exampledomain.com > output.txt i command output time took retrieve information output.txt. command have creates output.txt it's blank document. thank you wget outputs stderr. use: wget exampledomain.com > out 2>&1 # or wget exampledomain.com 2>out # or wget exampledomain.com --output-file=log # or, redirect output both file , stdout wget exampledomain.com 2>&1 | tee log

silverlight - Catastrophic error during OOB update using CheckAndDownloadUpdateAsync() -

i'm in dead end error, may experienced similar , knows how resolve? the problem when calling checkanddownloadupdateasync() request server sent , server returns either 304 or 200 http code. in case of 200 silverlight runtime performs update of application. doesn't happen me. strange thing works on mac, not on windows. request get https://somedomain.com/some.xap http/1.1 if-modified-since: mon, 01 jun 2015 15:13:18 gmt user-agent: silverlight host: somedomain.com response http/1.1 200 ok content-type: application/octet-stream last-modified: tue, 14 jul 2015 13:02:36 gmt x-request-id: v-5daa5e84-2a36-11e5-bbce-22000ac00b9d x-ah-environment: preprod x-cache-hits: 2 x-age: 1989 expires: tue, 14 jul 2015 15:14:18 gmt cache-control: max-age=0, no-cache, no-store pragma: no-cache date: tue, 14 jul 2015 15:14:18 gmt transfer-encoding: chunked connection: keep-alive connection: transfer-encoding x-akamai-staging: essl sl runtime gets valid 200 ok response, throws catastro...

Custom hover-effect for WPF button with strange behaviour -

i have simple button containing image: <button x:name="helpbtn" width="25" style="{staticresource hoverbutton}" template="{staticresource hoverbuttontemplate}" click="onhelpbuttonclicked" tooltip="{x:static resx:language.helpbutton}" height="25" borderthickness="0" canvas.top="2" canvas.right="52" canvas.left="-77"> <image x:name="helpimg" source="resources/2_help.png" width="6" height="10" stretch="uniform"/> </button> then have contenttemplate: <controltemplate x:key="hoverbuttontemplate" targettype="{x:type button}"> <grid> <contentpresenter content="{templatebinding button.content}" /> <rectangle x:name="hoverrect2" fill="darkgreen" visibility="hidden" opacity="0...

R: reading in .csv file removes leading zeros -

i realize reading .csv file removes leading zeros, of files, maintains leading zeros without having explicitly set colclasses in read.csv. on other hand, what's confusing me in other cases, remove leading zeros. question is: in cases read.csv remove leading zeros? the read.csv , read.table , , related functions read in character strings, depending on arguments function (specifically colclasses , others) , options function try "simplify" columns. if enough of column looks numeric , have not told function otherwise, convert numeric column, drop leading 0's (and trailing 0's after decimal). if there in column not number not convert numeric , either keep character or convert factor, keeps leading 0's. function not @ entire column make decision, may obvious not being numeric may still converted. the safest approach (and quickest) specify colclasses r not need guess (and not need guess r going guess).

ember.js - Ember Dynamically Generated HTML -

i have requirement need add html after dom has been rendered. wondering if possible manipulate dom after creation , dynamically add html , specifying associated ember action. e.g. intension of want achieve: $('.add').on("click", function(e){ e.preventdefault(); += 1; var content = "<div class=\"item dodgerblue\"><h1>"+i+"</h1></div>"; var content + "{{action "owlitemclicked" titlemodel.id titlemodel.index titlemodel on="click" }}" owl.data('owlcarousel').additem(content); }); specifically want add item carousel: http://owlgraphic.com/owlcarousel/demos/manipulations.html i'm not sure triple-stash, includes content without escaping it, work {{action}}. in case, looks me you'd better off defining html within each block , letting ember handle content addition. {{#each model |titlemodel index|}} <div class=\"item dodgerbl...

jquery - Apply anchor tag to all the h3 tag under a class -

im trying find way add anchor tag h3 tag.the content dynamic in nature . i want add dynamic anchor tag h3 tags only <div class="class1"> <h2>main heading</h2> <h3>heading1</h3> <h1>some content1</h1> <h3>heading2</h3> <h1>some content2</h1> <h3>heading3</h3> <h1>some content3</h1> </div> i tried below jquery code creating nothing $("h3.class1").append('<h3>'); var al = $("h3.class1 >"); al.append('<a href="#"></a>'); $('div.class1 h3').each(function (){ $(this).wrap('<a />'); });

c# - Entity Framework Context.Set<T>().Local would not sync with Datagrid after calling LoadAsync -

entity framework local property observablecollection , can bind lets datagrid. items not update call loadasync, or update not reflect datagrid. consider following example: xaml <grid> <grid.rowdefinitions> <rowdefinition height="auto" /> <rowdefinition /> </grid.rowdefinitions> <stackpanel orientation="horizontal"> <button content="load" click="btnload_click"/> <button content="loadasync" click="btnloadasync_click"/> <button content="setdatasource" click="btnsetdatasource_click"/> </stackpanel> <datagrid name="grdtest" grid.row="1"/> </grid> code behind testcontext db = new testcontext(); public mainwindow() { initializecomponent(); } private void window_loaded(object sender, routedeventargs e) { grdtest.itemssource = db.suppliers.local;...

django - How to pass arguments to an already running python program? -

i'm using django framwork, , have pass new query python script. however, python program have read large data file, , takes 2 minutes load data. want load data once, , pass new query running python program, fast enough web users. unfortunately, have searched lot, still don't know how implement it. one method read communication file: oldid = -1 while true: f = open("communication","r") t = f.read() f.close() t = t.split("==") id = int(t[0]) query = t[1] if id > oldid: # query not handled yet stuff handle query ... oldid = id you write file looks so: id==query replace id , query wishes. count id +1 if push new query. use script that.

resharper - Don't replace for-each by LINQ query -

Image
resharper wants replace for-each linq queries. don't that, , don't want resharper suggesting it. how can disable this? i cannot find in resharper settings. i don't want // resharper disable loopcanbeconvertedtoquery around each for-each. i have newer version, resharper 9, here under resharper > settings > code inspection > inspection severity . think might there in version well. there long list of things can show improvements on. somewhere in there language usage opportunities has 2 settings loops , linq. in resharper 9 there possibility search settings above treeview on left or above list in inspection severity screen. type 'linq' there , show settings described above immediately.

forms - How do I get my image upload to work on rails? -

i have form saves image title, description , url uploads onto project. added upload option form , i'm confused how can save onto server , show after upload. - , isn't priority - there way assign upload url users can share? my form: (f.file_field picture i'm using upload image) <h1>add picture</h1> <%= link_to "back pictures", pictures_url %> <%= form_for @picture |f| %> <p> <%= f.label :artist %><br> <%= f.text_field :artist %> </p> <p> <%= f.label :title %><br> <%= f.text_field :title %> </p> <p> <%= f.file_field :picture %> </p> <p> <%= f.label :url %><br> <%= f.text_field :url %> </p> <p> <%= f.submit "save" %> </p> <% end %> </center> controller: class picturescontroller < applicationcontroller def index @pictures = ...

vim - Exit visual mode without delay -

in vim, when in visual mode, have press esc twice exit , turn off selection. after 1 press of esc have wait 2 seconds selection turn off. what can exit visual mode when typing esc ? executing following command helped me set timeoutlen=1000 ttimeoutlen=0 see: http://www.johnhawthorn.com/2012/09/vi-escape-delays/

c# - Build a list of options based on an array -

how go programmatic making list? need combinations string[] list = { "open", "completed","rescheduled", "canceled", "started", "customer notified", "do not move", "needs confirmation" }; this list first 15 there on 200+ combinations. open completed open, completed rescheduled open, rescheduled completed, rescheduled open, completed, rescheduled canceled open, canceled completed canceled open, completed, canceled rescheduled, canceled open, rescheduled, canceled completed, rescheduled, canceled open, completed, rescheduled, canceled don't use lists it. try use enum , attribute flags like: [flags] public enum status { open = 0x01, completed = 0x02, rescheduled = 0x04, canceled = 0x08, started = 0x10, customer_notified = 0x20, do_not_move = 0x40, needs_confirmation = 0x80 } then can set few statuses @ once field like var status = ...

javascript - Jquery ID selector when attribute name has a hash -

i'm running problem, our internal framework has system if have form & containing element name starts hash-tag when processing these elements later on. so have instance : <label width='auto' for='x_test' >test:</label> <input type="checkbox" name="#x_test#" id="x_test" value="1" /> now using jquery if want select input, instance hide it: $( "#x_test" ).hide(); this not work unless remove hashtags name of element. i'm doing select id i'm not sure why such issue. is known issue & there can do? we on jquery-1.3.2 thanks update thanks hints, helped me bit , did learn things them in end problem bad existing code else interfering trying do. we have wizard en in each step copies inputs page hidden dynamic form wizard. but copying id-attribute etc didn't respect rule of unique id's anymore. because of jquery / jquery ui , javascript behaving realy weir...

amazon web services - Can I limit the size of an object put into S3 via the JavaScript API? -

it possible use javascript apis upload objects s3 , possible have fine-grain authorization using iam policies. instance, see policy: { "version": "2012-10-17", "statement": [ { "action": [ "s3:putobject", "s3:putobjectacl" ], "resource": [ "arn:aws:s3:::your_bucket_name/*" ], "effect": "allow" }, ] } inspired tutorial allows put objects bucket your_bucket_name . not clear me whether possible limit number of objects , size of each objects 1 can upload. have checked list of contitions , didn't find useful on this. i think 3 questions: is possible use javascript apis upload objects s3? (yes) is possible have fine-grained authorization using iam policies? (yes) is possible limit number of objects , size of each object 1 can upload. (no, @ least not through kind of bucket pol...

Scala implicit conversion to a Java array not working -

i'm pretty new scala , i've hit first hurdle ... java.nio.file.paths has method: public static path get(string first, string ... more) this java code compiles (and runs): string[] tokens = new string[] { "/home", "toby", "mydir" }; path path = paths.get(tokens[0], arrays.copyofrange(tokens, 1, tokens.length -1)); however scala code not compile: import collection.javaconversions._ ... val tokens = array("/home", "toby", "mydir") val path = paths.get(tokens(0), tokens.tail) the error "type mismatch; found : array[string] required: string" what missing? thanks paths.get not want array second parameter, string... more varargs notation. try: val path = paths.get(tokens.head, tokens.tail: _*) // path: java.nio.file.path = /home/toby/mydir look @ this question more explanation on _* .

knockout.js - KnockoutJS: Checkbox Inside Click-Bound Anchor-Tag not Selectable -

i trying bind checked on checkbox input resides inside anchor tag which, itself, click bound. whilst aware may not entirely valid (interactive content may not descendant of anchor-tags), still work intended - if understand it. currently, outside click event handled , click never arrives @ checkbox. an example of trying achieve here: http://jsfiddle.net/fzmppu93/2/ having had through knockoutjs documentation, tried clickbubble: true on anchor-tag's click binding - no avail. the use case, if you're interested, unordered list containing links - each of these "links" contains information on tv show: title, actors, image, synopsis. show selectable, there 'quick-actions' mark seen, star it, , forth. is there way of making checkbox work inside anchor-tag? i have written custom binding handler similar "clickbubble", mines allows prevent propagation of event. here binding handler: ko.bindinghandlers.preventbubble = { ...

javascript - Opening up my side drawer causes a header with fixed position to move when the page is scrolled -

here's fiddle i have 2 div elements in body , #drawer , #content . inside div #content header position: fixed . when top left menu button in header clicked, main #content div translated using css3 transforms , transition simulate "opened" state drawer. it's when problem occurs. scrolling #content div while #drawer open, or scrolling div little , opening #drawer causes header move top of page, though it's fixed. not precisely sure problem after little while staring @ it, love few more experienced eyes on i'm trying done possible. would appreciate guys can offer me. in advance :) i've had problems when using transform , position:fixed together. in fiddle used transition instead of transform . modified jquery touch, think you'll idea. the key this: #content.open, #content.open header{ left: 70%; } #content, header { transition: 300ms left; -webkit-transition: 300ms left; -moz-transition: 300ms left;...

android - Parse exception: com.parse.ParseRequest$ParseRequestException: invalid session token -

on internship must work parse. i'm made android app in wich using parse cloud. create sign button , if user push button, new account should create. after pushing button,i have exception: com.parse.parserequest$parserequestexception: invalid session token i don't know mistake.android studio don't show errors , using instruction . app work fine yesterday morning , first app created 1 week ago have same problem. have internet connection , restarted tablet device. my source code: parseuser user = new parseuser(); user.setusername(username); // string username = "ivan" user.setpassword(password); // string password = "divan" user.enablerevocablesessioninbackground(); user.signupinbackground(new signupcallback() { public void done(parseexception e) { if (e == null) { toast.maketext(getapplicationcontext(), "successfully signed up, please log in.", toast.length_long).show(); ...

html - Pseudo Element 100% width is not taking container size -

i'm using pseudo element (before) put border on top of container inside 2 column layout. want border on top of 1 container. shouldn't width of pseudo element (being set 100%) make width of container it's inside? #singlewrapper { margin: auto; max-width: 1100px; } .single #singlewrapper { margin: auto; max-width: 1100px; /*box-shadow: inset 0 650px rgba(0,0,0,0.30);*/ position: relative; overflow: hidden; } #leftcolumn .content-area { padding-right: 310px; width: 100%; } .articlewrapper:before { content: ""; position: absolute; top: 0; left: 0; background: #009cff; background: linear-gradient(to right, #1d0027, #935cd2, #1d0027); height: 2px; width: 100%; } #leftcolumn .content-area #main { background: #000; background: rgba(0, 0, 0, 0.30); padding-left: 20px; padding-right: 20px; } #singlewrapper .contentholder { margin-right: -310px; width: 100%; float: left; po...

nginx as a docker upstream proxy with maps -

trying use docker setup bunch of apps behind proxy using nginx maps option ease of configuration large number of backend applications. the trouble i'm running container won't resolve addresses i've given links. i've tried using dnsmasq troublesome, , didn't give me working resolution. any suggestions? nginx.conf: events { worker_connections 1024; } http { map $hostname $destination { hostnames; default host1:81; host1.test.local host1:81; host2.test.local host2:82; host3.test.local host3:83; } server { location / { proxy_pass http://$destination/; } } } docker-compose.yml: webproxy: build: nginx:latest ports: - "80:80" volumes: - nginx.conf:/etc/nginx/nginx.conf links: - "host1:host1" - "host2:host2" - "host3:host3" host1: image: nginx:latest ports: - "81:80" volumes: - host1/index.html:/usr/share/...

regex - Need fresh eyes on Python assertRegexpMatches -

my regex using : ur"^[\s\s]*ticket price (including £0.50 booking fees)[\s\s]£5.50[\s\s]*$" and string comparing : "ticket price (including £0.50 booking fees) £5.50" i have been messing around on regex101.com no avail. logic seems right me, not matching (i trying use assertregexpmatches() test code). or tips appreciated. you need escape paranthesis , dots (decimal). in regex (..) called capturing group used capture chars. match literal ( , ) brackets, must escape them in regex. ur"^[\s\s]*ticket price \(including £0\.50 booking fees\)[\s\s]£5\.50[\s\s]*$" demo

powershell - Extract string using regex trouble with ending -

attempting extract status value below string ($data) using regex. trouble specifying end of value. $data = "<?xml version="1.0" encoding="utf-8"?><bi:element xml:bi="http://www.bi.com/1.0.0" status="www.google.com/path/file.ext" version="2.0" xml:pa="http://www.pa.com/1.1.1" ...> // attempt #1 $data -match "status='"(.*)'"" // $matches[1] contains www.google.com/path/file.ext" version="2.0" xml:pa="http://www.pa.com/1.1.1" ...> // attempt #2 $data -match "status='"(.*)'" " // $matches[1] contains www.google.com/path/file.ext" version="2.0" xml:pa="http://www.pa.com/1.1.1" ...> // attempt #3 $data -match "status='"(.*)'" v" // $matches[1] contains www.google.com/path/file.ext why not first attempt work? not want use third , working example because relies on order...

cassandra - Connection error: Request did not complete within rpc_timeout when doing cqlsh -

i have installed cassandra v2.0.16 on centos release 6.6 (final). but when try cqlsh on it, gives following error, connection error: request did not complete within rpc_timeout on local machine, running ubuntu 12.04, works fine, on production machine (user managed vps running cent os) not working properly. i went /var/log/cassandra/system.log error [main] 2015-07-02 04:42:12,973 cassandradaemon.java (line 571) exception encountered during startup org.jboss.netty.channel.channelexception: failed bind to: localhost/127.0.0.1:9042 @ org.jboss.netty.bootstrap.serverbootstrap.bind(serverbootstrap.java:272) @ org.apache.cassandra.transport.server.run(server.java:159) @ org.apache.cassandra.transport.server.start(server.java:110) @ org.apache.cassandra.service.cassandradaemon.start(cassandradaemon.java:489) @ org.apache.cassandra.service.cassandradaemon.activate(cassandradaemon.java:567) @ org.apache.cassandra.service.cassandradaemon.main(cassandradaemon....

java - How to make DAO thread safe JPA? -

i new jpa , java. understood how entitymanager , emf works littel bit. have jpautill entitymanager, using threadlocal variable, makes entitymanager thread safe. have dao in persisting new users when having 10 thousand thread accesses simultaneously. i see following exception: javax.persistence.persistenceexception: org.hibernate.sessionexception: session closed! @ org.hibernate.ejb.abstractentitymanagerimpl.throwpersistenceexception(abstractentitymanagerimpl.java:614) here dao code try{ entitymanager = jpautil.getentitymanager(); user.setarea(getarea()); user.setcity(getcity()); user.setpassword("xxxxx"); user.setemail_id(getemail_id()); user.setmobile_num(tempmobile_num); user.setfirst_name(getfirst_name()); user.setsession_id("0"); user.setemail_verification_status("not verified"); user.setbalance(new bigdecimal(0.00)); if (!entitymanager.gettransaction().isactive()){ entitymanager.g...

javascript - jQuery - Set background color from multiple buttons' inner text -

i'm trying change background color multiple buttons based of inner text using jquery. easy enough straight javascript using loop can't figure out how same thing in jquery. here's i'm at: $('button').click(function(){ $(body).css('background-color', "$('button').text()"); }); you setting string, not value of text. , want use this reference element clicked. using $("button") return text of first button. $('button').click(function(){ $(body).css('background-color', $(this).text()); });

mongodb - Emberjs not returning all records -

i using sane stack, consists of sails , emberjs. using mongodb datastore. when following on sailsjs side of things; parent.find(req.query.id).populate('children').exec(function(err, parent){ console.log('children.length = ' + parent[0].children.length); }); i 212 but when following on emberjs side of things; parent.get('children').then(function(children){ console.log('children.length = ' + children.length); }); i 30. as matter of fact, once number of records goes on 30, not matter ember return 30 records. is there way rest of records? need records can sort , calculate things. not displaying them. any appreciated. explanation that's because default response limit in sails 30 records. it's there if have 10k or million rows don't make normal request , accidentally dump out entire database client , crash everything. this documented here: http://sailsjs.org/documentation/reference/configuration/sails-co...

playframework - "IO error while decoding Routes.scala with UTF-8" when compiling Play Framework project -

when compile project, console show: [error] io error while decoding routes.scala utf-8,please try specifying 1 using -encoding option" what might reason error? you might have smart quotes or other microsoft specific encoded characters in routes file. can happen if copy , paste microsoft word document or web file. “ or ” or apostrophe characters curl 1 way or another. replace them in programmer's text editor regular straight quotes , single quotes.

utf 8 - Properly escape characters in input value in JavaScript -

my goal display sarah o'connor in input value. need escape sarah o&#39; connor show correct utf-8 html character. i'v seen answers suggest replacing each individual special character. surely that's not correct way there hundreds of possible characters in peoples names around world. i'v tried javascripts escape() / unescape() , encodeuri() / decodeuri() functions, work html text not input values. please see jsfiddle here: http://jsfiddle.net/ghhza/ var div = $("#my-div"); var input = $("input"); var str = "sarah o&#39;connor"; div.html(str); //--> sarah o'connor input.val(str); //--> sarah o&#39;connor you can create element put html, can formatted result .text() , eg: input.val($("<div>", {html:"sarah o&#39;connor"}).text())

ember.js - ember-cli: split application into separate directories -

my ember application has few distinct components. there lot of code, want sources organized separate directories. let's have directory structure: [app] - [controllers] - [models] - [routes] - [views] [dashboard] - [controllers] - [models] - [routes] - [views] [admin] - [controllers] - [models] - [routes] - [views] i want these directories merged app @ build-time. don't need support conflicting names, e.g. app/controllers/foo.js + dashboard/controllers/foo.js . my goal basic level of organization. don't want prefix /dashboard/ on app, , don't want slow down build. similar question: multiple "apps" ember-cli understand ember-cli folks working on , it's not ready yet. any other ideas on how organize app more welcome. i tried this, files in dashboard being ignored. // brocfile.js var mergetrees = require('broccoli-merge-trees'); var app = new emberapp(); var dashboard = new emberapp({ trees: { ...

javascript - Loading JSON arrays in Jquery as tooltips -

i need load descriptions of json variable script tooltips. far have achieved doing it, have 2 problems : when hover in 1 sentence of table, tooltips 4 sentences appears. seems can't return table sentences normal when hover ends. html - table : <table id="mytable"> <tr class="head"> <th></th> <th data-city="ny">new york</th> <th data-city="il">chicago</th> <th data-city="ca">san francisco</th> </tr> <tr> <th id="one"><a href="#" class="tooltip" rel="0">a poetic perspective</a></th> <td>sat, 4 feb 2012<br />11am - 2pm</td> <td>sat, 3 mar 2012<br />11am - 2pm</td> <td>sat, 17 mar 2012...

progressive web apps - How is the Push API's push service URL set? -

the push api defines push service as a system allows application servers send push messages webapp. a subscription service created via call serviceworkerregistration .pushmanager.subscribe() without parameters. how url push service configured? have expected .subscribe() take url parameter service. the push api's sister spec, generic event delivery using http push , says: push service: resource used create push message subscriptions (see section 3). url push service configured user agents. but not specify how configuration take place. this quote the second document cite answers question: this document intentionally not describe how push service discovered. discovery of push services left future efforts, if turns out necessary @ all. user agents expected configured url push service. for browsers shipping built-in knowledge of specific push service, such gcm in case of chrome. mentioned in push notifications on open web article ...

visual studio - Creating debug build FFMpeg static libraries with Windows compiler -

we using ffmpeg static libraries compiled via --toolchain=msvc switch vs2010 compiler linked static runtime (-mt). these libraries work fine linked libcmt.lib. we compile debug build of these libraries (i.e. linking against libcmtd.lib). in configure call added: ./configure --toolchain=msvc --enable-debug --arch=x86 --extra-cflags=-mtd this result in calls cl.exe -mtd switch -mt switch , cause conflicts in linker stage. what missing? i managed solve using following configure switches: ./configure --toolchain=msvc --enable-debug --arch=x86 --extra-cflags="-mtd" extra-cxxflags="-mtd" --extra-ldflags="-nodefaultlib:libcmt"

jsp - how to load values in dropdown using jstl -

i searching way populate dropdown using jstl. need when page loading. tried code. not working. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <select> <c:foreach items="${requestscope.personlist}" var="person"> <option value="${person.getid()}">${person.getname()} </option> </c:foreach> </select> and controller servlet code. protected void processrequest(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { response.setcontenttype("text/html;charset=utf-8"); try { casualleaveservice service1 = new casualleaveserviceimpl(); list<person> personlist = service1.searchname(); request.setattribute("personlist", personlist); requestdispatcher rd = getservletcontext().getrequestdispatcher("/casual"); ...

ios - How to launch SMS Message app -

i want open sms message app copy text friends. not creating sms. how launch iphone sms message app using swift code? come across code below launching mail app not working. [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"mailto:"]]; i changed , same not working [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"sms:"]]; appreciate help. tia // swift 3 uiapplication.sharedapplication().openurl(nsurl(string: "sms:")!) // swift 4 uiapplication.shared.open(url(string: "sms:")!, options: [:], completionhandler: nil)

PHP simple video upload function -

i trying create php video upload function, can't work. no errors, doesn't upload file. have checked if max file size in phpinfo(), isn't. limit set 64m. the paths should correct, have triple checked everything. have followed guides, still nothing. <form action='' method='post' enctype='multipart/form-data'> <?php if(isset($_files['video'])){ $name = $_files['video']['name']; $type = explode('.', $name); $type = end($type); $size = $_files['video']['size']; $random_name = rand(); $tmp = $_files['video']['tmp_name']; if($type != 'mp4' && $type != 'mp4' && $type != 'mkv'){ $message = "format not supported!!"; } else { move_uploaded_file($tmp, 'videos/'.$name.'.'.$type); $message = "successfully uploaded!"; } echo "$message"...

python - Numpy nditer for memory saving? -

i'm lost when iterating on ndarray nditer. background i trying compute eigenvalues of 3x3 symmetric matrices each point in 3d array. data 4d array of shape [6,x,y,z] 6 values being values of matrix @ point x,y,z, on ~500x500x500 cube of float32. first used numpy's eigvalsh, it's optimized large matrices, while can use analytical simplification 3x3 symmetric matrices. i implemented wikipedia's simplification , both function takes single matrix , computes eigenvalues (then iterating naively nested loops), , vectorized using numpy. the problem inside vectorization, each operation creates internal array of data's size, culminating in ram used , pc freeze. i tried using numexpr etc, it's still around 10g usage. what i'm trying do i want iterate (using numpy's nditer) through array each matrix, compute eigenvalues. remove need allocate huge intermediary arrays because calculate ~ 10 float numbers @ time. trying substitute nested for loops 1...

java - Is it possible to make IntelliJ perform "smart" soft wrapping? -

Image
is possible make intellij idea's soft-wrap behavior smarter? here's java code (from paypal's ghastly api) , current soft wrapping behavior: here's soft wrapping behavior want see: note not want reformat actual text in file; want display of code smart. use wildly different width monitors , windows day day; code should "look right" on of them. doesn't mean "force vt-100 standard 80 cols", seems habitual among non-ide users. no, not possible. believe language plugins can customize soft wrap locations code wrapped @ meaningful locations, wrapped lines cannot aligned or indented in way.

java - Android Studio runtime error: Class not found using the boot class loader -

i'm new android studio , i've been trying run app "ev515" doesn't run on tablet , logcat shows me following message: caused by: java.lang.noclassdeffounderror: class not found using boot class loader; no stack available here's mainactivity far: public class mainactivity extends activity { private final string tag = "ev515"; private int samplerate; private int energy; private int amplitude; private int buffer[]; private button statusbutton; private button inputinfobutton; private button argsbutton; private button loadbutton; private button recbutton; private button runbutton; private button plotbutton; private button resetbutton; private textview status; private textview info; private textview args; private float time = 0.0f; private double elapsed = 0.0d; private string filename; private string filepath; private double f0min; private double f0max; private double framelength; private double timestep; private double evthreads; private doubl...