Posts

Showing posts from 2014

javascript - How do I put this jQuery code in an external .js file? -

i have jquery code works fine when placed between <body> , </body> tags of .html file. i want use javascript external javascript instead of internal. bit works if place javascript @ end before </body> tag. if place javascript within <head></head> not working also. so need getting javascript code run externally. how modify code when place in external .js file? and how call code onload? html <html> <head> <style> .blue1 {background: green;} .red {background: red;} .orange {background: orange;} .yellow {background: yellow;} </style> </head> <body> <table border="2px solid black">/*border*/ <tr> <td colspan="1"> <p class="hello_blue1">hello stack overflow1</p> </td> <td rowspan="1" colspan="2"> <p class="tab-text-7-aufz_red">hello stack overflow2</p&g

JQuery Passing Array string -

i'm trying pass array .each jquery code, passing numbers 0, 1, 2, 3,... instead of string values. my code define variable is: var accessoriescats = [ 'beaded accessories', 'cufflinks', 'flip flops', 'floral accessories', 'foot jewelry', 'hair accessories', 'hankies', 'jewelry', 'leg garters', 'purses', 'shoe stickers', 'something blue', 'tiaras', 'totes' ]; here entire code: <script> if (window.location.href.indexof("category-s/2022.htm") != -1) { var accessoriescats = [ 'beaded accessories', 'cufflinks', 'flip flops', 'floral accessories', 'foot jewelry', 'hair accessories', 'hankies', 'jewelry', 'leg garters', 'purses', 'shoe stickers', 'something blue', 'tiaras', 'totes' ]; $('#content_area &

php - pass parameters in URL code igniter -

i new ci , try pass information login page following... public function authenticate() { $this->load->model('user_model', '', true); if ($this->user_model->authenticate($this->input->post('username'), $this->input->post('password'))) { $this->session->set_userdata('loggedin', true); header('location: /'); } else { header('location: /sessions/login/error?='.'1'); } } and on login page use _get. so how best go in codeigniter? first of all, using sensitive data email/password general no-no. bad practice way. but answer question here - http://www.codeigniter.com/userguide3/libraries/input.html $this->input->get('username') equal $_get['username'] . might use $this->input->get('username', true) escape malicious code. and $this->input->post('username') equal $_post['

uinavigationcontroller - iOS 8 - Set Status Bar Color (when your UINavigationBar has a nil backgroud image) -

Image
i using view pager in app (specifically icviewpager). make view pager blend navigation bar so: i had put these lines of code in appdelegate.m [[uinavigationbar appearance] setbackgroundimage:[[uiimage alloc] init] forbarmetrics:uibarmetricsdefault]; [[uinavigationbar appearance] setshadowimage:[[uiimage alloc] init]]; however, causes status bar not same color navigation bar. how set color of status bar same navigation bar? how set color of status bar same navigation bar? you don't. status bar has no color . transparent. job make view has desired color extend top of view, behind status bar, that color shows through. this view window, example, or view controller's main view. right now, white, , see white color show through above top of navigation bar. if give window (or main view, or whatever white thing seeing) same color navigation bar, you'll effect want. alternatively, adjust size , position of navigation bar reaches top of window , cover

android - Updating custom card expand UI in cardslib? -

this isn't issue, it's more of question. wanted know when create card custom expand , put card in cardslist. when setupinnerviewelements() called? called when expand card or called when touch card or scroll list? and if update ui of card expand @ runtime while expanded how suggest doing ? suppose have button prompts user enter string , want append string existing string in cardexpand? , @ same time make string available other other cards in expand views ? there method override achieve ? im sorry cant provide code because long , tedious piece of code. thanks the setupinnerviewelements() in adapter, called standard getview() method inside adapter. it called when list scrolls, or when update adapter example (when expand/collapse card, update adapter). currently can't use different layout cards in adapter. hovewer can set values inside card (model) enable/disable elements in ui (in s etupinnerviewelements ). if update runtime ui, have update values in

logging - Worklight 6.2 - Server side WL.Logger -

i'm trying configure server logs on worklight runtime environment 6.2 (deployed on 8.5) is possible configure , format wl.logger output on server side in order to: log on differtent file standard output use conversion pattern layout (similar log4j one): e.g. [%d{yyyy-mm-dd hh:mm:ss,sss}], %p, %c, %m%n specify rolling behavior (size, filename format, ...) alternatively, possible use log4j? how? see here using different files log output. short answer: not worklight controls. log4j replaced standard logging mechanisms provided websphere.

java - How to use websocket with Restlet framework? -

