Posts

Showing posts from February, 2012

android - TextView side by side in RelativeLayout -

Image
im trying place 2 textviews, same size in width, side side inside relativelayout. in between them have made view of 1 dp in width separate textview. have tried wrap_content both both wont work. textviews called headertext , headertext2 in in id. please me. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:orientation="vertical" > <imageview android:layout_width="fill_parent" android:layout_height="110dp" android:layout_weight="0.3" android:scaletype="fitxy" android:src="@drawable/hunters" /> <!-- <scrollview --> <!-- android:layout_width="match_parent" --> <!-- android:layout_height="0dip" --> <!-- android:layo

mysql - Executing user-generated JavaScript from database -

i developing web application in django. vital application's core functionality taking user generated javascript , submitting through form mysql database. javascript code served webpages able see, performs calculations behind-the-scenes. know dangerous because of xss , perhaps other reasons, there way can safely? has ever done or seen work successfully? also, important thing javascript needs math. maybe there's scripting language doesn't have of power of javascript can still run in browser? sanitize input making sure math language , nothing else.

ruby on rails - Boolean attribute not being saved via check_box -

i have job model attribute of :rush boolean. used check_box form helper toggle :rush. the check box form element: <%= check_box_tag(:rush) %> <%= label_tag(:rush, "rush?") %> my strong parameters method: def job_params params.require(:job).permit(:recipient, :age, :ethnicity, :gender, :height, :weight, :hair, :eyes, :other_info, :instructions, :user_id, :company_id, :case_id, :rush, addresses_attributes:[:id, :label, :addy, :apt, :city, :state, :zip ] ) end the create action: def create @job = job.new(job_params) @job.user_id = current_user.id if @job.save redirect_to current_user else render 'new' end end when form submitted, doesn't save :rush yet other attributes including nested attributes save fine. missing here? since function says: params.require(:job).permit(:recipient, :age, :ethnicity, :gender, :height, :weight, :hair, :eyes, :other_info, :instructions, :user_id, :company_id, :case_id, :rush,

Run a Python script on Heroku on schedule (as a separate app) -

ok i'm working on app has 2 heroku apps - 1 writer writes db after scraping site, , 1 reader consumes said db. the former python script has kind of while 1 loop - it's twitter stream. want run every x minutes independent of reader doing. now, running script locally works fine, i'm not sure how getting work on heroku work. i've tried looking up, not find solid answer. read background tasks, redis queue, one-off dynos etc, i'm not sure use purpose. of requirements are: have python script keep logs of whatever want. in future, might want add admin panel writer, show me stats of script (and logs). hooking admin panel (flask) should easy-ish , not break script itself. i love suggestions or pointers here. i suggest writing consumer server waits around, processes stream on timed interval. is, start once , runs forever, doing processing every 10 minutes or so. see: sched python module, handles scheduling events @ times , running them. simpler:

android - Dialing in ListView -

i have basic app shows list view of items , when clicked toast generated saying clicked on .... want dial given phone numbers when clicked. here code customclicklistener listener = new customclicklistener(); tableview.setclicklistener(listener); tableview.addbasicitem("example 1", "summary text 1"); tableview.addbasicitem("example 2", "summary text 2"); tableview.addbasicitem("example 3", "summary text 3"); tableview.addbasicitem("example 4", "summary text 4"); tableview.addbasicitem("example 5", "summary text 5"); tableview.addbasicitem("example 6", "summary text 6"); tableview.addbasicitem("example 7", "summary text 7"); tableview.addbasicitem("example 8", "summary text 8"); tableview.addbasicitem("example 9", "summary text 9"); tableview.ad

html - multiple level unorderd list hierarchy in jquery -

i have html , css code, hve done in css show , hide, want done in jquery click event , padding left , right seccond , third level unroderd list has increased parent, if add 1 more unorderd list has add padding dynamically , shouldn't have add css that. <ul class="delete"> <li><a>1</a> <ul> <li><a>1a</a></li> <li><a>1b</a></li> <li><a>1c</a></li> <li><a>1d</a></li> </ul> </li> <li><a>2</a> <ul> <li><a>2a</a></li> <li><a>2b</a></li> <li><a>2c</a></li>

jquery - How to set values in checkbox using php array and Mysql -

