Posts

Showing posts from April, 2011

android - Crash in ListView at AbsListView.obtainView for ListActivity -

i'm watching content updates on listactivity using contentobserver follows: protected void oncreate(bundle savedstate) { super.oncreate(savedstate); contentresolver cr = getcontentresolver(); cursor cursor = cr.query(trackheader.content_uri, stracklistprojection, null, null, null); startmanagingcursor(cursor); this.madapter = new trackheaderdataadapter(this, r.layout.track_list_item, cursor, stracklistprojection, null); setlistadapter(madapter); handler handler = new handler(); mtrackheaderobserver = new contentobserver(handler) { @override public boolean deliverselfnotifications() { return false; } @override public void onchange(boolean selfchange) { super.onchange(selfchange); contentresolver cr = getcontentresolver(); madapter.changecursor(cr.query(trackheader.content

javascript - Get Cursor Position With Input type number -

i position of cursor in <input> . here code using: $("input").keyup(function() { $("<p>") .html("cursor position @ " + $("input").caretposition()) .appendto("#test"); }); and caretposition defined (just wrapper selectionstart ): $.fn.caretposition = function() { if (!this.length) return; var input = this[0]; try { return input.selectionstart; } catch(e) { // no need old ie support return 0; } } html <input type="number" /> <div id="test"> </div> unfortunately isn't working in chrome, working if firefox. in chrome, prints 0 time. make me think chrome doesn't support selectionstart have read support selectionstart . supported fact if change type="number" type="text" starts working. how work consistently across browsers type="number" ? (not ie, don't need support that). i have

spring mvc - Thymeleaf + Polymer -

i'm trying implement material design based on polymer java thymeleaf template engine. started learning tutorial , got exception: caused by: org.xml.sax.saxparseexception; attribute name "unresolved" associated element type "body" must followed ' = ' character. as far can understand thymeleaf, default can't deal web components/custom components. possible use polymer in context of thymeleaf template engine? if have like: <body unresolved touch-action="auto"> it not work thymeleaf because thymeleaf expects markup valid xhtml , unresolved on own invalid xhtml markup. following should work: <body unresolved="" touch-action="auto"> <body unresolved="unresolved" touch-action="auto">

.htaccess wildcard redirect from parked domain? -

i have 2 domains pointing site, example; http://some-long-domain.co.uk , http://short.co - want able share urls http://short.co/x/ic5rai , while redirecting traffic www. version of main domain, , keeping path on url. to complicate matters, don't want touch versions of domain subdomain use development (local. , staging.). e.g.; http://short.co/x/ic5rai -> http://www.some-long-domain.co.uk/x/ic5rai http://www.short.co/x/ic5rai -> http://www.some-long-domain.co.uk/x/ic5rai http://some-long-domain.co.uk/x/ic5rai -> http://www.some-long-domain.co.uk/x/ic5rai http://local.some-long-domain.co.uk/x/ic5rai -> http://local.some-long-domain.co.uk/x/ic5rai http://staging.some-long-domain.co.uk/x/ic5rai -> http://staging.some-long-domain.co.uk/x/ic5rai current re-write rules following, , work latter point (local/staging), not else. doing wrong? rewritecond %{http_host} !^www.some-long-domain.co.uk$ [nc] rewritecond %{http_host} !^local.some-long

listview - Change image by click of list view item in Visual Studio 2012 c# and xaml -

i trying build program includes listview, have listview in place want happen, isn't, when click on specific list view item want image change. using visual studio 2012 , designing windows store not windows phone for example, have albert einstein first listview element, when user clicks on list view item picture of albert einstein appear in image element, vice versa when user clicks second element in listview image of galileo should appear, have images pre-loaded private void listview_selectionchanged(object sender, selectionchangedeventargs e) { if (scientistlistview.selectedindex==0) { imageforscience.source = new imagesource(new uri("benjamin_franklin.png", urikind.absolute)); textbelowhistory.text = @"einstein born in 1879 in germany (ulm, wuttemberg) , died on april 18 1955 developed special , general theories of relativity while working in patent office einstein had time work on theories of relativity in

ember.js - Editing a record in Ember without updating the UI -

i'm using ember , ember-data , i'm trying edit record. problem since inputs two-way-bound model, modifying in form changes model throughout application (even though don't commit changes). hence, changes reflect everywhere in site though aren't stored. what ember way of editing records without modifying them until user confirms changes? there way clone models? that's funny, myself ran this, came solution, , documented in own stack overflow question @ calling mymodel.save() returning outdated model . scroll down solution part, second bullet. my perception pattern, while common, still not well-documented in ember community. example, see these recent discussions: https://stackoverflow.com/a/25350828/2308858 (see comments) http://discuss.emberjs.com/t/before-leaving-route/2328 i solved doing following: hook willtransition event in route that, whenever page doing editing transitioned out of, can execute code right before happens. note covers

c# - List property inside a model is coming null while posting the model to controller -

i creating basic mvc3 application in trying post complex model type list property (of model type) controller. when so, property coming null inside model. i have model follows: public class employeelist { public list<employee> employeelist { get; set; } } and employee again model : public class employee { public int id { get; set; } public string name { get; set; } } controller code is: [httpget] public actionresult index() { employeelist em = new employeelist(); em.employeelist = new list<employee>() { new employee(){}}; return view(em); } [httppost] public actionresult index([bind(prefix = "employeelist")]employeelist employeelist1) { ....... } and views follows: index.cshtml:- @model test.models.employeelist @{ viewbag.title = "index"; } <h2>index</h2> @using (html.beginform("index", "home", formmethod.post, new { @id = "testform" })) { @html.labelfo

oop - When should I declare variables in a PHP class? -

i'm new oop paradigm, there's simple explanation question... do need declare public object-wide variables in class? example: <?php class testclass { var $declaredvar; function __construct() { $this->declaredvar = "i declared variable."; $this->undeclaredvar = "i wasn't declared, still work."; } function display() { echo $this->declaredvar . "<br />"; echo $this->undeclaredvar; echo "<br /><br />"; } } $test = new testclass; $test->display(); $test->declaredvar = "the declared variable changed."; $test->undeclaredvar = "the undeclared variable changed."; $test->display(); ?> in code, though $declaredvar declared variable, $undeclaredvar accessible , useable--it seems act if had declared public. if undeclared class variables accessible that, what's point of declaring them front

OpenCart PHP unexpected T_DOUBLE_ARROW -

i'm getting error when try go site. last thing did uninstall 1 blog extension , installed new one. error: parse error: syntax error, unexpected t_double_arrow in /home/mcflipp/public_html/vqmod/vqcache/vq2-catalog_controller_common_header.php on line 341 the code on line is: 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']), 'id' => $category['category_id']. '_' . $child['category_id'], and code matches in catalog/controller/common/header.php is: $children_data[] = array( 'name' => $child['name'], 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']), 'id' => $category['category_id']. '_' . $child['category_id'], 'child

c# - Finding the serial device COM port -

i have windows c# application . application connects rfid card reader on serial port . though have given com port 3 default . land situations user's port not available , port being used different windows os. my application give user ability change com port , find com port being used operating system , user needs go device manager , check , novice person might not comfortable . is there function or way find port rfid card connected in windows , can display : application port set : com .... device connection port on os : com .... also target framework 3.5 edit 1: tried using serialport.getportnames() returns empty string : system.string[].. my rfid device listed under device manager ===> ports(com & lpt) silicon labs cp210x usb uart bridge (com3) hi @user3828453 how following , can, use correct port number returned if still have empty port have ask user go device manager , update port via interface. private static string getrfidcomport() { stri

phpstorm - Using custom Environment Variables in JetBrains products for File watcher Arguments -

Image
i trying use node-sass file watcher in webstorm. i created local variable named style main stylesheet name inside add variable file watcher settings everywhere needed. but if add $style$ in path error: /users/grawl/sites/sitename/node_modules/node-sass/bin/node-sass app/styles/$style$.scss public/$style$.css error reading file "app/styles/$style$.scss" process finished exit code 1 ide don't interprets variable. also tried use %style% no luck. please not blame me direct mapping filenames in file watcher without using built-in variables $filename$ or $filenamewithoutextension$ because webstorm 9 eap not support preprocessor's dependencies except of built-in preprocessors sass , jade. this case not case use local variables. for example want put variables public/ path (that can dest/ in other projects) , app/ (can source/ ). , on. so let's figure out feature.

node.js - socket.io try to listen to default apache port -

in node.js script, set socket.io listen on port 8080: client = require('socket.io').listen(8080).sockets); then can connect io.connect('http://.../8080') . but why, in firefox/chrome consoles, see multiple requests on port 80? these : get http://.../socket.io/?eio=2&transport=polling&t=1408319587655-58 http://.../socket.io/?eio=2&transport=polling&t=1408319592695-59 http://.../socket.io/?eio=2&transport=polling&t=1408319597750-60 those links working port 8080. shouldn't io.connect('http://...:8080') , not io.connect('http://.../8080') ?

java - Relative router path in configuration file in Akka -

i studying akka framework (java) , building crawler (which, hopefully, open source in coming months...). i've create low-level actors responsible crawl on data sources , return found data message. actors running inside akka router can’t make non-blocking calls on data sources (this solution suggested in akka documentation). 1 of cool features of framework can configure how routers works in configuration files, makes easier change system’s behavior. i.e.: akka.actor.deployment { /"*"/querierrouter { router = balancing-pool nr-of-instances = 50 } this configuration worked fine in simpler unit test. akka system capable identify configuration , associated desired router. however, application increased in complexity, different paths different sizes created , both of them reach router. currently, i’ve paths (simplified version): akka://crawler/user/$a/$a/resource_processor/$a/query/querierrouter which akka system unable find correct configuration, sendi

php - Populating dropdown using Laravel Eloquent and DB -

i'm on laravel , eloquent, , trying populate view's dropdown box results of select query. in controller: public function uploaddocs($userid) { $doc_options = db::select('select document.document_description document user_id = ?', array($userid)); return view::make('uploaddocs')->with('doc_options', $doc_options); } in view: <body> {{ form::select('doc_options_id', $doc_options) }} </body> i'm getting following stack trace: htmlentities() expects parameter 1 string, object given (view: /home/vagrant/code/eduview/app/views/uploaddocs.blade.php) any ideas? thanks. try $doc_options = db::statement(db::raw('select document.document_description document user_id = ?', array($userid)))->get(); edit: should explain first. db::select() used database builder in order chain onto other chain-able functions, , not doing whole query. you use db::statement provide new custom sql query in

firefox - Primefaces selectOneMenu with Selenium webdriver does not select the item + Java -

i need set value on p:selectonemenu during selenium test having problem set value. here code used that: { driver.findelement(by.id("myform:meselection_label")).click(); driver.findelement(by.xpath("//div[@id='myform:meselection_panel']/div[2]/ul/li[text() = 'mytext']")).click(); } problem not select selection, tried use index on li (e.g. /li[2]) second item. when run test shows dropdown list , can see elements in not select element. , yes, have converter on object. tried selenium ide , put xpath in there same above , works fine, in test case in java not select element @ all. i searched net , forums not find solutions it. seams people had problems no answers posted on these questions. here pom.xml dependencies testing: { <dependency> <groupid>org.seleniumhq.selenium.client-drivers</groupid> <artifactid>selenium-java-client-driver</artifactid> <version>1.0.2</version>

rust - How to call a trait method without a struct instance? -

if have struct method doesn't have self argument, can call method via somestruct::method() . can't seem same method that's defined trait. example: trait sometrait { fn one_trait() -> uint; } struct somestruct; impl somestruct { fn one_notrait() -> uint { 1u } } impl sometrait somestruct { fn one_trait() -> uint { 1u } } #[test] fn testing() { somestruct::one_trait(); // doesn't compile somestruct::one_notrait(); // compiles } the compiler gives error "unresolved name 'somestruct::one_trait.'" how can call struct's implementation of trait method directly? i believe not possible. problem cannot explicitly specify self type. there active rfc in pipeline should allow when implemented. in meantime, work around this: trait sometrait { fn one_trait(&self) -> uint; } struct static<t>; struct somestruct; impl sometrait static<somestruct> { fn one

Yahoo Oauth in Ruby API Request - Signature Invalid -

i have gotten access token , access secret. i'm trying make api request oauth information. i'm following alongside yahoo docs (not helpful): https://developer.yahoo.com/oauth/guide/oauth-make-request.html https://developer.yahoo.com/oauth/guide/oauth-signing.html also, i'm trying follow example closely: https://gist.github.com/cheenu/1469815 here code: (i split long url convenience) require 'cgi' require 'base64' require 'openssl' url = "http://fantasysports.yahooapis.com/fantasy/v2/game/nfl" parameters = "format=json &realm=yahooapis.com &oauth_consumer_key=#{rails.application.secrets.yhoo_consumer_key} &oauth_nonce=#{securerandom.hex} &oauth_signature_method=hmac-sha1 &oauth_timestamp=#{time.now.to_i} &oauth_token=#{apivar.final_oauth_token} #the access token &oauth_version=1.0" base_string = 'get&' + cgi.escape(url) + '&' + cgi.escape(parameters)

java - Issues switching between fragments -

i have activity has 3 fragments each pulls collection of information user on each page. have set in way there 2 users in list, third fragment redirect second one, , if there 1 user second fragment redirect upon swipe first one. below code use switch between fragments: fragment mfragment = new fragment1(); getfragmentmanager().begintransaction() .replace(r.id.fragment1, mfragment ).commit(); below complete code public class fragment2 extends fragment { private string currentuserid; private arrayadapter<string> namesarrayadapter; private arraylist<string> names; private listview userslistview; private button logoutbutton; string usergender = parseuser.getcurrentuser().getstring("gender"); string activityname = parseuser.getcurrentuser().getstring("activityname"); number maxdistance = parseuser.getcurrentuser().getnumber("maximum_distance&

java - Getting a List of computers on a network -

this question has answer here: get ip addresses of computer available on network? -java 6 answers i have been trying name or ip of computers on network on in java. i have tried pinging each 1 2 different ways: process p = java.lang.runtime.getruntime().exec("ping -n 1 " + host); returnval = p.waitfor(); this returns 0 every address when fails. and inetaddress.getbyaddress(host).isreachable(timeout); always returning false the computers appear in windows network tab in explorer. is there way retrieve list of names of computer in java use? windows? net view or arp -a last 1 gives mac addresses.

Javascript validation for text area -

i have text area should accept values format on on change validation: string1-value1 , string2-value2 , string3-value3 ,... example india - ind, usa - us, kenya - kya. how can using javascript validation. tried validations, not working. please me. try autocomplete // can append strategies existing textcomplete object. $('#textarea1').textcomplete([ { // tech companies words: ['apple', 'google', 'facebook', 'github'], match: /\b(\w{2,})$/, search: function (term, callback) { callback($.map(this.words, function (word) { return word.indexof(term) === 0 ? word : null; })); }, index: 1, replace: function (word) { return word + ' '; }, placement: 'top' } ]);

php - Sum of data in multiple rows that echo with GROUP_CONCAT in CodeIgniter -

Image
i have data set generated codeigniter using mysql. need total delivered qty in view page. used following code. <?php $delivered_qty_total += $row->quantity; endforeach; ?> <?php endif; ?> but did not give accurate total of delivered qty . passing data group_concat separator "<br />" .when using tbl_order_products.quantity instead of group_concat give me accurate total. need group_concat . 'group_concat(tbl_order_products.quantity separator "<br />" ) quantity ', add query: sum(tbl_order_product.quantity) quantity_total see demo example of how see working you.

jquery - Javascript function doesn't do a transition -

i want make list in nav have transition applied. the call animate(0,"mainnav",.04,0.03); the function function animate(num, element, transitionunit, delayunit){ var transition = 0; var delay = 0; var x = document.queryselectorall('nav > ul > li'); (i=0; i<x.length; i++){ x[i].style.webkittransform = "translate3d("+num+"px,0px,0)"; x[i].style.opacity = "1"; x[i].style.transition = transition + "s " + delay +"s !important"; delay += delayunit; transition += transitionunit; } } this function applies changes except misses x[i].style.transition = ""; , x[i].innerhtml = ""; what problem? i've tried changing including queryselector, i've had found work except 2 have mentioned above. p.s. works animate(0,"viewnav",.04,0.03);

haskell - QuickCheck: Testing every element in a finite set -

i'm looking way test function on deterministic set of values always (rather randomly selected value list). example, i'd way check f :: (num a) => -> bool f x = (x - 2) == (x-3+1) holds int s 1, 3, , 5, without explicitly writing out testgroup "f tests" $ map (testproperty . property) [f (1::int), f (3::int), f (5::int)] instead, want have wrapper type around int when call f on type, tests f values 1,3, , 5 every time. the motivation this answer testing polymorphic functions. i came solution using own instance arbitrary [some c] : data c :: (show a, arbitrary a, c a) => -> c instance arbitrary [dict c] => arbitrary [some c] arbitrary = dicts :: [dict c] <- arbitrary sequence $ map (\(dict (proxy::proxy a)) -> liftm (arbitrary :: gen a)) dicts data dict c dict :: (show a, arbitrary a, c a) => proxy -> dict c class classtotest -- ... instance arbitrary [dict classtotest] arbitrary = ret

javascript - Determining whether an array contains duplicate values -

i scan through js array , determine if elements unique, or whether array contains duplicates. example : my_array1 = [1, 2, 3] my_array2 = [1, 1, 1] i want result : my_array1 must return true, because array element unique , array2 must return false, because array element not unique how can go writing method? if want check uniqueness can also this.as stated on comment not assert best option.there great answers down below. var arr = [2,3,4,6,7,8,9]; var uniq = []; // use store unique numbers found // in process doing comparison var result = arr.slice(0).every(function(item, index, array){ if(uniq.indexof(item) > -1){ // short circuit loop array.length=0; //(b) return false; }else{ uniq.push(item); return true; } }); result --> true arr.slice(0) creates temporary copy of array, on actual processing done.this because when uniqueness criteria met clear array (b) short circuit loop.this make sure processing stops

c# - escaped xml with cdata that has also has both escaped data value and tags -

i receiving xml data web service returns data 1 escaped xml string. whatever reason, part of xml enclosed within cdata tag. escape xml within cdata contain escaped xml character well. example: &lt;root&gt; &lt;importdata&gt;dat&lt;/importdata&gt; &lt;response&gt; <![cdata[&lt;secondroot&gt; &lt;data&gt;123&lt;/data&gt; &lt;dataescapedcharacterincluded&gt; 3 &gt; 1&lt;/dataescapedcharacterincluded&gt; &lt;/secondroot&gt;]]> &lt;/response&gt; &lt;/root&gt; i need transform both xml inside , out of cdata section xml format xsl, i'm having hard time figuring out how usable xml form either c# or xsl can xsl transform different format. below: <root> <importdata>dat</importdata> <response> <secondroot> <data>123</data> <dataescapedcharacterincluded> 3 &gt; 1</dataescapedc

php - Regarding the updating of CGridViews in TbRelationalColumn view -

in tbrelationalcolumn view page, have javascript refreshes sub-grid in view on click of action button. if user opens multiple sub-grids, grid update work first opened sub-grid. i think because grid id not unique subgrids. can please help? $this->widget('bootstrap.widgets.tbgridview', array ( 'id'=>'main-grid', ... 'columns'=>array ( array('header'=>'sl no','value'=>'$this->grid->dataprovider->pagination->currentpage * $this->grid->dataprovider->pagination->pagesize + ($row+1)', 'headerhtmloptions'=>array('style' =>'text-align: center;'), 'htmloptions'=> array('style'=>'text-align: center;')), array ( 'name'=>'indent_no', 'header'=>'indent no', 'class'=>'bootstrap.widgets.tbrelationalcolumn', 'url' =>

sql - joining 3 field in mysql -

i have sql query using uin select sum(scores_ofexpert.score) scores_ofexpert scores_ofexpert.user_id = '30' , scores_ofexpert.score > '0' union select sum(scores_ofexpert.score) scores_ofexpert scores_ofexpert.user_id = '30' , scores_ofexpert.score < '0' union select sum(scores_ofexpert.score) scores_ofexpert scores_ofexpert.user_id = '30' this extract sum of negative scores,sum of positive scoes , sum of scores of user; this ------------- |-10 | ------------- |30 | ------------- |20 | ------------- but want result this ------------------------------------- |n_sum |p_sum |sum | ------------------------------------- |-10 |30 |20 | ------------------------------------- how it? you can use case select sum(case when s.score < 0 s.score else 0 end) n_sum, sum(case when s.score > 0 s.score else 0 end)

web services - Using Spring WS without Tomcat -

i have written client (which consumes soap web service) @bean(name = "foo") public jaxb2marshaller marshallerfoo() { jaxb2marshaller marshaller = new jaxb2marshaller(); marshaller.setcontextpath("path.to.entity.foo"); return marshaller; } @bean public fooconnector getfooconnector(@named("foo") jaxb2marshaller marshaller) { fooconnector client = new fooconnector(); client.setdefaulturi("http://" + host_ip + ":" + host_port + host_path + "/foo"); client.setmarshaller(marshaller); client.setunmarshaller(marshaller); return client; } fooconnector class extends springs webservicegatewaysupport . far works, deploying application tomcant , have no problems. have new requirement, want able run standalone java applications (cli tools) access web service. don't want rewrite above been definitions. looking way reuse these definitions instantiate simplehttpserverfactorybean automatically used

debugging LLVM IR with LLDB -

i've developed llvm front-end generating llvm ir target code source-language x. if extend front-end embed debug information within generated ir, possible use lldb debugging source-language? mean lldb support any source-language targeting llvm ir? you'll have dwarf language code , lldb recognize it. if dwarf unknown language, we'll ignore it... then no more support, things work, others won't. if emit correct line table information, should able map source, , should stepping working well. other things start getting hard. the next hard part how going tell lldb type information. lldb uses clang's ast's internal storage type information in debugger. lldb translates dwarf type information clang ast's both printing local variables (with frame variable command) , use expression parser. if language has type system looks kinda c lldb should able parse dwarf types. you'll plus correct variable information should frame variable working.

javascript - phonegap - Playing html5 audio from local ressource -

i have build simple demo app should play locally stored mp3-file (delivered part of app). want use html5-audio instead of phonegap's media-object. using howler.js framework better performance. the local file stored under www/res/audio/2.mp3 . everything works fine when running on desktop browser. however, cannot work when deployed android device. weired thing is: playback of remotely hosted mp3-file works peachy, assume wrong url(s) use local file. have tried different url-"versions", none of below works: www/res/audio/2.mp3 /android_asset/www/res/audio/2.mp3 file:///android_asset/www/res/audio/2.mp3 file://android_asset/www/res/audio/2.mp3 http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockguitar.mp3 //works great it drives me crazy. ideas how work , mistake is? please see code below or download entire code here . index.html <!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="format-detec

for loop - php cart not sending through more than one item to paypal -

i have created cart , reason not adding item paypal. sends 1 item. have list of items added in database , loop through them. <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart" /> <input type="hidden" name="upload" value="1" /> <input type="hidden" name="business" value="test@test.com" /> <div class="basket_block" id="basket_block"> <div class="checkout_inv" id="checkout_inv">invoice: oca1234</div> <?php $sql_cart="select * cart_table session_id = '$sessionid'"; $result_set_cart=$database->query($sql_cart); $num_rows_cart=$database->num_rows($result_set_cart); for($i=1;$i<=$num_rows_cart;$i++) { while ($row_cart=$database->fetch_array($result_set_cart)){ $prod_id_now=$row_cart[

C: string replace in loop (c beginner) -

i need replace strings in text. found function here @ stackoverflow: char *replace(const char *s, const char *old, const char *new) { char *ret; int i, count = 0; size_t newlen = strlen(new); size_t oldlen = strlen(old); (i = 0; s[i] != '\0'; i++) { if (strstr(&s[i], old) == &s[i]) { count++; += oldlen - 1; } } ret = malloc(i + count * (newlen - oldlen)); if (ret == null) exit(exit_failure); = 0; while (*s) { if (strstr(s, old) == s) { strcpy(&ret[i], new); += newlen; s += oldlen; } else ret[i++] = *s++; } ret[i] = '\0'; return ret; } this function works me fine single replacement. need replace whole array "str2rep" "replacement". i'm trying do(im beginner) **** #define maxtext 39016 int l; int j; char *newsms = null; char text[maxtext]; char *

php - how to display or append json data from js to html -

how can display json data js html here code have tried <script> $.ajax({ url:'load_categories.php', type:'get', data:{'from':loaded,'to':loadmore}, success: function (res) { var categories = $.parsejson(res); var i=0; (var x in categories){ alert(categories.date_+i); $('#categories').append('<div>'+(categories.date_+i+'</div>'); //not displaying on html i++; } $('#loadmore').attr('num_loaded',(loaded+10)); } }); </script> <div id="categories"></div> <?php //load_categories.php $res = mysql_query("select * impressions limit $from,$to"); //echo "select * impressions limit $from,$to"; $arr = array(); $i= 0; while($row = mysql_fetch_array($res)) { $arr['rec_id_'.$i] = $row['rec_id']; $arr['date_'.$i] = $row['date'];

python - Filesystem: Where would I place a program that makes a new project? -

so have written small generator make of work easier. produce html banners , asked make between fifteen , thirty-five @ time. instead of going through idiot , copy-pasting , modifying them one-by-one, abstracted out unique elements , made generator make them in python. has increased production factor of ten, i'm pretty happy it. up now, it's been under active improvement while used it, it's more or less mature @ point , i'd take 1 step further ceasing current pattern of copying latest client folder make next 1 , write script make new folder me unchanging template. maybe write in convert older clients new templates or something. whatever. i'm not sure in linux filesystem should go, though. /usr/local/bin looks it's binaries, , /usr/local/lib has important things python in it. /usr/local/src candidate, figured best check first, since won't moved once it's in. which of these (or other location) best place in? many thanks i suggest set li

cmd - Can't execute command in java -

i want 1 of these commands executed. can't in java. commands are: type table1.sql, table2.sql, table3.sql > sbackup.sql type *.sql > allinone.sql --[make backup file in folder] copy *.sql merged.sql i tried this: string command = "type " + "*.sql" + " --result-file=" + "c:\\sbackup.sql"; runtime.getruntime().exec(command); your valuable insight highly appreciated. thank you. type , copy both built-ins in windows command shell, not actual programs can execute. execute them, execute command shell , provide command argument after /c : string command = "cmd.exe /c type " + "*.sql" + " --result-file=" + "c:\\sbackup.sql"; runtime.getruntime().exec(command); ...but i'll note don't think type has --result-file argument.

linux - Cleaner way to restart daemontools services -

in our product, had created services using daemontools. 1 of service looks this, /service/test/run /service/test/log/run (has multilog command log ./main dir) /service/test/log/main/.. all process , directories owned root user. there security requirement change this, service should run in non-root user. log main directory should readable user , groups. for this, have change 'run' file under 'log' directory. need change permissions of 'main' directory under it. note these files under '/service' owned test-1.0-0.rpm. when update rpm, overrides existing run file , got error this, multilog: fatal: unable lock directory ./main: access denied i know shouldn't override 'run' file @ run time. have planned follow these steps in rpm script %post section, //stop service svc -d /service/test/log //moving main directory mv /service/test/log/main /service/test/log/main_old //updated run file has code create main limited permissions

javascript - jqRangeSlider slow on chrome -

i'm using jqrangeslider in creating multiple instances on website. reason, , on chrome - takes lot of time render sliders (about 1.5-2 seconds each x 9). sliders move (again, chrome ). ff , ie working perfectly. i tried removing other js files, no avail. i'm not sure how debug such problem. would appreciate idea. ok, i've found bug. issue originated, oddly enough, direction:rtl css property on body element :\ works, usual, faster ff , ie. hope someone.

primefaces - Can't get ajax rowSelect event to fire on PrimeFace5.0 DataTable -

i using primeface5.0 datatable. want add ajax rowselect event it. however, when row clicked, event not fired. table , ajax declared so: <p:datatable id="letable" value="#{lelist.leitems}" var="leitem" rowkey="#{leitem.id}" scrollable="true" scrollheight="100%" selection="#{lelist.selectedles}" selectionmode="multiple" rowindexvar="rowindex" resizablecolumns="true" liveresize="true" > <p:ajax event="rowselect" listener="#{leaction.onlerowselect}" update=":form:rowindexid" onstart="getlerowindexid(event)"> </p:ajax> .... </p:datatable> action-bean: public void onlerowselect(selectevent event) { .... } the whole thing worked prime faces 4.0 . after switching version 5.0 no longer works . can please me?

android - OnClickItem() in gridView how do I show the same image in a separate imageView -

the gridview being populated contents of specific folder called "mydir". layout gallery_fragment split in half 2 linearlayouts. 1 on left has gridview populated images "mydir". layout on right has imageview. the idea can select image gridview on left , appear on imageview on right. cannot use res/drawables folder in instance. i have been told need use hashmap hmap; have suggestions? public class galleryfragment4 extends fragment { private imageview imageview; private imagegridviewadapter imageadapter; private gridview gridview; private static final string gridview_tag = "android logo"; @suppresslint("usesparsearrays") public hashmap<integer, string> hmap = new hashmap<integer, string>(); // private linearlayout linear; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(

java - Error installing R package -

edit:1 have seen using rjava package on win7 64 bit r i have windows 7 64-bit machine r 3.1.0, java 7u67 64-bit installed. ( note: not allowed update r ) java_home set c:\program files\java\jre7 and path includes c:\program files\java\jre7\bin , c:\program files\java\jre7\server (the last entry jvm.dll file) from r prompt can see rstudio using 64-bit r r version 3.1.0 (2014-04-10) -- "spring dance" copyright (c) 2014 r foundation statistical computing platform: x86_64-w64-mingw32/x64 (64-bit) > .machine$sizeof.pointer [1] 8 i can load rjava library fine > options(java.home="c:\\program files\\java\\jre7\\") > library(rjava) warning message: package ‘rjava’ built under r version 3.1.1 but when try install install bigr package on machine , getting following error message > install.packages("c:/local/bigr-1.0.tar.gz", repos = null, type = "source") installing package ‘c:/users/alex/documents/r/wi

r - Arrange multiple (32) .png files in a grid -

Image
i've been pulling hair out past week trying figure out elementary r coding can't seem anywhere (haven't used r since 2013 not great excuse). all want 4x8 grid made of 32 .png files (maps i've made), , want without loading 1 image file @ time ( http://www.statmethods.net/advgraphs/layout.html ). so think can load images within folder writing (please correct me if beliefs bs) img <- list.files(path='c:/a',patt='compo[0-32].*',full.names=t) then thinking maybe in lines of par(mfrow=c()) , layout , grid.arrange ( writing png plots pdf file in r ), grid.raster ( how join efficiently multiple rgl plots 1 single plot? ) - i've read on , experimented accordingly not resulting in worthwhile.. the latter employed following outcome it made me giggle. don't think lattice way go anyway. any appreciated! not sure concern loading image files -- how else read data create new image? eta: load files, i'd use png::readpng .

c# - Read cdata and html inside a tag by linqToXml -

i want rid of cdata , want read br tag. xml : <body> <![cdata[ apple iphone är mycket mer än en mobil. den är en kombination av tre enheter: en revolutionerande mobiltelefon, en ipod widescreenformat och en banbrytande internetenhet. allt detta och mer därtill gör den till den bästa mobiltelefon du kan föreställa dig. ]]> <br/> <![cdata[ med de maskinvarufunktionerna iphone kombination med världens mest avancerade mobiloperativsystem öppnar apple möjligheter för vad en mobiltelefon kan göra. programmen är helt integrerade med varandra och kan synkroniseras med din dator - oavsett om du använder mac eller pc. från multi-touch-skärmen till det smarta tangentbordet och sensorerna. ]]> <br/> </body> and here code : public static list<string> getdescriptionxml(string iditem) { dictionary<string, string> dic = new dictionary<string, string>(); xdocument xdoc = xdocument.load(getdescription(idi