we have web server written in restlet framework, want implement websocket replace long polling design cause performance issue. checked restlet's forum , document, looks websocket no support yet , not in schedule.and don't want replace restlet other frame work since big change, comes out design proposals, , not sure 1 best: start jetty server, , use jetty's websocket lib handle websocket connection; prons:no need self develop websocket lib base on restlet; cons: need have 2 server listening on different ports. develop our own websocket lib based on restlet: prons: no need start second server; cons: big development effort. we still investigating, appreciate sharing , valuable comments, thanks!! websockets not supported yet in restlet framework, there issue opened : https://github.com/restlet/restlet-framework-java/issues/893

c# - Use object in multiple forms -

currently i'm making asp.net webapplication. i've login form make object user. how can access object in form? please see code: login form users user = new users(username, password); user.receiveuserinformation(); form userpage this want acces object "user". what's right way this. thought this: users user = new users(username, password); user.receiveuserinformation(); session["new"] = user; and then: session["new"].receiveuserinformation(); but doesn't work. it work using session : cast users class users newuser = (users) session["new"];

sass - Find real (optical) center of SVG icons using SCSS mixin -

so reading through pretty interesting (and accurate) article on play button never being centered optically - https://medium.com/@erqiudao/the-play-button-is-not-optical-alignment-4cea11bda175 after reading wanted try , take stab @ creating mixin always find actual center of icon no matter shape of it. but! lot trickier thought came here help! oh , side note: passing of svg icons font file has base styles on such as: font-family:"iconfont"; display:inline-block; vertical-align:middle; line-height:1; font-weight:normal; font-style:normal; speak:none; text-decoration:inherit; text-transform:none; text-rendering:optimizelegibility; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; any or guidance highly appreciated! best, artem

Bash scripted curl commands producing different results than manual runs -

i have text file of 900 curls run. pretty hairy, tons of quotes, apostrophes , other special characters. to run them have been trying create bash script loop through list: #!/bin/sh oldifs=$ifs ifs="&&&" echo "getting started" cat staging_curl_script|while read line $line done echo "done" unfortunately have had unusual issue. commands run fine in command prompt returning "file name long" error. echoed out these commands script , compared them manually run command, , identical. any idea why seeing different results? silly mistake here, needed bash -c "$line"

Batch script to RENAME file with current date -

i trying rename file replacing date in file name current date. getting "syntax incorrect error" here code: echo on /f "skip=1" %%x in ('wmic os localdatetime') if not defined mydate set mydate=%%x set today=%mydate:~0,4%-%mydate:~4,2%-%mydate:~6,2% set "_year=%mydate:~0,4%" set "_month=%mydate:~4,2%" set "_day=%mydate:~6,2%" ren c:\users\xyz125\documents\erics's docs\scripts\"test file (20150112).txt" "test file (%_year%%_month%%_day%).txt" pause wrong quoting: instead of ren c:\users\xyz125\documents\erics's docs\scripts\"test file (20150112).txt" "test file (%_year%%_month%%_day%).txt" rem ^ should be ren "c:\users\xyz125\documents\erics's docs\scripts\test file (20150112).txt" "test file (%_year%%_month%%_day%).txt" rem ^

wpf - Error message in a property -

