Posts

Featured post

python - Evaluating the next line in a For Loop while in the current iteration -

here trying do: trying solve issue has wrapping in text file. i want open txt file, read line , if line contains want contain, check next line see if not contain in first line. if not, add line first line. import re stuff = open("my file") line in stuff: if re.search("from ", line): first = line print first if re.search('from ', handle.next()): continue else: first = first + handle.next() else: continue i have looked quite few things , cannot seem find answer. please help! i try this, invalid triples of "from " , not elegant @ all. lines = open("file", 'r').readlines() lines2 = open("file2", 'w') counter_list=[] last_from = 0 counter, line in enumerate(lines): if "from " in line , counter != last_from +1: last_from = counter current_count = counter if current_coun

android - Hide fragments upon button click -

i have 3 buttons , 1 frame layout works container 3 different fragments in layout. when click button a, fragment opens, , on clicking button b fragment b replaces fragment a. same c. so question - suppose if user clicks button , fragment opens, , if clicks button again fragment open. fragment should gone. code looks similar onclicklistener listener = new onclicklistener() { public void onclick(view view) { fragment fragment = null; if(view == findviewbyid(r.id.button1)){ fragment = new fragmentone(); } else { fragment = new fragmenttwo(); } fragmentmanager manager = getsupportfragmentmanager(); fragmenttransaction transaction = manager.begintransaction(); transaction.replace(r.id.output, fragment); transaction.commit(); } }; button btn1 = (button)findviewbyid(r.id.button1); btn1.setonclicklistener(listener); button btn2 = (button)findviewbyid(r.id.button2); btn

INVALID_FIELD_FOR_INSERT_UPDATE in Salesforce via API -

i trying make batch update salesforce part of data masking project , getting error invalid_field_for_insert_update when try updating fields of particular custom object via api. our custom object has few standard fields , few custom fields. custom fields i'm trying update keep getting denied. each field i'm trying update either long text area(32768) or text(255). there no lookups, controlling fields, validation rules, nor there field dependencies. able make modifications other objects (account example) via masking process. able make modifications values through web ui on values custom object. i've tried members of api group system administrator. can please point me in right direction? don't have access source code of masking tool, have elevated rights in sf. in advance advice. the exact error: invalid_field_for_insert_update error message: unable create/update fields: name. please check security settings of field , verify read/write profile or permission

javascript - Fire on return from form "Submit" -

i want able parse values on return submit post. can't seem find way without manually initiating ajax call through javascript code on webpage: <form id="form1" method="post" action="/formsubmit" > <input type="text" name="username"> <input type="text" name="email"> <input type="submit" value="submit"> </form> code on nodejs server: router.post('/', function(req, res) { console.log("here: " + req.body.username); console.log("here: " + req.body.email); res.json({ data1: 'hello', data2: 'world'}); } edit #1: renders "{ data1: 'hello', data2: 'world'}" browser, need parse it what want see after form submit? way handle post request you're sending json. indeed need ajax render result more beautiful. in order avoid usage of ajax have send response html

Sound is not coming out while implementing Text-to-speech in Android activity -

i using texttospeak in 1 of app. while adding speech string texttospeech object instance, doesn't produce sound. though not getting error in log still sound not coming out. want device speak value of textview gets set resultmsg.settext() method. public class resultactivity extends activity { @override protected void oncreate(bundle savedinstancestate){ ............ resultmsg.settext(resultmsg_str); texttospeech = new texttospeech(getapplicationcontext(),newtexttospeech.oninitlistener(){ @override public void oninit(int status) { system.out.println("txt speech status = "+status); system.out.println("txt speech error status = "+texttospeech.error); system.out.println("txt speech success status = "+texttospeech.success); if(status == texttospeech.success){ texttospeech.setlanguage(locale.english);

javascript - Change image size on Bee3D slider -

i used bee3d library on link github https://github.com/lukeed/bee3d everything amazing i'm wondering if there option change image size, because when change image size in css there make big space between images thank you you can change slide side editing src/styles/_config.sass variables named $slide-w , $slide-h from github issue: https://github.com/lukeed/bee3d/issues/18

mongodb - How to keep track of users making Stripe Payments -

i'm trying figure out way mean stack application keep track of users have paid grant them access portion of webpage. i've considered several options: stripe customer id, mongodb record, , html attribute can update. my mean stack keeps track of users jwt, , appears stripe assigns them own customer id isn't ideal. can done jwt opposed forced cutomer id? mongodb record. i'm thinking might best option. when new user has been created, i'll give attribute of haspaid = no. update record of customer when payment submitted. guess run script set unpaid each day? html element/attribute. don't know if possible; cool create key carried during html session after payment received. if person closers browser session closed? i'm looking guidance on 3 options determine if they're best solution. also, if has suggestions alternatives, i'm ears! thanks in advance. speaking generally, common approach second one: use attribute in data model indicates