Posts

Showing posts from May, 2013

VIM: swap two columns separated by space -

i have 2 columns: cats dog dog cats i want swap 2 columns: dog cats cats dog using vim how this? my first idea, substitution, ended looking birei's went awk (that don't know much) used filter: :%!awk '{print $2, $1}'

normalization - Is there a library for normalizing postal codes? -

users of application asked country , postal code. want use postal codes key in data store. because postal codes entered user can have been entered in different forms. example canadian user might have entered: a1a 1a1 a1a 1a1 a1a1a1 a1a 1a1 etc... now can make normalization function canadian postal codes chooses 1 canonical form (for example, uppercase without spaces) , convert postal codes canonical form before saving db key. but, covers canada. don't want reinvent wheel. there library or api out there can normalize (and possibly validate) postal codes (or many) countries? thanks! the important thing remember postal codes not countries have them, , addresses added, updated or removed, post codes can re-coded. with in mind, if want ensure data you're capturing accurate, best solution use paid third party library or web service validate this. there number of companies provide services validate entire address, , not post code. these vary in global co

javascript - Error using textjs plugin -

i'm using textextjs(dot)com plugin make auto complete form want make "textarea" preload values eg: have value "music","dance","pop" , want insert when page loaded "automatic value". i've tried load using code nothing happens: $(document).ready(function(){ $(".text-wrap input[type=hidden]").val('["dance","music","pop"]'); }); this link can see better i'm making @ top "textarea" preload values

Loading large values of data from php to javascript? -

