Posts

Showing posts from July, 2014

android webview only show loaded data after second refresh/load -

i trying write android webview code load data jason file url. however, noticed data not shown on page initial time, succussfully shown if click button load/refresh data page again (not sure if because of refresh or reload). checked log file. first time click output following log. 08-17 16:07:38.784: v/webview(17435): singlecursorhandlertouchevent -geteditablesupport fasle 08-17 16:07:39.184: v/webview(17435): doshortpress : mnativeclass - 2089760 mpreventdefault - 2 08-17 16:07:41.777: v/webview(17435): singlecursorhandlertouchevent -geteditablesupport fasle 08-17 16:07:42.187: v/webview(17435): doshortpress : mnativeclass - 2089760 mpreventdefault - 2 08-17 16:07:42.588: d/dalvikvm(17435): gc_concurrent freed 375k, 46% free 3455k/6343k, external 377k/1281k, paused 2ms+2ms the second time run bring me following text in log, can see loaded string data output log @ last line. 08-17 16:07:51.837: v/webview(17435): singlecursorhandlertouchevent -geteditablesupport fasle

php - Laravel Eloquent - equivalent to first() for last? -

i have few models such user, post, comment, etc. in user, have: public function posts() { return $this->hasmany('post'); } i can first post via $customer->posts()->first() , if want latest post? there no last() can see. this further compounded hasmanythrough relationship (unfortunately inherited wacky schema): public function comments() { return $this->hasmanythrough('comment', 'post'); } if try $this->comments()->orderby('comments.id', 'desc')->first(); returns user object?? no, this // user model $this->comments()->orderby('comments.id', 'desc')->first(); won't return user model. and asked for, this: $customer->posts()->latest()->first();

osx - -bash: phonegap: command not found (Mac OS) -

i installed phonegap , cordova using npm on macbook (mac os x mountain lion) using these commands on command line. sudo npm install -g cordova sudo npm install -g phonegap both phonegap , cordova seemed install fine, when tried: mymac:~ user$ cordova mymac:~ user$ phonegap i got messages: -bash: cordova: command not found -bash: phonegap: command not found both installed, why command not work. i know old question, think answer helpful. i got same problem , solve creating symlink: cd /usr/local/bin/ sudo ln -s /usr/local/cellar/node/6.0.0/bin/phonegap phonegap sudo ln -s /usr/local/cellar/node/6.0.0/bin/cordova cordova remember change path /usr/local/cellar/node/6.0.0/bin/ yours installation folder. []s

search - Selectively setting the number of returned SOLR rows per field based on field name -

i have field in solr index, let's call book_title. a query returns 15 rows book_title:"the kite runner", 13 rows book_title:"the stranger", , 8 rows book_title:"the ruby way". is there way return first row of "the kite runner" , "the stranger", of "the ruby way" rows previous query result? result in 10 rows altogether. possible @ all, using single query? no, variable amount of documents are, far know, not possible. can use fieldcollapsing / grouping overview 8 documents each, if that's want - , ignore 7 other "the kite runner" , "the stranger". option first retrieve collapsed / grouped set of documents, issue second query complete result set 1 of selected groups.

python 2.7 - Pip/Easy_install do not install desired package -

i new python (2.7) trying run program requires "requests" module. have installed pip using get-pip.py script , registered python27 , python27/scripts paths environment variables. when run "python -m pip install -u pip" says package up-to-date. following installation guides, when run "pip install requests" new command prompt line. tried "easy_install requests" , same thing. tried "pip install --verbose requests" , have same behavior (so being verbose!). i running on windows vista ultimate, using command prompt administrator. since "python -m pip install -u pip" displayed something, on hunch tried: "python -m pip install requests" this worked! don't know why of installation guides not this.

java - Problems using JMenu with different choices -

