Posts

Showing posts from July, 2013

jQuery UI autocomplete copy input value to another input -

i'm trying copy input value jqui autocomplete input, has autocomplete function enabled. here's have in html <label for="locationfrom">location</label> <input id="locationfrom" /> <label for="locationto">location</label> <input id="locationto" /> and js $(function() { $('#locationfrom, #locationto').autocomplete({ source: [ "airport", "downtown", "street", "city" ], minlength: 0 }) .focus(function() { var self = this; window.settimeout(function() { if (self.value.length == 0) $(self).autocomplete('search', ''); });})}); i tried this, doesn't work $('#locationfrom').change(function() { $('#locationto').val($(this).val()); }); here's fiddle tnx it seems jquery autocomplete dose not fire 'onchange' event; can use autocomplete change event solve

java - Add page title between PdfPTables in iText -

Image
i have number of pdfptable s following each other this: is possible add title on of page(not first page)? believe cant use pdfpageeventhelper because table first on each page needs moved down(to not overlap title). any ideas or tips how can solved? cant figure out how know if there has been new page or not each of tables. public class tabledemo { /** resulting pdf file. */ public static final string result = "first_table.pdf"; /** * main method. * @param args no arguments needed * @throws documentexception * @throws ioexception */ public static void main(string[] args) throws ioexception, documentexception { new tabledemo().createpdf(result); } /** * creates pdf tables * @param filename name of pdf file created. * @throws documentexception * @throws ioexception */ public void createpdf(string filename) throws ioexception, documentexception {

php - Smarter way to update td content in jQuery -

i'm running html , jquery code works looks ugly me. appreciate suggestion more smarter. goal: update cells of php generated table using input field. each cells contains basic value should multiplied input. currently, read value of input, take basic value of each cell hidden input , rewrite whole html of each cell ( hidden input + updated data). html code: <table id='tbl'> <thead> <tr> <th colspan="2">quantity: <input type="text" id="quantity" name="quantity" value="1"> </th> </tr> </thead> <tbody> <tr> <td> <input name="1_1" type="hidden" value="11"><span>11</span> </td> <td> <input name="1_2" type="hidden" value="12&qu

C# - remove part of listbox items -

i have listbox has collection of files directory , need remove extension them. m4a format should make bit easier. have searched , cannot find solution. i new programming , appreciate help. if request example appreciate , please use lstsong instead of placeholder because confused whats placeholder , not in examples. as requested code writes it: string[] songspaths = system.io.directory.getfiles(librarypath + "/" + albumpath + "/" + songpath); list<string> listsongs = new list<string>(); foreach (var f in songspaths) { string songs = f.split('\\').last(); lstsong.items.add(songs); } i unsure how code works. understand of written friend me. why going afterwards. again. understanding comment need filename of files, without path or extension. can use path.getfilenamewithoutextension string[] songspaths = system.io.directory.getfiles(librarypath + "/" + albumpath + "/" + songpath); // files specifie

converting html to php with sql-query -

i want convert following code html file php file , print following code: html <!-- begin search box --> <form method="post" action="./index.php" accept-charset="utf-8" method="post" id="clinic-finder-form" class="clear-block" class="clear-block"> <input type="text" maxlength="128" name="address" id="address" size="100px" value="" class="form-text" autocomplete="off" /> <?php // support unicode mysql_query("set names utf8"); $cats = $db->get_rows("select categories.* categories categories.id!='' order categories.cat_name asc"); ?> <select name="products" class="" id="edit-products"><option style="width:100%;" val

javascript - Adding php loop data to js array -

i have php loop loops through products , data: <?php foreach ($this->products $product) { ?> <script type=text/javascript> product = { id: $product->virtuemart_product_id, name: $product->product_name }; </script> <?php } ?> the data contains information product un $product so: $product->virtuemart_product_id $product->product_name is possible add data existing javascript array or object in each of loops? add data of loop javascript array or product. any appreciated :) there more better , clean way, use json_encode php <?php $data = array(); foreach( $this->products $product ) { $data[] = array( "id" => $product->virtuemart_product_id, "name" => $product->product_name ); } ?> html <script type=text/javascript> var product = <?php echo json_encode( $data ) ?>; </script> you can use var product = <?php ec

java - Why is ReadOnlyDoubleProperty not a Double? -

i found javafx piece of code on internet doesn't compile. tableview.widthproperty().addlistener(new changelistener< double >(){ @override public void changed(final observablevalue<? extends double> observablevalue, final double adouble, final double adouble2) { //to change body of implemented methods use file | settings | file templates. } }); the error shown intellij is: cannot resolve method 'addlistener(javafx.beans.value.changelistener<'java.lang.double>)' on other hand, compiles , works great. tableview.widthproperty().addlistener(new changelistener<number>() { @override public void changed(final observablevalue<? extends number> observablevalue, final number number, final number number2) { //to change body of implemented methods use file | settings | file templates. } }); as can see difference here new changelistener uses number , not double (which extends

c++ - Qt 5 and QProcess redirect stdout with signal/slot readyRead -

this problem bothering me because should work, sadly not. try achieve read standard output of process , make process handle i.e. print out. the process produces output looks this: #include <stdio.h> #include <stdlib.h> #include <iostream> int main() { (int = 0; < 100; i++) { printf("yes %d\n",i); fflush(stdout); sleep(1); } return 0; } the process started in application this: #include <qprocess> ... qprocess * process = new qprocess; someclass * someclass = new someclass(process); connect(process,signal(readyread()),someclass,slot(onreadyread())); process->start("../test/test",qstringlist()); if (!process->waitforstarted(4000)) { qdebug() << "process did not start."; } ... void someclass::onreadyread() { qdebug() << "reading:" << process->readallstdoutput(); } my expected output be: reading: yes 0 reading: yes 1 ... reading: yes 99

iphone - Can I change the name of my App in iTunes -

i want change 1 of app name approved in itunes , don't want submit new app on app store, wanted change name of it. suppose app name abc , after chaging want xyz. plese share procedure. thanks yes, can change if submit update. you have click on new version of app, can edit "version information" , change name. for more info refer link

javascript - Sencha touch2, data in localstore not getting into localstorage -

model: ext.define('skse.model.placeslocal',{ extend:'ext.data.model', config:{ fields:['id', 'name','icon','required_stamps', 'active_stamps','description', 'campaign_id', 'user_favorites' , 'live_action_number'], proxy: { type: 'localstorage', id : 'local-places-id' } } }); store: ext.define('skse.store.placeslocal', { extend:'ext.data.store', config: { storeid: 'placeslocal', model: "skse.model.placeslocal", sorters: 'name', grouper: { groupfn: function (item) { return item.get('name')[0]; } }, groupdir: 'desc' } }); offline - online store sync: ext.define('skse.store.places',{ extend:'ext.data.store', config:{ autoload:tru

fibonacci - Correction into the right direction C# -

so tried generate fibonacci algorithm in c# however, everytime run code getting error states: the type or namespace name `ilist' not found. missing using directive or assembly reference? i lost..where going wrong? thank you... public ilist<int> generatefibonacci(int toindex) { ilist<int> sequence; sequence.add(0); sequence.add(1); (int i=0; i<toindex; i++) { sequence.add(sequence[i], sequence[i+1]); } return sequence; } i bet miss system.collections.generic , here correct version of program using system; using system.collections.generic; namespace consoleapplication2 { public class program { public ilist<int> generatefibonacci(int toindex) { ilist<int> sequence = new list<int>(); sequence.add(0); sequence.add(1); (int = 0; < toindex; i++) { sequence.add(sequence[i]+ sequence[i + 1]); } return sequence;

c# - select item from listview and cast to my custom object -

i'm trying select object listview , cast custom object this myobject foo = (myobject)mylistview.selecteditems[0]; but give's me compile error error 4 cannot convert type 'system.windows.forms.listviewitem' 'myobject' default listview not data-bindable (i.e. can't assign objects data source of list view). contains listviewitem objects, cannot casted data type. that's why getting error. if want custom object listviewitem need construct manually listviewitem : listviewitem item = (myobject)mylistview.selecteditems[0]; myobject foo = new myobject(); foo.firstname = item.text; foo.lastname = item.subitems[1].text; foo.age = int32.parse(item.subitems[2].text); or can store custom object in tag property of listviewitem , back: listviewitem item = (myobject)mylistview.selecteditems[0]; myobject foo = (myobject)item.tag; btw consider use datagridview supports binding.

Android listview row delete animation -

what best way animate listview row? i keep trying like: final animation animation = animationutils.loadanimation(getactivity(), r.anim.translate_up_fade_anim); animation.setanimationlistener(new animationlistener() { @override public void onanimationstart(animation animation) { } @override public void onanimationrepeat(animation animation) { } @override public void onanimationend(animation animation) { datasource.remove(index); adapter.notifydatasetchanged(); } }); view.startanimation(animation); but animation isn't want. think need animate every other listview row except deleted one, open suggestions. here's sourcee code (for android 4.1 guess). http://developer.android.com/shareables/devbytes/listviewremovalanimation.zip here's link video http://www.youtube.com/watch?list=plwz5rj2ekkc

c# - How to ignore unobserved exceptions with async/await in MonoTouch? -

Image
in previous versions of monotouch, used ignore unobserved exceptions: taskscheduler.unobservedtaskexception += delegate(object sender, unobservedtaskexceptioneventargs e) { console.writeline (e); e.setobserved (); }; whether practice debatable i'd know achieve same effect async / await keywords now officially supported in xamarin.ios 6.4 . here code use testing: async void onclick (object sender, eventargs e) { await task.run (() => { throw new exception (); }); } when run it, debugger pauses in asyncvoidmethodbuilder : i read .net 4.5 supposedly changed behaviour unobserved exceptions don't crash app —but doesn't if exceptions posted uikit synchronisation context can't handle them. is there way ignore unobserved exceptions await in monotouch? this correct behavior of async void methods: supposed raise exception on synchronizationcontext active @ time async void method started. the change mentioned in .net 4.5 dealing

c++ - "Console:: " do not compile -

this code taken http://msdn.microsoft.com/en-us/library/system.console.windowwidth.aspx want compile in gcc compiler. #include<cstdio> #include<string> #include<windows.h> #include<iostream> using namespace system; int main() { int origwidth; int width; int origheight; int height; string^ m1 = "the current window width {0}, , " "current window height {1}."; string^ m2 = "the new window width {0}, , new " "window height {1}."; string^ m4 = " (press key continue...)"; // // step 1: current window dimensions. // origwidth = console::windowwidth; origheight = console::windowheight; console::writeline( m1, console::windowwidth, console::windowheight ); console::writeline( m4 ); console::readkey( true ); // // step 2: cut window 1/4 original size. // width = origwidth / 2; height = origheight / 2; console::setwindowsize( width, height

php - Highchart chart not work on chrome and Firefox -

i have created highchart report, not appear on chrome , firefox browser, appear on ie, when allow activex in ie after chart apper correctly. plz give me reson verysoon wild guess here, i've seen chrome browsers not display highcharts in page loaded via ssl when use cdn hosted scripts. check see if there grey shield icon in address bar. click , select "load unsafe script". a fix include highcharts script on own server, on ssl (https://) it's recommended use highcharts cdn without protocol, , browser pick whichever 1 needs. example: <script type="text/javascript" src="//code.highcharts.com/highcharts.js"></script>

routes - Zend routing (default controller to handle all url) -

at first sorry poor english. want handle requests not match routes custompagecontroller . i trying configure module.config.php this: 'defaults' => array( 'type' => 'zend\mvc\router\http\literal', 'options' => array( 'route' => '/*', // or 'route' => '/user*' example, handling www.site.com/user4 (just example) 'defaults' => array( 'controller' => 'custom_page', 'action' => 'index', ), ), ), to handle queries not match routes must redirect last "defaults" route. not working. you can use errorcontroller alternative this. if controller name not found error code 500. can whatever want on controller (re-route custompagecontroller )

database - mysql query 3 tables -

Image
i'm messing around mysql query on 3 tables , and cant work. the situation: have 3 tables. now try make mysql query based on inputfield, put in "oxid" table "oxarticles" , result should be, articles category article/oxid put in inputfield. example: put "oxid" 2 in inputfield , press submit , result should looks this: lenkrad reifen sitz i tried lot never come close to. made day before query show me categories based on article cant modified , used actual problem. i hope guys can me :) thats far, think not close cause white page. $result = mysql_query("select distinct oxtitle oxarticles inner join oxobject2category b on a.oxid = b.oxobjectid b.oxcatnid in (select oxcatnid oxobject2category oxobjectid = 2)") or die(mysql_error()); ; now got it: the follow querys work: select distinct oxtitle oxarticles inner join oxobject2category b on a.oxid = b.oxobjectid b.oxcatind in (select oxcatind oxobject2category oxob

Remove an attachment in emacs org-mode, rather than deleting it -

i can see commands delete tasks attachments in org-mode after calling dispatcher c-c c-a . there way unattach these files (or directory) project or task? in advance. org-mode 's ways of attaching things putting them in folder associated heading. knowledge, there's no way ask system: file either in folder or isn't. on other hand, open attachment directory c-c c-a f , move file ever want. org-mode 's knowledge, deleted.

windows - Create a backup before deleting each file in a batch file -

i have folder has several files .txt extension. need delete them before need take backup of it. for example, assume have folder following contents: name1.txt name2.txt name3.txt name4.txt after delete, contents of folder should be: name1.txt.bkup name2.txt.bkup name3.txt.bkup name4.txt.bkup how can done? just rename .txt-files .txt.bkup, i.e.: rename *.txt *.txt.bkup if insist on creating backups before deleting (for example, configurable batch file, creating backups may switched off), can copy files before deleting: copy *.txt *.txt.bkup del *.txt

php - How to use the insert_id() with session to insert into other table? -

i struggling whole day this. how use insert_id() first insert function in model? tried sessions, couldn't work. i tried everything. my first insert looks this: $aanbdata = array( 'aanbieding' => $this->input->post('aanbiedingnaam'), 'tekst' => $this->input->post('aanbiedingomschrijving'), 'prijs' => $this->input->post('aanbiedingprijs'), 'conditie' => $this->input->post('aanbiedingconditie'), 'prijssoort' => $this->input->post('prijsopties'), ); $this->db->insert('aanbiedingen', $aanbdata); i tried this: session_start(); $this->session->set_userdata('aanbiedingid', $this->db->insert_id()); but id runs 1 behind on auto increment, when inserted row id=4 session id=3. why? edit: my model functions: public function addaanbieding() { $

Magento: how to echo metatitle in list.phtml -

i want echo content of metatitle under price of each products in grid view of list.phmtl file. used this: echo $this->getlayout()->getblock('head')->gettitle(); but prints current page title under each product. want print product's page title under each product. trying this: echo $_product->gettitle(); but no luck. suggestions? thanks lot you must use $_product->getmetatitle() , , ensure meta_title attribute used in product listing.

java - failed to unmarshall using JAXB -

so, have jaxbcontext jaxbcontext context = jaxbcontext.newinstance(foo.class); referring documentation, if newinstance(foo.class), newly created jaxbcontext} recognize both foo , bar, not foobar class foo { @xmltransient foobar c; bar b; } problem is, when try unmarshall xml foo, like: unmarshaller unmarshaller = context.createunmarshaller(); object obj = unmarshaller.unmarshal(xmlstring); xmlstring representation of foo, unmarshaller fails deliver obj instanceof foo, instead delivers bar instance. (i made simple, problem arises when context knows 5-6 classes) any appreciated!

mysql - Best way to deploy java application on AWS using Netbeans? -

i have publicly accessed database on rds works charm netbeans. deploy java application on aws. simplest way this? use application basic tasks, getting used cloud computing working on small scale. ec2 best bet , possible upload apps google app engine plugin. can use same jdbc driver use locally, , can use jpa against database? rather not use eclipse in bit of hurry , need working possible. this lot of questions 1 question, i'll see if can out. 1. simplest way deploy aws if application simple is, cost effective solution while you're getting used aws deploy micro instance , take advantage of the free tier . amazon: aws free tier includes 750 hours of linux , windows micro instances each month 1 year. stay within free tier, use ec2 micro instances. the simplest way deploy directly netbeans use integrated elastic beanstalk support . saves having configure things yourself. another option launch ubuntu ami , install tomcat. create war file application , plac

Assembly code. Encryption to Decryption Routine -

could take @ me , me work out decryption reverse string has been input user. don't mean doing reverse of procedure. push edx push ecx not eax add eax,0x04 mov edx,eax pop eax xor eax,edx pop edx rol al,1 rol al,1 rol al,1 sub al,0x02 ret * the registers are: inwards- ecx: encryption key. eax: character encrypted. outwards- eax: encrypted character thank taking time look. the algorithm symmetric because decrypt every character , key combination. these 2 functions tested loop error in decrypting value back: #include <iostream> using namespace std; unsigned char enc(unsigned char ch, unsigned char key) { unsigned char tmp = key^(~ch+(unsigned char)0x04); return (( (tmp<<3) | (tmp>>5) ) & 0xff)-0x02; } unsigned char dec(unsigned char ch, unsigned char key) { unsigned char tmp = (ch+0x02); tmp = ((tmp>>3) | (tmp<<5)) & 0xff; return ~((tmp^key )-(unsigned char)0x

java - The index 2 is out of range -

preparedstatement preparedstatement = connectionstring().preparestatement( "select username dbo.logindetails username = ? , password =?"); string user = tf_fname.gettext(); string _pass = new string(tf_lname.getpassword()); preparedstatement.setstring(1, user); preparedstatement.setstring(2, _pass); resultset resultset = preparedstatement.executequery(); while (resultset.next()) { system.out.println("username "+ resultset.getstring(1)+"password "+resultset.getstring(2)); } without +"password "+resultset.getstring(2) it works fine, printing username database throws error. com.microsoft.sqlserver.jdbc.sqlserverexception: index 2 out of range. select username ..................... you have 1 column in select clause. change select username, yourpasswordcolumnname from......

java - Validate IDP initiated SAML2.0 Response -

saml experts please help!!!! am new saml , jsp. wanna validate idp(identity provider) initiated saml response token using opensaml library in java(environment linux,tomcat6.0) , retrieve attribute information sent such userid,username,email.the saml response not encrypted , have idp's trust certificate installed in java keystore.the saml token profile "web browser sso" , uses http-post binding.the certificate has public key in it.do need private key validate?what steps done succesful validation?just digital signature validation enough trust source?should profile validation or else? below given saml response receiving idp. please let me know if need more information?sorry if did not give enough information.please me...thanks in advance. <samlp:response xmlns:samlp="urn:oasis:names:tc:saml:2.0:protocol" id="xyz" version="2.0" issueinstant="2013-07-10t16:43:54z" destination="http://www.testsp.com"> <saml:is

javascript - JQuery if input starts with a value -

i managing check value inside postcode input field using following: html: <input type="text" class="cart-postcode2" size="10" tabindex="22"> jquery: $('.cart-postcode2').keyup(function(){ var value = $(this).val(); if (value.indexof('bt') >= 0) { alert("is ireland"); } }) this working great want alert if starts bt , not contain bt in part of value, know if possible? so typing bt2 9nh alert "ireland" typing ox2 8bt not you can check if string starts bt , indexof() give index 0 if value stats bt $('.cart-postcode2').keyup(function(){ var value = $(this).val(); if (value.indexof('bt') == 0) { alert("is ireland"); } })

java - How to get a value from a JSON string using jackson library? -

i trying value json string getting null value instead. app2.java : package jsonexample1; import org.codehaus.jackson.jsonnode; import org.codehaus.jackson.map.objectmapper; import java.io.ioexception; import java.io.stringreader; public class app2 { private jsonnode rootnode; public void setup() throws ioexception { string jsonstring = "{\n" + " \"hotellistresponse\" : {\n" + " \"customersessionid\" : \"0abaaa7a-90c9-7491-3ff2-7e2c37496ca2\",\n" + " \"numberofroomsrequested\" : 1,\n" + " \"moreresultsavailable\" : true,\n" + " \"cachekey\" : \"7790c974:13ff7e2c374:6ccd\",\n" + " \"cachelocation\" : \"10.186.

How do I revert from generate:resource while using JeffreyWay/Laravel-4-Generators? -

how revert generate:resource while using jeffreyway/laravel-4-generators ? is there shortcut remove installed resource through command, inverse of statement below ? php artisan generate:resource post --fields="title:string, body:text" i have installed & created resource using generator in https://github.com/jeffreyway/laravel-4-generators , watching tutsplus video https://tutsplus.com/lesson/running-migrations/ there no shortcut - need remove files manually. if using git (or similar version control) can 'roll back'. otherwise need delete: post migration table creation model/post.php views/posts/* controllers/postcontroller seeds/poststableseeder.php tests/controllers/postscontrollertest.php remove postseeding databaseseeder.php update routes.php remove route::resource('posts');

error handling - PHP supress 3rd party library warning -

i using net_epp library centralnic ( https://github.com/centralnic/php-epp/ ) @ point script calls @$frame = new \net_epp_frame_command_login(); //the epp framework throws warning otherwise note @ in beginning of line, done purpose suppress warning thrown here 3rd party library. so, constructor of net_epp_frame_command_login calls parent constructor class net_epp_frame_command_login extends net_epp_frame_command { function __construct() { parent::__construct('login'); that looks like class net_epp_frame_command extends net_epp_frame { function __construct($command, $type) { $this->type = $type; this part in turn throws me 2 warnings - warning: missing argument 2 net_epp_frame_command::__construct() notice: undefined variable: type how can suppress warnings without modifying library? update interestingly, if talk server directly not display warning although if page contents using curl does. $args = array("d

Vagrant + Parallels -

i know has been asked in past things move fast , i'm wondering if, in last few months, has had luck either finding, using, or building plug-in vagrant can work parallels? i've done bit of searching , have not come except github plug-in not being developed... also, i've messaged parallels think in best interest have plug-in works vagrant not loose developers lure of easier life. add in details provide. there 1 in active development @ https://github.com/yshahin/vagrant-parallels

cmd - Windows egrep not matching regex -

i'm trying search regex on windows after installing egrep. this example of i'm trying find: in string below want match ever it's comparing single specific letter if (lod_user.is_type == "a" || lod_user.is_type == "e" || lod_user.is_type == "s" || lod_user.is_type == "x") so acceptable result s_type == "a" or s_type == "s" and these queries i've attempted: "c:..\..\program files (x86)\gnuwin32\bin\egrep.exe" -hn --regexp=s_type[\s-]*==[\s-]*"[cuompsqdexyaz]" filename the address egrep, refer egrep egrep -hn --regexp=type[\s-]*==[\s-]*"[cuompsqdexyaz]" filename egrep -hn --regexp=[\s-]*==[\s-]*"[cuompsqdexyaz]" filename egrep -hn --regexp=[\s-]*==[\s-]*"a" filename testing 1 letter egrep -hn --regexp=^type[\s-]*==[\s-]*"[cuompsqdexyaz]"$ filename egrep -hn --regexp=^type$[\s-]*==[\s-]*"[cuompsqdexyaz]" filename

asp.net mvc - merge C# console application into an MVC 4 app -

i writing suggestions , opinions. i have console application using soap web service. i have finished implementing logic need in console app , need build web page it. i thinking of using mvc instead of c# web application suggested peers. i hope can pointers of how start working this. how merge existing project mvc project? , of end logic sit in model part?? getting confused mvc concept. your backend logic sit in controller action method, create typed model or dynamically viewbag dynamic type. view (aspx or cshtml) consume information , bind page. please see http://www.asp.net/mvc/tutorials more information/tutorials.