i read question php array loading javascript see can load large amount of data php javascript, seems may have implemented wrong. javascript processes , formats data after comes in php loads data database, data placed client-side session storage data can worked each page. (if there better way please let me know). this in 1 .php file. <?php session_start(); require_once 'classes/membership.php'; $membership = new membership(); $confirmation = $membership->confirm_membership(); if ($confirmation){ $data = $membership->get_data("assump"); echo '<script>var data = '.json_encode($data) .';</script>'; } ?> this in separate .js file function loaddata(){ // sessionstorage can accessed javascript file for(var = 0; < data.length; i++){ sessionstorage.setitem("assump" + i, data[i]); } } however no values being loaded. possible do? edit: moved javascript .php file var da

hibernate - How To Delete Rows From Temp Table With EntityDelete In CFSCRIPT -

if have array of entities loaded temp relation using ormexecutequery() , how can use entitydelete() delete entities. i have tried entitydelete( temparr ) not work. however, able iterate through array , add each entity additional info new final relation. here cfscript code: temparr = ormexecutequery( "from temp cartid=#form.cartid#" ); transaction { for( i=1; lte arraylen(temparr); i=i+1 ) { reg = entitynew( "register" ); reg.setfirstname( temparr[i].getfirstname() ); ........ entitysave( reg ); ormflush(); } entitydelete( temparr );//<<== not deleting entities } error: - object passed not valid entity. use entitydelete( temparr[i] ); @ end of for-loop. temparr = ormexecutequery( "from temp cartid=#form.cartid#" ); transaction { for( i=1; lte arraylen(temparr); i=i+1 ) { reg = entitynew( "register" ); reg.setfirstname( temparr[i].getfirstname

python - What are Flask Blueprints, exactly? -

Image
i have read the official flask documentation on blueprints , one or two blog posts on using them. i've used them in web app, don't understand or how fit app whole. how similar instance of app not quite? documentation comprehensive seek layman explanation or enlightening analogy spark me. sufficiently perplexed when colleague asked me explain flask blueprint them elected ask here. a blueprint template generating "section" of web application. think of mold: you can take blueprint , apply application in several places. each time apply blueprint create new version of structure in plaster of application. # example flask import blueprint tree_mold = blueprint("mold", __name__) @tree_mold.route("/leaves") def leaves(): return "this tree has leaves" @tree_mold.route("/roots") def roots(): return "and roots well" @tree_mold.route("/rings") @tree_mold.route("/rings/<int:yea

ios - Creating Initializers in Objective-C -

the previous instructions in book reading create designated initializer bnritem class, book walked me through: bnritem.h // designated initializer bnritem - (instancetype)initwithitemname:(nsstring *)name valueindollars:(int)value serialnumber:(nsstring *)snumber; bnritem.m - (instancetype)initwithitemname:(nsstring *)name valueindollars:(int)value serialnumber:(nsstring *)snumber { // call superclass's designated initializer self = [super init]; // did superclass's designated initializer succeed? if (self) { // give instance variables initial values _itemname = name; _serialnumber = snumber; _valueindollars = value; // set _datecreated current date , time _datecreated = [[nsdate alloc] init]; } // return address of newly created initialized object return self; } the book explained init method gets inherited brnite

mysql - How to setup relationship between tables In phpMyAdmin -

the question have is, when create table example: table1 following columns: customerid customername address state where customerid primary key auto_increment . and table2 example columns: purchaseid customerid product cost where primary key purchaseid , foreign key customerid table1 . it should mean established relationship between table1 , table2 using customerid . both these tables empty wrote sql command: insert table1 (customername,address,state) values('value1','value2','value3') this works fine, when try insert child table ( table2 ) tells me: error foreign key constraint so want insert parent table child table customerid shows in table2 (child table) foreign key , corresponds customerid in table1 (parent table). do have create 2 tables first without foreign key try establish relationship. keeps saying there constraint long relationship there. the table2 foreign key constraint means table2 cust

asp.net - DropDownList always returns first item in Iron Speed -

i using dropdownlist in iron speed. problem returns first item in selection, though use page.ispostback. code: protected overrides sub populatepaidbycompperioddropdownlist( _byval selectedvalue string, _byval maxitems integer) me.paidbycompperiod.items.clear() if (not page.ispostback) dim connectionstring string = configurationmanager .connectionstrings("database").connectionstring dim conn new sqlconnection(connectionstring) conn.open() dim comm sqlcommand = new sqlcommand("select distinct periodnumber, convert(varchar(10), perioddateto, 23) payrolldate, year(payrolldate) yeardate payroll order payrolldate desc", conn) dim reader sqldatareader = comm.executereader while reader.read paidbycompperiod.items.add(new listitem(monthname(month(cdate( reader.getstring(1)))) & " " & d

jquery - Knockout select dropdown disable item -

currently i'm able enable/disable entire drop down using enable binding in knockout. when enable = false, whole drop down no longer clickable, , user cannot see other possible values in drop down. <select data-bind="options: optionslist, optionstext: 'key', optionsvalue: 'value', value: fieldvalue, enable: enable"></select> what got rendered this: <select disabled=""></select> what i'm hoping render this <select> <option disabled="disabled" value='1'>one </option> <option selected="select" value='2'>two </option> <option disabled="disabled" value='3'>three </option> </select> this way can still see options disabled user can't change them. i have looked @ optionsafterrender in knockout, no longer have access selected value. item passed in key , value of select item, not observable. any a

regex - Find a inner text between 2 symbols and replace inner text using regular expressions in php -

i've been googling , trying myself can't , headache. have string: "estamos en el registro {id} cuyo contenido es {contenido} por lo que veremos su {foto}" i need replace {value} $value getting string this "estamos en el registro $id cuyo contenido es $contenido por lo que veremos su $foto" it posibble using regular expressions in php thanks in advance answer do this: $replaced = preg_replace('~{([^}]*)}~', '$$1', $yourstring); on the demo , see substitutions @ bottom. { matches opening brace } matches closing brace in ([^}]*) , parentheses captures group 1 [^}]* ... [^}] negative character class means 1 char not closing brace, , * quantifier means 0 or more times $$1 replaces match literal $ , content of capture group ( $1 )

printing - How to grab print content in Print Monitor API & save it to a file? -

my requirement: user click 'print' button in software can implement following jobs: save print job pdf/jpeg/bmp on hard disk. send print job printer , print. i learning print monitor sample in few days, following msdn's wdk port monitor samples, don't know grab print content, acorrding msdn, port monitor send raw data kernel-mode port driver, i know lcmstartdocport() calls createfile(), lcmwriteport() calls writefile(), seems these 2 function communication "kernel-mode port driver"? it seems need grab raw data & save local disk? any suggestion? thank you!

java - Where should scanner go in this program? -

i'm working on program takes input of 2 numbers , different calculations. have twonumbers class several different methods calculate sum, distance, average, etc. should put scanner in class, or should put in main method? i know basic i've been learning java couple weeks , i'm having hard time finding how should done/how input correlate instance variables , firstnumber , secondnumber public class twonumbers{ private double firstnumber; private double secondnumber; public double getsum() { double sum = firstnumber + secondnumber; return sum; } public double getdifference() { double difference = firstnumber - secondnumber; return difference; } public double getproduct() { double product = firstnumber - secondnumber; return product; } public double getaverage() { double average = (firstnumber + secondnumber) / 2; return average; } public double getdistance() { double distance = math.abs(firstnumber - secondnumber); return d

python - how to simplify boolean logic in if else statement? -

i have 4 variables, of them true , false, , each combinations, have call 1 or few functions. using if else statement each case , know if there nicer way same result dictionary or else. thank you here code : if (self.cpe_ip , self.cpe_passwd) , self.phone , self.pppoe: print "launch isp portal, modem , radius" if self.isp() == "east": self.launchbell() else: self.launchtelus() print 'check modem...' self.modemstatus() radius = sgp_radius.radius(self.pppoe) print 'check radius logs...' self.data = radius.sgp() self.radius_save() #exit(0) elif (self.cpe_ip , self.cpe_passwd) , not self.phone , not self.pppoe: print "launch modem test only" self.modemstatus() #exit(0) elif not(self.cpe_ip , self.cpe_passwd) , self.phone , not self.pppoe: #print "only bell portal" if

javascript - angular resolve returns function instead of value -

i trying refactor code out of controller , route's 'resolve' , having trouble getting correct return value resolve . think problem either due misunderstanding of js closures or $q library in angular. in routing: .when('/countries/:id', { templateurl: 'country/country.html', controller: 'countryctrl', resolve: { activecountry: ['countrydata', '$q', '$route', function(countrydata, $q, $route) { var defer = $q.defer(); countrydata($route.current.params.id).then(function(data){ console.log(data); defer.resolve(data); }); return defer.promise; }] } }) the console.log in block returns correct json object api call. however, when passed controller, controller returns function countrydata service: .controller('countryctrl', [ 'countrydata', '$routeparams', '$scope', function (

mongodb - grails mongo transaction rollback with save(flush:true)? -

i have issueinstance , has many issueiteminstances, and 1 issueiteminstance has 1 receiptiteminstance(many-to-one), when issueinstance.save(flush:true, failonerror:true), i'd recalculate receiptiteminstance.quantity looping issueiteminstances other saved issueiteminstance.quantity(many-to-one), and when !receiptiteminstance.validate()(e.g. quantity big), i'd rollback, but seems doesn't work 1.static transactional = 'mongo' , 2. issue.withtransaction when throw exception,the issueinstance , issueiteminstances not deleted. if save(), it'd not recalculate correct because issueiteminstance not saved yet. is there hint or way manual? i use mongodb gorm ':mongodb:3.0.1' thank much, mark use: issue.withtransaction { status -> issue issueinstance // issue instance def receiptiteminstance // receipt item instance if (!receiptiteminstance.validate()) { status.setrollbackonly() return // exit

onedrive music Meta data -

i make application live connect rest api. when uploaded korean music files, saw problem. the metadata of korean music files encoding, metadata broken. i did next process. i uploaded music file which's metadata encoded "utf-8" i requested file's information.that broken. i uploaded music file which's metadata encoded "utf-16" i requested file's information.that ok. what encoding type possible in skydrive server?and how can proper metadata? even though question on year old, think have answer. appears onedrive/skydrive support id3v2.3 iso-8859-1 format, , not utf8 or utf16. experienced adding tracks updated id3 tags, , tracks show proper album artist , ones updated did not. i'm using mp3tag edit tracks, defaults id2v2.3 utf16. when changed iso-8859-1 format, onedrive reads id

c# - How to upgrade WinForm infragistics v12.1 to 14.1 -

i have add new infragistics references version 14.1 references(v12.1) using utility , when add references new version got errors... "error 6404 type or namespace name 'infragistics' not found (are missing using directive or assembly reference? ...etc" it still finding references of old version after installing infragistics 2014, should see menu item in visual studio called infragistics. click on , click on check updates. scan projects old references, , upgrade namespaces , controls latest versions. click on upgrade button next each project comes in list. remove errors.

Magento - Importing Configurable Products -

can provide example csv on basis of following instructions magento import configurable product? http://www.magentocommerce.com/knowledge-base/entry/importing-configurable-products you should use magmi. http://sourceforge.net/projects/magmi/ it separate application. so, need upload magmi folder under main magento folder.

c - Segmentation fault -

adds node ascending ordered linked list i have seen similar stuff here didnt me. please correct me wherever wrong. #include<stdio.h> #include<stdlib.h> struct node { int data; struct node* link; }; struct node* head = null; void add(int); void print(); int main() { add(1); print(); add(2); print(); add(5); print(); add(4); print(); add(3); print(); return 0; } ***/* if list empty or if new node inserted before first node*/*** void add( int num) { struct node* temp; temp = head; struct node* newnode = (struct node*)malloc(sizeof(struct node)); newnode->data = num; newnode->link = null; if((head == null)||( head->data > num)) { newnode->link = head; head

html - QTextBrowser SetHtml gives blank screen randomly -

i have developed application in need generate slip containing information entered user. show slip, created new widget screen on used qtextbrowser display information. i have used qtextbrowser->sethtml display information, format information etc.the information includes "the hard coded titles" "information stored in database sqlite" . its running fine on system (pc) when uploaded on friends system (pc), got blank slip. happens few slips starts displaying slip. here's function :- void printrecieptinfo::createhtml() { htmlstring.clear(); const qstringlist childgroup = settings->childgroups(); if (childgroup.length() < maxgroupinrecieptsettings){ return; } initrecieptinfo(); htmlstring = "<table align='center' border='yes' width='450'>"; if (ritem[1].status){ if ((ritem[0].status) && (ritem[0].text != "")){ htmlstring.append(

java - Creating Vertical Scrollable Pane for JPanels -

Image
i trying make jscrollpane contains jpanels have charts jfreechart api. generatechartpanel method return charts in jpanel can make bunch of them. far have in main: public static void main (string[] args){ jframe main = new jframe(); main.setlayout(new borderlayout()); main.setpreferredsize(new dimension(500,500)); //creates specframe jscrollpane specscrollpane = new jscrollpane(); jpanel container = new jpanel(); container.setlayout(new gridlayout()); container.add(generatespecpanelfromsmiles("c")); container.add(generatespecpanelfromsmiles("cc")); container.add(generatespecpanelfromsmiles("ccc")); container.setvisible(true); specscrollpane.setvisible(true); specscrollpane.add(container); main.add(specscrollpane); refineryutilities.centerframeonscreen(main); main.setvisible(true); when run this, nothing shows up. apparently can't pack, setcloseop, setlayout, or center these pa

c# - why introduce a temp variable? -

this question has answer here: c# events , thread safety 15 answers i saw lot of following usage of event handler. why assign handler local variable , use local variable? event eventhandler propertychanged; private void raisepropertychanged(string propertyname) { var temp = propertychanged; if (temp != null) temp(this, new propertychangedeventargs(propertyname)); // why not "if (propertychanged != null) propertychanged(...)" } the temporary variable ensures thread safety, because between check , actual call other thread may unsubscribe event result in nullreferenceexception . eric lippert has a great article on this

eclipse - Can I use Git from the command line to manage an Android Project? -

i know eclipse has built in git integration, i'm used quick, simple git commands command line. does eclipse manage git repository differently done through command line? even having git in eclipse still use command line git. operation have managed right in eclipse adding new files index. in other cases using command line easier fighting ui. me. the main reason have git in eclipse (i hope) manages understand "sudden" changes source files happen when change working tree command line. it's easier close eclipse, git work (bisect, or rebasing example), launch eclipse again.

c++ - How to use inheritance for a class with TEST_CLASS in CppUnitTestFramework -

i've got class inherits class so: class testclass : public baseclass i wondering if possible make test class using test_class macro or other macro part of microsoft unit testing framework c++. tried: class test_class(testclass : public baseclass) but ide gives error 'error: expected either definition or tag name' , compiler error error c3861: '__gettestclassinfo': identifier not found i know it's bad practice inherit on test class make implementing test easier. relatively new c++ wondering if simple have missed or if it's not possible. thanks, there 1 other option didn't include , others may tripping on question without knowing solution. you can derive arbitrary type looking @ macro itself: /////////////////////////////////////////////////////////////////////////////////////////// // macro define test class. // note can define test class @ namespace scope, // otherwise compiler raise error. #define test_class(classname) \

python - how to call function in paramiko -

for transfer entire folder server using sftp paramiko. copy code stackoverflow but doubt how call function, put .. sftp = paramiko.sftpclient.from_transport(t) m = mysftpclient() m.put_dir() m.mkdir() but throwing error: *** caught exception: <type 'exceptions.typeerror'>: __init__() takes 2 arguments (1 given) the error message indicates function calling takes 2 arguments while sending zero. try doing instead: t = paramiko.transport(("ftpexample.com", 22)) t.connect(username = myusername, password = mypassword) sftp = paramiko.sftpclient.from_transport(t) use sftp client upload file @ localpath (e.g. /usr/tmp/test.png") remote path: sftp.put("localpath","remotepath")

php - PhpStorm 7 align consecutive combined operators and assignments -

code style of php in phpstorm v7 can align consecutive assignments. there way make align combined operators well? example: $a = 1; $a *= 2; $foo = 2; should become: $a = 1; $a *= 2; $foo = 2; there plugin can install via browse repositories button on plugins part of settings window called front end alignment. once it's installed have command called regex align under code drop down. don't know except can highlight code want align , execute command. bring window , entered equals sign , hit ok , align code based on farthest equals sign. i'm new phpstorm , found plugin i'm sure more should @ least started. hope helps.

java - Scout crash at launching SWT -

Image
i have strange error in scout eclipse. college push cone in git , pull out. on computer works well, on mine it's error when launching swt. error : !entry org.eclipse.e4.ui.workbench 4 0 2014-06-26 09:44:21.234 !message unable create class'org.eclipse.e4.ui.workbench.swt.util.bindingprocessingaddon' bundle '72' !stack 0 org.eclipse.e4.core.di.injectionexception: java.lang.linkageerror: loader constraint violation: when resolving method "org.eclipse.e4.ui.bindings.internal.bindingtable.addbinding(lorg/eclipse/jface/bindings/binding;)v" class loader (instance of org/eclipse/osgi/internal/baseadaptor/defaultclassloader) of current class, org/eclipse/e4/ui/workbench/swt/util/bindingprocessingaddon, , class loader (instance of org/eclipse/osgi/internal/baseadaptor/defaultclassloader) method's defining class, org/eclipse/e4/ui/bindings/internal/bindingtable, have different class objects type org/eclipse/jface/bindings/binding used in signature @ org.e

android - how to use Shared Prefrences -

i want know how use shared prefrences .... problem using shared prefrence ...i m not filling in edit text if condition not working ...when pressed without filling in edit text ..curser going next activity if condition not working debugger showing no value not null..if filling information degugger showing me value have entered here code public class signupe extends activity { sharedpreferences pref; context context; editor editor; button nexttofinish; edittext fulname,username,datofbirth,email,password; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.signupe); pref=getapplicationcontext().getsharedpreferences("mydata", context.mode_private); nexttofinish=(button)findviewbyid(r.id.nexttofinish); fulname=(edittext)findviewbyid(r.id.fulname); username=(edittext)findviewbyid(r.id.user_name); datofbirth=(edittext)f

PHP : Unknown encoding in CSV file -

i'm kinda new encoding issues i have csv file client , can't figure out how encoded i have "é" accents appears � in vim or openoffice, when try encode them utf8 using mb_convert_encoding( $string, "utf-8" ) or utf8_encode($string) "�" i tried latin encodings (iso-8859-1, iso-8859-15) utf8 iconv , mb_convert_encoding i tried method found convert cp1250 utf8 , 1 macintosh utf8 still no luck. there way find solution without asking client change csv encoding utf8 ? thanks lot ! edit in order find correct encoding parsed encodings listed in mb_list_encodings() , tried convert utf-8 each of them. none of them render "é". i'll ask client use utf-8 when exports csv using vim hexadecimal value of wrong character can � character in file , encoding issue client-side you need know encoding file in, period. if don't know that, try view document bunch of different encodings (e.g. in text editors have option of fi

zsh - Iterate over a range shell -

for in bar b in 1000000 montage -geometry 500 $a-$b-*-${0..20000..1000}.png \ $a-$b-${0..20000..1000}-final.jpg done done i'm unable images number 0 1000 2000 ... 20000 using $(0..20000.1000) . is there other way in shell this? there must no $ before {start..end..step} % echo -{0..20000..1000}- -0- -1000- -2000- -3000- -4000- -5000- -6000- -7000- -8000- -9000- -10000- -11000- -12000- -13000- -14000- -15000- -16000- -17000- -18000- -19000- -20000- that being said, need loop go on these numbers. word containing range replaced expansion. means command line not called each element alone, of them together. means, that, if using same range twice, expansion not conveniently combined. compare % echo start a-{1..3}-b a-{1..3}-b end start a-1-b a-2-b a-3-b a-1-b a-2-b a-3-b end and % n in {1..3}; echo start a-$n-b a-$n-b end; done start a-1-b a-1-b end start a-2-b a-2-b end start a-3-b a-3-b end

servlets - Filter not invoked for files outside /WEB-INF folder -

everything fine on localhost! using tomcat 7.0.53, having css, js, images resources out of web-inf folder. accessing them : ${pagecontext.request.contextpath}/resources/css/file.css in web.xml file have filter witch trying set response header resource files <filter> <filter-name>thefilter</filter-name> <filter-class>packages.thefilter</filter-class> </filter> <filter-mapping> <filter-name>thefilter</filter-name> <url-pattern>/ressources/*</url-pattern> <url-pattern>*.png</url-pattern> <url-pattern>*.gif</url-pattern> <url-pattern>*.jpg</url-pattern> <url-pattern>*.jpeg</url-pattern> <url-pattern>*.css</url-pattern> <url-pattern>*.js</url-pattern> </filter-mapping> as said works fine on localhost. once online filter caches declared servlet urls! must sai have 2 others filter needed app work, cause i'm using struts2 3.16.

javascript - Selected value for angular select not be set on page refresh -

the selected value of angularjs select not being set on page refresh. it is set if navigate different view , navigate again. the model select saved local storage , initialized scope onload. i have checked data in scope same in 2 situations of navigating away , again, , refreshing page. data same. after lot of investigation, see when select pristine, or when page refreshed , select list have blank option, first 1 below value ? : <select ng-model="question.answer" class="form-control" ng-options="opt opt.value opt in question.options" > <option value="?" selected="selected"></option> <option value="0">1</option> <option value="1">2</option> </select> note above html output. angular view has: <select ng-model="question.answer" class="form-control" ng-options="opt opt.value opt in question.options" /> i&#

javascript - Wordpress wont find files -

i installed wordpress on , want landing page display, modified html templates , sliced them index.php , header.php , footer.php , sidebar.php . i put style.css in theme root, , there images in img , image directories, additional css in css directory, , javascript , jquery in js directory. my problem wordpress doesn't load of files. template, , when click on 1 of them in source got error 404 . i tried change permissions, tried several ways of including files, tried find on google, , today deadline, got project yesterday, appreciated. thanks. you might not added <?php bloginfo('template_directory') ?> in template have added js , css.. must add in url work.. e.g. <script type="text/javascript" src="<?php bloginfo('template_directory') ?>/js/jquery.easing.1.3.js"></script> <link rel="shortcut icon" href="<?php bloginfo('template_directory') ?>/images/favicon.ico"

java - Spring:Propagation.REQUIRED not working -

i inserting records in couple of tables namely dept , emp . if dept table created want insert records in emp table. also, if of insert in emp fails, want rollback transaction includes both rollback emp dept tables. i tried using propagation.required shown below: java file public void saveemployee(employee empl){ try { jdbctemplate.update("insert emp values(?,?,?,?,?)",empl.getempid(),empl.getempname(), empl.getdeptid(),empl.getage(),empl.getsex()); } catch (dataaccessexception e) { e.printstacktrace(); } } @transactional(propagation=propagation.required) public void saverecords(){ savedepartment(dept); saveemployee(empl); } context.xml <tx:annotation-driven transaction-manager="transactionmanager" proxy-target-class="true"/> <bean id="transactionmanager" class="org.springframework.jdbc.datasource.datasourcetransactionmanager"> &l

ruby - Gems install correctly, but then don't show up in gem list -

i switched rvm rbenv ruby version management, , since i've been running sorts of problems gems. if run gem list lists 10 gems, of system defaults. when run bundle install in project gemfile, lists ton of other gems , says installed. can't run them command line or require them in ruby files! output gem list : *** local gems *** bigdecimal (1.2.0) io-console (0.4.2) json (1.7.7) minitest (4.3.2) psych (2.0.0) rake (0.9.6) rdoc (4.0.0) rubygems-update (2.3.0) test-unit (2.0.0.0) and bundle install using i18n 0.6.9 using json 1.8.1 using minitest 5.3.5 using thread_safe 0.3.4 using tzinfo 1.2.1 using activesupport 4.1.1 using builder 3.2.2 using activemodel 4.1.1 using arel 5.0.1.20140414130214 using activerecord 4.1.1 using bond 0.5.1 using rack 1.5.2 using rack-protection 1.5.3 using rack-test 0.6.2 using ripl 0.7.1 using ripl-multi_line 0.3.1 using ripl-rack 0.2.1 using shotgun 0.9 using tilt 1.4.1 using sinatra 1.4.5 using sinatra-activerecord 2.0.2 using sqli

php - How to save SMTP message to sent folder? -

i working on custom mail template sender. must sent email external host smtp transfer protocol. need connect, sent email , copy/post host's sent folder. i tried phpmailer code doesn't work. class phpmailer_mine extends phpmailer { public function get_mail_string() { return $this->mimeheader.$this->mimebody; }} $mail= new phpmailer_mine(); ... code , body send attachments ... $result=$mail->send(); if ($result) { $mail_string=$mail->get_mail_string(); imap_append($imapstream, $folder, $mail_string, "\\seen"); } phpmailer works $imapstream, $folder , they? how must define them? the problem hosting. changed server , worked out. code above ok :d other too

javascript - Horizontal moving of datalist items should stop on mouse hover -

all items bound datalist sql server without problem, these items should scroll horizontally , should stop on mouse hover. here's code: <div style="width:500px;height:200px;"> <asp:datalist id="itemsdatalist" runat="server"> <itemtemplate> <asp:hyperlink id="itemhyperlink" runat="server" navigateurl="~/webform1.aspx"> <div> <asp:image id="itemimage" runat="server" /> </div> </asp:hyperlink> </itemtemplate> </asp:datalist> <div>

Heroku ruby production error -

i had error occurred in production , wondering have heroku setup or app? this error : argumenterror: invalid %-encoding (\k9Λ|�x� ��(%0i0�z���-g�뒨ڼ) vendor/ruby-2.0.0/lib/ruby/2.0.0/uri/common.rb:898:in decode_www_form_component vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/utils.rb:41:in unescape vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/utils.rb:94:in block (2 levels) in parse_nested_query vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/utils.rb:94:in map vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/utils.rb:94:in block in parse_nested_query vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/utils.rb:93:in each vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/utils.rb:93:in parse_nested_query vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/request.rb:332:in parse_query vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.14/lib/action_dispatch/http/request.rb:275:in parse_query vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/request.rb:209:in post vendor/bundle

xml - XSLT to remove duplicate node and attribute -

need remove duplicate entry in xml using xslt1.0 , how can acheived ? example : below input xml , need unique image element <image source="marginal_links_orange.png"/> <image source="marginal_programme_home.png"/> <image source="marginal_programme_guide.png"/> <image source="marginal_links_orange.png"/> <image source="marginal_programme_home.png"/> expected output : <image source="marginal_links_orange.png"/> <image source="marginal_programme_home.png"/> <image source="marginal_programme_guide.png"/> i think solve problem <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:fo="http://www.w3.org/1999/xsl/format"> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> &

Google Drive SDK "sharedWithMe = false" search query not works -

i'm trying list of folders in "my drive" , requesting " https://www.googleapis.com/drive/v2/files " search query: mimetype = 'application/vnd.google-apps.folder' , trashed = false , 'me' in writers , sharedwithme = false but giving error: { "error": { "errors": [ { "domain": "global", "reason": "invalid", "message": "invalid value", "locationtype": "parameter", "location": "q" } ], "code": 400, "message": "invalid value" } } but when use sharedwithme = true works fine. here https://developers.google.com/drive/web/search-parameters not mentions sharedwithme true check not possible. intended behaviour? is there better way folder listing of "my drive" instead query?

Php code works fine until it's put inside a function -

i mystified. below code works fine if it's enclosed in tags , $data1, $data2 variables gotten via $post. i'd enclosed in function, , if do: function ($input1, $input2) { (then code here) } it fails. variables? or (just guess) can't "require" within function? anyway...here's code. feel simple , syntactic, i'm totally stumped. here's code: //set connection or die returning error. require "connection.php"; echo 'connected'; // make query: $query = "insert message (col1, col2) values ('$somedata1', '$somedata2')"; $result = @mysqli_query ($myconnection, $query); // run query. if ($result) { // if ran ok. echo "success!"; } else { // if did not run ok. echo "error"; } // end of if mysqli_close($myconnection); // close database connection. //free result set. mysqli_free_result($result); //close connection. mysqli_close($myconnec

javascript - Node.js Piping the same readable stream into multiple (writable) targets -

i need run 2 commands in series need read data same stream. after piping stream buffer emptied can't read data stream again doesn't work: var spawn = require('child_process').spawn; var fs = require('fs'); var request = require('request'); var inputstream = request('http://placehold.it/640x360'); var identify = spawn('identify',['-']); inputstream.pipe(identify.stdin); var chunks = []; identify.stdout.on('data',function(chunk) { chunks.push(chunk); }); identify.stdout.on('end',function() { var size = getsize(buffer.concat(chunks)); //width var convert = spawn('convert',['-','-scale',size * 0.5,'png:-']); inputstream.pipe(convert.stdin); convert.stdout.pipe(fs.createwritestream('half.png')); }); function getsize(buffer){ return parseint(buffer.tostring().split(' ')[2].split('x')[0]); } request complains this error: cannot pipe after

c# - Why doesnt assigning a new value to a controls location property change its location at runtime? -

whenever need move control's location on form @ run-time, have assign new values top , left properties! why doesn't location property trick? example should able : private void btn_mousemove(object sender, mouseeventargs e) { if (e.button == mousebuttons.left) { ((button)sender).location = e.location; } } but doesn't work , instead have way: private void btn_mousemove(object sender, mouseeventargs e) { if (e.button == mousebuttons.left) { ((button)sender).left = e.x + ((button)sender).left; ((button)sender).top = e.y + ((button)sender).top; } } those 2 code snippets not equivalent. the mouseeventargs reports coordinates relative to control you've attached mousemove event to, in case button. in first example, e.location 0,0 when mouse located @ top-left corner of button. button's locati

c++ - Cannot write files using ofstream -

i got problem code, want write files path doesn't seems work. here's code: void writeonfile(const char *path) { ofstream filetolog; filetolog.open(path); if (filetolog) filetolog<< "--[[ test ]]\n"; } and call writeonfile that: writeonfile("c:/logs/lua/testing/filename.lua"); but doesn't work. tried without if (filetolog) it's same. me please? your code won't create file if 1 of folders "c:/logs", "c:/logs/lua", "c:/logs/lua/testing" not exist.

android - Binary XML file line #6: Error inflating class com.google.ads.AdView -

my logcat showing such error on adding admob project.i have tried manually adding sdk jar file still doesn't work.my libs folder consist of jars-google-play-services , android-support-v4.i have referred other posts same error nothing works me. logcat 07-02 00:26:42.082: e/androidruntime(26811): fatal exception: main 07-02 00:26:42.082: e/androidruntime(26811): java.lang.runtimeexception: unable start activity componentinfo{com.example.xmlpullparserproject/com.example.xmlpullparserproject.mainactivity}: android.view.inflateexception: binary xml file line #6: error inflating class com.google.ads.adview 07-02 00:26:42.082: e/androidruntime(26811): @ android.app.activitythread.performlaunchactivity(activitythread.java:2184) 07-02 00:26:42.082: e/androidruntime(26811): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2211) 07-02 00:26:42.082: e/androidruntime(26811): @ android.app.activitythread.access$600(activitythread.java:149) 07-02 00:26:42.0