i want set values in checkbox using array , values fetched database. have string 1,2,3,6,8 has been converted string using explode function. fetched values database has 10 elements has item_id 1 , on. want compare values array 1 one , matches value, checkbox checked , if not checkbox remain unchecked. total checkbox 10. 5 should selected per item_id , array. $string = 1,2,3,6,8; $array = explode(',', $string); $string = "1,2,3,6,8"; $values = explode(',', $string); for($i=1;$i<=10;$i++) { if(in_array($i,$values)) echo "<input type='checkbox' name='checkboxes[]' value='$i' checked='checked'>"; else echo "<input type='checkbox' name='checkboxes[]' value='$i'>"; }

node.js - npm install less throws error from ruby -

i trying use less, following getting started guide i ran sudo npm install -g less ended with: /usr/bin/lessc -> /usr/lib/node_modules/less/bin/lessc less@1.7.0 /usr/lib/node_modules/less ├── mime@1.2.11 ├── mkdirp@0.3.5 ├── source-map@0.1.33 (amdefine@0.1.0) but when try using lessc error ruby: $ lessc /home/jasonshark/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:298:in `to_specs': not find 'less' (>= 0) among 153 total gem(s) (gem::loaderror) /home/jasonshark/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:309:in `to_spec' /home/jasonshark/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem' /home/jasonshark/.rvm/gems/ruby-2.0.0-p247/bin/lessc:22:in `<main>' /home/jasonshark/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval' /home/jasonshark/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:i

How to use omnipay for implementing online payment with CodeIgniter? -

i trying using omnipay implementing online payment. i have read several article on topic. also, have read omnipay documentation on github. not understand, how can implement ? because, documentation not clear me. is there article on ? recently, have faced problem. after trying days later, have success. mention steps as: step-1: @ first install composer in system. follow link composer-> http://getcomposer.org/ step-2: install omnipay in system according instruction https://github.com/adrianmacneil/omnipay#installation step-3: create composer.json file in root directory. , paste code in it { "require": { "omnipay/omnipay": "*" } } step-4: install curl in system using command curl -s http://getcomposer.org/installer | php step-5: update composer using: php composer.phar update step-6: include composer autoloader. add line top of index file file: require_once __dir__./vendor/autoload.php'; s

c# - System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() -

i want sent push notification via parse.com , have webservice that [webmethod] public bool pushnotification(string pushmessage) { bool ispushmessagesend = false; string poststring = ""; string urlpath = "https://api.parse.com/1/push"; //var httpwebrequest = (httpwebrequest)webrequest.create(urlpath); system.net.webrequest request = system.net.httpwebrequest.create(urlpath); request.usedefaultcredentials = true; request.preauthenticate = true; request.credentials = credentialcache.defaultcredentials; poststring = "{ \"channels\": [ \"trials\" ], " + "\"data\" : {\"alert\":\"" + pushmessage + "\"}" + "}"; request.contenttype = "application/json"; request.contentlength = poststring.length; request.headers.add("app id", "my parse app id&qu

android - Is there a way to see the virtual keyboard presented and how can I close it with AndroidViewClient? -

after typing text on field (automatically androidviewclient ) virtual keyboard remains on device screen. if make dump culebra script on step not receive views related virtual keyboard receive views can't see since virtual keyboard hides them. wish androidviewclien t "see"/distinguish virtual keyboard. , need how can close virtual keyboard androidviewclient (what command should use?) upd included iskeyboardshown() method checks if virtual keyboard shown, works! wrote method below. acts back key event. def back(self): self.shell('input keyevent keycode_back') that's looking for! if want dismiss keyboard: def dismisskeyboard(self): if self.iskeyboardshown(): self.device.press('keycode_back')

matrix - Python - pandas - Append Series into Blank DataFrame -

say have 2 pandas series in python: import pandas pd h = pd.series(['g',4,2,1,1]) g = pd.series([1,6,5,4,"abc"]) i can create dataframe h , append g it: df = pd.dataframe([h]) df1 = df.append(g, ignore_index=true) i get: >>> df1 0 1 2 3 4 0 g 4 2 1 1 1 1 6 5 4 abc but suppose have empty dataframe , try append h it: df2 = pd.dataframe([]) df3 = df2.append(h, ignore_index=true) this not work. think problem in second-to-last line of code. need somehow define blank dataframe have proper number of columns. by way, reason trying scraping text internet using requests+beautifulsoup , processing , trying write dataframe 1 row @ time. so if don't pass empty list dataframe constructor works: in [16]: df = pd.dataframe() h = pd.series(['g',4,2,1,1]) df = df.append(h,ignore_index=true) df out[16]: 0 1 2 3 4 0 g 4 2 1 1 [1 rows x 5 columns] the difference between 2 constructor approaches ap

php - Compare and replace values in array -

i need compare 2 arrays , first array have 1 order , can´t change , in other array have different values , first array must compare id id of other array , , if id it´s same , take value , replace show in same order for example : $array_1=array("1a-dogs","2a-cats","3a-birds","4a-people"); $array_2=array("4a-walking","2a-cats"); the result in case want it´s : "1a-dogs","2a-cats","3a-birds","4a-walking" if id in case 4a it´s same , entry must modificate , put value of other array , stay in same order i no work me : for($fte=0;$fte<count($array_1);$fte++) { $exp_id_tmp=explode("-",$array_1[$fte]); $cr_temp[]="".$exp_id_tmp[0].""; } for($ftt=0;$ftt<count($array_2);$ftt++) { $exp_id_targ=explode("-",$array_2[$ftt]); $cr_target[]="".$exp_id_targ[0].""; } /// here tried use array_diff , othe

java - Unable to catch SocketTimeoutExeption -

i attempting catch sockettimeoutexception socket remains active , can continue reading through program. unfortunately, no matter how attempt catch read timeout can't , therefore application closes. i have socket , setsotimeout 30000. i call input.readline() , want catch timeout , continue. appreciated. string response; try { response = input.readline(); system.out.println("server response: " + response); return; } catch(assertionerror e){ //we timed out. print user timeout occured, //try command again system.out.println("timeout: please try command again.\n" + "if created game, join existing or create again."); } catch (sockettimeoutexception e) { //we timed out. print user timeout occured, //try command again system.out.println("timeout: please try command again.\n" + "if created game, join existing or create again."); } catch (ioexception ex) { //do nothing

java - NoClassDefFoundError executing jar using jaxrpc -

i have developed webservice client application using jaxrpc. within eclipse application runs fine, after have exported jar file, following runtime error d:\>java -jar myclient2.jar exception in thread "main" java.lang.noclassdeffounderror: javax/xml/rpc/service exception @ mynet.myscheduler.<init>(myscheduler.java:47) @ mynet.myscheduler.<init>(myscheduler.java:36) @ mynet.mynetmain.main(mynetmain.java:11) caused by: java.lang.classnotfoundexception: javax.xml.rpc.serviceexception @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) ... 3 more i have tried

Php mysql while loop fetching rows -

i want fetch experience row database, level players accordingly experience, is, level equal experience ÷ 100. for example, if player's experience 100, he's level 1. if it's 200, he's level 2. here's code: <?php $con = mysqli_connect("localhost", "username", "password", "db"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $result = mysqli_query($con, "select * playerdata order bank desc limit 9999"); while($row = mysqli_fetch_array($result)) { $row['unique_id']; // ? echo "<br>"; $xp = $row['experience']; if ($xp == '1') { echo 'you\'re level one'; } if ($xp == '2') { echo 'you\'re level 2'; } } mysqli_close($con); ?> i don't know how handle while statement while loop yet. how can calculate level

php - Display rows including empty rows in symfony 1 -

Image
i'm newbie in web development, , want modify existing project.i want display rows including null value,a default value of 0 or empty one.this code in action.. public function executedetails(sfwebrequest $r) { if($this->getuser()->hasattribute('extend_term_ch')) { $this->getuser()->getattributeholder()->remove('extend_term_ch'); } $this->loan = doctrine_core::gettable('loans')->findonebyid($r->getparameter('id')); $this->debits = doctrine_core::gettable('creditlogs')->getbyloanid($r->getparameter('id')); } and in templates <?php $totalamount = 0 ?> <?php foreach($loan->collections $i=>$c): ?> <?php $totalamount += $c->amount ?> <tr class="<?php echo ($i%2==0)?'even':'odd' ?>"> <td> <?php echo $c->mode_of_payment ?> <?php

bash - Recursively copy user-executable files -

how can recursively copy user-executable files in folder folder? example, have in folder folder/one : -rwxrwxr-x 1 user group 7777777 jun 1 12:00 executable1 -rw-rw-r-- 1 user group 4444 jun 1 12:00 text1.txt in folder folder/two : -rwxrwxr-x 1 user group 7777777 jun 1 12:00 executable2 -rw-rw-r-- 1 user group 4444 jun 1 12:00 text2.txt it should recursively copy executable1 , executable2 folder destination folder without preserving original hierarchy. destination folder should have: -rwxrwxr-x 1 user group 7777777 jun 1 12:00 executable2 -rwxrwxr-x 1 user group 7777777 jun 1 12:00 executable1 you use find command: find folder -type f -executable -exec echo "{}" /tmp \; replace echo cp -p after verify output correct.

php - Making classes focus on doing one thing - practically -

this again, more of conceptual question (see previous post is there difference between object , models in php/codeigniter? ) this codeigniter (an mvc framework) on php. i'm trying work out best ( = practical, , sound principles) way implement example. in example, in database schema, since using tank_auth on codeigniter, table called "users" has been created automatically me (by tank_auth). 1 user table represents users in whatever role in book lending library application. a person fill numerous roles simultaneously (lender, author, librarian, manager, etc). had started out thinking should have "people_model" (as m in mvc) wondering if not better this: there should "lender" model , "author" model , "librarian" model etc. i'm hard pressed explain why make sense, because of oop principle "make classes focus on doing 1 thing (single responsibility)". so example principle refers to? "librarian" cl

Segmentation fault in c when reading a line -

i want read user input(like terminal) until exit written or ctrl + c / ctrl + d pressed. read every line(until return/enter pressed), check if it's space or comment(#) , execute functions. i tried 3 methods, no success. error every time insert string , press enter char line[256]; while(printf("%s>", shell_name) && scanf("%50[^\n]", line) != eof) { segmentation fault (core dumped) while(printf("%s>", shell_name) && getline(line, 100, stdin) != eof) note: expected ‘size_t * restrict ’ argument of type ‘int’ while(printf("%s>", shell_name) && fgets(line, sizeof(line), stdin) != null) { segmentation fault (core dumped) for more orientation i'm doing next if(isspace(&line) == 0 && &line[0] != "#") what doing wrong? there more suitable/easy/better option? the segfault kicks in because enter infinite loop: scanf("%50[^\n]", line) reads input

c# - refresh captcha displayed in image tag wp8 xaml -

i displaying captcha url in xaml this <image name="captcha" source="http://lenovo-pc/vitforums/captcha.php" margin="108,146,80,262"></image> where source php script on local computer on lan .. want refresh captcha image url when click refresh button .. how can in advance just reset source new uri unique each time, example adding current time querystring parameter this: private void refresh_click(object sender, routedeventargs e) { captcha.source = new bitmapimage(new uri("http://lenovo-pc/vitforums/captcha.php?t=" + datetime.now.ticks, urikind.absolute)); }

php - Laravel Route Params and Form Params -

i have backend in laravel, rest api, because i'm using angularjs in fronend , making ajax requests. let's have make crud users and don't know if there difference between putting of parameters in route or of them in form input. for example: route::post('/users/update', 'userscontroller@update); and call 'id' parameter from: input::get('id') or route::post('/users/update/:id', 'userscontroller@update); and include parameter of function update like: public function update($id) { } is there real difference between 2 ways? maybe security issues? coding standards? or same? should use laravel's rest controllers? if building rest api should have url example.com/posts/42 , not example.com/posts?id=42 because cleaner , coding standard. i drop uppercase characters in urls , go second choice of implementation. way, if need update user should use put request so: put users/:id .

ruby - Rails eventmachine not initialized evma_install_oneshot_timer -

i'm using rails 4.1.1 , thin 1.6.2 , redis 2.8.9 (with hiredis driver), , faye-rails gem. i use faye-rails subscribe changes on few models, , use redis other (unrelated) stuff. when tried call create on faye-observed model (let's apple), throws error this: 2.1.1 :001 > apple.create (0.1ms) begin sql (0.4ms) insert `apples` (`created_at`, `updated_at`) values ('2014-06-01 17:26:54', '2014-06-01 17:26:54') (7.6ms) rollback runtimeerror: eventmachine not initialized: evma_install_oneshot_timer /home/david/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:323:in `add_oneshot_timer' /home/david/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:323:in `add_timer' /home/david/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/em/timers.rb:12:in `initialize' /home/david/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/em/deferrable.rb:173:in `new' /home/david/.rvm/gems/ruby-2.

