Posts

Showing posts from January, 2014

knockout.js - Remove the value Binding based on the model -

knockout.js - Remove the value Binding based on the model - i have model property @ times should bind input element , select element, based on configuration. utilize value binding on both elements , hide either 1 using visible binding. as both bindings on page, when input visible , when come in text not exists in hidden select , unable alter value. in case input element visible ( isdropdown false) not want select bound (or there other improve way handle this?). sample javascript model var player = function (name, age, country, isdropdown) { this.name = ko.observable(name); this.age = ko.observable(age); this.country = ko.observable(country); this.isdropdown = ko.observable(isdropdown); }; var playermodel = function () { var self = this; self.myplayer = new player('murray', 28, 'uk', false); //self.myplayer = new player('murray', 28, 'uk', true); self.countrylist = ['us', 'uk', 'sw

parsing - Best way to parse comma delimeted CSV that include commas that arnt delimeters? [Java] -

parsing - Best way to parse comma delimeted CSV that include commas that arnt delimeters? [Java] - this question has reply here: java: splitting comma-separated string ignoring commas in quotes 9 answers i'm trying parse info sets through database. csv files i'm working have info separated commas. there info encompassed quotation marks include commas part of string. how step through each line of info , parse out each info entry given obstacle? edit: csv parsers not alternative because programme used non csv files. , i'm trying minimize external libraries. i found issue because of code here parse through quotes: while(bufferinput.hasnext()){ nextline = bufferinput.nextline(); dataarray = nextline.split(","); for(i = 0; i<colnum;i++){ //try-catch search through dataarray , f

ruby - Getting a string from a file -

ruby - Getting a string from a file - this question exact duplicate of: what each part of code mean? ruby [closed] i have been using: open("some.txt") { |f| f.each_line.find_all{ |line| /re/.match(line) } } what each component of piece of code mean? one way map results operation want them. if wanted first 3 words do: open("some.txt") { |f| f.each_line.find_all{ |line| /re/.match(line)}.map{|line| line.split[0...3].join(' ')} update: above assumes recipe first word on line. instead of doing that, can modify regex takes next word characters until space \w*\s , repeats e.g. 2 or 3 times {2, 3} : open("some.txt") { |f| f.each_line.find_all{ |line| puts /re(\w*\s){2,3}/.match(line) } } (play around regex needed on http://rubular.com/) ruby file screen-scraping

python - Programmatically generate requirements.txt file -

python - Programmatically generate requirements.txt file - i'm trying generate requirements.txt file programatically. way can diff against sec .txt file. far i've tried following, output requirements console (no .txt file generated). so far i've tried import pip pip.main(["freeze",">","requirements.txt"]) and subprocess import phone call call(["pip","freeze", ">","requirements.txt"]) if effort run same command manually in terminal though, file generated without issue. suggestions? ask pip straight provide list of distributions script myfreeze.py import pip open("requirements.txt", "w") f: dist in pip.get_installed_distributions(): req = dist.as_requirement() f.write(str(req) + "\n") then expected content in requirements.txt file. python subprocess pip requirements.txt

java - BitmapFont special characters not displayed in Android, in desktop version works though -

java - BitmapFont special characters not displayed in Android, in desktop version works though - i have libgdx project supports android , desktop version. fonts used freetypefontgenerator generate fonts. fonts worked fine, decided create bitmapfonts .fnt & .png file, have alternative back upwards html project (freetypefontgenerator not compatible html) the problem: if launch android project there no special chars (ü, ñ, etc.) displayed: --> in android text displayed this: ber --> in desktop text correctly displayed this: über the odd thing if run desktop version special characters work fine, although desktop version uses same code (since create font in core project): font = new bitmapfont(gdx.files.internal("fonts/gooddog40.fnt"), new textureregion(new texture("fonts/gooddog40.png"))); the .fnt & .png files looks me (and works fine in desktop!), since can see special chars contained there. create next using hiero font ge

apache pig - how to set multiline string in my pig script? -

apache pig - how to set multiline string in my pig script? - how can set multiline string in pig latin? i'm trying set string containing json within it. this: myjson = ' { "name":"someone", "age":"20" } '; apache-pig

node.js - Use a node module from casperjs -

node.js - Use a node module from casperjs - is possible install node module, installed via npm, , require casperjs script? (i see lots of posts , tools running casper or phantom within node.js, not i'm trying do.) the casperjs docs seem possible, show hand-written toy modules don't anything. real-world module i'm trying install imap , @ point cannot module work, built-in ones net . simple example: class="lang-none prettyprint-override"> npm install imap echo "var test = require('imap');" > test.js casperjs test.js gives me: class="lang-none prettyprint-override"> caspererror: can't find module imap /usr/local/src/casperjs/bin/bootstrap.js:263 in patchedrequire test.js:1 (i can see imap module npm ls , , can utilize fine node.js script.) or alternatively built-in module: echo "var test = require('net');" > test.js casperjs test.js complains "can't find module n

TFS 2013 git build authentication error with libgit2 -

TFS 2013 git build authentication error with libgit2 - i have private git repository hosted on linux , utilize tfs 2013 builds it. installed tfs 2013 update 2. tfs build failed error vs 30063 not authorized access repository libgit2sharpexception in libgit2. i've tried multiple options configure users in git , tried pass creadentials in url, didn't helped. seems tfs 2013 not working private non-tfs-git repositories. has thought how prepare error? i've searched little bit , contacted microsoft back upwards , scenario described in question not supported current version of visual studio , tfs (both 2013 update 2). the scenario build non-tfs git repositories not supported @ time. if there’s other area can help please allow me know. http://msdn.microsoft.com/en-gb/library/hh850445.aspx git tfs tfs2013

sql - Postgresql: Gaps Between tsranges, empty set -

sql - Postgresql: Gaps Between tsranges, empty set - i have tables of reservations each user: reservations_development=# \d reservations table "public.reservations" column | type | modifiers ------------+---------+----------------------------------------------------------- id | integer | not null default nextval('reservations_id_seq'::regclass) user_id | integer | occurrence | tsrange | indexes: "reservations_pkey" primary key, btree (id) "reservations_occurrence_user_id_excl" exclude using gist (occurrence &&, user_id =) i trying create view of gaps/opening between reservations each user, , have next query: create or replace view reservation_gaps ( user_mins (select tsrange(localtimestamp, min(lower(occurrence))), user_id ( select user_id, occurrence reservations

ios - How i can open pdf into iphone for selected pdf viewer? -

ios - How i can open pdf into iphone for selected pdf viewer? - if pdf file in mailbox, long tap pdf file , popup box list of pdf reader app's have installed. how can add together our app on there open pdf file? with uidocumentinteractioncontroller - (void)onopenwith:(uibutton *)thebutton path:(nsstring *)path { nsurl *url = [nsurl fileurlwithpath:path]; if (url) { self.documentinteractioncontroller = [uidocumentinteractioncontroller interactioncontrollerwithurl:url]; self.documentinteractioncontroller.delegate = self; [self.documentinteractioncontroller presentoptionsmenufromrect:cgrectzero inview:thebutton animated:yes]; } } #pragma mark - uidocumentinteractioncontrollerdelegate - (uiviewcontroller *)documentinteractioncontrollerviewcontrollerforpreview:(uidocumentinteractioncontroller *)controller { homecoming self; } - (uivi

javascript - How to improve my Backbone code -

javascript - How to improve my Backbone code - i'm starting develop in backbone.js. , still not know how write code using best practices. my app working have issues, example, comparator not work. i help create him better. view: todos.views.tasksview = backbone.view.extend({ template: jst['todos/index'], tagname: 'div', id: '#todos', initialize: function () { this.collection = new todos.collections.taskscollection(); this.collection.fetch({ reset: true }); this.render(); this.listento(this.collection, 'reset', this.render); this.listento(this.collection, 'change', this.render); this.listento(this.collection, 'sort', this.render); }, render: function () { $(this.el).html(this.template({ tasks: tasks[0].task })); homecoming this; } }); collection: todos.collections.tasksco

javascript - How load $http service app on startup in Ionic framework? -

javascript - How load $http service app on startup in Ionic framework? - how load $http service app on startup in ionic framework? // service appmodule.factory('newgames', function($http, $ionicloading) { // json array var newgames = []; var request = {'searchstring' : 'name_fr'}; $http.get('http://example.com/rest/data.php', { cache: true}, request).success(function(response) { newgames = response; }); homecoming { all: function() { //$ionicloading.hide(); homecoming newgames; } } }); // controller myapp.controller('mainctrl', function($scope, newgames, $ionicslideboxdelegate, $stateparams, $ionicplatform) { $scope.nextslide = function() { $ionicslideboxdelegate.next(); } $scope.newgames = newgames.all(); }); if press button, info loaded. how create info loaded @ startup? use ionic.platform.ready() method, documented here. you can run method anywher

directory - Fastest way to check in python if a file exists and get its path in a very wide tree of subdirectories -

directory - Fastest way to check in python if a file exists and get its path in a very wide tree of subdirectories - this question has reply here: find file in python 4 answers so problem have directory on 1000 subdirectories , want efficient way check if file in them. there way without stepping through each directory until find it? prefer pythonic way of doing can run through os.system acceptable long efficient. give thanks you! as mentioned in http://bugs.python.org/issue11406 walk slower should be, community came alternative of course. assuming fastest mean run time, should utilize scandir : https://github.com/benhoyt/scandir/#readme python directory find binary-search-tree directory-structure

c++ - Getting shifted depth map from StereoSGBM -

c++ - Getting shifted depth map from StereoSGBM - what have done far calibrating these photographic camera , extract depth map it. there problem in depth map. correspondence points shifted , not know why. my code not special @ , tried many variations of stereo(gb)bm parameters. stereosgbm sgbm; sgbm.numberofdisparities = 5*16; sgbm.sadwindowsize = 5; // sgbm.disp.... , on remap(left, rleft, rmap[0][0], rmap[0][1], cv_inter_linear); remap(right, rright, rmap[1][0], rmap[1][1], cv_inter_linear); sgbm(rleft, rright, disparity); i thought after stereorectify minimum disparity 0 improve results (still worse) if utilize negative values. here image (just 1 example): my input images (left, right, remapped left, remapped right): c++ opencv camera-calibration stereoscopy

Prolog programming language and proof trees -

Prolog programming language and proof trees - recall proof meta-circular solve(true, true). solve([], []). solve([a|b],[proofa|proofb]) :- solve(a,proofa), solve(b, proofb). solve(a, node(a,proof)) :- rule(a,b), solve(b,proof). assume 3rd rule of interpreter altered, while other rules of interpreter unchanged, follows: % signature: solve(exp, proof)/2 solve(true, true). solve([], []). solve([a|b], [proofa|proofb]) :- solve(b, proofb), %3 solve(a, proofa). solve(a, node(a, proof)) :- rule(a, b), solve(b, proof). consider proof tree created query in both versions. can variable substitution achieved in 1 version only? explain. can true leaf move other side of left infinite branch? explain. in both questions give illustration if reply positive. how influence on proof? please help me ! tx (i have lot of reservations against meta-interpreter. first reply question had) in meta-interpreter reify

sql - Reseeding Identity Column to Original Value -

sql - Reseeding Identity Column to Original Value - is there way reseed identity column it's original value? have identity(1,1) table definition. i've tried reseeding using method: dbcc checkident (table1, reseed, 1) but noticed, sql reseeds current seed + new seed value, when insert new rows starts auto-increment count @ 2 instead of 1. i've tried making new reseed value 0, rows insert after end beingness 1 , column doesn't auto-increment anymore. by way, if helps, need column restart auto-increment count @ 0 because need count restart every month. have trigger after insert set this, reseeding giving me trouble. the next statement: dbcc checkident('yourtablename', reseed, 1); tells database akin to: "hey database! highest identity value in the yourtablename table #1, next inserted record should utilize identity value #2." this explains why table starts identity value 2 when reseed using statement. more microsoft'

loops - Iterate through a structure in MATLAB without 'fieldnames' -

loops - Iterate through a structure in MATLAB without 'fieldnames' - the usual way iterate through struct info type in matlab using fieldnames() function done in: mystruct = struct('a',3,'b',5,'c',9); fields = fieldnames(mystruct); i=1:numel(fields) mystruct.(fields{i}); end unfortunately, generates cell info types, , utilize kind of iteration matlab function block in simulink not allow cell info types code generation reasons. is there way iterate through construction without making utilize of cell info types @ same time? in octave there neat way of explained in https://www.gnu.org/software/octave/doc/interpreter/looping-over-structure-elements.html for [val, key] = mystruct # esp. 'key' end does know similar way in matlab? when generating code using matlab coder or simulink coder, not cell arrays disallowed, referencing fields of construction using dynamic names. since can't utilize dynamic n

Twilio library doesn't work in Rails, but works outside rails? -

Twilio library doesn't work in Rails, but works outside rails? - first time poster here ( gentle, i've done research! ) i'm new ruby ecosystem having come language, strikes me odd. i've added twilio-ruby library gemfile, done bundle install / tried bundle update bundle show twilio-ruby ~/.rvm/gems/ruby-2.1.2/gems/twilio-ruby-3.11.5 however, next error when trying any of examples. undefined method 'messages' #<twilio::rest::client::account:0x00000102cea740> substitute calls, etc etc. nil works. not @client.account.sms.messages ( legacy calls ). i'm familiar pry , have done @client.pry yielding self.account.methods.sort , these methods / class members not nowadays in module @ all. so work? ruby test.rb containing: @client = twilio::rest::client.new '{{removed}}', '{{removed}}' #@client.pry p @client.account.messages.create( :from => '+1xxx', :to => '+1xxx', :body => 'hey there!

javascript - nsIProcess with arg with quote not getting created -

javascript - nsIProcess with arg with quote not getting created - i'm trying run little routine convert .doc word files (using libreoffice) html. when run on command line, works, not through nsiprocess : var cc = components.classes; var ci = components.interfaces; var sofficepath = ('c:\\program files (x86)\\libreoffice 4.0\\program\\soffice.exe').replace(/"/g, ''); var path = 'c:\\users\\brett\\appdata\\local\\temp\\brl-downloader6.doc'; function createprocess (path, args) { var ansifile = cc['@mozilla.org/file/local;1'].createinstance(ci.nsilocalfile); ansifile.initwithpath(path); var process = cc['@mozilla.org/process/util;1'].createinstance(ci.nsiprocess); process.init(ansifile); process.runasync(args, args.length, null); } createprocess(sofficepath, [ '--headless', '-convert-to', 'html:"html (starwriter)"', path.replace(/"/g, '') ]); i think related

asp.net mvc - Change DropDownList data with Javascript -

asp.net mvc - Change DropDownList data with Javascript - i have page user can select if transaction type inter accounts transfer, or payment. the model pass in had 2 lists. 1 list of selectlistitem 1 list of selectlistitem one of lists populated this: var entities = new entityservice().getentitylistbyportfolio(); foreach (var entity in entities.where(x=>x.entitytypeid == (int)constants.entitytypes.bankaccount)) { model.bankaccounts.add(new selectlistitem { value = entity.id.tostring(cultureinfo.invariantculture), text = entity.description }); } if user selects 'inter business relationship transfer', need to: populate dropdowna list accounts, , populate dropdownb same list of accounts if select "payment", need alter drowdownb list of thirdparty. is there way, using javascript, alter list sources, client side? function changedisplay() { var id = $('.cmbtype').val(); if (id == 1) // payment {

node.js websocket crashes when client disconnect -

node.js websocket crashes when client disconnect - i new nodejs , websockets , trying play it. what read incoming datas serial port, send these datas web page using websocket. here works fine. i utilize node-static serve web page i utilize ws websocket the problem when client close browser, nodejs websocket server crashes next error : root@ws-server-2:~/app# node socketserver.js open serial communication client disconnected. /root/node-v0.10.29/lib/node_modules/ws/lib/websocket.js:187 else throw new error('not opened'); ^ error: not opened @ websocket.send (/root/node-v0.10.29/lib/node_modules/ws/lib/websocket.js:187:16) @ sendall (/root/app/socketserver.js:30:16) @ serialport.<anonymous> (/root/app/socketserver.js:58:8) @ serialport.emit (events.js:95:17) @ object.module.exports.raw [as parser] (/root/node-v0.10.29/bin/node_modules/serialport/parsers.js:8:13) @ object.serialport.options.datacallback (/root/no

How do you view POST information from a JQuery AJAX post request? -

How do you view POST information from a JQuery AJAX post request? - i'm using phonegap , making jquery ajax post javascript. i'd able view actual post request php can confirm beingness sent correctly. here know how that? pseudocode attached. $.ajax({ url: myurl, type: 'post', xhr: function() { var myxhr = $.ajaxsettings.xhr(); if (myxhr.upload) { myxhr.upload.addeventlistener("progress", progressfunc, false); } homecoming myxhr; }, //ajax events success: completehandler = function(data) { //... }, data: { ... }, datatype: "json", //options tell jquery not process info or worry content-type cache: false, contenttype: false, processdata: false, crossdomain: true,

sql - C# EF6-Lambda Expressions deep big-tree query improvement for efficiency and clean code -

sql - C# EF6-Lambda Expressions deep big-tree query improvement for efficiency and clean code - hi there fellow coders, i looking improve next query. we using ef6 (codefirst) , c# lambda expressions, , repository/unit of work patterns. also, needed restrict query in way inner-query entities query retrieve subset of joined data, , found dynamicselectextensions library extends iqueryable , gives selectincluding statement this. the query namespace repositorios { public class canaldecomunicacionrepositorio: efrepositoriodesactivable<canaldecomunicacion>, icanaldecomunicacionrepositorio { public canaldecomunicacionrepositorio(dbcontext context) : base(context) { } public iqueryable<canaldecomunicacion> consultaparalibreria() { homecoming dbset.where(canalcomunicacion=> canalcomunicacion.fechadesactivacion==null) .selectincluding(new list<expression<func<canaldecomunicacion, ob

php - multiple values insert to mysql using last used id for multiple files -

php - multiple values insert to mysql using last used id for multiple files - i'm making auto info form in admin panel. want add together 6 images have same id auto info form auto info selectors (x12) file input (x6) /form 2 separate tables (cars , images) how give file inputs same id auto info? i'm new programming, in mind have utilize max(id) auto table, add together +1 , give input files carid when inserting them database. there , easier way this? or logic faulty? if using mysqli in php utilize mysqli_insert_id function http://www.php.net//manual/en/mysqli.insert-id.php this gives id of lastly record inserted. you should never utilize max id. exclusively possible record has been inserted user / process between insert , next inserts of dependent records. php mysql file user-input

vb.net - Windows Form App Code Security -

vb.net - Windows Form App Code Security - i'm creating windows form app , underlying code needs secure. in code database info , many equations people should not able see. what i'm asking if install app on someone's computer, how easy them "break" application , view sensitive information? if it's not hard them find code, there ways prevent happening? appreciate input. it's easy view code. tools ilspy or .net reflector can practically show code have written in c# or vb.net. there possibilities, free or cheap, cost you: obfuscation: replaces names , logic in excutable other code hardly human readable. easy , there tools confuser job, code still there , can read. it's slowing attackers down. another alternative have evaluated myself using hardware protection in form of dongles. here whole application encrypted secret key stored on smartcard. portions of code needed decrypted on fly @ runtime , executed. since code encrypted can'

java - JBoss Error: Could not load class designated by HandlesTypes -

java - JBoss Error: Could not load class designated by HandlesTypes - i getting these weird jboss errors while deploying war file. info [org.jboss.web] (msc service thread 1-3) jbas018227: not load class designated handlestypes [com.companyname.classname].: java.lang.classnotfoundexception: com..companyname.classname [module "deployment.projectname.war:main" service module loader] @ org.jboss.modules.moduleclassloader.findclass(moduleclassloader.java:196) [jboss-modules.jar:1.2.0.final-redhat-1] these info error causing farther issues in deployment.using jboss ead 6.1 check if have .class (compiled file) .war -> classes (directory). in case, had class implementing webapplicationinitializer interface (spring interface) , wildfly 8.2 couldn't load it... needs have .class file /web-inf/classes folder... i solved problem moving file web app module (.war) because bug solved in wildfly 9 @ moment. see: enter link description here java eclips

java - netbeans ServiceProvider not returning variable from method -

java - netbeans ServiceProvider not returning variable from method - i working on desktop application netbeans platform. app place map in topcomponent , user can draw layout , other elements on it. element stored in hashmap. added hashmap mouse gestures. at point, need retrieve hashmap object when pressing button on ui. button in modulea , hashmap, maps , objects defined in moduleb . trying using serviceprovider pattern. code follows: package org.dhviz.design.gui.buttontoolbar; //...annotations here... public final class associateconstopipes implements actionlistener { @override public void actionperformed(actionevent e) { collection<? extends dhvizjmapviewerinterface> allhandlers1 = lookup. getdefault().lookupall(dhvizjmapviewerinterface.class); (dhvizjmapviewerinterface chi1 : allhandlers1) { system.out.println(chi1.getmapconsumerhashmap()); } } } the class implementing interface defined , placed in module

user interface - Why is my calculator program not working - Python? -

user interface - Why is my calculator program not working - Python? - i'm writing programme calculator i'm experiencing little problem. whenever press 1 of buttons, increases numbers 9 every time, though should (from loop). please can tell me why 9 please? code - import tkinter plus = true numbers = 0 def main(): def numbutton(i): global numbers if plus == false: numbers-=i else: numbers+=i def quithandler(): root.destroy() def entryhandler(): global numbers numbers+=int(text.get()) text.set("") def printhandler(): text2.set(numbers) def restarthandler(): global numbers root.destroy() plus = true numbers = 0 main() def plushandler(): global plus plus = true def minushandler(): global plus plus = false root = tkinter.tk() frame = tkinter.frame(root).pack(side=

jquery - What is the different between $parent.find("children") vs $("children", $parent)? -

jquery - What is the different between $parent.find("children") vs $("children", $parent)? - this question has reply here: jquery find versus context selection 4 answers i know both next statements produce same result, var $childnode = $parent.find("children"); , var $childnode = $("children", $parent); but want know 1 improve other , why? and how these methods vary in implementation? as stated in the documentation, there no difference: selector context implemented .find() method; therefore, $( "li.item-ii" ).find( "li" ) equivalent $( "li", "li.item-ii" ) . jquery jquery-selectors

java - NumberFormatException: Invalid int "-" -

java - NumberFormatException: Invalid int "-" - i have problem. have edittext has android:inputtype="numberdecimal|numbersigned" . in java code have this @override public void ontextchanged(charsequence arg0, int arg1, int arg2, int arg3) { // todo auto-generated method stub int value = 0; string editcontent = edittext.gettext().tostring(); if(editcontent != null && editcontent.length() > 0) { value = integer.parseint(editcontent); } seekbar.setprogress(value); } when seek insert negative number have numberformatexception invalid int "-". how can solve this? first time when set "-", method ontextchanged called, , parsing done on "-", not valid int. need escape parsing if string "-". use below code ontextchanged(...) . better move code after

c# - What datastructure to quickly map multiple objects to another object -

c# - What datastructure to quickly map multiple objects to another object - i need different datastructure application. essentially have custom info construction consisting of "nodes". task follows: given number of distinct nodes (where number of nodes unknown) retrieve or create new node. reminds me much of cache function multiple arguments. difference arguments , homecoming value have same type , values returned might given me input later on. example 1: @ first nodes , c. have create new node (lets name ac) , homecoming it. when nodes , c again in future need able very quickly determine if have created ac node , homecoming it, or, if has not been created before, create , homecoming it. example 2: when nodes c , have return/create different node! cannot homecoming ac, has new node (ca). order important! later in processing it's possible nodes created earlier. illustration in 3rd phone call datastructure it's exclusively possible receive nodes

Delphi service always runs at 15% processor load -

Delphi service always runs at 15% processor load - i encountered problem service wrote time ago. service meant translate various programs calling multilizer application via createprocess . problem 1 time checks of given directories cleared , actual translation method called cpu load rising 15-20% , remain @ level if files have been processed. onstart-event of service creates non delayed thread has execute-method looks this: procedure ttranslatethread.execute; var count : integer; begin sleep(serviceobject.hinterval); while not terminated begin inc(count); if count>= 10 begin count :=0; if serviceobject.checkdircount>0 begin serviceobject.translateservice; sleep(serviceobject.hinterval); end; end; end; however suppose main cause of problem lies in way have phone call multilizer. because service has wait multilizer finish translating. used waitforsingleobject wait multilizer finish although know it's kind of

Communicating UI Thread not usings View.post in android? -

Communicating UI Thread not usings View.post in android? - i have question when comes views can utilize view.post illustration how in adapter adapter.notifydatasetchanged() cant utilize view.post, example im updating listview more best practice of using codes madapter = new homepageadapter(this, list); mlistview.setadapter(madapter); madapter.notifydatasetchanged(); which of style best practice: runonuithread madapter = new homepageadapter(this, list); homepage.this.runonuithread(new runnable() { @override public void run() { mlistview.setadapter(madapter); madapter.notifydatasetchanged(); } }); asynctask class updates extends asynctask<void, void, void> { @override protected void doinbackground(void... arg0) { madapter = new homepageadapter(homepage.this, defaultlistval); homecoming null; } @override protected void onpostexecute(void result) {

php - function that cleans values passed through $_POST before it submits it -

php - function that cleans values passed through $_POST before it submits it - i'm writing function takes content $_post , inserts in string , returns resulting string to question "what favorite color?" user inputs blue question "what favorite animal?" user inputs dog $content = "the visitor's favorite color {color}"; $content = sentencebuilder($content); $content = "the visitor's favorite animal {animal}"; $content = sentencebuilder($content); function sentencebuilder($content){ global $_post; foreach($_post $key => $value){ if($key=='color'){ $content = preg_replace("/\{($key+)\}/", $value, $content); } if($key=='animal'){ $content = preg_replace("/\{($key+)\}/", $value, $content); } } homecoming $content; } this returns "the visitor's favorite color blue" , "the visitor's favorite animal dog." if leave c