Posts

Showing posts from March, 2015

java - primefaces:row edit event not working when click on pencil icon -

i using jsf,primefaces , hibernate have fetch data database inside table when click in pencil icon not working , not error or exception generated , click compiler not going on our bean class have name 1 table , client name database table working facility name column when define 2 column not working my xhtml page <p:datatable id="allfacilitylist" var="facility" rendered="true" value="# {facilitybean.facilitylist}" paginator="true" rows="15" paginatorposition="top" styleclass="fixed-size" emptymessage="no facility insdie faclity list" style="width: 965px;" editable="true"> <p:ajax event="rowedit" immediate="true" listener="#{facilitybean.onedit}" update=":ftlistform"/> <p:column headertext="facility name" style="width:60%; alignment-adjust: midd

networking - Send message alert to multiple computers on a network -

i have simple question. @ school today , had managed send message alert saying 'hello' every computer in library. took while messages go away, no-one rid of it. don't want did, interested in how did it. i'm studying computer science major @ school. linux_user:~$ echo "message" | wall

html - Javascript to automatically zoom in with a browser on load -

i have created java application 500x400 px iphones width greater 400px, after site loads need manually zoom application. there javascript automatically zoom window width of screen being displayed 400px, secondly there way disable scrolling :) thank much! check out css3 media queries. allow include stylesheets depending on browser's viewport's size. , disable scrolling u set scroll hidden. code disable scroll. $('html, body').css({ 'overflow': 'hidden', 'height': '100%' }) also using js u detect platform u r rendering application , use zoom zoom in accordingly. example mozilla : if ($.browser.mozilla){ var step = 0.02; currffzoom += step; $('body').css('moztransform','scale(' + currffzoom + ')'); } else { var step = 2; curriezoom += step; $('body').css('zoom', ' ' + curriez

sprite kit - How do I use whiteColor in Swift and SpriteKit -

i'm running yosemite , xcode 6. created new project using "game" option, spritekit , swift. in override didmovetoview() in gamescene.swift added following line try change ground color: self.backgroundcolor = skcolor(whitecolor) this compiles won't run, stopping error "use of unresolved identifier 'whitecolor'" the import is: import spritekit do need import whitecolor defined (which assume constant in header file somewhere ? +[skcolor whitecolor] class method, usual, translate skcolor.whitecolor() self.backgroundcolor = skcolor.whitecolor()

c# - dropdownlist doesn't lost his selected value but listbox does -

i have 2 user control 1 has dropdownlist other listbox, on main page there button when click button page goes postback , user controls session add controls on page. , can selected items drop down list list box cant sync viewstate guess. what did try; binding session uc in page init, adding listbox datavalue , datatext, viewstate enable listbox(which default guess) if think logic right must doing wrong in code let me know try paste here in simplified version. here's code you're trying do, maybe you're not doing correct , can spot out. protected void page_load(object sender, eventargs e) { var newlistbox = new listbox(); newlistbox.id = "anewid"; newlistbox.items.add("1"); newlistbox.items.add("2"); newlistbox.selectedindexchanged += lstboxchanged; panel1.controls.add(newlistbox); } private void lstboxchanged(object sender, eventa

How to click a link using jquery or javascript? -

i have link: <a href="#panel2-2">manage lists</a> i want "click" link using jquery or javascript. i've tried: $("#panel2-2").click(function(){}); $("#panel2-2").trigger('click'); it doesn't work! how can click using javascript? you need use jquery attribute equals selector . description : selects elements have specified attribute value equal value. for case, use this: $( "a[href='#panel2-2']" ).click();

python - Gridwise application of the bisection method -

i need find roots generalized state space. is, have discrete grid of dimensions grid=axbx(...)xx , of not know ex ante how many dimensions has (the solution should applicable grid.size ) . i want find roots ( f(z) = 0 ) every state z inside grid using bisection method . remainder contains f(z) , , know f'(z) < 0 . need increase z if remainder > 0 decrease z if remainder < 0 wlog, matrix history of shape (grid.shape, t) contains history of earlier values of z every point in grid , need increase z (since remainder > 0). need select zalternative inside history[z, :] "smallest of those, larger z ". in pseudo-code, is: zalternative = hist[z,:][hist[z,:] > z].min() i had asked earlier . solution given b = sort(history[..., :-1], axis=-1) mask = b > history[..., -1:] index = argmax(mask, axis=-1) indices = tuple([arange(j) j in b.shape[:-1]]) indices = meshgrid(*indices, indexing='ij', sparse=true) indices.append(index)

css - LESS: Applying a ruleset only when selector is in another selector -

say i've got: .apple { color: red; } now, let's i've got: .big { .apple { font-size: 1.25em; } } is there way can put .big selector inside rule .apple ? in psuedocode, like: .apple { color: red; &:[when inside `.big`] { font-size: 1.25em; } } you place & @ end: .apple { color: red; .big & { font-size: 1.25em; } }

Error 145: Cannot add or update a child row within inserting data into database .. mySQL -

i have created database in mysql , script add data database. when want add data pnumbers table, have problem. cannot add or update child row: foreign key constraint fails (`blahari1/pnumbers`, constraint `pnumbers_ibfk_1` foreign key (`customerid`) references `customers` (`id`)) any ideas how solve issue? implementation of database: use blahari1; drop table if exists calls; drop table if exists pnumbers; drop table if exists customers; drop table if exists operators; drop table if exists tarifs; create table customers ( id integer unsigned not null auto_increment primary key, name varchar(30) unique ) engine=innodb default charset=utf8 collate=utf8_czech_ci; create table operators ( id integer unsigned not null auto_increment primary key, name varchar(30) unique ) engine=innodb default charset=utf8 collate=utf8_czech_ci; create table tarifs ( id integer unsigned not null auto_increment primary key, name varchar(30) unique ) engine=innodb default charset=utf8 coll

iOS Simulator - Can't log in with iCloud -

i trying test icloud sync functionality of app between (real) device , simulator, can't seem log icloud. when go settings->icloud , enter account details, gets stuck on 'verifying'. if enter incorrect details, brings invalid password prompt expected. has got fix this? tl;tr log http://www.icloud.com , agree terms it works. there additional steps needed: at work tried new apple id: @ work xyz@mywork.com . @ first didn't work though able access ios dev center. realised required access http://www.icloud.com such apple id , agree terms. after few seconds received 'welcome icloud' email work address , went simulator , successfully logged in . btw, personal account xyz@mac.com have ages , use regularly worked beginning because have agreed terms long time ago. so not @icloud.com of @me.com or @mac.com accounts work. accounts work.

How to define a range of integers in Excel? -

is there range type in excel defining ranges of integers? example: range [1, 10] i not find after researching, perhaps missing something the following formula return array of integers: =row(indirect("1:10"))

how to do a linux reboot from php file -

i have user brftv on linux system , have www-data runs nginx. from terminal can let brftv user run sudo /sbin/reboot and works fine since added following /etc/sudoers file's "#user privilege specification" section: brftv all=nopasswd: /sbin/halt, /sbin/reboot, /sbin/poweroff www-data all=nopasswd: /sbin/halt, /sbin/reboot, /sbin/poweroff but when php file runs following code, nothing happens exec('nohup sudo -u brftv /sbin/reboot'); i added www-data line etc/sudoers above in case necessary when running above exec() (even though run -u brftv, i'm no linux expert, thought better safe in case). the php file runs exec() owned www-data, , chmod 777, should have privilege execute it. i have tried running php-file both through browser (would run user www-data assume) , terminal $ php myfile.php . ------------------- update ----------------- i did this sudo chmod u s /sbin/reboot which allows users on system run reboot cmd without passwor

python - os.path.join does not yield the contents of the file -

print "which category view? savory, dessert, cake, soup or drink? " category = raw_input() x in os.listdir(category): print x name = raw_input("which recipe wou view? ") fullname = os.path.join(category, name) f = open(fullname, "r"); print f i writing program allow users view contents of .txt files saved in specific directories. when run code don't contents , instead message says this: open file 'savory/b.txt', mode 'r' @ 0x1004bd140 any ideas. new python dont have of idea causing error assume due missing code. thank you. the return value of open file object (not file contents!) .you need call method on file object read file: f = open(fullname, "r") print f.read() f.close() if it's big file may want iterate on file line-by-line f = open(fullname, "r") line in f: print line f.close() on side note, here's alternate syntax don't have remember call close method: with open

javascript - jquery autocompleter is not working for dynamically added textboxes -

here fiddle jquery ui autocompleter working on page load first textbox, after ading more textbox same classname, autocompleter not working. can me please $(document).ready( function(){ var availabletags = [ "actionscript", "applescript", "asp", "basic" ]; $( ".lang" ).autocomplete({ source: availabletags }); $('#addrow').click( function() { var curmaxinput = $('input:text').length; $('#rows li:first') .clone() .insertafter($('#rows li:last')) .find('input:text:eq(0)') .attr({'id': 'ans' + (curmaxinput + 1), 'value': '', 'name': 'ans' + (curmaxinput + 1) }) .pa

java - Simple framework skip soap envelope and body -

i'm using retrofit , simple xml framework in android model soap response looks this: xml: <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/xmlschema" soap:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <buslocationresponse xmlns="at_web"> <version>1.0</version> <responsecode>0</responsecode> <input> <route>801</route> <direction>n</direction> </input> <vehicles> <vehicle> <route>801</route> <direction>n</direction> <updatetime>09:42 pm</updatetime> &

python - Problems Serving Flask through Nginx -

i unable serve flask through nginx. looked through logs , says: traceback (most recent call last): file "/var/www/site.me/server.py", line 1, in <module> flask import flask importerror: no module named flask sun jun 8 09:35:30 2014 - unable load app 0 (mountpoint='') (callable not found or import error) sun jun 8 09:35:30 2014 - *** no app loaded. going in full dynamic mode *** sun jun 8 09:35:30 2014 - *** uwsgi running in multiple interpreter mode *** sun jun 8 09:35:30 2014 - spawned uwsgi master process (pid: 2176) sun jun 8 09:35:30 2014 - spawned uwsgi worker 1 (pid: 2180, cores: 1) sun jun 8 09:35:30 2014 - spawned uwsgi worker 2 (pid: 2181, cores: 1) however, in virtual environment, made sure flask installed. configuration file nginx. server { listen 80; root /var/www/site; index index.html index.htm; error_log /root/documents/site; rewrite_log on; server_name www.site.me; location / { include u

hibernate - Spring Boot Test: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined -

i trying set test context under spring boot, defined testapplicationcontext so: @runwith(springjunit4classrunner.class) @springapplicationconfiguration(classes = {mvcconfig.class,securityconfig.class}) @webappconfiguration @enableautoconfiguration @propertysource({ "classpath:persistence.properties" }) @componentscan public class testapplicationcontext { @autowired private environment env; @bean public embeddedservletcontainerfactory servletcontainer() { tomcatembeddedservletcontainerfactory factory = new tomcatembeddedservletcontainerfactory(); factory.setport(9000); factory.setsessiontimeout(10, timeunit.minutes); //factory.adderrorpages(new errorpage(httpstatus.404, "/notfound.html")); return factory; } @bean public platformtransactionmanager transactionmanager(entitymanagerfactory emf) { jpatransactionmanager transactionmanager = new jpatransactionmanager(); transactionmanager.s

javascript - Drop down selection using HTML/jQuery -

i want build drop down menu second selection displayed if first selection data belongs specific category. as can see below, first selection countries. if country selected has states, second drop down selection displayed, containing states of country. 1)is there tag (in code "xyz") can use separate countries in "state" , "no-state" categories? if there is, how can read value of "xyz" tag? 2) if use the: <option class="no-state" value="germany">germany</option> and use jquery read it give me value germanyspain (which correct not want) $('.no-state').val(); html part <div id="country"> <select> <option xyz="no-state" value="germany">germany</option> <option xyz="state" value="usa">usa</option> <option xyz="no-state" value="spain">spain</option> </select&g

dart - limit T in a generic class to types that implement some interface -

in dart consider following class question<t>{ string body; t answer; } //an interface class ianswer{ string value()=>this.tostring(); } i need t limited types example implement interface ianswer, possible without having check if t ianswer , throw , exception in question constructor? class question<t extends ianswer>{ string body; t answer; }

jquery - submit form and then show results in an existing div -

this don't work me. results show in action form page. jquery: <script type="text/javascript"> $(document).ready(function() { $("#em2").submit(function() { $.ajax({ data: $(this).serialize(), type: $(this).attr('method'), url: $(this).attr('action'), success: function(response) { $('#resultados').html(response); } }); $('html, body').animate({ scrolltop: $('#resultados').offset().top -292 }, 'slow'); return false; }); }); </script> html: <form id="em2" name="em2" action="resultados.php" method="post"> <input type="hidden" name="e" value="no" /> <input type="hidden" name="b" value="empleo" /> <input type="hidden&quo

java - how to group the values ​​in json array to be displayed in a listview? -

Image
how group values ​​in json array displayed in listview? example of arrayjson :` "caleg": [ { "id": "jk", "tahun": 2014, "nama": "jusuf kalla", "role": "cawapres", "id_running_mate": "jw", "jenis_kelamin": "l", "agama": "islam", "tempat_lahir": "watampone, sulawesi selatan", "tanggal_lahir": "1942-05-15", "status_perkawinan": "kawin", "nama_pasangan": "hj. mufidah yusuf", "jumlah_anak": 5, "kelurahan_tinggal": "", "kecamatan_tinggal": "", "kab_kota_tinggal":

rss - I'm having trouble with XML parser in android -

i keep seeing tutorials doesn't help, i'm using xmlpullparser keeps getting error , application shows xmlerror page, because of format of xml? here i'm doing: public class xmlparser { private static final string ns = null; public queue<item> parse(inputstream in) throws xmlpullparserexception, ioexception { try { xmlpullparser parser = xml.newpullparser(); parser.setfeature(xmlpullparser.feature_process_namespaces, false); parser.setinput(in, null); parser.nexttag(); return readfeed(parser); } { in.close(); } } private queue<item> readfeed(xmlpullparser parser) throws xmlpullparserexception, ioexception { queue<item> resp = new linkedlist<item>(); parser.require(xmlpullparser.start_tag, ns, "channel"); while (parser.next() != xmlpullparser.end_tag) { if (parser.geteventtype() != x

ASP.NET/MVC Multiple View Models (Product Page & Reviews) -

i have product view, wanting include corresponding product reviews on same page presented user. <!---a single product---> <div class="product"> ... </div> <!--many reviews--> <div class="reviews"> ... </div> in order retreive views, productid needed. how pass both productmodel , reviewmodel productpage view? you can have 1 model per view. can use viewbag make additional information available view. a better way create new view model, productdetailsviewmodel holds data need, populate in controller , pass view.

c# - How to enter login/password details and get data -

Image
there 1 website , want data c# application there. i enter url on web browser http://x.com/api/my_id , firstly messagebox login. and when enter account response. {"success":true,"message":null} i want on c#, return response on variable. tried methods httpwebrequest , webclient couldn't (i had errors 405 method not allowed) can me on this? t thanks comment, dont know how found solution when posted here, sorry. example code solved it. webclient client = new webclient(); string username = "id"; string password = "pw"; string url = "http://x.com/api/" + username; client.credentials = new system.net.networkcredential(username,password); string credentials = convert.tobase64string(encoding.ascii.getbytes(username + ":" + password)); client.headers[httprequestheader.authorization] = "basic " + credentials; var result = client.d

javascript - # in url always displays the home page before showing its corresponding contents -

say, www.example.com#something . this shows www.example.com briefly before loading www.example.com#something when reload www.example.com#something. in need of solution please. $(".trending-menu").die().live('click', function() { $(document).hide(); var trendinglink = (trendinginfo && trendinginfo.trendinglink ? trendinginfo.trendinglink : ''); window.location = nonsecure_url + "/index.html#" + trendinglink; $(document).show(); $('.cls_ftd_invisible_mask').trigger('click'); utils.trackomniture(false, "trending products"); });

.net - Set properties in the way it's declared in c# class -

Image
i have class called "symbol" , have list of properties. public class symbol { z_prop{get;set;} b_prop{get;set;} a_prop{get;set;} } i have done db call , assign data reader class instance. below code //dr datareader object symbol symbols = new symbol(); symbols.z_prop= dr["z_prop"].tostring(); symbols.b_prop= dr["b_prop"].tostring(); symbols.a_prop= dr["a_prop"].tostring(); gridview output this: columns : a_prop b_prop z-prop values : value value value everything works fine. after assigning reader values, symbol properties ordered alphabetic order. want properties ordered declared in class. suggestion why it's ordered alphabetically?. i think meant properties aligned in alphabetical order when see symbol class debugger window.if case can not how debugger works. by default debugger show members in alphabetical order. check below image:

Append or modify keys in conf files using sed/bash one-liner -

i have modify files such sysctl.conf , , i'm familiar using sed replace existing values. is there way append new key/value pair file if sed wasn't able replace it? for instance, using example: modify config file using bash script sed -c -i "s/\($target_key *= *\).*/\1$replacement_value/" $config_file how add $target_key = $replacement_value new line $config_file using same sed expression slight changes? and on related topic, how can force creation of $config_file if didn't exist? you can't in single sed call. it's simplest make 2 steps: if grep -q "$target_key *= " $config_file; sed -c -i "s/\($target_key *= *\).*/\1$replacement_value/" $config_file else echo "$target_key = $replacement_value" >>$config_file fi there few things should make above more robust, however: your regular expression not anchored, means trying set 'port' find/change 'support', etc. it wo

Android : Align image on top right hand corner of button -

Image
i have image looks checkbox, align on top right hand corner of button. have tried relative layout not achieve desired result. suggestion achieve desired result? i have tried using framelayout checbox image remains hidden <framelayout android:layout_marginleft="10dp" android:layout_margintop="20dp" android:layout_width="wrap_content" android:layout_height="wrap_content"> <imageview android:id="@+id/filter_check" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/checkmark" android:layout_gravity="right" /> <button android:id="@+id/filter" style="@style/widget.button.white.bluetext.bluestroke" android:layout_width="wrap_content&quo

c++ - DirectX9 texture shows up distorted -

Image
for reason on machines conditionally ( d3dptexturecaps_nonpow2conditional ) supports "non power of two" (nonpow2) textures i'm getting kind of image distortion: (on machines supports nonpow2 textures works fine.) this 1280x720 resolution rgb24 ( d3dfmt_x8r8g8b8 ). i know there 4 rules when dealing conditionally supported textures: 1. the texture addressing mode texture stage set d3dtaddress_clamp. mpdevice->setsamplerstate(0, d3dsamp_addressu, d3dtaddress_clamp); mpdevice->setsamplerstate(0, d3dsamp_addressv, d3dtaddress_clamp); mpdevice->setsamplerstate(0, d3dsamp_addressw, d3dtaddress_clamp); 2. texture wrapping texture stage disabled (d3drs_wrap n set 0). mpdevice->setrenderstate(d3drs_wrap0, 0); 3. mipmapping not in use (use magnification filter only). mpdevice->setsamplerstate(0, d3dsamp_mipfilter, d3dtexf_none); 4. texture formats must not d3dfmt_dxt1 through d3dfmt_dxt5. i'm using d3dfmt_x8r8g8b8 ... texture cre

javascript - Access checkbox element in my form with JQuery -

i have (struts generated) html code: <form accept-charset="utf-8" class="search" method="get" action="facturable/list.action" name="list" id="list"> <div class="fieldset_medium_right"> <div class="label"> <input type="checkbox" id="list_allso" value="true" name="allso"> <input type="hidden" value="true" name="__checkbox_allso" id="__checkbox_list_allso"> </div> <div label""="" class=""> <input type="checkbox" id="list_allent" value="true" name="allent"> <input type="hidden" value="true" name="__checkbox_allent" id="__chec

Titanium Mobile SQLite Select performance -

i m using latest sdk , studio. developing ios 7. , m taking photo iphone , store path in sqlite. , have 1 tableview showing photos .each image 1.5 mb , maybe ı want show 1000 or more photo in same table. how can speed select method?

html - Duplicate Content from "simple accordian css3 & jQuery" -

i have website may have duplicate content unusual reason. site uses piece of code called "simple accordian css3 & jquery". can find code here: htmldrive.net/items/show/543/simple-accordion-css3-and-jquery this accordian uses id alters url structure when expanded. so, if id called "benefits" in accordian, url change www.example.com/page.html www.example.com/page.html?section=benefits when accordian expanded. i use siteliner.com check internal duplicate content , siteliner recognizes both original version of url , modified version (with ?section=id appended url) , tells me have 100% duplicate content across both pages. website ranks poorly , think why. is google seeing same duplicate content siteliner , automatically penalizing me? what should fix this? likely siteliner not running javascript on page , looking @ raw response(s).

Different renderers for datagrid in flex 4.0 -

i'm working in flex 4.0 , have data grid 3 columns. second column should display selection(s) user has made according these rules: if selected 1 name display label name in grid cell, if chose more 1 name drop down list should displayed title "multiple selected" , drop down when clicked show names associated entry. therefore second column can have mixture of labels , drop down lists. example first entry chose 1 person, first row second column shows label person's name. in second entry chose 2 names, second row second column shows drop down list 2 names in drop down list. can see second column has label , drop down list mixture. note selection process not taking place in datagrid, information being supplied means of setting dataprovider datagrid. i figure out make itemrenderer both label , dropdown list disable 1 while enabling other when conditions met. problem approach modify width because label comes first , pushes drop down list right (even when isn'