matlab - Determine if the user clicked inside the polygon or outside of it -

i trying write script in matlab fills polygon , prints "inside" output window when user clicks inside polygon , "outside" output window when user clicks outside polygon. reason prints inside when click outside polygon. have put code below. xv = [ -3 3 3 -3]; %// x coords of polygon vertices. arbitrary number yv = [-5 -5 7 7]; %// y coords of polygon vertices. same number x fill(xv,yv,'b') %// draw polygon axis([-10 10 -10 10]) [xp, yp] = ginput(1); %// point coordinates inside = inpolygon(xp,yp,xv,yv); %// inside? while inside fprintf('inside\n') [xp, yp] = ginput(1); end fprintf('outside\n') the code missing line in while loop reset value of inside , checking see if user input still in polygon: while inside fprintf('inside\n') [xp, yp] = ginput(1); inside = inpolygon(xp,yp,xv,yv); %// inside? end % outside polygon, finished fprintf('outside\n') and once user has clicked outsid

MySQL/SQL prevent deleting records that are use in another table -

the structure of 2 tables follows: use exercise; create table companies ( id int, name varchar(100), city varchar(100), c_size varchar(100), primary key (id) ); insert companies(id, name, city, company_size) values (222, 'karma llc','city2', 'big'), (223, 'manny ind.','city1', 'medium'), (224, 'random plc','city1', 'medium'), (225, 'hijack llc','city1', 'medium'), (226, 'travels llc','city1', 'small'), (227, 'mirana ind.','city2', 'small'), (228, 'polla ind.','city3', 'small'), (229, 'americano llc','city3', 'small'), (230, 'macaroni llc','city4', 'small'); create table invoices ( id int auto_increment, `date` date, company int, amount decimal(7,2), primary key (id) ); insert invoices(`date`,company,amount) values

