Posts

extjs - Ext Form Model load two fields with same data -

i have ext model form. need load single data value password field both password , confirm password field. possible load records in ext? yes possible. when record loaded in form, data obtained calling getdata() on record. therefore, can tweak model provide copy of password in field this: ext.define('user', { extend: 'ext.data.model', fields: [ 'id', 'name', 'password' ], getdata: function() { var data = this.callparent(arguments); data['confirm_password'] = data['password']; return data; } }); full example: https://fiddle.sencha.com/#fiddle/pgr alternative approach if not want change model, password field mirror value confirm password field whenever value set through setvalue : var form = ext.create('ext.form.panel', { defaulttype: 'textfield', items: [ { fieldlabel: 'name', na...

mysql - How to store each record or row in descending order into database in rails? -

i want store record or row in descending order of scores of match database in ruby on rails. can top 3 topper rank of current user. don't know how this. the problem simple: don't need specify order when insert data in database. database engine capable of sorting data according instructions when perform select. simply create rails model store score , reference of subject associated score (e.g. user_id). then, solution selecting records ordering score. assuming model called result result.order("score desc").limit(3) just small note. simple problem, long have necessary basic knowledge of ruby, rails , database interaction. this answer helpful if do. if don't, you'll need start simpler problems learn these topics first.

javascript - How to append json array to value attribute -

Image
there search box in view. when search product on here retrieve(single) product using ajax my ajax code is <script> $(function() { $("#update_prod").click(function(event) { event.preventdefault(); var head = $("#update_product").val(); $.ajax({ datatype: 'json', type: "post", url: "<?php echo base_url(); ?>index.php/admin/update_product", data: { product: head }, success: function(data) { } }); }); }); </script> so in controller public function update_product() { $product = $_post['product']; $query = $this - > db - > query("select * product title '%$product%' , online=1"); $result = $query - > result_array(); echo json_encode($result); } and im reviving data in console [{ "id": "99", "brand_id": "8", "category_id": "1", ...

java - covert text file to multiple pdf files based on a string -

i have big text file, have 20,000 student's transcript data.i need create 1 pdf each student’s transcript (means 20,000 pdf) in text file. how can achieve this. appreciate ideas. thanks. this new requirement, havn't start anything. checking possible ways achieve this. sample input text file have data below. * student-name : test1;student # : 123456 subject : english marks : 100 subject : maths marks : 90 * student-name : test2;student # : 345678 subject : english marks : 100 subject : maths marks : 90 * student-name : test3;student # : 567859 subject : english marks : 100 subject : maths marks : 90 * student-name : test4;student # : 657656 subject : english marks : 100 subject : maths marks : 90 for above text file, requirement create seperate pdf each student transcirpt test1.pdf,test2.pdf,test3.pdf,test4.pdf

ember.js - Sync the states of multiple instances of same Ember Component -

here's situation: i wrote component facility-search searches through fixture data. put multiple instances of {{facility-search}} on same template (tab pages). component has input boxes can write search keywords. want observe change in value of input box , update same instance of component both of them in sync. this i'm doing in components/facility-search.js import ember 'ember'; import em 'ember'; var facilitysearchcomponent = ember.component.extend({ // tag name appears in html tagname: 'div', // randomnumber searchboxid: null, // facilities allfacilities: null, // search values textfacility: "", textcountry: "", textspecies: "", // text input ids needed <label for="id"/> // elements in multuple components should not have same id textfacilityid: 'text-facility', textcountryid: 'text-country', textspeciesid: 'text-species', // initiali...

api - How can I predict which Facebook friends chat with each other based off online status and Facebook's "last time active" feature -

if @ facebook's chat ( http://i.imgur.com/hxhjehc.png ) can see says last time specified user active. so if 2 friends both last active 2 minutes ago , both go online , become inactive again, there high likelihood chatting. i want know if has idea best way go accessing data be. don't think it's available through facebook api unsure. furthermore, perform sort of probabilistic statistical analysis on data see how confident algorithm guess of whether or not 2 friends chatting. i know question broad ideas on either acquiring data or design , analysis of data appreciated. this not available via graph api, don't see chance here implement planning.

networking - How Global Unicast Addresses work for IPv6 on android devices -

i developing android app , need find global unicast addresses android device without make network requests. (that should easy if can make network request since can therefore see outfacing public ipv6 in header). want see how find unicast address before make network request. i have used apis retrieve possible ipv6 interfaces. focus on ips falling 2000::/3 range. however, got 1 ipv6 ( right answer), got two/multiple address in 2000::/3 range. assume scenario might cause network status changes, not sure. for example: api returns me following 2 ipv6s 2600:1010:b022:1349:d25c:f9bf:2881:d30c%3%3 , 2600:1010:8043"3aba:67ca:ac76:4a8f:dbdb%9%9 can tell me how global unicast ipv6 works on android devices? how can ensure getting real ipv6 , not temporary one? with privacy extensions, temporary address rest of world use. periodically changes try prevent associating address you. how privacy extension implemented os dependent, but, generally, temporary address while, ...