Posts

Showing posts from May, 2012

java - Selenium sendkeys drops character with Chrome Driver -

selenium sendkeys chrome driver drops character "2" , "4". other characters ok. when use other browser (ie or ff), ok. code: webelement name = driver.findelement(localizator); name.clear(); name.sendkeys("1234567890 abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz"); result: input box filled with 13567890 abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz characters 2 , 4 missing, other characters filled correctly. i use windows 7 64bit, chrome version 29.0.1547.57 m, chromedriver win32 (v2.2.215849.dyu) - newest one. investigating czech republic also, going make wild assumption, keyboard set czech default. i had strange issues sendkeys when system had czech keyboard default one. since changed default english, problems dissapeared. if not help, please provide info going happen if try this: name.sendkeys("2"); name.sendkeys("22222222"); name.sendkeys("4"); name.sendkeys("44...

c# - WCF ado.net Insert record (at end) -

stackers, i have been troubled problem long, decided post question here. this whats bothering me. writing app windowsphone 8. app revolves around local , remote database. local database part easy part. now, want use wcf service insert records remote db (using ado.net service @ serverside). have succesfully inserted records in remote database there's catch (atleast im aiming at). my database table (in im inserting) has primary key , don't want tell/insert primary key when insert data database. want insert new record after last record. there way this? this have far: private measuremententities context; context = new measuremententities(new uri("http://192.168.11.240:85/nfcdataservice.svc/")); public void saveanwserstodblocal(bool ans1, bool ans2, bool ans3) { measurement temp = new measurement(); temp.anwser1 = ans1; temp.anwser2 = ans2; temp.anwser3 = ans3; temp.measurementid = 1; // p...

c# - Mocking a web service that relies on another service layer -

tried search solution, maybe couldn't form question right useful result. i know if there techniques mock (web) service relies on black box own logic have no knowledge of or control over. take payment gateways example. how mock payment testing want simulate payment fails on bank's level above gateway's level (the service i'm calling)? example card declined or other card related failure. i suggest create facade in code deals external service. can mock facade. your facade thin layer exposes methods external service you're interested in , performs necessary mappings between external service types , internal model.

javascript - How do i check whether the image is already viewed or not? -

i have 10 number of images , whenever user clicked on or using mouse key open image , need record whether image viewed or not , respectively need disable events on image current user. just set attribute containing ids of viewed images. that's easy , quick.

c# - DragDropEffect.Copy Resets itself to None -

i have scatterviewitem in scatterview , manipulation not handled me. have richtextbox in scatterview, property allowdrop = true . by default, richtextbox's dragenter event fires whenever scatterviewitem drag it, correct. checked dragdropeffect here, , it's dragdropeffect.move . drop event fires appropriately after that. i changed dragdropeffect move copy in dragenter, drop event no longer fires. checked dragdropeffect again in dragover , somehow became none . tried setting in dragover copy (again) each time become none on next trigger of dragover. the time drop event fire if dragdropeffect set all or move . how change dragdropeffect.copy , still fire drop event? did set e.handled = true after setting dragdropeffect.copy. edit: apologises, did manipulate svi's drag , drop little. in scatterview's onmanipulationstarted , svi , called svi.begindragdrop(svi.datacontext) . that's did svi. what (drageventargs).allowedeffects property valu...

symfony - Any suggestion on how to read Symfony2 source code? -

i'm interesting reading symfony2 source code , want figure out how works. where should start? app_dev.php , open files read line line? or there big pictures or key points of base code design? have read of documents symfony.com. before diving symfony2 source code, suggest starting create own framework... on top of symfony2 components serie of 12 articles . explains role of each component , way can used.

c# - Timeout expired, optimize query -

Image
i have query detail of bills between 2 dates: select dt.* detailtable dt, billtable bt, packagetable pt pt.id = bt.idpackage , dt.idbill= bt.id , pt.codecompany = @codecompany , pt.date between @begin , @end for every package there many bills, , want details of bills of company, result in database 20,000 have : system.data.sqlclient.sqlexception (0x80131904): timeout expired. timeout period elapsed prior completion of operation or server not responding. the c# code : using (sqlconnection sqlconn = new sqlconnection(sqlservermasterconnection)) { if (sqlconn.state != connectionstate.open) sqlconn.open(); using (sqlcommand cmd = new sqlcommand("select dt.* detailtable dt, billtable bt, packagetable pt pt.id= bt.idpackage , dt.idbill= bt.id , pt.codecompany = @codecompany , pt.date between @begin , @end", sqlconn)) { cmd.parameters.add(new sqlceparameter(@begin , begindate)); cmd.parameters.add(new sqlcep...

javascript - how to count headers of excel file -

i using script excel html table conversion working basis oflimited no of column , row provide initialy want works on basis or row , column given in excel file <script> function _ge(id) { return document.getelementbyid(id); } function _nc(val) { return (val != null && val.length > 0); } function convert2html() { var fo = _ge('file1'); var = _ge('txtsheetname'); var ho = _ge('txtheaderrowstart'); var co = _ge('txtheadercolstart'); var hco = _ge('txtheadercols'); var ro = _ge('txtdatarows'); if (!(_nc(fo.value) && _nc(so.value) && _nc(ho.value) && _nc(co.value) && _nc(hco.value) && _nc(ro.value))) { alert('all fields mandatory.'); return false; } var ex; try { ex = new activexobject("excel.application"); ...

javascript - jQuery scan through div class name, use those class names to print matching checkboxes -

i'm new javascript/jquery , wondering if @ possible collect div's class names , create checkboxes based on class names jquery. example. <div class="champ"> <h3>reading</h3> </div> <div class="league1"> <h3>sheffield wednesday</h3> </div> <div class="prem"> <h3>sunderland</h3> </div> <div class="prem"> <h3>tottenham hotspur</h3> </div> <div class="champ"> <h3>watford</h3> </div> say html file associated class names, result spit out checkboxes class names present divs while avoiding duplication of same class name. so example above end looking like champ league1 prem any appreciated thanks. i'd suggest: // creating new elements: var newcheckbox = $('<input />', { 'type' : 'checkbox', 'name' : 'ukfootballclubs' }...

php - creating archive with pear Archive_Tar -

i'm creating tar archive following function public static function packdirectory($path, $outpath) { require_once 'archive/tar.php'; $obj = new archive_tar($outpath); $obj->seterrorhandling(pear_error_print); $handle=opendir($path); $files = array(); while (false !== ($file = readdir($handle))) { if ($file == '.' || $file == '..') { continue; } $files[] = $path . '/' . $file; } $obj->create($files); } path folder1/folder2/folder3/ . creates archive following folder1/folder2/folder3/filea folder1/folder2/folder3/fileb folder1/folder2/folder3/filec folder1/folder2/folder3/subfolder/filed i want be filea fileb filec subfolder/filed how tha can done? you need use createmodify method - takes 2 more parameters archive_tar's create method. complete, these 3 parameters are: $p_filelist - array of filenames $p_add_dir - string/path prepended filenam...

postgresql - Create array dynamically inside begin and end -

how create array dynamically inside postgresql? consider e.g.: create or replace function fun( ) returns setof void $body$ declare numeric; begin in 1..10 loop //i have create array arr1[] ,arr2[] ... based on length end loop; end; $body$ language plpgsql there special function purpose - array_fill: postgres=# select array_fill(0, array[10]); array_fill ----------------------- {0,0,0,0,0,0,0,0,0,0} (1 row) postgres=# select array_fill('hello'::text, array[10]); array_fill --------------------------------------------------------------- {hello,hello,hello,hello,hello,hello,hello,hello,hello,hello} (1 row) postgres=# select array_fill(0, array[3,3]); array_fill --------------------------- {{0,0,0},{0,0,0},{0,0,0}} (1 row) in pl/pgsql (but slower large arrays (over 100 items): $$ declare result int[] = '{}'; begin in 1..10 loop result :...

c# - CheckBoxList item checked Event -

i'm implementing checkboxlist , if item checked\unchecked, irrespective of 1 it, want launch event. how done, please help. according msdn <asp:radiobuttonlist id="radiobuttonlist1" onselectedindexchanged="index_changed" autopostback="true" runat="server"/> void index_changed(object sender, eventargs e) { label1.text = "you selected " + radiobuttonlist1.selecteditem.text + " value of $" + radiobuttonlist1.selecteditem.value + "."; } the same should work on checkboxlist too.

mysql - Text import error -

good day i have created bat file import text file mysql database , looks follows: sqlcmd /user root /pass password /db "mydb" /command "load data local infile 'file.csv' table tg_orders fields terminated ',' enclosed '"' lines terminated '\n'" my problem cannot "treat consecutive delimiters one" work... how add that? now have got real crux of problem, not consecutive delimiter problem - it's csv file format problem. if csv file contains fields b121,535 , not enclosed within quote marks of kind and delimeter , no amount of sql jiggery-pokery sort out problem. un-quoted fields commas always interpreted 2 separate fields unless enclosed within quote marks. post sample line csv file causing problems , can diagnose further. failing that, export data initial system again making sure formatting correct (either enclose in speech marks or string fields) finally, sure database mysql based ...

symfony1 - symfony 1.1 sfNumberValidator plugin code in php -

i have validation check in validate/confirm.yml on field postalcode as: postalcode: required: yes required_msg: enter_valid_postalcode validators: numbervalidator numbervalidator: class: sfnumbervalidator nan_error: not_a_number_error for reason want move logic or same functionality of class sfnumbervalidator in action file. like class registeractions extends sfactions { public function validateconfirm() { .... ... $postalcode = $this - > getrequestparameter('postalcode'); if (postalcode != '') { //do same kind of validation sfnumbervalidator } } .... } you have create sfnumbervalidator instance , call execute method. something this: if ($postalcode != '') { $validator = new sfnumbervalidator($this->getcontext(), array( 'nan_error' => 'not number', 'min' => 10000, '...

jquery - Rails validates a field that isn't included in page -

i have sample app created , i'm having trouble editing fields. whenever try , update fields, it's triggers "validates :password_confirmation" in user model though haven't included password_confirmation field in page. here of codes: this 'pages/services.html.erb' display data <h1>shows users</h1> <% if current_user %> <table border="1"> <% @column_names.each |column_name| %> <% if column_name == "name" || column_name == "username" || column_name == "email"%> <td> <strong><%= column_name.capitalize %></strong> </td> <% end %> <% end %> <% @users.each |user| %> <tr> <td><%= user.name%></td> <td><%= user.username%></td> <td><%= user.email%></td> <td><%= link_to "edit", ...

html - How can i fix the margin of a label next to a checkbox? -

i have check box have added margin-right:10px little space between them. it's working fine when label have line-break exemple , margin doesn't seem work properly. have check box alone on left , label on right without having under checkbox if have multiple lines. code <dd id="rr-element"> <label for="rr-1"> <input type="checkbox" value="1" id="rr-1" name="rr[]"> value 1 lorem lipsum dolor si amet </label> </dd> css #rr-element{width:180px;} dd label input { margin-right:10px; } little update : max-width of ul or dd 180px; don't want on single line. try this html <dd id="rr-element"> <input value="2" id="rr-1" type="checkbox" name="searchform[position][]"> <label for="rr-1">value 1 lorem lipsum dolor lorem lipsum dolorlorem lipsum dolor</label> ...

how to make a radial line segment using D3.js -

i'd create line using polar coordinates. example: line centre @ cx=0, cy=0, @ angle of pi/4, drawn start radius of 4 , end radius of 7. i use maths , job myself, d3.js appears have radial line generator , i'm finding documentation hard grasp, being d3 noob. using line generator relatively straightforward. can use default options , specify in data this: d3.svg.line.radial()([[4,math.pi/4],[7,math.pi/4]]); alternatively, provide data changes , else default: var line = d3.svg.line.radial() .angle(math.pi/4) .radius(function(d) { return d; }); line([4,7]);

excel - Viewing a txt file with row separator "\x00" -

Image
i got program outputs txt column separator "\t" , row separator "\x00" (hex code) but when open txt ms excel, notepad++, libreoffice, contents put in 1 row. but want open in either ms excel or libreoffice in "normal" view can edit easily. i tried find type of buttons in libreoffice change separator couldn't. i changed encoding of using notepad++ encodings, changing encoding didn't @ least @ notepad++. how can open file row separator being displayed should? i want see in multiple rows , edit efficiently. in notepad++, can perform find , replace (ctrl+h). set search mode extended for find what, enter \\x00 for replace with, enter \n hit replace all then replace \t tabs, can: for find what, enter \\t for replace with, enter \t hit replace all

sql server - SQL Table Constraint to prevent column totals exceeding 100 -

i have table contains columns this: someid, int pk item1weighting, int item2weighting, int item3weighting, int i want add constraint table prevents total of 3 "weighting" columns on single row exceeding total value of 100. i've done quite bit of searching , can't find any suggestions gratefully received. thanks kev you can declaratively without resorting triggers. create table t ( someid int primary key, item1weighting int, item2weighting int, item3weighting int, constraint ck_weightingnotover100 check ((isnull(item1weighting,0) + isnull(item2weighting,0) + isnull(item3weighting,0)) <= 100) ) or add retrospectively existing table alter table t add constraint ck_weightingnotover100 check ((isnull(item1weighting,0) + isnull(item2weighting,0) + isnull(item3weighting,0)) <= 100)

google play - My android app can download but doesnt appear in my downloaded apps -

my new android app can download playstore doesn't appear in downloaded apps. when download play store there option 'open' app aswell 'uninstall', uninstall button visible. ( http://i.imgur.com/jntvjq2.png notice missing open button) here's manifest, there no errors during tests ran. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.jackattackapps.bigl" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="18" /> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="android.permission.internet"/> <application android:allowbackup="true" android:icon="@drawable/icon...

c# - SPItemEventReceiver and code in other assembly -

i have 4 projects inside solution: class library,(.net 3.5) called common.dll sharepoint project called sharepointstrucutre has list definition. sharepoint project contains sharepoint job. both of them reference common.dll, in both packages 4 sharepoint project webpart. couldn't make work common.dll, when have added safecontrol part in web.config - webpart giving me message: type not safe , couldn't imported. ended copying code common.dll 4th project. (lame!) worst part on local setup, working(webpart adding without typesafe messages, eventreceiver works fine). problem arise when deploying live system. problem: in project sharepointstrucutre have spitemeventreceiver executes common.dll code. , fails! exception: system.io.filenotfoundexception: not load file or assembly 'common, version=1.0.0.9, culture=neutral, publickeytoken=0dbfee127d760dde' or 1 of dependencies. system cannot find file specified. file name: 'common, version=1.0.0.9, cu...

timezone - A day without midnight -

there's @ least 1 time zone skips 23:59:59 1:00:00 when "springing forward" dst. know is? the following gets today's date, fails 1 day year time zones matching above criterion. $ perl -mdatetime -e'say datetime->today( time_zone => $argv[0] )->ymd;' \ america/new_york 2013-08-28 i need time zone testing purposes. i'm not trying above code work. there several. common 1 brazil using america/sao_paulo time zone. $ perl -mdatetime -e'say datetime->new( year => 2013, month => 10, day => 20, hour => 12, time_zone => "america/sao_paulo")->truncate( => "day" )->ymd;' invalid local time date in time zone: america/sao_paulo you can around problem switching "floating" tome zone before getting date: $ perl -mdatetime -e'say datetime->new( year => 2013, month => 10, day => 20, hour => 12, time_zone => "america/sao_pau...

web services - What is causing automatic status change after placing order through a webservice api in Prestashop? -

i have successfuly made new order through prestashop webservice api. causing me problem order's current_status somehow automatically changed 12 ( payment remotely accepted ) everytime order placed. i can't figure out reason because set 10 ( awaiting bankwire payment ) , still set 10 in response after making post request. if check in back-office, in database or through api, order has status 12 now. any idea causing change? prestashop automatically adds order status "remote payment accepted" orders added via web service. alternatively, can add order status via web service after add order. please consider following code: $xml = $webservice->get(array('url' => ps_shop_path.'/api/order_histories?schema=blank')); $xml->order_history->id_order = $id['order']; $xml->order_history->id_order_state = '3'; $opt = array('resource' => 'order_histories'); $opt['postxml'] = $xml->as...

c# - Take 4 places after decimal for a double variable -

this question has answer here: limiting double 3 decimal places 8 answers truncate number of digit of double value in c# 10 answers i dont want round want take 4 places after decimal. example: double = 0.00038; i want result 0.0003 // 8 discarded how can achieve that? double result = math.truncate(10000 * something) / 10000;

html - Making overlaying divs equal using css -

i have 1 div overlaying div follows: div.container { position: relative; min-height: 100%; margin:0; padding:0; background:url('http://www.scratchprogramming.org/img/book.png'); background-repeat:no-repeat; background-attachment:fixed; background-position: 62% 70%; overflow:hidden; } div.content { position: absolute; min-height: 100%; margin:0; padding:0; top: 0; left: 0; width:100%; z-index:10; overflow:hidden; } my html starts out this: <div class="container"> <p id="catimage"> <img src="img/scratchcat.png" alt="cat" /> </p> </div><!--container--> <div class="content"> now had set height on cat image long background image in container ( book.png ) fill content area. the problem when testing on different browsers... somtimes book.png background goes on content leng...

EJB with JNDI not listed in the glassfish JNDI list -

i have made ejb jndi, using annotations. made jar of ejb code , deployed in glassfish server (version 3). able object of ejb in remote client application, using jndi lookup. not able ejb name or mappedname in glassfish jndi list. use command asadmin list-jndi-entries list of jndi entries. @remote public interface testejbjndi { public object test(); } @stateless(name="testsdkinterface", mappedname="/test/ejb/jndi") public class testejbjndiimpl implements testejbjndi{ @override public object test(){ system.out.println("inside getprotocoldata"); return null; } } public class remoteclient { public static void main(string[] args) { try { context ctx = new initialcontext(); lookup(ctx); } catch (namingexception ne) { ne.printstacktrace(); } } private static void lookup(context ctx) throws namingexception { system.out.println(...

r - Split-sample design -

i working on large data set containing 9,000 observations belonging different groups. now, use method called split-sample design analyze data. let me explain in detail do. data has following structure: groupid performance commitment affect size 1234 5 4 2 2 1234 6 8 9 2 2235 4 3 2 5 2235 4 3 2 5 2235 2 1 7 5 2235 2 1 7 5 2235 2 6 10 5 3678 3 5 5 4 3678 7 3 5 4 3678 5 2 6 4 3678 1 4 6 4 now, aggregate data in following way: each group, use average performance score of first half of group , average commitment , affect scores of second half of group create 1 new observation (for uneven group sizes drop 1 ran...

asp.net - SSRS: Why do SKA-cookies build up until "HTTP 400 Bad Request - Request Too Long" occurs? -

Image
i have switched sql-server reporting services 2012 (ssrs 2012) forms authentication can use on internet. i not find forms-authentication sample ssrs 2012 anywhere, had take ssrs 2008r2 one, , adapt 2012, single-sign-on (sso). at point seemed working expected; managed sso working across domains. but have problem: i testing reports (more 200) google chrome, because had insert little javascript alters td border-size html displays right in non-ie5-quirksmode. after 50th report, got: "http 400 bad request - request long" after that, not view other report, not did work previously. the problem seems caused many cookies, , indeed, when deleted few "*_ska" (session keep alive?) cookies, began working again. my problem don't know causes "cookie overflow". don't know, if bug in chrome, bug in vanilla ssrs or bug caused new forms authentication. all in new forms-authentication has cookies this: using system; using system.collections....

git - Overview of version control in emacs -

i found out emacs integrates support version control (via same problem as, , answer from, emacs , symbolic links ). tried find overview of emacs vc includes, find details , technical (e.g. emacs man vc ). does know of quick introduction / overview of emacs vc? i.e. why use it, instead of (e.g.) git directly? basic features have? why use it, instead of (e.g.) git directly? for same reason 1 uses other integrated tools , guis: less typing, faster turnaround. what basic features have? cli cycle: edit file switch shell, run git commit file edit commit message in new editor; oops - need @ original file ... emacs cycle: edit file c-x v v - new buffer appears commit message, can edit while viewing changes made in diff buffer ( c-x v = ); c-c c-c when done , can resume editing right away. or select files in vc-dir buffer ( c-x v d ) , operate on them: diff, commit, pull &c. just start using emacs/vc , ask specific questions. ps. see em...

php - how to change form action using jquery -

im trying change form action based 2 ahref tags, 1 button , other 1 text. when clicks button, action of form should /profile.php?id= , if text clicked action should /profile.php?uid= im stuck @ problem. here code in html: <a href = "profile.php?/edit/employment-information/" id="edit"><input type="button" name="editemp" id="edit" value="edit"> <a href="profile.php?/add/employment-information/" id="add">add information</a> <form name="empform" method="post" action="profile.php" autofocus id="form"> <input name="employ" type="text" id="employ" pattern="[a-za-z ]{3,20}" placeholder="who employer?"> <input name="position" type="text" id="position" pattern="[a-za-z ]{3,20}" placeholder="what job description?"> <input name...

asp.net mvc - MVC - DropDownList from database -

i have error when want save selected country. here error: in french: l'élément viewdata avec la clé « country » est de type « system.string » mais doit être de type « ienumerable<selectlistitem> ». in english : viewdata key "country" « system.string » must « ienumerable<selectlistitem> ». here code : in controller: public actionresult getmeth() { var countries = _bll.countrycodes.findall(); viewdata["listitems"] = c in countries select new selectlistitem() { text = c.namefr, value = c.code }; return view(); } public actionresult postmeth(mymodel model) { ... ... country = model.country; ... ... } in viewmodel: ...

node.js - How can you make an HTTP GET request OVER a socket using NodeJS? -

i'm working hardware device (i did not create) has standard way communicate on socket connection. device initiates socket connection contacted server(nodejs server in question). i have been successful in setting socket connection with... var socketserver = net.createserver() .listen(9999, function(){ console.log('socket listening at: http://localhost:9999'); }); socketserver.on('connection', function(sock) { console.log('connected: ' + sock.remoteaddress +':'+ sock.remoteport); console.log(sock); // need fire http here }); however, need send http request on socket connection. far way can figure out how manually socket.write myself. what i'm hoping class http allows like... http.get(socket, function(res){ // handler code }) i'm positive issue me being newb @ nodejs, spent 3-4 hours scouring stackoverflow , google answer far no success. figured out! @peter-lyons suggestion. however, answer rather...

How to remove duplicate dictionaries from a list in Python? -

i have list of dictionaries sorted specific key. each dictionary contains 32 elements, , there on 4000 dictionaries in list. need code work through list , return new list duplicates removed. the methods these links: removing duplicates in lists how remove duplicates list in whilst preserving order? don't me because dictionary unhashable. any thoughts? if need more info, comment , add info. edit : a duplicate dictionary 2 dictionaries same values list[dictionary][key] . ok, here detailed explanation need it. i have list of dictionaries thus: [ { "id" : "0001", "organization" : "solarusa", "matchcode" : "solarusa, street, somewhere state, whatev zip", "owner" : "timothy black", }, { "id" : "0002", "organization" : "solarusa", "matchcode" : "solarusa, street, somewhere state, whatev zip", ...

iOS UICollectionView Detect if there are cells that aren't visible -

i have uicollectionview, horizontally scrolling , set being 1 row only. how able detect if there cells aren't visible on screen; outside bounds of collectionview's frame? my idea show arrow next uicollectionview if there cells aren't visible. you can check instance method of uicollectionview : nsarray *indexpaths = [self.collectionview indexpathsforvisibleitems]; you compare first 1 first item in data source, , last 1 last item.

Unable to maintain JSF ViewState within a dataTable component -

i'm working inherited jsf app. still quite new it. here's screenshot of page i'm working with: http://goo.gl/gidpcd . exam software , you're looking @ question administration. on screen user can write question, cite question source, write answers, associate category , associate images. where i'm getting stuck when add/delete answers down toward bottom. i'm suspicious issue viewstate. when click add or delete answers. page reloads , lose file associations within jsf datatable component. viewstate maintained in of other form elements on page, it's files within datatable can't seem head wrapped around. here's jsf datatable component (i'll list code in it's entirety below): <h:datatable id="table0" value="#{adminquestions.fileslist}" var="file" columnclasses="id,title,selected last" rendered="true" > <h:column> <f:facet name="header">file...

jsf - Loading h:selectOneMenu depending of another h:selectOneMenu value -

i have 2 h:selectonemenu (1: countries, 2: cities). need load cities 1 selected country in cities selectonemenu using ajax. when change value of countries selectonemenu cities selectonemenu takes null value countrybean.selectedcountry. <h:panelgrid columns="2"> <h:outputlabel for="countries" value="countries: " /> <h:selectonemenu converter="omnifaces.selectitemsconverter" id="countries" required="true" value="#{countrybean.selectedcountry}"> <f:selectitem itemlabel="choose country" /> <f:selectitems value="#{countriesbb.findallcountries()}" var="country" itemlabel="#{country.name}" /> <f:ajax event="change" render="cities" /> </h:selectonemenu> <h:outputlabel for="cities" value="cities: " /> <h:selectonemenu c...

terminal - 'tee'ing /dev/pty to stdio AND somewhere else (file/ or other device) -

thanks in advance either answering specific question or letting me know if there better way accomplish trying altogether. i'll start out specific question: i have serial program writing , reading /dev/ttyp0, , if run cat -v /dev/ptyp0 i can see ascii characters program outputting runs. great, wanted. but want display characters , tee device (a serial port - via usb serial adapter). i thinking work run cat -v /dev/ptyp0 | tee /dev/tty.usa19h62p1.1 but result of no output whatsoever - on screen nor device. thought maybe i'd try teeing off file make sure using tee correctly: cat -v /dev/ptyp0 | tee file.txt but still nothing @ all. empty file.txt, empty terminal on sreen. doing wrong? running osx 10.8.4 way. now here's boarder picture of doing: have emulator program (basilisk ii) emulating macintosh machine running mac os 7.5.3. trying specialty program talk hardware device, old audio multi-effect unit, via rs-232. works, unreliably, , have f...

ios - Passing path of document directory to xcode run scripts -

i want pass location of documents (data) directory script runs after build in xcode target. what environment variable should use? as sandbox directory created after build completes , simulator starts, environment has no knowledge @ of documents (sandbox directory). can run script in background, keeps checking simulator's dump folder see directory created after app started.

android - Viewpager with Fragment issue -

i used example shown in link its run fine in portrait position when turn phone landscape position force close , any overcome problem appreciated , . viewpagerexample public class viewpagerexample extends fragmentactivity { private myadapter madapter; private viewpager mpager; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); madapter = new myadapter(getsupportfragmentmanager()); mpager = (viewpager) findviewbyid(r.id.pager); mpager.setadapter(madapter); } public static class myadapter extends fragmentpageradapter { public myadapter(fragmentmanager fm) { super(fm); } @override public int getcount() { return 3; } @override public fragment getitem(int position) { switch (position) { case 0: return new detailfragment(); case 1: return new imagef...

error in my PHP code -

i'm getting error in code. if put wrong user, shows user ok if put correct user, shows user ok i don’t know error in code please take @ code , let me know went wrong. login.php <html> <body> <form action="list_work.php" method="post"> username: <input type="text" name="username"> password: <input type="text" name="password"> <input type="submit"> </form> </body> </html> list_work.php <?php $username = $_post["username"]; $password = $_post["password"]; // connect database $dblink = new mysqli('localhost', 'sqldata', 'sqldata', 'balhaf'); if(mysqli_connect_errno()) { die("mysql connection failed: ". mysqli_connect_error()); } mysqli_select_db($dblink,"balhaf2"); // fetch file information $query = "sel...

c++ - Packing rectangles without rotation? -

is algorithm packing rectangles without rotation? maybe implementation in c++? i found this and guillotinebinpack shelfbinpack skylinebinpack but rotate rectangles. you can sort boxes width , place node of tree. split tree along 2 axis. next box best fit, i.e. least waste , place box free node. rinse , repeat until no boxes or node left. can packing lightmaps kd-tree blackpawn.

mustache - GRMustache how to render a parent variable inside a loop? -

this question using grmustache in ios application. although documentation links standard mustache docs. i looping through mustache data , in root of page there variable called #noanimation. variable works outside of loop not work inside loop. how can parent variable inside loop. i have tried {{../noanimation}} , rendering engine breaks. {{#noanimation}}will work{{/}} {{# withposition(data) }} <div class="title">{{ title }}</div> {{#noanimation}}will not work{{/}} {{/ withposition(data) }} grmustache version /** * major component of grmustache version * * @since v1.0 */ #define grmustache_major_version 6 /** * minor component of grmustache version * * @since v1.0 */ #define grmustache_minor_version 7 /** * patch-level component of grmustache version * * @since v1.0 */ #define grmustache_patch_version 4

Rails: Installing Twitter-Bootstrap 3 in a Rails project -

i total n00b , trying install twitter-bootstrap 3 rails project. twitter-bootstrap-rails gem unfortunately version 2.0, otherwise totally use that. there kind of set magic need in app configure rails project other copy , paste bootstrap directories rails project repo? any , advice appreciated!

python - How to process SIGTERM signal gracefully? -

let's assume have such trivial daemon written in python: def mainloop(): while true: # 1. # 2. # 3. important # 4. job # 5. sleep mainloop() and daemonize using start-stop-daemon default sends sigterm ( term ) signal on --stop . let's suppose current step performed #2 . , @ moment we're sending term signal. what happens execution terminates immediately. i've found can handle signal event using signal.signal(signal.sigterm, handler) thing still interrupts current execution , passes control handler . so, question - possible not interrupt current execution handle term signal in separated thread (?) able set shutdown_flag = true mainloop() had chance stop gracefully? a class based clean use solution: import signal import time class gracefulkiller: kill_now = false def __init__(self): signal.signal(signal.sigint, self.exit_gracefully) signal.signal(signal.sigterm, self.exit_gracefully...

javascript - Rails: Namespace CoffeeScript so a script is only called on given page(s) -

i'm calling java/coffescript function, typehandler (not shown), repeatedly different parameters. happening on every page load application. needs happen on 3 or 4 pages script applicable. and, within pages should called twice given appropriate parameters: #app/assets/javascripts/disk_items.js.coffee jquery(document).ready -> typehandler = (selector, url, hidden_id, entry_id) -> ... ## if page diskitem#edit typehandler '.projects_tt', '/projects.json', '#disk_file_project_code', '#project_code' typehandler '.products_tt', '/products.json', '#disk_file_product_id', '#product_title' ## if page inventoryitem#edit_multiple typehandler '.projects_tt', '/projects.json', '#inventory_item_project_code', '#project_code' typehandler '.products_tt', '/products.json', '#inventory_item_product_id', '#product_title' ... how to: only run script on...

java - Running a Jython app on WebSphere Liberty -

i'm looking run jython/modjy (modjy kinda analogous mod_wsgi except bridges java web servers , applications) on ibm 8.5 liberty profile. however when convert jython-modjy sample app .war file , put in dropins directory, websphere server struggles find path of demo_app.py (wsgi handler). here's snippet of web.xml file: <init-param> <param-name>python.home</param-name> <param-value>c:/jython2.5.3</param-value> </init-param> <init-param> <param-name>app_filename</param-name> <param-value>demo_app.py</param-value> </init-param> the other app related parameters app_directory , app_callable_name default current directory , handler respectfully: i following error when try run app: modjy.modjy_exceptions.applicationnotfound: application filename not found: none/demo_app.py the way i've gotten work specifying absolute path, isn't portable any appreciated thanks, david i d...

android - can't show image after use function runnable -

i have problem error on code, public class mainactivity2 extends activity { edittext et; imageview iv; runnable stream; handler hand = new handler(); runnable run ; public button tombol2; @suppresslint("newapi") @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main2); intent intent = getintent(); string url= intent.getstringextra("url"); tombol2 = (button) findviewbyid(r.id.button2); iv = (imageview) findviewbyid(r.id.imageview1); drawable d1=loadimagefromweboperations(url); iv.setimagedrawable(d1); handler handler = new handler(); handler.postdelayed(new runnable() { @override public void run() { // todo auto-generated method stub iv.setimagedrawable(d1); } }, 10000); } private drawable loadimagefromweboperations(string url) { try { inputstream = (inputstream) new url(url).getcontent(); dr...