javascript - How do i get the width and height after using appendTo -

basically, have parent div named 'wrapper' , adding other div's: divimg , counter , caption. centering 'wrapper' . appending divs 'wrapper' works ok. i'm stuck on how center 'wrapper' . reason, cannot width , height of 'wrapper' after using appendto . it's same , height. how width , height after using appendto , see code below: function appendimage() { var wrapperwidth; var wrapperheight; var windowwidth = $(window).width(); var windowheight = $(window).height(); var wrapper = $("#modal-wrapper"); var divimg = $("<div></div>") .hide() .attr("id", "container-img") .appendto(wrapper); var counter = $("<p></p>") .hide() .addclass("slideshowcounter") .text(text goes here...) .appendto(wrapper); var caption = $("<p></p>") .hide() .addclass("imgcaption") .text(caption goes

excel - Adding A Hyperlink To An Individual Chart Series -

i have selected first series of chart using following code: activesheet.chartobjects(1).activate activechart.seriescollection(1).select how add hyperlink series? each chart series have different hyperlink, same seriescollection(2) , on. many thanks adding code in workbook: public withevents cht chart const linkvar = "http://www.google.com" private sub workbook_open() set cht = worksheets(1).chartobjects(1).chart end sub private sub cht_select(byval elementid long, byval arg1 long, byval arg2 long) on error goto fin if selection.name = "series1" activeworkbook.followhyperlink address:=sheet2.range("a1").value, _ newwindow:=true end if if selection.name = "series2" activeworkbook.followhyperlink address:=linkvar, _ newwindow:=true end if fin: end sub private sub workbook_sheetselectionchange(byval sh object, byval target range) if cht nothing set cht = work