this problem. if user type number in textbox right, if type char, don't see messagebox () in property. why ? <textbox horizontalalignment="left" tabindex="12" text="{binding time_hh, updatesourcetrigger=propertychanged,stringformat='{}{##}'}" flowdirection="righttoleft" maxlength ="2" height="30" width="30" /> and property private _time_hh integer public property time_hh() integer return _time_hh end set(value integer) = 0 len(value.tostring) if isnumeric(value.tostring(i)) = false messagebox.show("error") value = 0 end if next _time_hh = value onpropertychanged("time_hh") end set end property your time_hh property integer, there's no way it's gonna contain non-numeric character.

c# - Creating a reference to another object -

i want make object stores reference object. have code this: public partial class form1 : form { int test = 1; store st; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { st = new store(test); } private void button1_click(object sender, eventargs e) { test = 7; } private void button2_click(object sender, eventargs e) { label1.text = convert.tostring((int)st.o); } } public class store { public object o; public store(object obj) { o = obj; } } if click button2 - can see "1" in label. if click button2 , button1 - still see "1". how should alter code i'll see "7" in case? when create store object you're evaluating value of test variable, , storing that value rather the test variable . if want have way of evaluating variable value later, can use lambda close on var

iframe - Is there a way to sandbox the execution of third party javascript on a webpage? -

my client has webpage embeds banner ads third party. 1 of these banner ads include intrusive/malicious javascript, creating alerts/popups. has no way of validating ads' javascript ads injected host. wondering if there way him sandbox untrusted javascript within webpage in order ensure banner ads unintrusive things (relatively speaking) having monkey dance on mouseover.

Partially indexing Cassandra table with SOLR -

one of tables inside our cassandra (dse 4.7) cluster contains south of 15 billion records. number of servers have - impossible index them solr. so, possible somehow index data partially/sample and/or start indexing , "pause" indexing let's after 500mm records? i assume other option dump 500mm records , reload them "temp" table , index that...? the point is, start indexing , have ability search , grow , add more servers - have ability index more , pause again. is possible? thanks! there no way index few rows. agree parallel table (probably ttl) best bet. here (pretty effective) tactics minimize size of dse search index. can shrink ~50% if you're not using things highlighting (term...) or boosts (omitnorms): • set termvectors="false" • set termpositions="false" • set termoffsets="false" • set omitnorms="true" • index fields intend search

javascript - Disable mobile Chrome 43's "Touch to Search" feature programmatically -

when select text in chrome 43 on android device "touch search" popup. we're using text selection feature on our site , new chrome feature interferes of our ui. in long run, we'll working out new ui/ux work side-by-side feature, in interim, want disable on our web app. is there sort of meta tag or javascript can add turn off? know if possible? this can manipulated in number of ways. user can turn off in flags pauli suggested, , can control it. developer control, right there couple of options basic summary if think user interactable element won't enabled: css: -webkit-user-select: none; html: anything aria-role not have touch search enbabled anything tabindex of -1 or > 0

javascript - Working around the Same-Origin Policy? -

i have file on local installed xampp called test.php . when go http://127.0.0.1/test.php , execute it, script should post values id , name site http://otherdomain.com/post.php , put output data . not work because of same-origin policy . when trace packages error calles "ns_error_dom_bad_uri" . question is, there anyway make possible anyways without needing have access http://otherdomain.com/ ? test.php <script> $(window).load(function(){ var url = "http://otherdomain.com/post.php"; $.post(url,{id : "12", name : "john"}, function(data) { alert("it worked!"); }); }); </script> update i changed following set up. have 2 files called send.php , proxy.php. send request send.php proxy.php , proxy.php sent actual request otherdomain.com. when execute send.php now(means pressing button) result "error: 403 forbidden access".

c# - Can you group generic objects into a list? -

i have made machine converts biscuits 1 type another. each biscuittransformer has method digestivebiscuittransformer: ibiscuit transform(digestivebiscuit digestivebiscuit) method. is possible group these using common interface, given type different in each transformer, e.g. chocolatebiscuittransformer ibiscuit transform(chocolatebiscuit chocolatebiscuit) the gingernutbiscuittransformer: ibiscuit transform(gingernutbiscuit gingernutbiscuit) ideally, trying achieve, biscuittransformationmanager take in type of biscuit, , give ibiscuit back. it load of transformers list<ibiscuittransformer> and ibiscuittransformer expose type inputbiscuittype {get;} compare incoming biscuit type: biscuittransformationmanager: ibiscuit transform<t>(t biscuit) { var transformer = loadtransformers().single(c => c.inputbiscuittype == typeof(t)); return transformer.transform(biscuit); } i don't think works because transformer expecting concrete type, no

php - Wordpress show only one post for each author ( Page loads too slow ) -

i want show 1 latest post each author , found code working. however, takes long load page since have on 100k authors , 100k posts in database. how can optimize code? <?php //displaying latest post per author on front page function filter_where($where = '') { global $wpdb; $where .= " , wp_posts.id = (select id {$wpdb->prefix}posts p2 p2.post_status = 'publish' , p2.post_author = {$wpdb->prefix}posts.post_author order p2.post_date desc limit 0,1)"; return $where; } add_filter('posts_where', 'filter_where'); query_posts($query_string); //the loop if ( have_posts() ) : while ( have_posts() ) : the_post(); ... ?> here original article code. http://www.dbuggr.com/smallwei/show-latest-post-author-wordpress-front-page/

Android - volley multiple requests -

i have 2 requests need execute onstart(...){ callfirstws(); callsecondws(); } each function use singleton class format singletonclass.getinstance(<activity>).addtorequestqueue(<request>); the singleton class public final class internetsingleton { private static internetsingleton singleton; private requestqueue requestqueue; private static context context; private internetsingleton(context context) { internetsingleton.context = context; requestqueue = getrequestqueue(); } public static synchronized internetsingleton getinstance(context context) { if (singleton == null) { singleton = new internetsingleton(context); } return singleton; } public requestqueue getrequestqueue() { if (requestqueue == null) { requestqueue = volley.newrequestqueue(context.getapplicationcontext()); } return requestqueue; } public void addtorequestqu

jquery - select an element if children not having a specific class -

i looking selector solution, not using .find() or other jquery functions. i wander why if $('.parentclass:has(".childrenclass")') , returns elements if 1 of children has .childrenclass but if $('.parentclass:not(".childrenclass")') returns elements if 1 of children has .childrenclass is there way select element if of children have not specific class? i wander why if $('.parentclass:has(".childrenclass")'), returns elements if 1 of children has .childrenclass if $('.parentclass:not(".childrenclass")') returns elements if 1 of children has .childrenclass because :not(".childrenclass") not remotely opposite of :has(".childrenclass") . :not tests whether that element doesn't match selector. :has tests whether element's children match selector. is there way select element if of children have not specific class? yes, can combine :not , :has : $(&q

if statement - Grails GSP - Display different textfields dependant on locale -

i'm having issue trying display different g:textfield dependant on users locale using grails 2.4.3. i've found bypass issue raised in grails 2.4.3 have set variable on gsp page: <g:set var="lang" value="${session.'org.springframework.web.servlet.i18n.sessionlocaleresolver.locale'}" /> i can display ${lang} correctly , see correct value on screen. i have display different textfield dependant on locale value assumed use following doesn't work? <g:if test="${lang.equals('de')}"> german textfield </g:if> i have tried lang.equals , lang == de i've shown here each de , en <g:elseif test="${lang == 'en'}"> english textfield </g:elseif> <g:else> no language support </g:else> do this: <g:if test="${lang == locale.german}"> ... i recommend current locale this: <%@ page import="org.springframework.web.servle

How to crate a window/dialog without a title bar from chrome extension on chrome OS? -

i'd display window or dialog box without title bar chrome extension. extension plugs file browser on chrome os. i've seen examples use jquery accomplish of them use browser tabs , applicable chrome browser. tabs not available extension i'm not quite sure how that. any suggestions appreciated.

efficient way to JOIN in SQL -

i have join 2 tables: articles , sales, not data of articles, need last load. is there difference between 2 ways? there faster/efficient way? , more important, why? 1) select * sales s inner join articles on s.article_id = a.article_id , a.load_date = (select max(load_date) articles) 2) select * sales s inner join ( select * articles load_date = (select max(load_date) articles) ) on s.article_id = a.article_id most dbmses support windowed aggregate functions , rank might more efficient (and easier write if you're used it): select * ( select *, rank() -- max date gets rank #1 on (partition a.article_id order a.load_date desc) rn sales s inner join articles on s.article_id = a.article_id ) dt wher rn = 1

javascript - Scroll to fixed navigation loads at the top -

i using joomla! 3, have icemega menu , uses jquery scroll-to-fixed collect navigation on way down. in chrome: when site loads on homepage loads , works fine; when navigate different page navigation loads scroll-to-fixed class added navigation @ top of browser window. occurs on homepage if navigate homepage. in firefox: seems have separate problem; scroll snaps top soon. both browsers issues rectified if inspect element opened , closed. the homepage banner (layerslider) larger in height tried increase height of rest of sites banner had no effect. the website : http://multi.multi-web-service.co.uk/ thanks

How can I build Shiny applications with Animation in R? -

i trying build shiny app build interactive animations r. have function can build gifs/other output options using animation package( http://cran.r-project.org/package=animation ) loops through series of ggplots(by date). , shiny app can show single ggplot based on selected date.i want build shiny app refreshes animation based on selected date range. are there examples of code uses maybe savehtml uioutput in shiny? possible? reset animation in shiny r studio shows trying build animation within shiny. https://gist.github.com/yihui/5899181 example of integrating savegif function shiny app, through download. alternative suggestions/packages @ approach problem in r not using animation and/or shiny appreciated. i suggest using googlevis package --> tool, gvismotionchart. it's simple work with, make sure data numeric or time oriented in way , have character/categorical variable plot circles. best of all animation tools included inside motion chart. if want detai

How to find the rows with maximum number of variables columnwise r -

i have data frame has thousands of rows , 25 columns. rows have different lengths, meaning not have values columns. however, empty cells @ end of row: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 how can find longest row? in example above row number 3. if missing values nas , values @ end. indx <- which.max(rowsums(!is.na(df1))) or can use apply loop on rows indx <- which.max(apply(df1, 1, function(x) length(x[!is.na(x)]))) if missing values '' indx <- which.max(apply(df1, 1, function(x) length(x[x!=''])))

java - Data loss from class during for each iteration -

i've got debug outputs in constructor output expected incoming parameter{c=0.620405, h=0.104122, o=0.275473} stored parameter{c=0.620405, h=0.104122, o=0.275473} but when call tostring() while iterating through list returns empty set. what's causing behavior? public class pnnlentry { private string matnum = ""; private string material = ""; private string formula = ""; private string density = ""; private string comment = ""; private string references = ""; //map element weight fraction string private map<string, string> elements = new treemap<string, string>(); public pnnlentry(){ } public pnnlentry(string num, string mat, string form, string dens, string com, string ref, map<string, string> elem){ matnum = num; materia

javascript - PHP Form Validation framework JQuery Format -

i started web developing time ago i've engaged bigger size projects. i started using bootstrap , jquery along jquery validation plugin makes easy validate forms on client side. i wondering if there's library php validates user input given restrictions (on same format jquery validation plugin), implement server side checks easily. you may want @ post. while not specific answer question, may instead give different way @ server-side checks. easiest form validation library php?

java - Convert plaintext to perform elgamal encryption -

hi i'm writing program in java test variant of elgamal encryption, problem not encryption/decryption chain itself, how perform operations on input given: text file. have text file words in (for example content can be: "hello world, test" ) , need perform numeric operations on them this: ciphertext= (message * y) mod p where y , p 2 biginteger . tried conversion chain: (reading 1 string @ time): string->hexadecimal->decimal then perform encrypt operation, , inverse: decimal->hexadecimal->string but doesn't work time (i'm investigate on issue). fixed. my question is, there better way this? reading byte array 's i'm not sure how use them. [i can post example of encryption/decryption chain if needed] biginteger has constructor taking byte array argument. any string can converted byte array, without loss, using (for example), utf-8 encoding: byte[] bytes = string.getbytes(standardcharsets.utf_8);

bash - Run shell script inside a container -

i´m using lemonlatte / docker-webvirtmgr base file, problem there no ssh keys configured user www-data, wrote following shell script: #!/bin/sh if [ ! -d "/var/local/webvirtmgr/nginxhome" ]; mkdir /var/local/webvirtmgr/nginxhome chown -r www-data:www-data /var/local/webvirtmgr/nginxhome usermod -d /var/local/webvirtmgr/nginxhome www-data su - www-data -s /bin/bash -c "ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -n ''" su - www-data -s /bin/bash -c "touch /var/local/webvirtmgr/nginxhome/.ssh/config && echo -e 'stricthostkeychecking=no\nuserknownhostsfile=/dev/null' >> /var/local/webvirtmgr/nginxhome/.ssh/config" su - www-data -s /bin/bash -c "chmod 0600 ~/.ssh/config" fi after added 2 statements dockerfile: add setupssh.sh /webvirtmgr/setupssh.sh run /bin/sh -c "/webvirtmgr/setupssh.sh" i tried cmd /webvirtmgr/setupssh.sh, run /webvirtmgr/setupssh.sh no success... when run script inside cont

javascript - Angular js validation function returns before the api call for validation is completed -

if (!validate()) { return; }; function validate() { var nameisvalid = false; var validationstatus = true; dataapi.getnamevalid(viewmodel.name).then(function (data) { nameisvalid = data.isvalid; validationstatus = checkvalidinput(nameisvalid); }); return validationstatus; } function checkvalidinput(isvalid) { if(!isvalid){ return false; } //chk other input field validations } the issue validate() returns true.if change validationstatus = false returns false. getnamevalid async false still return validationstatus called before getnamevalid() completes execution checkvalidinput never gets called , actual validation never happens. there approach kind of scenarios need wait

r - Using standard deviations in GenMatch to encourage more pairs -

so following example matching package , in particular genmatch example. this continues on previous question link r package here following example in genmatch library(matching) data(lalonde) attach(lalonde) x = cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74) balancemat <- cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74, i(re74*re75)) genout <- genmatch(tr=treat, x=x, balancematrix=balancemat, estimand="ate", m=1, pop.size=16, max.generations=10, wait.generations=1) genout$matches genout$ecaliper y=re78/1000 mout <- match(y=y, tr=treat, x=x, weight.matrix=genout) summary(mout) we see 185 treated observation paired 270 non-treatment observation. we can generate table treatment cases , age on left , control case , age on right by: pairs <- data.frame(mout$index.treated, lalonde$age[mout$index.treated], mout$index.control, lalonde$age[mout$index.control]) now, litera

javascript - D3js zoom/drag not working any more in my code (+code sample) -

code in file http://tc51.net/w/at/stackoverflow.com/20150604.1/20150604.1.zip you find .htm, .js, .css, .csv files of: the example started with my current work in progess. the problem since did refactoring required further developments, chart drag/zoom feature not working anymore. no apparent javascript error in debugger, , seems have 3djs inner zoom functions have no clue did wrong. can me find out? thank you. (i tried create 2 jsfiddles don't work @ all, have no idea why: start example: https://jsfiddle.net/tttt/erndok36/2 current work in progress: https://jsfiddle.net/tttt/mfudwy0q ) and here code: //start example: http://mbostock.github.io/d3/talk/20111018/area-gradient.html function parsedate(unix_timestamp){return new date(unix_timestamp*1000);} var svg, m, w, h, x, y, xaxis, yaxis, area, line, gradient, margin, vardata, //parsedate = d3.time.format('%y-%m-%d').parse, format = d3.time.format('%y') function createsvg() { margin = {t

ios - NSDecimalNumber for finances -

i'm building app deals money , i've been using floating point arithmetic until now, i've learned it's better use nsdecimalnumber. i want make sure i've understood correctly, here goes: imagine worker, earning 20.57$/hour. information provided user. did before: @property (nonatomic) float hourlyrate; nsnumberformatter *numberformatter = [[nsnumberformatter alloc] init]; numberformatter.numberstyle = nsnumberformatterdecimalstyle; nsnumber *hourlyrate = [numberformatter numberfromstring:self.ratetextfield.text]; settingsobject.hourlyrate = [hourlyrate floatvalue]; but i've changed to: @property (nonatomic) nsdecimalnumber *hourlyrate; settingsobject.hourlyrate = (nsdecimalnumber *)[nsdecimalnumber decimalnumberwithstring:self.ratetextfield.text locale:[nslocale currentlocale]]; is correct way read nsdecimalnumbers string? say person enters workplace @ 10:01. save information so: [[nsuserdefaults standarduserdefaults] setobject:[nsdate date] f

Make histogram from data in python -

i trying make histogram data saved in .dat file: have made other types of plots, when trying make histogram receive error: valueerror: x has 1 data point. bins or range kwarg must given. table has (many) more 1 data point! code below... import numpy np import matplotlib.pyplot plt a=open('/24_5_15b.dat','r') header0=a.readline() w1=[] w2=[] line in a: line=line.strip() columns=line.split() w1=float(columns[13]) w2=float(columns[15]) w1=np.asarray(w1) w2=np.asarray(w2) n, bins, patches = plt.hist(w1, 20, normed=1, histtype='bar', rwidth=0.8) plt.show() when ask print w1 prints values. numbers floats - make difference? thanks... from looks of this, trying plot histogram first line: for line in a: ... n, bins, patches = plt.hist(w1, 20, normed=1, histtype='bar', rwidth=0.8) to make histogram, need pass of data, not 1 @ time. i recommend using genfromtxt too, can use like: a = np.genfr

r - converting a dataframe to a 2 column dataframe based on vaues -

i trying convert multi-column dataframe 2 column dataframe. each row person (based on id in first col) multiple attributes. how can list each person , attribute in 2 columns? example: temp<-data.frame(v1 = c(1,2,3),v2 = c(4,5,6)) row.names(temp)<-c("person1","person2","person3") temp v1 v2 person1 1 4 person2 2 5 person3 3 6 res<-data.frame(person=c("person1","person1","person2","person2","person3", "person3"),val= c(1,4,2,5,3,6)) res person val 1 person1 1 2 person1 4 3 person2 2 4 person2 5 5 person3 3 6 person3 6 here's comment converted answer per request library(reshape2) temp$id <- rownames(temp) melt(temp, "id") or simpler version @akrun melt(as.matrix(temp))

Embed Javascript in VB.NET -

i need way add javascript code in vb.net; private sub button1_click(sender object, e eventargs) handles button1.click me.webbrowser1.document.invokescript("javascript:(function(){document.body.appendchild(document.createelement('script')).src='http://example.com/api.php?p=mail';})();") i use javascript code fill form in website (on firefox browser bookmarks) javascript:(function(){document.body.appendchild(document.createelement('script')).src='http://example.com/api.php?p=mail now want use in vb.net browser when invoke script nothing happens. tried on other ways don't go. try: webbrowser1.document.parentwindow.execscript "javascript:(function(){document.body.appendchild(document.createelement('script')).src='http://example.com/api.php?p=mail';})();", "jscript" see vbforums ...

java - Method invocation failed when throwing exception from web service -

i have simple web services i'm throwing custom exception called namenotfoundexception. i'm using jax-ws create web service , i'm deploying jboss 6.3 server. now, working should, i'm getting proper exception client. however, when exception thrown in web service method interrupted ( as should be ) , not return value end stack trace: 15:04:14,807 error [org.jboss.as.webservices.invocation.invocationhandlerjaxws] (http-localhost/127.0.0.1:8080-63) jbas015594: method invocation failed exception: name not found: @ se.webservicetest.exception.namenotfoundexception: name not found @ se.webservicetest.getname(simplewebserviceimpl.java:36) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) [rt.jar:1.7.0_51] @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) [rt.jar:1.7.0_51] @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) [rt.jar:1.7.0_51] @ java.lang.reflect.method.invoke(method.java:606) [rt

c# - Upgrading MSI throwing 'method not found' error -

i have project 2 class libraries. used 'setup , deployment tool' make msi files. initially, have build v 1.0.0 , installed in machine. after that, have made few changes in libraries , made build v 1.0.1. when tried install v1.0.1 in machine has 1.0.0. installed replacing older 1 expected. but, when tried run app v1.0.1 , click button, throwing exception follows. submitbutton_click : method not found: 'void library1.method..ctor(int32, system.string, int32, int32, system.datetime, system.string, system.datetime, int32, tabletevallibrary.skillmethod, system.string, tabletevallibrary.user, system.collections.generic.list`1<library1.porceedure>, int32)' its weird. sure project has ctor , able run app via visual studio. any suggestion me on this? when upgrade vs setup (removepreviousversions) can succeed doesn't mean files have been updated. standard file replacement rules used, , means files replacced if file versions have been increme

android - Toolbar will not collapse with Scrollview as child of CoordinatorLayout -

i trying follow google docs on using coordinatorlayout having issue scrollview inside coordinatorlayout. basically, toolbar collapse recyclerview or listview when scrolling down. scrollview not collapse. <android.support.design.widget.coordinatorlayout android:layout_width="match_parent" android:layout_height="match_parent"> <scrollview android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" > <textview android:id="@+id/tv_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:gravity="center" android:text="@string/filler" style="@style/textappearance.appcompat.large"

http - Debugging FireFox for stored credentials -

to implement automatic log-in on server's 401 query ( basic authentication) using nshttpauthmanager ( manager stored credentials bre used in automatic authenticat). when adding credentials should added http authentication manager reason popup credential still coming.how can check values of stored entry how can test whether credentials port,username,password,realm being added authentication manager or not? tutorial help.

sql server - How do I properly get a table within a table in SSRS? -

Image
i'm trying create payroll register detail report. there number of sections report, there employee info section(name, id, masked ssn, etc) earnings section(pay type, hours, rate, , dollars, tax section(itemized list of taxes--fed, state, local, etc), deductions section(an itemized list of deductions--health, dental, etc), benefits section(health, 401k, etc). here image of report drawn model: for stored procedure, created following temp table: create table #employeepaydetail( [id] [int] identity(1,1) not null, [employeeid] [nvarchar](30) null, [employeename] [nvarchar](50) null, [employeessn] [nvarchar](50) null, [checknumber] [int] null, [description] [nvarchar](30) null, [units] [decimal](19,5) null, [rate] [decimal](19,5) null, [amount] [decimal](19,5) null, [section] [int] null, [sort] [int] null ) most obvious, however, section field used determine section going put data in. 1=earnings 2=taxes 3=deductions 4=benefits the name, ssn, , employeeid denormalized

Windows Service on Windows Server 2003 R2 - Status is running but seems not to be working -

i have custom windows service built on net 2.0 , deployed on windows server 2003 r2. it has been working fine last 3 years have started facing problem it. it worked time , stopped working if status running. tried stop service twice every time stuck error 1053 , unable stop it. both times had reboot server because option i'm left @ last. not solution production servers. can please in regard? thanks.

gorm - How to update an instance with field unique that has not changed in Grails? -

i have problem when trying update instance has field constraint: unique, has not been modified. https://grails.github.io/grails-doc/latest/ref/constraints/unique.html class sectorempresarial{ long codigo string nombre static constraints = { nombre nullable: false, size: 0..50, unique: true } } example: instance created def sectorempresarialinstance = new sectorempresarial(codigo:1,nombre:"my_name") sectorempresarialinstance.save(flush:true) editing instance (error here) /* params=(codigo:2, nombre:"my_name") nombre has not changed */ def sectorempresarialinstance = sectorempresarial.findbycodigo(1) sectorempresarialinstance.properties = params sectorempresarialinstance.save(flush:true) // here present error because nombre has constraint: unique.

c++ - Valgrind says about "Invalid write" in fclose() -

i created stream using fmemopen(). closing fclose() , freeing buffer after reading. valgrind reports problem @ fclose() line: ==9323== invalid write of size 8 ==9323== @ 0x52cae52: _io_mem_finish (memstream.c:139) ==9323== 0x52c6a3e: fclose@@glibc_2.2.5 (iofclose.c:63) ==9323== 0x400cb6: main (main.cpp:80) ==9323== address 0xffefffa80 below stack ptr. suppress, use: --workaround-gcc296-bugs=yes what's happening? maybe fclose() cannot close memory stream? or maybe valgrind worries without reason , can ignore that? as haven't posted code, following pure speculation. you're writing more output stream promised when opened it. did account final nul (if didn't open "b" )? did read following in manual page? when stream has been opened writing flushed ( fflush (3)) or closed ( fclose (3)), null byte written @ end of buffer if there space. caller should ensure byte available in buffer (and size counts byte) allow this.

c++ - error when compiling from a Terminal with a makefile -

i trying recompile command line program in mac os x 10.10. last time did few years ago worked fine. following error: haplist::output(std::ostream&, std::vector<int, std::allocator<int> > const*, double, bool) in haplist2.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) make: *** [phase] error 1 i novice @ , know little beyond typing "make" @ command line prompt. clear x86_64 architecture, compiled fine before under os x lion. have clues how fix ? matt the error states function haplist::output has been declared, definition (function body) has not been found during build. locate function's definition resides , use work out why it's not being included in build.

c# - Test my json data parser should return a logger -

Image
let's @ json string structure. so there 7 loggers, let's expand nodes details. { "root_logger" : "myfailoverlogger", "loggers": [ { "logger_name": "myfilelogger", "logger_type": "mycompany.loggers.filesystemlogger", "layout": "${message}|${exception}", "stack_trace": { "error": true, "fatal": false }, "file_path_pattern" : "\\\\corporate.mycompany.com\\data\\recordings\\logs\\yyyy\\mm\\dd", "file_name_pattern" : "app.{mmddhhmm}.log", "rollover_after_n_hours" : 5, "rollover_after_n_megabytes": 5, "level" : { "min_level" : "info", "max_level" : "debug" } }, { "logger_name" : "

ckeditor - Cannot Select image file from external file browser with ckeditor4 but it works perfectly in ckeditor3 -

hello may able this. i had been using ckeditor3 , had created simple custom image browser. worked perfectly. click image button , dialog box pop , click browse server button. searched images , when found 1 wanted use clicked image browser automatically close , image show in image preview box in image plugin dialog box. unfortunately image plugin ckeditor 3 has become incompatible internet explorer 11. upgraded latest ckeditor 4. so in ckeditor 4 can still open image dialog , click image browser , browse images when select image, although image browser closes should image not being passed plugins preview box or url field within dialog box. remains blank. if manually paste in image url image show in preview box no longer image browser anymore. i have spent hours looking solution on google , coming empty, have ideas? problem solved to fix problem had change code in file browser follows. not know why first snipped works in ckeditor 3 not 4. function selectfile(file

showing wrong icon/splash screen on Windows Phone - cordova/phonegap -

just got rejection windows store policy team because... '10.1 app icon generic or unrepresentative' i believe know issue becuase downloaded app onto phone , on windows phone tile icon, splash screen , icon in app list showing generic cordova logo this... https://cordova.apache.org/images/cordova_256.png where meant use these... https://github.com/carlryds/craftingguideforminecraft/tree/master/www/res the right icons show on android (tried on samsung galaxy s4) not windows phone (nokia lumia 520), heres config.xml file, me code looks right, maybe i'm missing something?... https://github.com/carlryds/craftingguideforminecraft/blob/master/config.xml any ideas?

python - Plone Archetypes redirection after creation -

i've searched in internet while, haven't found out useful... i want simple redirect page listing page (folder) after save/create @ content type. i know have use validate_integrity.cpy , write redirect's logic there, file isn't run... so far example of validate_integrity.cpy: ## script (python) "validate_integrity" ##title=validate integrity ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind state=state ##bind subpath=traverse_subpath ##parameters= ## products.archetypes import plonemessagefactory _ products.archetypes.utils import addstatusmessage request = context.request errors = {} errors = context.validate(request=request, errors=errors, data=1, metadata=0) import pdb; pdb.set_trace() if errors: message = _(u'please correct indicated errors.') addstatusmessage(request, message, type='error') return state.set(status='failure', errors=errors) else: message = _(