Posts

android - How to maintain scroll position of listview when the adapter update -

i bind adapter listview , @ first have fetch 10 records when scroll ends again items added in listview , works perfect. but when added items after scroll end @ time items added listview position set top. want set position new added items. here codes: onscroll function: public void onscroll(abslistview view, int firstvisibleitem, int visibleitemcount, int totalitemcount) { new items().execute(); } async function: class items extends asynctask<string, string, string> { @override protected void onpreexecute() { ... } protected string doinbackground(string... args) { list<namevaluepair> params = new arraylist<namevaluepair>(); params.add(new basicnamevaluepair("id", string.valueof(id))); jsonobject json = jparser.makehttprequest(url, "get", params); try { (int = 0; < products.length(); i++) { ...

excel - In VBA, when I change the format of one column, the adjacent one changes too -

i trying format 2 columns - 1 "general" , 1 "number 0.000," when second 1 formats, changes format of first column "number 0.000" well. if manually select columns , change format works fine. why macro changing format of both columns? here code snippet: range("c:c").select selection.numberformat = "general" range("d:d").select selection.numberformat = "0.000" try avoid using .select , might cause issues. try: range("c:c").numberformat = "general" range("d:d").numberformat = "0.000" that works me. the reason works if manually select range because when select range, .select part in macro use selected. avoiding .select helps ensure no matter cell/range have selected, use explicit range want (in case, range("c:c") , range("d:d")).

haskell - How can packages be unhidden when using only stack? -

i'd try out writer monad in ghci. advised here , tried use stack manage ghc , packages, , avoid global installation. from fresh ubuntu 15.04 install, after installing stack: stack setup mkdir lyah && cd lyah stack new stack install mtl stack ghci ghci> import control.monad.writer not find module ‘control.monad.writer’ member of hidden package ‘mtl-2.1.3.1’. i understand pre-stack ghc-pkg used show/hide packages, i'm not sure how proceed here 'unhide' mtl package. edit .cabal file stack new created , add mtl build-depends section. part of file should this: build-depends: base >= 4.7 && < 5 , mtl then, stack build before stack ghci . by way, not use stack install install libraries - merely shortcut copy binaries. e.g. stack install hlint first build package , copy resulting binary ~/.local/bin/ . instead, add packages .cabal file, shown above, , use stack build installed.

javascript - Defining A Variable With the Result of the Previous, And Are There Better Ways To Go About It? -

i'm writing web page generates list of blog posts, along associated data (such timestamps , previews of articles), , i'm attempting generate unique variable every blogpost generation increments one. in order this, i've created variable called "name" on line 59, , take string "dtartnum" , concatenate integer of loop, maximum of i, or variable $sqlindex (which index of number of articles in database). on line 60, have variable want define result of variable name, , assign value of $sqlindex (with result_of_name being placeholder result of name each time it's defined). reason (based on other articles on stack overflow i've read) php executes during page load (roughly). in line of logic, means php variables become inaccessible, , have procedural generated , stored locally php generates page. later on, i'm planning on using ajax library i've found post variable page (which has yet created) act "id" (which primary key) row...

javascript - Django dynamically generated form sets. Deleted forms throwing validation error -

i have inline formset created inlineformset_factory. here simplified example. #models.py class mymodel(models.model): owner = models.foreignkey(user) job_type = models.foreignkey(jobtype) price = models.integerfield() class meta: unique_together = (('owner', 'job_type'),) #forms.py formset = inlineformset_factory(user, mymodel, fields=('job_type', 'price')) i using javascript dynamically add forms , delete forms formset. when click delete form hidden. i'm submitting forms ajax , sending errors if necessary. this works fine except 1 detail. mymodel has unique condition. if deletes preexisting form (so hidden) , adds form same job_type , submits, django throws uniqueness validation error though 1 of forms being deleted. i thought fix clearing job_type field on deleted form throws 'this field required' error , still throws uniqueness error. any appreciated! update further research reveals error present in admin...

mysql - Cannot submit a form on php and mysqli_query -

i have html form want submit data specific database in wamp using phpmyadmin, connection done. however, data cannot submitted. message after submitting data in form : successful connection ( ! ) warning: mysqli_query() expects parameter 1 mysqli, resource given in c:\wamp\www\ex\insert-data.php on line 11 call stack # time memory function location 1 0.0005 136600 {main}( ) ..\insert-data.php:0 2 0.0023 144480 mysqli_query ( ) ..\insert-data.php:11 error inserting new records! my code in 'insert-data.php' is: <?php if(isset($_post['submitted'])){ include('connect.php'); $fname = $_post['fname']; $lname = $_post['lname']; $sqlinsert= "insertinto`test`(`fname`,`lname`)values('$fname','$lname')"; if(!mysqli_query($dbconn,$sqlinsert)){ die('error inserting new records!'); } echo "1 record added database"; } ?> <!doctype html> <...

java - The method getHostConfiguration() is undefined for the type HttpClient -

trying twilio working proxy get: the method gethostconfiguration() undefined type httpclient in following code: twiliorestclient client = new twiliorestclient(accountsid, authtoken); client.gethttpclient().gethostconfiguration().setproxy("1.1.1.1", "8080"); the imports have are: import java.io.ioexception; import org.apache.commons.httpclient.credentials; import org.apache.commons.httpclient.hostconfiguration; import org.apache.commons.httpclient.httpclient; import org.apache.commons.httpclient.httpmethod; import org.apache.commons.httpclient.httpstatus; import org.apache.commons.httpclient.usernamepasswordcredentials; import org.apache.commons.httpclient.auth.authscope; import org.apache.commons.httpclient.methods.getmethod; import org.apache.http.httpresponse; import org.apache.http.client.methods.httpget; import org.apache.http.impl.client.closeablehttpclient; import org.apache.http.impl.client.httpclientbuilder; import java.io.unsupportedencodi...