Posts

Showing posts from April, 2010

javascript - Embed PDF at full height -

my question ... possible embed pdf in html document height 100%. problem actual height of pdf vary , layout needs respond this. there several ways embed pdf in html. one use pdfobject . below example works out of box in firefox, you'll find further instructions browsers on website. <object data="myfile.pdf" type="application/pdf" width="100%" height="100%"> <p>it appears don't have pdf plugin browser. no biggie... can <a href="myfile.pdf">click here download pdf file.</a></p> </object> or use google drive viewer display pdf (and quite few more file types): <iframe src="http://docs.google.com/viewer?url=[http://path-to-your-file.pdf]&embedded=true" width="600" height="780" style="border: none;"></iframe> using drive viewer visitors don't need additional software/plugin view files. you can adjust hei

windows - C++ Issue with cin and CTRL + Z -

i'm reading c++ primer 5th , have little problem exercise: read sequence of words cin , store values vector. after you’ve read words, process vector , change each word uppercase. print transformed elements, 8 words line. my code this: #include <iostream> #include <vector> #include <string> #include <cctype> using std::vector; using std::string; using std::cin; using std::cout; using std::endl; int main(){ vector<string> words; string wordbuffer; vector<string> output(1); while (cin >> wordbuffer){ words.push_back(wordbuffer); } (string &word : words){ (char &letter : word){ letter = toupper(letter); } } unsigned currentline = 0; (decltype(words.size())index = 0; index < words.size(); ++index){ output[currentline] += words[index] + " "; if ((index+1) % 8 == 0){ ++currentline; output.p

laravel blade form show me an exception error -