i´ve been working on gui , i´ve run problems jmenu. gui in separate class takes actions of program rest of classes. problem using menu want 2 things: first, show correct panels based upon user choice , second, wait user input complete chosen task. i´ve arranged 13 different if.. else clauses depending on user choice, part works correctly nescessary input options (panels) shown user need input data. part 2 when user sees right panels , wants input information (int , strings) things don´t go intended. instead of waiting user input , take actions based on data program rushes forward , continues. since no data entered, needless say, output not intended one. i´ll provide part of class it´s quite large. class employee implements actionlistener { public void actionperformed(actionevent e) { if(e.getactioncommand().equals("1")) { panelb.setvisible(false); panelc.setvisible(false); pan

dry - C# Repeated code in methods -

i have amount of methods. in every method code repeated. example this class sample1 { public void samplemethod1() { try { //code of method } catch(exception ex) { console.writeline(ex.message); } } public void samplemethod2() { try { //code of method } catch (exception ex) { console.writeline(ex.message); } } } public void samplemethod3() { try { //code of method } catch (exception ex) { console.writeline(ex.message); } } can not repeat myself? read aop. perhaps, solution of question? you can create method accepts action , tries execute it: class sample1 { public void samplemethod1() { tryexecute(() =>

php - I want a pagination to my options page of wordpress plugin? -

Image
my demo i want pagination according results coming wordpress database...this done on options page of wordpress plugin.. my code retrieve database follows $per_page=5; $sql = "select * wp_dive "; $result = $wpdb->get_results($sql_10) or die(mysql_error()); $length=count($result); $pages = ceil($length/$per_page); foreach( $result $results ) { $id=$results->id; $name= $results->name_cust; $gender= $results->gender_cust; $dob= $results->dob_cust; <?php $html= "<div class=\"divcontentbody\">";?> <?php $html .= "<span class=\"clsorderno\">". $id."</span>";?> <?php $html .= "<span class=\"clsname\">". $name."</span>";?> <?php $html .= "<span class=\"clsgender\">".$gender."</span>";?> <?php $html .= "<span class=\"clsdob\">". $dob .&

listview - Android static percentage bar view - not a progress bar -

i'm trying show items in listview so: a. name1 80.33 ====== 60% b. name2 101.22 ======= 70% c. name3 55.22 === 30% d. name4 140.11 ========== 100% the "graph" should solid colored line entire width of 100% needs there, , should occupy entire width available except value on far left , percentage on far right. percentages more percentiles, relative lowest value in set! anyway have tried framelayout progressbar , seems ill-suited plus can't lay out way want. i'm thinking 1px colored image stretch percent need 1px dark image rest of way. any ideas? thanks! edit: ok progress new problem: here's did in layout: <view android:id="@+id/pr_bar_1" android:layout_width="30dip" android:layout_height="4dip" android:layout_gravity="center_vertical" android:background="#ffffff" /> <vi

Reduce inodes count on Magento website -

i getting errors on website , website inodes count overload. hosting inodes limit 200,000 website inodes count 909,496 , can't open phpmyadmin. hosting support asked me remove unused files. how can decrease inodes count , files unused in magento based website? usually indicator need more capable hosting provider. the major places magento creates files during operation in var/ folder , product image cache. if you've never checked before, following areas can accumulate phenomenal amount of detritus. using ftp client, check following areas in var/ folder: check don't have bazillion sessions files in var/session , remove older current date check there aren't excessive amount of files in var/report , might want find out why magento generating them , fix issue. delete them all. logging generate on time several huge files in var/log , delete them , @ new ones find out errors being generated. imports , other stuff can cause temporary files accumulate in

ios - iTunes Connect - Waiting for review -

i uploaded new version of app , it's still waiting review. has been 10 days since uploaded binary. i uploaded full version of same app same day uploaded new version of free app. full version changed status ready sale 3 days ago (it took 7 days finish review). new version not "in review". seven days new app , 10 days (so far) new version. wondering... normal? completely usual. it's other way around, updates reviewed faster new app binaries. can sit down , relax ;)

php - Codeigniter, HMVC : MX_Router is never called, resulting in 404 error -

i'm using codeigniter 2.1.3. noticed nice module called hmvc (hierarchical mvc), allows mvc development in hierarchical manner, name indicates. downloaded , installed it. however, after doing manipulations explained in every tutorial available, 404 error when trying access test page created. after searching while without success, decided install latest version of codeigniter (2.2.0). followed tutorial, , worked. i decided try compare 2 versions (the 1 works, , doesn't) see sources called, , seemed fail in codeigniter v2.1.3. i found out in version 2.1.3 of codeigniter, error happens because in function _validate_request of class /system/core/router.php, program reaches end of function because hasn't found controller class matching uri (in case localhost/codeigniter/users : suppose detect have module called users, , should use controller in application/modules/users load page). program reaches function show_404() (see below) , generates 404 error : // if w

java - JButtons in JPanel only appearing on mousover -

after digging through few other posts have asked question, problem still remains. here jframe class creates , holds jpanel in turn holds buttons. import java.awt.gridlayout; import javax.swing.jframe; import javax.swing.jpanel; public class window extends jframe{ private static final long serialversionuid = 1l; private grid grid; private squarebutton[][] buttons; private jpanel board; public window(){ super("territories"); grid=new grid(); buttons=new squarebutton[8][8]; board=new jpanel(new gridlayout(8, 8)); //creates each button proper x , y values , adds each board (int i=0; i<8; i++){ (int j=0; j<8; j++){ buttons[j][i]=new squarebutton(j, i); board.add(buttons[j][i]); } } //setting frame properties setsize(560, 560); setdefaultcloseoperation(exit_on_close); setresizable(false); bo

asp.net mvc - DropDownList setting selected item in MVC5 -

how can set default value drowdownlist? i have this: @html.dropdownlistfor(model => model.businessid, (selectlist)viewbag.businesses, new { @class = "form-control" }) edit: // get: reviews/create public actionresult create() { viewbag.businesses = new selectlist(db.businesses, "businessid", "businessname"); return view(); } [httppost] [validateantiforgerytoken] public actionresult create([bind(include = "reviewid,reviewtext,rating,businessid")] review review, int id) { if (modelstate.isvalid) { db.reviews.add(review); db.savechanges(); return redirecttoaction("details", "businesses", new { id = review.businessid }); } review.businessid = id; viewbag.businesses = new selectlist(db.businesses, "businessid", "businessname", review.businessid); return view(review);

ios - Why is SKNode nodeAtPoint returning wrong node? -

apples docs state nodeatpoint method on sknode returns deepest node in tree. take mean if draw out tree scene node @ top, answer should expected 1 of nodes @ bottom-most position in tree. isn't happening me. here's tree looks like: scene | world | +------------+----+---------+------------+ | | | | leftarrow rightarrow boardlayer statuslayer | +-----------+-----------+--------+-+---------------+ | | | | | arrow highlight trough rotating(0) testdump (21) | +--------+----------+ | | | guides board playerpiece

html - Center a DIV at bottom of page -

i'm trying center div @ bottom of page , having no luck. i've scoured web, keep turning nothing when attempting apply solutions. any chance out there might have solution? see code below: <!doctype html> <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script></script> <style type="text/css"> body { background-color: aqua; height:100%; min-height:100%; } .centerdiv { display: table; width:90%; margin:0 auto; height:100%; min-height:100%; text-align: center; } .box { display: inline-block; width: 100px; height:100px; border: 3px solid #fff; } </style> </head> <body> <div class="centerdiv"> <div class="box box1" style="background-color:#585858;"> </div> <div class="box box2" style="background-color:#118c4e;"&g

Match function response when no match found -

i have match function nested within if function. if match found within range, formula works. if match not found, "n/a": match not found. blank cell instead. here link example spreadsheet illustrates question: https://docs.google.com/spreadsheets/d/1_yliqk_-7ygxakoigtfjlvwm3d-ia_rf1qo0_o_klwq/edit?usp=sharing have tried match function returns? 0 no result or n/a? you if returns 0 replace if (match(..) >= 1, "1") with if (match(..) >= 1, "1", "") otherwise should check result of match against logic function isna or isnumber edit: apparently had be: =iferror((then formula),"")

jquery - send formData and other object from ajax to php -

i have ajax query send form "have upload file input" php file, to send file formdata : var formdata = new formdata(); var file = $("#logo").get(0).files[0]; formdata.append("logo", file); and have other input values wanna send name , password,email ... , here object created : {name:name, email:email, password:password, auth:auth} so i'm asking how send formdata + object data in ajax here : $.ajax({ data : ...... ? }); you have append each element within serialized form data formdata object. refer here: send formdata , string data through jquery ajax?

java - SWT Menu unresponsive on MAC -

i trying out example of how create menu using swt. using eclipse on mac. referring example . whenever run example, have 2 problems: the menu doesn't show until make full screen. the menu buttons unresponsive i.e when click on help, doesn't show dropdown containing help. do have make spwcific changes while creating menus on mac?

javascript - Mapbox dynamic markers in Meteor.js -

able set mapbox viewpoint dynamically passing geocoder street address stored in database. but rather setting map view address, want draw marker @ address' location. template.vendorpage.rendered = function(){ //get address database id address = function(){ pathname =location.pathname.split("/"); thisid = pathname[2]; return vendors.findone({_id: thisid}).address } //set variable address function thisaddress = address(); //draw mapbox l.mapbox.accesstoken = '<my token here>'; var geocoder = l.mapbox.geocoder('mapbox.places-v1'), map = l.mapbox.map('map', 'alexnetsch.j786e624'); geocoder.query(thisaddress, showmap); function showmap(err, data) { // geocoder can return area, city, or // point, address. here handle both cases, // fitting map bounds area or zooming point. if (data.lbounds) { map.fitbounds(data.lbounds); } else if (data.latlng) { map.setview([data.latlng[0],

Saving features to SQL Server using Openlayers and geoserver -

i using sql server plugin geoserver ( http://docs.geoserver.org/stable/en/user/data/database/sqlserver.html ) show geometries using wms. works fine. able extract geometries vectors without trouble. now need add retrieved vector layer , save table in sql server database. causing problems. this of code: savestrategy = new openlayers.strategy.save(); savestrategy.events.register("success", '', changessuccess); savestrategy.events.register("fail", '', changesfailed); function changessuccess(e) { alert('done'); } function changesfailed(e) { alert('failed'); } selectionlayer = new openlayers.layer.vector( "selectionlayer", { strategies: [new openlayers.strategy.bbox(), savestrategy] , projection: new openlayers.projection("epsg:25832") , protocol: new openlayers.protocol.wfs({ version: "1.1.0", url: "ht

javascript - How to get the zipcode of a user using AngularJS -

i need populate data based on zipcode of user visiting site. could tell me how retrieve zipcode of location of user? i using angularjs on app. ok. bit involved, here how it, if you. first, use geolocation api follows: window.navigator.geolocation.getcurrentposition(function(pos){ console.log(pos); }); inside callback, position object. looks this: { "timestamp":1408324851386, "coords"{ "speed":null, "heading":null, "altitudeaccuracy":null, "accuracy":30, "altitude":null, "longitude":-111.8942634, "latitude":40.7288257 } } then, can take latitude , longitude , call server translate zip code. getting lat/long hard part. doing math turn zip easy. an alternative calling own server translate lat/long zip, call google maps' reverse lookup api. give lat long, , gives address, complete zip. see here how that. disclaimer: won't

jquery - Auto populate select fields in a PHP form with a drop down selection -

i use bootstrap , ci. created form contain 2 drop down retrieves data mysql. i have tb_sekolah table id , kota , nama , provinsi , status_sekolah column names. i did show data kota in tb_sekolah table in first dropdown. problem is, show data nama in second dropdown. if user select data in first dropdown second dropdown show data nama . example: column kota has data such yogyakarta, bantul, , sleman. column nama has data such sma 1 yogyakarta , sma 3 yogyakarta , sma 1 sewon , sma 1 sleman . if user selects yogyakarta in first dropdown second dropdown shows sma 1 yogyakarta , sma 3 yogyakarta firstly have disable second dropdown , have write jquery/javascript function invokes on change event ie, when first dropdown selected. $('#select').on('change',function(){ var value = $(this).text(); $.ajax({ url: "url goes here", data: value }).done(function(data) { $('#seconddropdown').removeclas

.net - LINQ - How to modify the select depending on value that DB would return -

i'm relatively new linq , i'm developing .net function instantiates poco selected fields of linq query. the problem 1 of these fields must transformed "at runtime". this malfunctioning example: private shared function getinfectionhistory(hiveid long) ilist(of hiveinfectiondetail) using db landdatamodelunitofwork = context.createunitofwork dim historyresult = in db.hiveafbinfections i.hiveid = hiveid select new hiveinfectiondetail { .dateinfected = i.dateinfected, .datecleaned = i.datecleared, .potentialafbinfection = i.potentialinfection, .afbinfection = not i.potentialinfection } if islistempty(historyresult.tolist()) return nothing end if return history

android - Upload Data in IntentService when no Internet Connection -

i'v built intentservice upload data service. when there's no internet connection doesn't work. how can wait in intentservice internet connection? i've found lot answers broadcast receiver how can save data want upload? if start broadcastreceiver , start intentservice, data want upload lost. does have code example?

css - Slider's background changes while scrolling the page,How Could it be possible -

please take @ website : http://psnprofiles.com/ how slider's background work? think it's div how place behind else , scroll down see effect on slider's background picture how can make slider's background that,to change while scrolling page down. what want jquery scroll script. in page, see down bottom if ($('#slider')) { $(window).scroll(function(e) { var scrolltop = $(this).scrolltop(); if (scrolltop <= 520) { if (scrolltop < 60) { scrolltop = 60; } $('#slider').css('-webkit-transform', 'translate3d(0,'+math.floor((scrolltop-60)/2)+'px, 0)').css('-moz-transform', 'translate3d(0,'+math.floor((scrolltop-60)/2)+'px, 0)'); } }

java - Inserting values from textfield in to database -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i trying insert textfields data database. insert data table compte_utilisateur , i've 2 comboboxes : first groupe containing names of groups (alias libelle_groupe ) in database, , second statut containing status values (alias valeur ) in database. i want insert db user ( alias compte_utilisateur ) , need id_groupe of name of group selected in combobox , id_statut of status selected in combobox. i've tried this, i'm having exception : java.lang.nullpointerexception the code : resultset valeur1= stmtlistelivre.executequery("select id_groupe groupe libelle_groupe='"+combo_name.getselecteditem().tostring()+"'"); resultset valeur2= stmtlistelivre1.executequery("select id_statut statut valeur='"+jcombobox1.getselecteditem().to

bash - Use variables with dot in unix shell script -

how use variables dot in unix (bash) shell script? have script below: #!/bin/bash set -x "file=system.properties" file=$1 echo $1 if [ -f "$file" ]; echo "file $file exists" else echo "file $file not exist" fi this need ⟶ x=propertyfile , , propertyfile=$1. can please me? you can't declare variable names dots can use associative arrays map keys, more appropriate solution. requires bash 4.0. declare -a file ## declare variable associative array. file[system.properties]="somefile" ## assign value. echo "${file[system.properties]}" ## access value.

ios - UISegmentedControl (with images) in UITableViewCell (AutoLayout) always 29 points high -

standard tableview app. autolayout. each (cell) class has own .xib file, no storyboard. i have segmented control in tableview cell filling (almost) completely, 4 edges bound 6 points space container (=content view of tableviewcell ). segments made images, not text. i expect when call -[setimage: forsegmentatindex:] control changes intrinsic content size make enough space segment images - view height. did set it's content hugging priority 251 (and cell's hugging priority stays @ default 250), when use narrow images segmented control height should shrink (and cell content view height also). , when use larger images segmented control height should grow... compute correct height measuring invisible reference cell (dequeued myself in -[viewdidload] , kept in viewcontroller property), asking autolayout -[systemlayoutsizefittingsize:uilayoutfittingcompressedsize] reference cell's contentview. works fine, different sizes return in -[tableview heightforrowatindexpath]

excel - Converting from string to date -

short story: my question 2 fold: how copy on text 05-jun-2014 text file text 05-jun-2014 not displayed #name? or cut off @ 5 ? (i need whole thing copied over.) how take text , make date? long story in text file have dates in format day-month-year , e.g 05-jun-2014 . see, "e" in june cut off. if type in 05-jun-2014 in excel, recognizes it. use cdate convert string date. my problem multi-fold. want excel vba recognize 05-jun-2014 date. if try copy phrase 05-jun-2014 text document. 5 copy over. copy string jagged array jaggarray , there call it. below can see code how copy text: private function creategcstruct(byref tempstring() string, byval anum integer, byval onum integer, _ byref olist() string, byval index integer, byval gcsoidate date, byval gcfname string, _ byval typename string) gcbstruct '...code... ' jaggedarray: dim jaggarray() variant '...code... '2) capture structure information textfile array 'a) remov

git submodules - Structure dependencies directory in python project -

i have python project , wish include dependencies in single directory named "deps" follows: +deps ---+dep1 ---+dep2 +module1 +module2 an import statement this: import deps.dep1 my intention have "deps" submodule in git. right way go it? i've chosen course automating deploy of python using virtualenvs such pain! edit: if choose go way, need add "deps" directory pythonpath or use sys.path.append(). trying figure out solution without modifying import statements , without having place export pythonpath statement in bash profile(which again cause issues during deployment) please help! there no right or wrong way it. many projects prefer bundle dependencies keep tight control , avoid having depend on package managers, or availability of packages on given system. i keep deps part of main git repository , have each dependency separate git submodule, fork of respective project's own git/hg repository.

android - JAVA CV unsatisfied link error -

i want use javacv library image processing. facing problem integrating library in porject. log cat gives error on line ffmpegframerecorder recorder = new ffmpegframerecorder(path + "video" + system.currenttimemillis() + ".mp4", 320, 480); all other javacv functions work correctly. ffmpegframerecorder gives error. have followed readme.txt , included javacv.jar , , javacpp.jar in libs folder, extracted .so files opencv-arm , ffmpeg-arm armeabi folder in libs . the logcat error is: 08-22 12:46:07.402: e/androidruntime(2408): caused by: java.lang.unsatisfiedlinkerror: cannot load library: link_image[1963]: 1581 not load needed library 'libavcodec.so' 'libjniavcodec.so' (find_library[1220]: 1581 'libavcodec.so' failed load previously) i have created new workspace, redownloaded files , created new project , reintegrated jar files, after worked.

Federate a c++ client application with openam or opensso -

we have c++ client application user authenticates , connects server using credential through client. there way implement sso module communicate openam? there 2 possible way implement this: using c agent sdk perform authentication , session management -> may find c sdk isn't pleasant , potentially tied web servers in aspects. c sdk uses legacy openam endpoints, potentially mean in future need adapt code use newer version of sdk uses rest interfaces use new rest apis directly. rest interfaces still evolving though, hence subject of changes. in 12.0.0 there api versioning solution though, should mean existing rest clients can remain use "old" version of rest api.

html - CSS Selector (if not null) + nested -

i searching .class[height!= "0"] .span every time try nest like div.item.class[height="0"] didn't work. maybe can me? :) here more code: html <div class="barwrapper"> <ul id ="tabs" class="nav-bar" data-tabs="tabs"> <li class="speed" style="height: 0%;"><a href="#riesenslalom" data-toggle="tab"><span></span></a></li> <li class="speed" style="height: 0%;"><a href="#speed" data-toggle="tab"><span></span></a></li> <li class="mixrace act" style="height: 100%;"><a href="#mix_race" data-toggle="tab"><span></span><

Good practice to write a daemon for Rails -

i run websocket listener on server listen message , update data or invoke worker accordingly. write rails module can update activerecord , enqueue sidekiq task seamlessly. practice in doing this? i looked through many possible practices , found out rails runner best me. you can rake tasks. and absolutely sure can give try faye-rails handle work without running separate workers explicitly.

highcharts - Plot growth of 100 when return is given. Highstocks -

i populate chart y-axis plotted growth of 1000. i.e., if have data [01-jan-2014,1.23],[02-jan-2014,1.03],[03-jan-2014,0.23]....[10-aug-2014,-0.65] first point x: 1st jan y: 1000 , next point on x: 2nd-jan y: 1000(1 + 1.03) next x: 3rd-jan-2014 y: 1000(1+1.03)(1+0.23)...and on. this should same if change dates using range selector. chart has start 1000 , growth date should plotted. a working example of using ms chart present @ link http://www.morningstar.in/mutualfunds/f00000pe1t/hdfc-top-200-fund--direct-plan-dividend-option/overview.aspx how achieve using highstocks.

javascript - Error when upgrading to angular 1.2.22 -

i've upgraded angular 1.0.8 angular 1.2.22, following error: error: [$injector:modulerr] http://errors.angularjs.org/1.2.22/$injector/modulerr?p0=gameapp&p1=%5b%24injector%3aunpr%5d%20http%3a%2f%2ferrors.angularjs.org%2f1.2.22%2f%24injector%2funpr%3fp0%3d%2524routeprovider%0aw%2f%3c%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a6%3a443%0agc%2fl.%24injector%3c%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a36%3a139%0ac%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a34%3a204%0ad%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a34%3a418%0ae%2f%3c%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a33%3a327%0ar%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularjs%2f1.2.22%2fangular.min.js%3a7%3a288%0ae%40https%3a%2f%2fajax.googleapis.com%2fajax%2flibs%2fangularj

jquery - How can i reset list viewModel -

i have list of model same knockoutjs live example: http://jsfiddle.net/rniemeyer/7rdc3/ main: var viewmodel = new giftmodel([ { name: "tall hat", price: "39.95"}, { name: "long cloak", price: "120.00"} ]); ko.applybindings(viewmodel); how can reset object viewmodel null or new giftmodel([]) button click event (not use knock out event) , want whenever click button, grid empty gift. example : $( "#button" ).click(function() { clearknockoutviewmodel(); }); ---> viewmodel empty , html clear. this right way. $( "#button" ).click(function() { clearknockoutviewmodel(); }); function clearknockoutviewmodel(){ var element = $('#elementid')[0]; ko.cleannode(element); ko.applybindings(viewmodel, element); } you loose viewmodel logic if empty it.

django - Using `defer` or `only` on ForeignKey -

i'm trying squeeze few milliseconds view. i'd avoid loading pretty large text fields foreignkey model won't use. to make clearer: class foo(models.model): slug = models.slugfield() text1 = models.textfield() text2 = models.textfield() ... @models.permalink def get_absolute_url(self): return ('foo_detail', (), {"object_id": self.pk, "object_slug": self.slug}) class bar(models.model): foo = models.foreignkey(foo) ... then in template: {% bar in bars %} {{ bar.foo.get_absolute_url }} {% endfor %} now, if @ queries issued orm, each foo django retrieves every field (as expected), in end pk , slug needed. in case, sums more or less hundredth of second per object on testing machine. of course write method this: class bar(models.model): ... def get_foo_absolute_url(self): return foo.objects.only('pk', 'slug').get(pk=self.foo).get_absolute_url() and

android - How to Architect Database for Implementing a Commenting System -

i implementing commenting system in app. need database hold comments. if make row each post, have add comments in 1 collumn , split them identifier. please tell me better way this. if 1 comments on app, comments part of chain of comments. store on every row this: databaseid|positionofcomment|comment|discussionid databaseid - primary key of table (use google) positionofcomment - increasing number 1, 1 first comment, 2 second , on comment - actual comment user made discussionid - needed foreign key in case have many different comment sections / discussions going on. in case have make discussions table. if there 1 chain of comments, not need this.

Java, get package name of class from string -

all have: string desiredclass = "myclass"; i want instantize class, name comes string. know can done with: class.forname(desiredclass); formula, need package path string (name.space.path.myclass). know can queried .getpackage() - again, needs direct class reference, not string. looks snake has bitten end :) you need know package name before initializing object. without wouldn't able distinct 2 classes same name 2 separate packages. if had 2 classes test1.myclass , test2.myclass 1 should chosen in code: string desiredclass = "myclass"; class.forname(desiredclass); so need know package name in advance , like: string desiredclass = "test1.myclass";

servlets - Open Save Cancel dialogue not coming for IE10 for HTML file -

upto ie 8, if try open attached html file, can see open-save-cancel dialogue. in ie-10, open option not coming. save-cancel coming. removed due kind of security issue? if yes, there workaround fix this? we using below code open html file - (this might irrelevent same code working fine till ie-8. it's reference) inputstream in = filetobedisplayed.getbinarystream(); outputstream fr = response.getoutputstream(); response.setheader("content-disposition","attachment;filename="abc.html"); response.setcontenttype("text/html"); int b; while ((b = in.read()) != -1) { fr.write(b); } in.close(); fr.flush(); fr.close(); for reference : http://social.technet.microsoft.com/forums/ie/en-us/3094ac49-8d49-4a60-a7cf-fb12c823e500/ie9-download-manager-will-not-display-open-option-only-save-and-cancel-is-displayed-for?forum=ieitprocurrentver

javascript - Angular js ng-class false condition not working in ng-repeat -

i want highlight li if radio selected. inside ng-repeat , ng-class true condition working, false condition not working, please check code below <div ng-init="friends = [ {name:'john', age:25, gender:'boy'}, {name:'jessie', age:30, gender:'girl'}, {name:'johanna', age:28, gender:'girl'}, {name:'joy', age:15, gender:'girl'}, {name:'mary', age:28, gender:'girl'}, {name:'peter', age:95, gender:'boy'}, {name:'sebastian', age:50, gender:'boy'}, {name:'erika', age:27, gender:'girl'}, {name:'patrick', age:40, gender:'boy'}, {name:'samantha', age:60, gender:'girl'} ]"> <ul class="example-animate-container"> <li class="animate-repeat" ng-repeat="friend in friends" ng-cla

excel - Remove character only during search? -

i have excel file faq lots of q&a. on first worksheet there search function. enter word(s) want search , press enter. function looks these word(s) in entire workbook. able proper search have remove full stop, comma, exclamation , question marks. i use replace this, didn't think of consequences. characters remove permanently text makes little hard read , ugly at. so question is, how can remove these characters during search? have copy each text new cell , search there, or there way? this part of function remove characters , final search. function findwords(celltosearch range, nofwords integer, mywords string) long dim counter long dim word, element dim arr, wordsarr celltosearch = replace(celltosearch, chr(33), "") celltosearch = replace(celltosearch, chr(44), "") celltosearch = replace(celltosearch, chr(46), "") celltosearch = replace(celltosearch, chr(63), "") wordsarr = split(mywords) arr = split(celltosearch) if ubound