java - JavaFX2: How to retrieve Task in Service's onFailed event? -

i have javafx service , try handle task failure. reference task instance in handle method of onfailed handler. in debug can see workerstateevent source holds task reference, cannot find way other reflection avoid. am missing in here? i ended having subclass of service class property (this needed, logging purposes). it job, i'm not marking proper solution because don't it. perhaps has better idea.

android-how to make a login? -

i've information in application , it's company information . want make login every time app closes , runs . this i've done far . make custom dialog user , password field . problem , every time rotate screen or come mainactivity , need re login , it's bothering alot . i want dialog comes every time close app , run again , . i've tried onstop , ondestory when rotate screen or change activity , leave mainactivity , show me dialog . how can show dialog first time app runs , if close app , run again ,it asks me login again ? thanks on orientation change, life cycle functions of activity called, because reconstructed zero. application must take account. current activity goes onpause() onstop() ondestroy(), new activity goes oncreate() onstart() onresume(), in order. therefore must store fact have logged in, in such way application not forget. peristent data storage can done sharedpreferences example, if don't want use more complicated. check ou

javascript - Knockout for MVC. Child Dropdownlist doesn't load the model data at first time -

model: public class storedata { public selectlist regions { get; set; } public selectlist groups { get; set; } } client: function cascadingddlviewmodel() { this.groups = ko.observablearray([]); } var objvm = new cascadingddlviewmodel(); ko.applybindings(objvm); html: @html.dropdownlist("gid", (selectlist)model.groups, new { id = "ddlgroup", data_bind = "options: groups, optionstext: 'text', optionsvalue: 'value'" }) jquery loading dropdown $("#ddlgroup").change(function () { var ddl = this; var id = ddl.options[ddl.selectedindex].value; var url = $(ddl).attr("data-url"); $.getjson(url, { id: id }, function (data) { objvm.stores(data); }); }); at first time after load data in dependent dropdownlist data absent. after choosing item in parent list ok. problem comes after page reload. how bind data after page load? i decided problem using 1 line $('#ddlregion&

multithreading - deleting data sent to thread in FLTK using c++ -

i'm performing long task, implemented in function, in new thread (i.e. not main gui thread) in fltk (in c++). i achieve callback function in turn creates thread have of form void callback(fl_widget* widget,void* passed_data){ data_type* data = new data_type; data->value = x; //populate data structure send function fl_create_thread(thread1,function,data); } where fl_create_thread (at least purposes) using pthread_create meaning data variable passed void pointer , 'function' takes void pointer too. i realised create memory leak don't delete 'data': can't delete after line fl_create_thread thread hasn't (or ever) finished running. have tried deleting pointer @ end of 'function' raises 2 issues 1) deleting void pointer undefined , getting warnings effect. 2) defeats point of using function: there better general coding practice? can tell me how should approach this? thanks. 1) deleting void pointer undefined , gett