first of sorry bad english. have laravel form using blade template engine show me exception error. if remove code , use php form echo statmente fine , page show up. problem? here code {{ html::ul($errors->all()) }} {{ form::open(array('url' => 'news')) }} <div class="form-group"> {{ form::label('name', 'name') }} {{ form::title('name', input::old('title'), array('class' => 'form-control')) }} </div> <div class="form-group"> {{ form::label('email', 'email') }} {{ form::text('email', input::old('description'), array('class' => 'form-control')) }} </div> {{ form::submit('create nerd!', array('class' => 'btn btn-primary')) }} {{ form::close() }} there no such thing form::title() in laravel. try this {{ html::ul($errors->all()) }} {{ form::open(array('

abap - What does the syntax ->* mean? -

i have read documents syntax ->* , still don't it. can explain means , in scenarios can use it? i have syntax in example: assign ovs_callback_object->query_parameters->* <ls_query_params> casting. the ->* operator "dereference" operator. turns type ref something type something . in example, ovs_callback_object->query_parameters reference, don't want assign reference field-symbol, want assign actual field reference points to.

excel - Python - Do Logical Comparisons with Different Text Encodings Make a Difference? -

i trying automate task of copying data excel application based on "tagname" column exists in both. i'm having python copy "tagname" , save variable each ("metertag" , "exceltag"). i've thrown tkmessagebox right before compare confirm values same (and are), if statement not being executed, else is. question is: python treat excel formatted text differently other copied texts? (how fix that?) otherwise else problem? click(573,745) time.sleep(.3) click_hold(625,357) win32api.setcursorpos((571,357)) click_release(571,357) ctcopy() time.sleep(.3) click(1116,264) win32clipboard.openclipboard() metertag = win32clipboard.getclipboarddata() win32clipboard.closeclipboard() time.sleep(.1) click(2295, 252) #top of tags excel time.sleep(1) click(2295, 252) #top of tags excel time.sleep(1) x in range (0,499): ctcopy() win32clipboard.openclipboard() exceltag = win32clipboard.getclipboarddata() win32clipboard.closeclipboard() time.sleep(.02)

javascript - raising onkeypress element when input value is null -

i developing chat application user-typing , user-erasing functionality having difficulties in calling function when textarea chat input null( when user erase typed ) var msg=$("#chat_input").val(); if ((e.which== 8 || e.keycode == 8) && (msg.trim() == "" || msg.length <= 1)) { // call function } when user type 1 letter , erase function not called , if statement false how can fix backspacing last character or having new lines or spaces means this.value return false $('#chat_input').keyup(function(e){ if (e.which == 8 && this.value == false) { } }); jsfiddle demo value false if space, newline etc, don't need trim() ( msg.length <= 1 ) // = true when second last or last

R paste0 2 columns if not NA -

i paste0 2 columns if element in 1 column not na .if 1 element of 1 columns na keep element of other column only. structure(list(col1 = structure(1:3, .label = c("a", "b", "c"), class = "factor"), col2 = c(1, na, 3)), .names = c("col1", "col2"), class = "data.frame",row.names = c(na, -3l)) # col1 col2 # 1 1 # 2 b na # 3 c 3 structure(list(col1 = structure(1:3, .label = c("a", "b", "c"), class = "factor"),col2 = c(1, na, 3), col3 = c("a|1", "b", "c|3")), .names = c("col1", "col2", "col3"), row.names = c(na,-3l), class = "data.frame") # col1 col2 col3 #1 1 a|1 #2 b na b #3 c 3 c|3 as @roland says, easy using ifelse (just translate mental logic series of nested ifelse statements): x <- tran

java - I can't restrict my program to accept only binary numbers -

i'm creating program gui number converter. want program ask user binary string , if not enter binary number, program show him error message , ask him enter again. problem can add restriction alphabets when comes numbers fails or keeps showing error message. import java.util.*; public class test { scanner key = new scanner(system.in); string in; int b; public test(){ do{ system.out.println("enter binary string of 5 numbers"); in = key.nextline(); int i,j; char ch; (i=0 ; i<=5 ; i++){ b = 0; ch = in.charat(i); j = ch; if (character.isdigit(ch) && ch<=0 && ch>=1) b = 1; else system.out.println("please enter binary number (1 , 0)"); break; //b = 1; } }while(b != 1); int c;

ios - Show the same image in cells of UICollectionView -

i need show same image in cells of uicollectionview following logic: i have 14 different background images i need repeat same image every cell multiple of 14. eg: indexpath.row == 1 , indexpath.row == 14, indexpath.row == 28 and on, put 1 image indexpath.row == 2 , indexpath.row == 15, indexpath.row == 29 set image, , on. how possible fix request ? i tried code, seems no success :( - (void)setimageforcell:(uicollectionviewcell *)curcell forindexpath:(nsindexpath *)indexpath { //=> service image uiimageview *imgservice = (uiimageview *)[curcell viewwithtag:101]; (nsuinteger = 0; < 14; i++) { if (i == indexpath.row && indexpath.row % 13 == 0) { imgservice.image = [uiimage imagenamed:[nsstring stringwithformat:@"service_%d" , i]]; } } } thanks try this: if(indexpath.row < 14) { imgservice.image = [uiimage imagenamed:[nsstring stringwithformat:@"service_%d" , indexp

jquery - Unable to post a form using AJAX -

i trying post values using ajax not able so, watever may throwing fail. $("#displayinfo").hide(); var csrftoken = document.getelementbyid("csrf").value; var csrfname = document.getelementbyid("csrf").getattribute("name"); var postfrmdata = $('#'+formid).serialize(); var returndata= $.ajax({ url: "reportssearchresults", type: "post", data: postfrmdata, datatype: "json", beforesend: function(xhr) { xhr.setrequestheader(csrfname, csrftoken); } }); returndata.done(function(res) { alert("pass"+res); }); returndata.fail(function(data) { alert("fail"+data); }); return false; kindly tell reason why not getting submitted you're doing wrong. think looking (not tested): //if form submitted $('form').submit(function( e ) { e.prevendefault(); $form = $(this); //get form //post ajax r

shell - Read every line of file in bash and awk -

i have file(test.txt) has contents like /the/path/foo.txt foo.txt /the/paths/doo.txt doo.txt /the/path/foo.pl foo.pl /the/paths/doo.pl doo.pl /the/path1/soo.csv soo.csv /the/path2/moo.csv moo.csv i want have awk {print $1} saved variable1 , awk {print $2} saved variable2 in bash script i.e variable1 gets /the/path/foo.txt , variable2 gets foo.txt , on thanks you can use read built-in capture , assign fields variables (assuming there no spaces in paths): while read -r var1 var2; # variables done < text.txt

gorm - Grails criteria query checking `OR` logic -

i having grails criteriaquery checking or logic againist single state variable this: or { eq("status", status.one) eq("status", status.two) eq("status", status.three) } this code working fine, question is, checking or logic againist single state, there way optimize code like eq("status",status.one || status.two || status.three) thanks in advance. you can use 'in'( "status", [status.one, status.two, status.three] ) or 'in'( "status", status.values() ) if status enum values one, 2 & three.

sorting - How to sort huge data in spring data mongodb -

i have collection contains lots of document(about 10 million).how can sort these documents without using aggregation framework ? here want use code : pageable pageable = new pagerequest(pagenumber, howmany, sort); query.with(pageable);

jsf - Is there incompatibllity between dynamic UI inlcude and P:SelectOneMenu -

i have ui include have dynamic content , content loaded when press in command link. problem when press command link ui include loaded without javascript created primeface : could problem related @resource dependency. this controller: @named @viewscoped public class test { private string value; private list<string> options=new arraylist<>(); private string url=""; public string changeurl(){ url="/snippets/test2.xhtml"; return "#"; } @postconstruct public void init(){ options.add("test 1"); options.add("test 2"); options.add("test 3"); options.add("test 4"); } //getter , setter } and xhtml page: <h:form> text <ui:include src="#{test.url}" /> <p:commandlink action="#{test.changeurl()}" value="submit" process="@this" update="@form"/> </h:form> and included page: <ui:composition>

delphi - RawByteString type in Free Pascal -

free pascal docs state rawbytestring type defined in free pascal cannot find where. 1 should expect defined in system unit, in delphi, when compile (using fpc 2.6.2, {$mode delphi}) function declaration class function fromansi(const s: rawbytestring): bytearray; static; i compiler error error: identifier not found "rawbytestring" guess can declare type myself: type rawbytestring = type ansistring(cp_none); but find "native" fpc declaration. thanks quick answers. since don't need support fpc 1.x workaround need is: {$ifdef fpc} {$if fpc_version = 2} {$if fpc_release <= 6} type rawbytestring = ansistring; {$ifend} {$ifend} {$endif} you need use fpc 2.7.1. the new string types not exist in 2.6.x

javascript - How can I get this pop-up to appear after scrolling through relative percentage of the page? -

i'm working on wordpress website has "article box" feature suggests article on website after user has scrolled point x on page. the problem not relative value, absolute one. meaning box appears in longer articles, late in short articles, , inconsistent across different screen resolutions. the "article box" takes few values set in admin panel including "distance top", "which articles displayed", "article display view", "number of posts", , "disable time". hope provides context code excerpt below. you can see live example scrolling down page . i've found relevant javascript: /** * more stories box */ if(tds_more_articles_on_post_enable == "show") { //adding event scroll jquery(window).scroll(function(){ var cookie_more_box = td_read_site_cookie('td-cookie-more-articles'); //alert(cookie_more_box); //setting distance top if(!

arrays - PHP parse response from web service that contains the xsd too -

i need parse xml using php soapclient. response appears contain xsd too. below example of response get. welcome comments , contributions. thank much. <xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="newdataset"> <xs:element name="newdataset" msdata:isdataset="true" msdata:maindatatable="prv_servicios" msdata:usecurrentlocale="true"> <xs:complextype> <xs:choice minoccurs="0" maxoccurs="unbounded"> <xs:element name="prv_servicios"> <xs:complextype> <xs:sequence> <xs:element name="idprv_servicios" type="xs:int" minoccurs="0"/> <xs:element name="servicios" type="xs:string&

python - Adding a crosshair or marker to a matplotlib contour plot -

i plotting numpy array contour plot using matplotlib: import numpy np import matplotlib.pyplot plt plt.contour(array, linewidths = 1, colors = 'k') plt.contourf(array, cmap = plt.cm.jet) plt.colorbar() plt.show() i add 'crosshair' or other marker denote maximum value in array given by: maxi = np.max(array) how should go doing this? thanks. you can plot cross if know position. [row, col] = numpy.where(array==np.max(array)) plt.plot(col, row, 'b+')

functional programming - Clojure manually find nth element in a sequence -

i newbie clojure (and functional programming matter) , trying basic problems. trying find nth element in sequence without recursion. so like (my-nth '(1 2 3 4) 2) => 3 i had hard time looping through list , returning when found nth element. tried bunch of different ways , code ended is (defn sdsu-nth [input-list n] (loop [cnt n tmp-list input-list] (if (zero? cnt) (first tmp-list) (recur (dec cnt) (pop tmp-list))))) this gives me exception says "cant pop empty list" i dont need code, if point me in right direction help! you using function pop , has different behavior different data structures. user> (pop '(0 1 2 3 4)) (1 2 3 4) user> (pop [0 1 2 3 4]) [0 1 2 3] user> (pop (map identity '(0 1 2 3 4))) classcastexception clojure.lang.lazyseq cannot cast clojure.lang.ipersistentstack clojure.lang.rt.pop (rt.java:640) furthermore, mixing calls pop calls first . if iterating, use peek / pop or first / rest

android - Switch Widget - onCheckedChanged triggers when setting values in ArrayAdapter -

i have listview switch widget per listview item, problem having when set value in arrayadapter setoncheckedchangelistener triggered. how can set value in adapter without triggering setoncheckedchangelistener? have found similar question here not work me. below arrayadapter code. public class alarmsadapter extends arrayadapter<alarms> { private list<alarms> alarmslist; private context context; private contactdetailsfragment cdfragment; public alarmsadapter(context context, int textviewresourceid, list<alarms> alarms) { super(context, textviewresourceid, objects); this.context=context; alarmslist=alarms; } @override public view getview(int position, view convertview, viewgroup parent) { final alarms alarm = alarmslist.get(position); view view = convertview; viewholder holder = null; if( view == null ) { layoutinflater vi = (layoutinflater)context.getsystemservice(context.layout_inflater_service); view = vi.infl

subreport - SQL Server 2008 R2 (Report Builder 3.0) - Dynamic Sub-Reports -

i have few reports i've built in report builder 3.0 on sql server 2008 r2, join these reports single report dynamically generated sub-reports , pass array of guids parameter , depending on type of record guid represents in database - generate appropriate sub-report. i know wasn't possible in previous versions, been several years since last tried , such i'm wondering if scenario possible , if there resources out there touch on subject i'm struggling find anything. i figure scenario display 1 @ time. have main report in wanted dynamic number of different subs displayed. 1) main report (main) tablix containing subreport (submain), dataset main passes id, subid , subtype. submain has no dataset. 2) , directly in submain add subs (subdetail) have own dataset. , set visibilty subdetails depending on type.

sql - How to combine separate Date and Time columns into DateTime? -

i have customer database include lmd(last modified date) data type date , lmt(last modified time) data type int. need create datetime lmd , lmt column. here rows, lmd lmt 2014-09-03 172351 you might use divsion , modulo extract needed parts dateadd declare @datefield date declare @timefield int set @datefield='20140910' set @timefield=121314 select cast(@datefield datetime) + dateadd(hour,@timefield/10000,0) + dateadd(minute,@timefield/100 % 100,0)+ dateadd(second,@timefield % 100,0) select cast(lmd datetime) + dateadd(hour,lmt/10000,0) + dateadd(minute,lmt/100 % 100,0)+ dateadd(second,lmt % 100,0), lmt, lmd mytable

reading and printing a .csv file like a 2D matrix with both integer and float values in c -

reading file in c .csv extension. file consisting of both integer , float type data values. there way read csv file. appreciated. the data follows: application_no. actual_effort (in pm) no of processes no of tasks no of partnerlinks task variables element variables event variables script developer's skills developer's confidence tpss ts tcc 1 918.28 1 3 5 33 7 2 3 3.5 1 8 135 143 2 8891.513 3 9 3 100 15 6 12 3 1 36 1197 1233 3 22479.261 5 15 23 125 25 10 20 3 1 190 2700 2890 4 2961.131 2 4 9 70 13 4 17 2 0 72 416 488 5 19650.198 7 14 19 130 28 12 5 2.5 0 231 2450 2681 6 377.75 1 2 4 22 8 2 2 3 1 6 68 74 7 2671.93 1 5 12 55 12 6 4 2 0 17 385 402 8 966.15 3 3 6 31 8 5 7 2.5 0 27 153 180 9 3765.81 2 6 17 73 14 2 3 3.5 1 46 552 590 10 7467.11 4 8 21 87 19 13 1 2 0 116 960 10

java nested if statement else not working -

this question has answer here: java if-if-else behavior 6 answers the else part of statement not executing when none of other statements true. if (personplay.equals(computerplay)) system.out.println("it's tie!"); else if (personplay.equals("r")) if (computerplay.equals("s")) system.out.println("rock crushes scissors. win!!"); else if (personplay.equals("p")) if (computerplay.equals("r")) system.out.println("paper raps around rock. win!"); else if (personplay.equals("s")) if (computerplay.equals("p")) system.out.println("scissors cut paper. win!"); else system.out.println("you lose"); use brackets : if (personplay.equals(computerplay)) { system.out.printl

One button, 2 action and name change, Swift? -

i'm new field, maybe simple question, not know, swift. know how make 2 buttons used stopwatch, start , stop. have same button start , stop stopwatch, , text change stop start, possible , how? i able create simple ios project works requirements. here step step. create uiviewcontroller scene in project's storyboard , name "viewcontroller". add uibutton auto layout constraints in scene. in project navigator, create uiviewcontroller subclass file following code in it: import uikit class viewcontroller: uiviewcontroller { @iboutlet weak var mybutton: uibutton! var timer: nstimer? var myint = 0 var launchbool: bool = false { didset { if launchbool == true { mybutton.settitle("stop", forstate: .normal) timer = nstimer.scheduledtimerwithtimeinterval(1, target: self, selector: "firestopwatch", userinfo: nil, repeats: true) } else { mybut

regex - Fixed string Regular Expression C# -

hi want know regarding fixed-string in regular expression. how represent fixed-string, regardless of special characters or alphanumeric in c#? for eg; have @ following string: infinity.world.uk/members/namelist.aspx?id=-1&fid=x the entire string before x fixed-string (ie; whole sentence appear same) x decimal variable. what want want append decimal number x fixed string. how express in terms of c# regular expression. appreciate help if need modify existing url, dont use regex, string.format or string.replace problem encoding of arguments use uri , httputility instead: var url = new uri("http://infinity.world.uk/members/namelist.aspx?id=-1&fid=x"); var query = httputility.parsequerystring(url.query); query["fid"] = 10.tostring(); var newurl = url.getleftpart(uripartial.path) + "?" + query; result: http://infinity.world.uk/members/namelist.aspx?id=-1&fid=10 for example, using query["fid"] = "%&quo

javascript - AngularJS, get cookie session from a post response to get access to user contents on another web site -

i'm working on app based on angularjs. load contents available on web site server. on web browser, uses basic form login. test how server reacts nodejs server using request module , succeeded load wanted. angularjs. i have : create post request contains form. server answer request containing redirection urlportail , set-cookie. block redirection or @ least put cookie asked headers of redirection request put cookie new requests load content want what writed : $http({ method: 'post', url: 'url/login.php', data: $.param({login: 'login', password: 'password'}), headers: {'content-type': 'application/x-www-form-urlencoded'} }) .success(function(data1, status, headers1) { console.log('headers 1') console.log(headers1()) var session = parsecookies(headers1()); //create string (something 'id=12jkl23244') set-cookie of headers $http({ method : 'get', url: 'url/urliwa

Chef/Vagrant - how to point omnibus installer to an already downloaded file? -

every time vagrant destroy vagrant up vagrantfile processing goes out , fetches same old chef did last time. config.omnibus.chef_version = :latest how avoid downloading 34mb every single time? want restart scratch rather use vagrant provision . i watched fetched chef from, downloaded myself to /users/jluc/kds2/chef/vagrant/chef_11.14.6-1_amd64.deb by commenting out chef_version directivei kinda hoping use install_url, doesn't seem happy file. #config.omnibus.chef_version = :latest config.omnibus.install_url = '/users/jluc/kds2/chef/vagrant/chef_11.14.6-1_amd64.deb' skipping install_url , pointing chef_version downloaded file did not either. the doc ( https://github.com/schisamo/vagrant-omnibus ) says install_url should install script. how use normal install script, use downloaded file? @peter great. sounds work, having trouble getting to. have in install script reference in vagrantfile works vagrant ssh #!/usr/bin/env bash dpkg --install

AngularJS - How do I access the form defined inside a templateUrl in my directive? -

i attempting access form inside directive validation purposes, i'd access $setpristine, however, can't seem figure out how form if it's created using templateurl. i have plunker detailing issue here: http://plnkr.co/edit/sp53xzdtbyxl6daue1uv?p=preview i'm getting error: controller 'form', required directive 'testdirective', can't found! here relevant plunker code: .js: var app = angular.module("myapp", []); app.directive("testdirective", function() { return { restrict: 'e', scope: {}, templateurl: "formtemplate.html", require: "^form", // <-- doesn't work link: function (scope, element, attrs, ctrl) { console.log(ctrl); scope.open = function() { // have access form here // ctrl.$setpristine(); } }, controller: function($scope) { $scope.firstname = "mark"; $scope.save = function(form) {

java - Why does @RelatedToVia have optional type and elementClass parameters? -

@relatedtovia in spring-data-neo4j annotates field on nodeentity object reference @relationshipentity object connecting node node. @relatedto , in contrast, marks field reference connected node itself, , has optional type parameter can used specify type of relationship between 2 nodes. @relationshipentity(type="some_link") class somelink { @startnode foonode foo; @endnode barnode bar; } @nodeentity class foonode { @relatedto(type="some_link") barnode bar; @relatedtovia(type="some_link") //what's point in annotation? somelink link; } @relatedtovia has same optional type parameter, , i'm curious why is: type of relationship specified in field type (a field annotated @relatedtovia must typed @relationshipentity -annotated class, must specify type compile), point of specifying in annotation parameter? even more confusingly, @relatedtovia has optional elementclass parameter that, according docs,

sed Regex to find name of database in USE sentence -

i have file: hi use dbname; hi which sql text. i want capture dbname: sed -n '1,/^\(use\|use\)/{/^\(use\|use\)/{/^\(use\|use\)\s\+\([a-za-z0-9]*\);/\1/p }}' 001.sql edit: why try here: find line 1 line starts use. in lines, grab 1 starts use. in line, replace dbname , print. however, says 'unknown command \' (backslash before 1/p) what doing wrong? if wanting extract, use grep , made extracting things. grep -po '(?i)\buse *\k\w+' file -p option interprets pattern perl regular expression. -o option shows matching part matches pattern. (?i) makes regular expression case insensitive. \k throws away has matched point. but if want stick sed, do: sed -n 's/^use \([[:alnum:]]*\);/\1/pi' file

c# - How to pass input value from the form which is not part of any model? -

in razor view have form: @using (html.beginform()) { @html.antiforgerytoken() <div class="form-horizontal"> <h4>person</h4> <hr /> @html.validationsummary(true, "", new { @class = "text-danger" }) @html.hiddenfor(model => model.id) <div class="form-group"> @html.labelfor(model => model.firstname, htmlattributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.editorfor(model => model.firstname, new { htmlattributes = new { @class = "form-control" } }) @html.validationmessagefor(model => model.firstname, "", new { @class = "text-danger" }) </div> </div> etc. long time,but want pass values these below controller:

c# - Add new child to existing child -

so have kind of xml file: <?xml version="1.0" encoding="utf-8"?> <root> <project1> <students> <student> <name>test2</name> <studentnum>01</studentnum> </student> </students> </project1> </root> to add new student xml file, use code (c#) xmldocument doc = new xmldocument(); doc.load(server.mappath("datastorage.xml")); xmlelement student = doc.createelement("student"); xmlelement name = doc.createelement("name"); xmltext xmlname = doc.createtextnode(txtstudentname1.text); xmlelement studentnum = doc.createelement("studentnum"); xmltext xmlstudentnum = doc.createtextnode(txtstudentnum1.text); name.appendchild(xmlname); studentnum.appendchild(xmlstudentnum); student.appendchild(name); student.appendchild(studentnum); doc.documentelement.appendchild(student); doc.save(server.mappath("datastorage.xml")); but p

meteor - How to modify already installed Atmosphere packages -

before meteor 0.9.0 edit atmosphere package files after has been installed. templates pre-compiled , hidden in meteor core, can't edit html(templates). i found way have modified package. load github, modify , add app-specific packages /packages directory. can continuously modify package. does know better way ? thank you. you right, example package mrt:accounts-t9n, have following steps 1- cd yourproject && mkdir packages && cd packages 2- git clone https://github.com/softwarerero/meteor-accounts-t9n.git 3- cd meteor-accounts-t9n 4- edit package.js , change line 4 name: "mrt:accounts-t9n" 5- cd .. && meteor add mrt:accounts-t9n for moment solution, don't find another.

Change Series of Numbers to List, python -

i have been given series of numbers take , put python list or tuple comma separated numbers. i've been digging around on stacked, maybe can't find correct way phrase question because keep finding ways conver tuples lists , vice versa. this have. received email list series of numbers (but several hundred more): 417985 417986 417987 417988 417989 417990 i use numbers query database, so: number in (417985,417986,417987,417988,417989,417990) is there way in python convert series of numbers canget comma separated values in query? fyi, lot of python, that's comforable, other method interested hear. if going use these numbers in sql query, need generate sql parameters rather build query string. you'd read lines , turn sequence (a list do) of integers: numbers = [int(line) line in email_lines] you generate query enough placeholders each of values: statement = "select * table number in ({0})".format( ', '.join(['?' *

jquery - javascript code is not executing correctly locally, but works in JS Fiddle -

this question has answer here: works in jsfiddle not on live site 1 answer why jquery or dom method such getelementbyid not find element? 6 answers i have simple html file looks this: <html> <head> <script src="jquery-1.11.1.min.js"></script> <script src="mainscript.js"></script> </head> <body> <button id = "thebutton" type="button">click me!</button> </body> </html> mainscript.js looks this: $("#thebutton").click(function() { alert( "handler .click() called." ); }); nothing happens when click though. if put alert js file happen. if run snippet of js in console, when click button work. i've tes

ios - Send notification when iPhone is turned on or off -

is there way send notification when power button pressed "turn on" or message server if power button pressed "turn off"? no, not possible. can detect app going background or foreground , more not this.

SQL Server 2008 Split 1 column into 3 (Shipping dimensions) -

i have table with 1 column product dimensions. example rows: 16" l x 22" w x 6" h 22.5" l x 12" w x 9" h i trying length, width, , height separate columns. have use sql because being used in software integration accepts sql statements. thinking have go route of regex. sql statement data far select top 10 [id] ,substring([ship_dimensions],patindex('%[0-9] \"%',[ship_dimensions]),2) length ,substring([ship_dimensions],patindex('%[0-9] \"%',[ship_dimensions]),2) width ,substring([ship_dimensions],patindex('%[0-9]*\"%',[ship_dimensions]),2) height [part] i need output length | width | height 16 | 22 | 6 22.5 | 12 | 9 any suggestions appreciated. one way follows: select left(dim, charindex('" l', dim)-1) [length] , substring(dim, charindex('" l', dim)+6, charindex('" w', dim)-charindex('" l x ',

jquery - SVG text background image problems -

so i'm designing photo frame designer. can find here . want when 1 of patterns (under solid blocks of colour under text design) clicked text on frame changes have background pattern's image. understand svg uses fill attribute , need make pattern. @ minute. want this need able called on click. here code. can find full code on website though. <defs> <pattern id="patt1" patternunits="userspaceonuse" width="1246" height="1000"> <image xlink:href="images/pattern1.jpg" x="0" y="0" width="1247" height="751" /> </pattern> </defs> <text class="text" transform="matrix(2.4428 0 0 1.5 624.6 550.5599)" font-family="'comicsansms'" font-size="41.6368">your words here</text> and $("#pattern1").click (function() { $('

Piping to different commands based on exit status in bash -

trying achive like: command | { [[ ${pipestatus[0] == 0 ]] && cmd_pipe_success || cmd_pipe_failed ; } e.g. piping different commands, depending on exit-status. the above exmaple didn't works, e.g.: command_ok() { sed 's/^/ok /'; } command_no() { sed 's/^/no /'; } touch x ls -l x 2>&1 | { [[ ${pipestatus[0]} == 0 ]] && command_ok || command_no ; } rm x ls -l x 2>&1 | { [[ ${pipestatus[0]} == 0 ]] && command_ok || command_no ; } both prints ok , in both cases runs command_ok . is possible achieve run command_no when exit-staus of ls nonzero? i know, possible achieve like command_ok() { sed 's/^/ok /'; return 0; } command_no() { sed 's/^/no /'; return 0; } touch x res=$(ls -l x 2>&1) [[ $? == 0 ]] && command_ok <<<"$res" || command_no <<<"$res" rm x res=$(ls -l x 2>&1) [[ $? == 0 ]] && command_ok <<<"$res"

Spring AMQP/RabbitMQ transaction rollback in EJB3 CMT -

i trying test rollback of transaction initiated ejb3 container, involves spring jpa repository call , message sender rabbitmq using spring amqp integration. after cmt rollback see db transaction gets rolled back, message getting delivered queue. i injecting spring bean ejb makes call rabbit template , has @transactional annotation. see transactioninterceptor committing transaction after spring bean send message call. hoping delegate commit container. any suggestions/workarounds appreciated. wasn't able figure out how initialize transactionsynchronizationmanager without using @transactional annotation. here code committing transaction when spring bean proxy executes transactioninterceptor code: resourceholdersynchronization @override public void aftercommit() { if (!shouldreleasebeforecompletion()){ -- method returns false processresourceaftercommit(this.resourceholder); -- calling commitall } } connectionfactoryutils/rabbitresourcesynchroni

javascript - Undefined fileField/ how to hide image if the fileField is = "" -

a newbie here. apologize in advance grammar, not first language. okay, have form, , includes file field (which optional in validation) show picture user selected (before pressing submit). , yes, works. however, problem is, if go , press file field again, press 'cancel', unselect selected file shown image won't go away. way user won't confused if change mind selecting image. used javascript showing image after user selects. so here's code (i'll try exclude irrelevant parts): <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script> function showimage(input) { if (input.files && input.files[0]) { var reader = new filereader(); reader.onload = function (e) { $('#newimage') .attr('src', e.target.result) .width(90) .height(90);

javascript - Create Map sample that clicks into the actual map -

Image
i trying build prevents users clicking on interactive aspects of map until click map shown when google search place toronto eaten centre. i did visual mock better explain: i using google maps , not able div float on google maps (which first attempt @ creating having div float on when clicked on disappear , map resize via javascript). google when search location example found here . here fiddle trying float div on top use click actual map. below css of floating div not show above map absolute position , z-indexes .map-floater { position: absolute; z-index: 3; height: 280px; width: 100%; background: #555; opacity: 0.7; } your markup isn't right, put overlay in same container map <div class = "map-holder"> <div class = "map-floater"> </div> <iframe src="path/to/map" width= "100%" height = "380px" frameborder="0"/> </div> demo

algorithm - Permutation of a numbers in array to sum a number -

this question has answer here: how count possible combination coin problem 14 answers i have given array.and want find permutation of array sum specific numbers. example array =[2,3,5 ,1] target = 8 `solution: [2,2,2,2] ,[5,3] ,[3,3,2] ,[5,2,1] , possible combination please provide me approach solve problem , problem facing how handle repetition of elements.target large number of 10^6. think same as this theory you facing typical subset problem . worst case complexity of problem exponential no matter how put it. might find polynomial-time approximations work wonders average case though.

ruby on rails - How to setup this association in Factory Girl -

first time doing testing/using factory girl , i'm confused. i've got model called partnerships , has has_one relationship model called schools. partnership model: class partnership < activerecord::base has_one :school end school model: class school < activerecord::base attr_accessible :name belongs_to :partnership end school factory: factorygirl.define factory :school name "elementary school" end end partnership factory: factorygirl.define factory :partnership association :school factory :partnership_for_school after(:create) |partnership| partnership.school factorygirl.build(:school) end end end end in spec file, tried create simple test: describe "partnerships" "should able create partnership school" school_partnership = factorygirl.create(:partnership_for_school) school_partnership.school_id.should_not be_nil end end bu

intellij idea - How do I bring back a clicked on "easier to read code display"? -

i notice idea has ability render "raw" type parameters in java in such way easier read. if have class class margininfo { margininfo( boolean top, boolean right, boolean left, boolean bottom ) { when calling it, actual code is new margininfo( true, true, true, true ); but renders as new margininfo( top: true, right: true, left: true, bottom: true ); once click on rendered code, rerenders actual code. after clicking code, if editing elsewhere stays actual code. there way idea have signature go rendering in "easier read" format after clicking? (also feature have name?)

java - Map which allows to provide the equals-comparator and the hashing function separately -

while trying model polynomials, in particular multiplication, run following problem. during multiplication, individual monomials of 2 polynomials multiplied , of course in can happen have (3x^2 y + 5x y^2) * (x + y). result contains 3x^2 y^2 , 5 x^2 y^2, want combine addition right away. naturally use part x^2 y^2 of monomial key in (hash) map add different coefficients (3 , 5 in example). monomial object envisage should naturally contain coefficient, should not part of map key. of course write equals/hashcode of monomial object such ignore coefficient. feels wrong, because mathematically monomial equal 1 if coefficients equal. introducing coefficient-free monomial object intermediate operations not right. instead of using map, use list , use binary search dedicated comparator ignores coefficient. short of implementing map not use keys' equals/hashcode, dedicated one, there better ideas of how fuse monomials? consider using treemap , sortedmap and map . can

java - Different behavior on ubuntu and windows using libgdx -

i'm trying develop simple client / server game. server stores players data , sends them when requested or when data changes (player position, name etc) while client displays players connected server. graphic aspect simple: square representing player can move in 2d. i'm running server , client on ubuntu, while other client runs on windows. noticed when move windows player corresponding square moves smoothly on ubuntu side, while when move ubuntu square there lag when windows displays other pc's player. i thought happened because of bad connection or poor server optimization, because smoother client 1 running on same machine of server. but noticed if move both windows , ubuntu player, lag disappears , movement become smooth on both sides. this main method on client: public void render () { if(updatelistneeded && islogged) { //if game started update players list client.requestlist(); updatelistneeded = false; } player.update();

r - Small multiples line plot -

Image
i trying create small multiples line plot data frame looks this: time b c d 2013-01-01 69.23580 8.708641 nan 3.452663 2013-02-01 69.46016 8.353662 nan 4.601604 2013-03-01 69.62315 9.156498 nan 3.953704 2013-04-01 71.04144 7.817074 nan 3.762032 2013-05-01 74.29557 7.971487 nan 4.475369 i ideally want 4 plots on single graph showing line plots each of variables in data frame. using following code (after melt ing data frame) gives me weird results. q <- ggplot(data=temp) + geom_line(aes(x=time, y=value, color=variable), size = 1) + facet_grid(variable~value) + xlab("time") any in regard appreciated. i don't know if think using facet_wrap function. and scales argument change scale since fixed default option. should scales fixed ("fixed", default), free ("free"), or free in 1 dimension ("free_x", "free_y") data_text <- " time b c d 20