javascript - Jquery UI autocomplete: both labels and values are behaving like values -

i'm working jquery ui's autocomplete. the problem i'm having this: when work witih external data source, both label , value behave values. in other words, when reference external data source, single label , value pair, both label , value appear in dropdown together, 2 choices. in other words, both appear values, instead of appearing label , value. when click on 1 of them, alert alert(ui.item.label); shows value, whether label, or value. i can't see why label , value both behaving values, since i've marked in json source. the problem not occur local data source, external one. here's local code: <script> $(document).ready(function() { $("#inputbox").autocomplete({ source: "sd/aa.php", minlength: 3, select: function(event, ui) { alert(ui.item.label); alert(ui.item.value); } }); }); </script> <input id="

javascript - dynamic margin based on jQuery window.width() -

i have little problem jquery function. need add margin element when window.width < 580px , need remove when window.width larger. here problem, first part of function work well, not second. var wwidth= $(window).width(); if ( wwidth < 582) { $( window ).resize(function() { var nwwidth=$( document ).width(); var marginl = (nwwidth - 292)/2; $('.hub-item').css('margin-left',marginl +'px'); }); } else { $( window ).resize(function() { $('.hub-item').css('margin-left','0px'); }); } i have no mystakes in console margin not 0. u all! edit : correct code : $(window).resize(function() { var wwidth= $(this).width(); if (wwidth < 582) { var nwwidth=$( window ).width(); var marginl = (nwwidth - 292)/2; $('.hub-item').css('margin-left',marginl +'px'); } else { $('.hub-item').css('margin-left','0px&#

using minimum_match inside filter in elasticsearch -

i'm trying build elastic-call wanna sett filters within curtain area, like: { "query" : { "filtered" : { "query" : { "match_all" : { } }, "filter" : { "and" : [ { "bool" : { "must" : { "terms" : { "my_filter" : [1, 2, 4], "minimum_match" : 3 } } } }, { "geo_distance" : { "location" : "56.20123,14.3240234", "distance" : "30km" }

c# - Fluent API EF inheritance and mapping -

i've system several self referencing entities one-to-many relationship (parent-child). i'd use common base class of entities: public class selfreferencing { public selfreferencing parent {get; set;} public icollection<selfreferencing> children {get; set;} } and inherit particular entity selfreferencing. fluent api mapping requires reference properties of defining type, when trying following: modelbuilder.entity<concreteselfreferencing>() .hasmany(e => e.children) .withoptional(e => e.parent); so, can me find possibility make use of inheritance , entities mapped? thx note: example below known table-per-hierarchy (tph) - i.e. contained in 1 table. click on this link table-per-type (tpt) , has different tables each type. when using base types , inherited types, have tell ef how determine association specific inherited type. taking code: public abstract class selfreferencing { public selfref

javascript - single page login system using ajax and pdo -

i want make login system without page refreshing using ajax , pdo. because im planning make single page website people can login , go profile using show , hide javascript only. my problem when press login button nothing happens. index.php <?php include_once('myincludes.php'); ?> <html lang="en"> <head> <script src="bootstrap/js/jquery-1.11.0.min.js"></script> <script type="text/javascript"> $(document).ready(function () { $('#login').click(function (e) { e.preventdefault(); var emptyfieldsuser = $('#user').filter(function () { return this.value === '' }); var emptyfieldspass = $('#pass').filter(function () { return this.value === '' }); if (emptyfieldsuser.length) && (emptyfieldspass.length) { alert("try again"); } else { var data = {}; data.user_text = $('#user').va

tfsbuild - Scheduled TFS 2008 builds not running -

2 scheduled builds triggered run @ 9:30(et) , 10:30(et) in tfs 2008 offshore team(in india), can validate it, morning(ist). both builds scheduled run every weekday , sunday except friday. they running fine until last couple of days. won't trigger on own though source code has changed after last build. manual builds , other ci builds working fine. i have verified trigger time in db , shows correct scheduled time. any idea could've gone wrong? i reset build service , set things order. both builds ran @ scheduled time today. thing i'm still skeptical why build service working fine manual builds or ci builds.

sql - Execute query using C# -

i trying execute sql code, connected directly database, don't know how execute query. sqlconnection connect = new sqlconnection("database"); sqlconnection myconnection = connect; connect.open(); sqldataadapter adptador = new sqldataadapter(@"query", connect); datatable tabela = new datatable(); adptador.fill(table); clientcontext.web.lists.getbytitle("title"); clientcontext.executequery(); list list = clientcontext.web.lists.getbytitle("listname"); clientcontext.load(list); listitemcreationinformation listitemcreationinformation = new listitemcreationinformation(); listitem item = list.additem(listitemcreationinformation); foreach (datarow row in tabela.rows) { item["lastmodifiedby"] = row["lastmodifiedby"].tostring(); item.update(); cm = new sqlcommand("sql command"); **execute cm** clientcontext.executequery(); } sqlcommand has executereader, executing command , returning da

android - Scaling selector drawable -

i have drawable used in selector. image/drawable star , selector used checkbox , should represent favorite-button. <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="false" android:drawable="@drawable/star" /> <item android:state_checked="true" android:drawable="@drawable/star_faved" /> </selector> the images 256x256px big , dont scale when used checkbox. tried use 9patch, couldnt work. <checkbox android:layout_width="20dp" android:layout_height="20dp" android:text="read" android:button="@drawable/favorite_checkbox" android:focusable="false"/> what standard way approach this? 256x256 px seems big enough xxxhdpi resource. so, imagine made @ 640 dpi. a 9 patc

google chrome - Would webRTC be supported on any iOS browser? -

why webrtc not supported on chrome ios? there hard limitation support? does know of plan support webrtc on ios browser? the ball in apple's court , has inherit limitations put down apple. apple very quiet , particular such things. also, webrtc not finalized standard , surely doubt apple accept until standardized. heck, microsoft still technically not support it(meaning ie not support yet). you make native application , subvert browser. there ericsson browser may support webrtc it has not looked promising on ios either

mysql - Workbench not allowing to add Primary Index -

i have following defined in mysql workbench database table, example table1 : index name = primary type = primary i have created similar separate table name table1_test , trying create same index same index type it's not letting me choose primary dropdown menu? reason?

hibernate - No value for key bound to thread (Grails) -

i'm developing web application grails. environment specs are: groovy grails tool suite (ggts) 3.6.0.m1-e4.4-win32-x86_64 hibernate 4.3.5.3 groovy 2.3 grails 2.4.0 windows 8.1 pro n i start application, , on grails start page choose controller: class uploadcontroller { def index() { } def upload() { forward(controller: "parser", action: "takeuploadedfiles") } } with controller there not happen anything. corresponding .gsp upload form. use upload multiple files @ once. <%@ page contenttype="text/html;charset=utf-8" %> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> <meta name="layout" content="main"/> <title>inhalte einlesen</title> </head> <body> <div class="body"> <g:uploadform controller="upload" action="upload" autocomplete="off&quo

breeze - DevForce supporting Xamarin? -

i came across post on ideablade´s forum: http://www.ideablade.com/forum/forum_posts.asp?tid=4635&kw=xamarin&pid=17331&title=devforce-2014#17331 i find question interesting, there no response ideablade. does ideablade have plans devforce supporting pcl or xamarin in future? or can devforce used xamarin? samples? there no plans support xamarin in devforce. ideablade's new product, breeze#, can used xamarin. see http://www.breezejs.com/breeze-sharp more info.

TLS / SSL server hello in reuse mode -

does know how many times server try send hello client, after client has sent hello, before giving , closing session( if ssl id reused)? does know how many times server try send hello client, after client has sent hello, before giving , closing session( if ssl id reused)? at tls/ssl level, server send serverhello once, , won't 'give , close session' @ all. may give , close connection , if has read timeout set on socket: otherwise can sit there forever waiting next part of handshake client. at tcp level happen several times if client doesn't ack it, don't think that's you're asking about. ssl session resumption has nothing it.

Clarification on String concatenation in java -

this question has answer here: why java's concat() method not anything? 6 answers i beginner in java, please go easy on comments. string test = "test"; test.concat("test"); system.out.println("concatenated string: " +test); system.out.println("concatenated test: " +test.concat(test)); why first print statement not print testtest, while second 1 does? might basic question, not find answer online. can please explain? because you're not assigning concatenated string value (as concat() returns resulting string), lost. if want result, need do: test = test.concat("test"); the second println() works, because resulting concatenated string returned, captured , used system.out.println() , lost outside of println() not assigned (so if check test after, still contains "test"

Python & Matlab Difference in Matrix Calculation for Nesting Loop -

import numpy np x=[ 2061075.875, 2061801, 2061154.25, 2061605.75, 2061314.375] y=[ 10638640, 10639060, 10638727, 10639118, 10638802] st=[ 73.92976, 71.13528, 64.40809, 71.80971, 72.72918] l=[ 254.96384, 239.15473, 200.20001, 218.91659, 185.49989] deltal=10 n=np.floor(np.divide(l,deltal)) in range(0,len(x)): if (int(n[i]/2)==n[i]/2): px_down = np.zeros((len(x),max(np.floor(n/2)))) py_down = np.zeros((len(x),max(np.floor(n/2)))) j in range(0,int(n[i]/2)): px_down[i,j]=x[i]-(deltal*j)*np.sin(st[i]*np.pi/180) py_down[i,j]=y[i]-(deltal*j)*np.cos(st[i]*np.pi/180) else: px_down = np.zeros((len(x),max(np.floor(n/2)))) py_down = np.zeros((len(x),max(np.floor(n/2)))) j in range(0,int((n[i]-1)/2)): px_down[i,j]=x[i]-(deltal*j)*np.sin(st[i]*np.pi/180) py_down[i,j]=y[i]-(deltal*j)*np.cos(st[i]*np.pi/180) the result of px_down , y_down strange , ma

claims based identity - Log the logins to the various applications that identityserver manages -

we've got lot of sites common authentication thinktecture identityserver v2. now have log of logins sites. we've got custom iuserrepository log user login in, how goahead , grab site user loggin into? and when jump 1 site - how logged in case there's no built in support this, best place modify code? it seems done in wsfederationcontroller , in issue method realm based on uri. public actionresult issue() { tracing.start("ws-federation endpoint."); if (!configurationrepository.wsfederation.enabled && configurationrepository.wsfederation.enableauthentication) { return new httpnotfoundresult(); } var message = wsfederationmessage.createfromuri(httpcontext.request.url); // sign in var signinmessage = message signinrequestmessage; if (signinmessage != null) { // place log current user , application user loggin db??? // or thinktec