Posts

Showing posts from September, 2015

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

jquery - Javascript function at global scope -

i'm trying load google maps js api on wordpress site, , keep getting "initmap not function" error. figure writing code wrong, adapted standalone page, perhaps working in wordpress messed things up. having issue js files not loading in correct order, js loads before google maps, wouldn't issue. must wrong initmap function. function causing error. thought had passed global scope, i'm not sure did correctly. api key call wp_enqueue_script( 'google-maps-js', 'https://maps.googleapis.com/maps/api/js?v=3&key=###key###&callback=initmap', array(), '20151215', true ); function in js file jquery(function($) { window.initmap = function() { // disallow drag on mobile var isdraggable = $(document).width() > 480 ? true : false; map = new google.maps.map(document.getelementbyid('map'), { scrollwheel: false, draggable: isdraggable, streetviewcontrol: false, styles: [

Python pandas: conditionally select a uniform sample from a dataframe -

Image
say have dataframe such category1 category2 other_col another_col .... 1 2 2 3 3 1 b 10 b 10 b 10 b 11 b 11 b 11 i want obtain sample dataframe category1 uniform number of times. i'm assuming there equal number of each type in category1 . know can done pandas using pandas.sample() . however, want ensure that sample select has category2 equally represented well. so, example, if have sample size of 5, want such as: a 1 2 b 10 b 11 b 10 i not want such as: a 1 1 b 10 b 10 b 10 while valid random sample of n=4 , not meet requirements want vary as possible types of category2 . notice in first example, because a sampled twice, 3 not not represented category2 . okay. goal uniformly possible, represent sample data. if helps provide clearer example, 1 thing having categories fruit , vegetables , meat , grains , junk . in sample size of 10, w

Javascript populate array based on JSON object -

i have json object follows: var testjson = [ { "asseta": "asset_a", "assetb": "asset_b" }, { "asseta": "asset_a", "assetb": "asset_b" }, { "asseta": "asset_c", "assetb": "asset_d" }, { "asseta": "asset_c", "assetb": "asset_e" }]; what want step through object , add repeating keys array, usedassets. here code far: var usedassets = []; (var key in testjson) { console.log("current key: " + key + " " + "value: : " + testjson[key].asseta); console.log("current key: " + key + " " + "value: : " + testjson[key].assetb); // check if in array if ((isinarray(testjson[key].asseta, usedassets) || isinarray(testjson[key].assetb, usedassets))) { break; } else { usedassets.push(testjson[key].asseta); usedassets.pu

core animation - Teleprompter app in Xcode using Swift -

i have finished online course in ios development on udemy , i'm ready start developing first (real) app. my goal make teleprompter app similar to: https://itunes.apple.com/dk/app/video-teleprompter-lite/id1031079244?mt=8 to start with, create moving text. have looked @ various concepts such core animation, text view, segue 1 view controller etc. none of them seem able display moving text in proper "teleprompter way". i appreciate suggestions how start/which relevant concepts @ in context. try reading on uidynamics, uipushbehavior. https://developer.apple.com/reference/uikit/uidynamicanimator

java - JMapViewer, MouseListener called 2 times -

working jmapviewer, strange behavior of component recognized. using defaultmapcontroller map position (lat, lon). import java.awt.graphics; import java.awt.point; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; import javax.swing.jframe; import org.openstreetmap.gui.jmapviewer.defaultmapcontroller; import org.openstreetmap.gui.jmapviewer.jmapviewer; public class test extends jmapviewer{ public test() { addmouselistener(new defaultmapcontroller(this) { public void mouseclicked(mouseevent e){ point start = e.getpoint(); system.out.println(e.getpoint()); } }); } protected void paintcomponent(graphics g){super.paintcomponent(g);} public static void main (string [] args){ jframe jf = new jframe(); jf.setsize(800, 600); test t= new test(); jf.add(t); jf.setvisible(true); } } running code, after left mouse button presse

SQL query with multiple joins a subqueries -

i understand sql query cannot dynamically add , remove columns. every site have same data. need data 'z' , tack on fields linked tables. table tt_transaction , table tt_extendeddatatype independent. tt_extendeddatadetail has 2 foreign keys. 1) fk-> tt_transaction.id 2) fk -> tt_extendeddatatype i need pull each transaction extended data. each site have same extended data names. i think following broken code demonstrates trying better can explain. select z.*, aaa.name, aaa.value, bbb.name, bbb.value tt_transaction left join ( select a.name, a.description, b.value, b.transaction_id text tt_extendeddatatype inner join tt_extendeddatadetail b on a.id = b.type_id a.name = 'number' ) aaa on aaa.transaction_id = z.id left join ( select a.name, a.description, b.value, b.transaction_id text tt_extendeddatatype inner join tt_extendeddatadetail b on a.id = b.type_id a.name = 'string' ) bbb on bbb.transaction_id = z.id my cur

javascript - Bootstrap-slider loading not working -

i think having issue being able select dom elements part of bootstrap-slider . when attempt target them events such click , nothing gets fired. when refresh page, events fire properly. why might occur? $(document).on("page:change", function() { $(".slider-handle") .on("mousedown", function() { console.log("focused") $(".active-handle").removeclass("active-handle"); $(this).addclass("active-handle"); }) .on("mouseup", function() { console.log("removed") $(this).removeclass("active-handle"); $(".active-handle").removeclass("active-handle"); }) .on("click", function() { console.log("removed") $(this).removeclass("active-handle"); $(".active-handle").removeclass("acti

c# - Making a non-serializable vendor class serializable -

i using class vendor's dll not xml serializable because 1 of class members interface. however, need serialize instance of class. how can tell xmlserializer ignore interface , serialize else? you can 2 things: 1) create class every thing want, populate vendor class, serialize it. check adapter design pattern 2) use json.net. once need serialize ipagedlist have metadata , did this: public static string serializepagedlist(ipagedlist<t> pagedlist) { string result = jsonconvert.serializeobject( // new anonymous class wanted new { items = pagedlist, metadata = pagedlist.getmetadata() }, new jsonserializersettings { nullvaluehandling = nullvaluehandling.ignore, referenceloophandling = referenceloophandling.ignore }); return result; } i hope helps.

ios - How can I remove my app's in-app purchase while leaving premium functionality intact -

i have iphone app existing iap option. i'd remove in-app purchase requirement while still providing premium content. i'd replace "buy" button "get started" button , go on there :-) there "best way" strip out (overwrite, redirect, etc) iap code (objective-c). well, expect premium functionality in code isn't coupled iap. so, substitute logic receipt checking new use case. so, recon, best way throw away iap code , write new functions.

css - make content inside divs display in the same locations -

i have page displays products on website inside boxes ( https://s21.postimg.io/9nw7kqrfb/screen_shot_2016_09_12_at_22_27_46.png ) but data inside boxes not displaying in same locations in each box if image small. if make each box set height, how can make product title , price display @ bottom of box under each other each both same? html 1 box: <li class="post-2483 product type-product status-publish has-post-thumbnail product_brand-mikrotik product_cat-routers instock featured taxable shipping-taxable purchasable product-type-simple"> <a href="#" class="woocommerce-loopproduct-link"><span class="et_shop_image"><img width="300" height="180" src="#" class="attachment-shop_catalog size-shop_catalog wp-post-image" alt="mikrotik-rb2011" title="mikrotik-rb2011"><span class="et_overlay"></span></span><h3>mikrotik rb2011

c# - "REMOTE_ADDR" returning the same IP -

i'm trying figure out why i'm being returned 1 ip address when call request.servervariables["remote_addr"]. here's code: var ip = context.request.servervariables["http_x_forwarded_for"]; if (string.isnullorempty(ip)) { ip = context.request.servervariables["remote_addr"]; } return ip; i have 22,000 records return same ip address. i've tested x_forwarded_for , http_client_ip locally only, , both come null. i'm wondering if of have clue why happening? i'm trying rough estimate of client located. thanks.

python 3.x - Wtforms.fields.html5 DateField not working as plain old DateField in Flask -

i have problem getting html5 datepicker provide value form in flask using wtf-forms. same form working expected if drop html5 datefield plain old vanilla wtf-forms datefield. for curious: versions: python 3.5.2, flask: 0.11.1, flask-wtf: 0.12 the relevant code be: model: class order(db.model): __tablename__ = 'orders' paid_date = db.column(db.datetime, nullable=true) form shouldn't make difference completeness here snippet order-update.html: <div class="form-group"> {{ form.paid_date.label }} {% if form.paid_date.errors %} {% error in form.paid_date.errors %} <p class="error-message">{{ error }}</p> {% endfor %} {% endif %} {{ form.paid_date }} </div> minimal controller: @app.route('/orders/update/<int:order_number>', methods=['get', 'post']) def update_order(order_number): order = order.query.g

java - Kafka consumer client creation singleton instance vs static method -

please tell 1 best practice create kafka consumer client. public class kafkaconsumerfactory { public static createkafkafkaconsumer(){ kafkaconsumer consumer = new kafkaconsumer< (getkafkaconsumerproperties()); consumer.subscribe(collections.singleton.(gettopic())); return consumer; } or .. public class kafkaconsumerfactory { kafkaconsumer consumer; public kafkaconsumer createkafkafkaconsumer(){ if(consumer = null) { consumer = new kafkaconsumer< (getkafkaconsumerproperties()); consumer.subscribe(collections.singleton.(gettopic())); } return consumer; } } will there considerable benefit in having singleton kafka consumer client in production environment ? kafka consumer not thread safe shouldn't singleton. in case of producer, thread safe , recommended have single instance.

android - How can I send an Alert Dialog as a push notification? -

Image
i implement push notification, push notification wouldn't notification on status bar, dialog . kind of this: i'm starting android development , couldn't figure out. i'm sending notification via nodejs , i'm not sure if payload right too.

actionscript 3 - itemRenderer is getting changed in the rows of a MX datagrid when scrolling -

Image
i having bad time itemrenderer. have mx datagrid using show data collecting http service. wanted show data "preview" in first column , adding itemrenderer datagridcolum.itemrenderer property. here works fine. <mx:datagrid id="labelsgrid" width="100%" height="100%" visible="false" variablerowheight="true" sortablecolumns="false"> <mx:columns> <mx:datagridcolumn headertext="preview" datafield="recordid" width="{ preview_column_width }" itemrenderer="us.lbs.itemrenderers.preview"/> <mx:datagridcolumn headertext="design id" datafield="label_id" /> <mx:datagridcolumn headertext="font size" datafield="label_minheight"/> <mx:datagridcolumn headertext="width" datafield="label_width"/> <mx:datagridcolumn headertext="heig

javascript - Creating menu with jQuery -

<li><div class="link" id="contentlink1"><a href="link1.html" target="_blank">link 1</a></div></li> <li><div class="link" id="contentlink2"><a href="link2.html" target="_blank">link 2</a></div></li> i generating these links through db , want add link2 within link1 create nested navigation have inject jquery create nested navigation. for have tried grab link2 html , put after link1 html did not work. can or suggest solutions can create nested navigation through jquery. var link2 = $('#link2').parent().html(); var link1 = $('link').after(); link1 = link2; console.log(link1); i playing around see weather link2 contents copied inside link1 html content did not work. you can check fiddle. have add css though. also, not sure why adding link inside div, doesn't seem necessary me. [updated cod

Powershell import-csv conditional for column -

i'm trying find best way using powershell modify row in csv based on following condition: if column test contains word,word following: 1) copy entire row once keep first word in column test 2) copy entire row again keep second word in column test 3) delete original row had word,word in column test example: subject~school~test~code~year math~padf~true,false~0943~2016 i'd like: subject~school~test~code~year math~padf~true~0943~2016 math~padf~false~0943~2016 i'm no expert in powershell, playing around using import-csv, , using get-content foreach-object, it's not working. if knows of easier way or solution case above, fantastic! thank you knows of easier way or solution case above with programming, there's no such thing ' the ' solution. write want (good steps 1,2,3 in question) , make code that: import-csv d:\data.csv -delimiter '~' | foreach-object { if ($_.test -match ',') # if row.t

excel - How to activate entry-mode with VBA on non-activex textbox inserted to worksheet? -

Image
i manually placed non-activex textbox on worksheet. if assign macro, clicking textbox runs macro expected. however, entry-mode not enabled on textbox. how can macro put textbox entry-mode? note, textbox inserted insert ribbon. thx i discovered answer shortly before posting above question: sub activate_textbox() ' stuff before edit mode... ' ... ' textbox name dim sname string sname = application.caller ' textbox shape object dim txtbox shape set txtbox = activesheet.shapes(sname) ' enter edit mode (put cursor textbox) txtbox.textframe2.textrange.select ' cleanup set txtbox = nothing end sub recommended protect sheet, else you'll see selection handles on textbox when has focus. and, if protect sheet, you'll want unlock text, can type in it:

c# - How do I connect a bot to Skype and Cortana? -

the current faq botframework says not have publish bot in bot directory, , supports skype; doesn't list cortana (but ms mentioned @ build supports cortana, maybe faq out of date?). anyway -- of tutorials i've seen far make register bot in bot directory configure them -- how setup normal bot that's not registered in bot directory , connect services skype , cortana? when create new bot on dev.botframework.com, automatically connected skype. don't need , can have 50 100 users. cortana entirely different thing. cannot have cortana channel, telegram or skype. (how like). what heard ability leverage cortana's functions using luis built-in app. luis language processing system bots. built-in cortana-like app recognize stuff "set reminder for..." , "give me directions to...".

scala - Defining a ScalaCheck generator in terms of another Gen -

how define generator in produce random data fields of given block . following scaffolding code. need expression replace ??? . expression should generate seq[field] , field should generated using defined genfield function. def blockgen(b: block): gen[block] = { id <- b.blockid //use same blockid b fields <- ??? //get type each field , call genfield } yield block(id, fields) adt trait data {} trait field extends data { val name: string val value: string } case class stringfield(name: string, value: string) extends field case class numberfield(name: string, value: string) extends field case class block(blockid: field, fields: seq[field]) extends data generators def fieldgen(fieldtype: field): gen[field] = { { f <- fieldtype match { case _: numberfield => numgen case _: stringfield => strgen } } yield f } val strgen: gen[stringfield] = { name <- gen.identifier value <- gen.alphastr } yield stringfield(name

sql server - ssdt dacpac: how to prevent dacpac to generate the error when dropping columns in a table with data -

Image
i dropping column in table xxx data. dacpac generating checking follow. if exists (select top 1 1 [dbo].[xxx]) raiserror (n'rows detected. schema update terminating because data loss might occur.', 16, 127) nowait all data migration has been done in pre-deployment script. have comment out manually. how prevent auto generating? uncheck block incremental deployment if data loss might occurred in vs\publish\advanced\general.

android - Firebase Cloud Messaging notification with curl getting MismatchSenderId -

i'm developing android apps firebase(ver.9.4.0). when sent fcm notifications using tokens shown below, devices couldn't notification. curl --header "authorization: key=aizaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ --header content-type:"application/json" \ https://fcm.googleapis.com/fcm/send \ -d "{ \"data\": {\"url\":\"http://xxxxxxxxxxxxxxxxx\",\"type\":\"0\"}, \"priority\":\"high\",\"notification\": {\"body\": \"title\"}, \"registration_ids\":[\"apa91bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"]}" error message: {"multicast_id":5831565775247505735,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"mismatchsenderid"}]} the tokens couldn't send start apa91b . the tokens send start xxxxxxxxxxx:apa91b . try refresh to

tomcat - start & stop RESTful service from Java Application -

this question implementing restful listener service, provide background first provide context. i have existing java application & swing ui takes directory , database file input. after these set button imports pdf forms within directory database. there small jframe window in ui buttons , logging output. works well. i want java app connect our exchange mail server, listen new emails pdfs attached, save them directory , import using application above. to connect our exchange server (imap, pop etc not enabled) going use ews-java api https://github.com/officedev/ews-java-api however requires client wants push notifications exchange mail server (via rest) 3 things: 1) connect exchange server (i can this) exchangeservice newservice = new exchangeservice(exchangeversion.exchange2010_sp2); newservice.seturl("https://myurl/ews/exchange.asmx"); exchangecredentials credentials = new webcredentials("user","password"); newservice.setcredentials(crede

mysql - How to retrieve all data from database using select option in php? -

so have table database want echo out using select option . i'm having trouble because have option user can add more options , don't know how set value of it. can me guys? thanks! here current code: <?php while(mysqli_stmt_fetch($stmt)) { ?> <select class="form-control input-sm"> <option value="able seaman" <?php if($boiler_size == 'able seaman') { echo "selected"; } ?>>able seaman</option> <option value="ako ito" <?php if($boiler_size == 'ako ito') { echo "selected"; } ?>>ako ito</option> <option value="apprentice" <?php if($boiler_size == 'apprentice') { echo "selected"; } ?>>apprentice</option> </select> you have count of rows has been selected db since if count 0 throwing error in while loop or foreach preferred usage showing dynamic select options.

Communication between a web application and an android application -

i have web application built on java , android application. both deployed on different servers. how can send request android application web application? also, how can send corresponding response web application android application? use rest api's (in json format).

c# - Refresh user control instance inside a panel when a button is clicked -

i have these codes in mainform when click on picturebox , user control loads in panel. my problem datagridviews inside other controls doesn't updated. when make transactions in other user controls affects other user controls . what want automatically update gridviews refreshing user control when associated button clicked . private void picturebox5_click(object sender, eventargs e) { panel2.controls.add(uccustomer.instance); uccustomer.instance.dock = dockstyle.fill; uccustomer.instance.bringtofront(); lblmenu.text = "customer management"; } private void picturebox2_click(object sender, eventargs e) { panel2.controls.add(ucdelivery.instance); ucdelivery.instance.dock = dockstyle.fill; ucdelivery.instance.bringtofront(); lblmenu.text = "delivery management"; } private void picturebox3_click(object sender, eventargs e) { panel2.controls.add(ucreport.instance); ucreport.instance.dock = dockstyle.fill; uc

android - pass data from activity one to activity three directly while going through activity two but data should not be passed to activity two -

i have 3 activities a,b , c. need pass data activity activity c. navigation b c i.e. can't go activity c activity directly. don't want pass data activity b , don't want use external storage sqlite or shared preferences. can done through intent ? if yes , how ? if no, there other way ? yes sure. example in activity class activitya extend activity{ public static string abc = "hello"; } in activityc activityc extend activity{ oncreate(){ string = activitya.abc; log.d("test",a); } }

Allow User To Select Path For Save File in Android -

i developing 1 application our client , there 1 little functionality stuck, need help, scenarion: have developed 1 recycle view, users can see list of images , songs , videos per category, user have 1 option see or listen images, audio or video, , there option download it. need @ have done 1 static path user can save files, our client wants allow users select path save files , need file dialog user can select location. note: guys note 1 static path have done , working superb, storing path in local database can use later, remain how can allow user select location save file? i think android directorychooser choose directory file save. manifest you need declare directorychooseractivity , request android.permission.write_external_storage permission. <uses-permission android:name="android.permission.write_external_storage" /> ... <application> <activity android:name="net.rdrei.android.dirchooser.directorychooseractivity"

android - How to pass yyyy-mm String to yyyy-mm-dd datetime string to filter records from sqlite? -

here have datetime string in yyyy-mm-dd format like 2016-08-26 2016-09-21 2015-07-23 2016-04-25 what need if pass 2016-08 in parameter need record of 2016-08-26 need how can achieve far have tried public list<customermodel>date(string year){ string countquery ="select * "+customermodel.customertable + " " +customermodel.customer_createdat + " strftime('%y-%m',"+customermodel.customer_createdat+") = "+year +""; cursor cursor = db.rawquery(countquery, null); list<customermodel>list=new arraylist<>(); if(cursor!=null && cursor.getcount()>0){ if(cursor.movetofirst()){ do{ customermodel accountmodel=new customermodel(); accountmodel.setcreatedbyname(cursor.getstring(cursor.getcolumnindex(customermodel.customer_createdby))); // accountmodel.setcreatedat(cursor.getstr

php - auto increment receipt number and year -

currently project receipt number auto incrementing. eg: 1, 2, 3, ...n want prefix financial year differentiate recept number of every year. like, 2016-17/1 2016-17/2 , on. , year should change according financial year (1st april 31 march assume 1 year). once date 1st april receipt number should 2017-18/1 2017-18/2 , on. so, question is..is there code through can have recept no prefix year. thank in advance. <div style="float:left"> <label> receipt no:</label> <input type="text" class="form-control" style="width: 60% !important; color:#999999;" name="receipt_no" value="<?php $query = mysql_query("select `receipt_no` tsurphus"); if(mysql_num_rows($query)>0){ $data = mysql_query("select max(receipt_no)+1 tsurphus");

javascript - How to setup WebGL autocomplete on Visual Studio Code? -

i need develop game html5 , webgl on js, editor not suggest methods, fields, enums related webgl become easier. ideas? you should download webgl.d.ts, example from here and reference file in first string of js file: /// <reference path="webgl.d.ts" />

C# XML deserialized. How to get a few elements from next line? -

if (slowo == "sprzedawca") { list<ocrres.word> temp = result.words.where(item => item.value.contains(slowo)).tolist(); int line = int.parse(temp.first().line); console.write(line); } i need view next line elements line atribute of element. how them ? elements looks : <w line="9" blanks="0" fontindex="0" formating="0" confidence="79,56706" pointsize="0" r="90,351,172,30" id="21">sprzedawca</w> correct me if i'm wrong. given xml , somewhere there there collection of w elements. want collection , each element w extract attributes, right? if case, below how can it: var xml = xdocument.parse(input); var welements = xml.root.descendantsandself("w"); foreach (var w in welements) { // extract attribute values var confidence = w.attribute("confidence").value; console.

awt - I want to add Shortcut JUST DELETE in java -

notepad. notepad made. how add menushortcut delete in line 9? plz me.... ms[0] = new menushortcut(keyevent.vk_n); ms[1] = new menushortcut(keyevent.vk_o); ms[2] = new menushortcut(keyevent.vk_s); ms[3] = new menushortcut(keyevent.vk_p); ms[4] = new menushortcut(keyevent.vk_z); ms[5] = new menushortcut(keyevent.vk_x); ms[6] = new menushortcut(keyevent.vk_c); ms[7] = new menushortcut(keyevent.vk_v); ms[8] = new menushortcut(keyevent.vk_delete); ms[9] = new menushortcut(keyevent.vk_f); ms[10] = new menushortcut(keyevent.vk_f3); ms[11] = new menushortcut(keyevent.vk_h); ms[12] = new menushortcut(keyevent.vk_g); ms[13] = new menushortcut(keyevent.vk_a); ms[14] = new menushortcut(keyevent.vk_f5); try this: menuitem.setaccelerator(keystroke.getkeystroke( java.awt.event.keyevent.vk_s, java.awt.event.ctrl_mask)); where vk_s the key want , ctrl_mask control key. there option using menuitem.setmnemonic('f'); this work if press alt+f when running progr

wordpress - When minimizing my browser my websites menus stack??! tried everything (css) -

i worked hard on first website! can't seem figure 1 out. have checked custom css. , still can figure out how fix problem. hope guys can because makes website bad! www.martinfisherphotography.com website. try use bootstrap. if not have enough experience go point #2 use javascript onload(); , onresize(); functions. have been talking earlier here: http://stackoverflow.com/questions/36091978/can-not-get-this-javascript-to-communicate-with-my-css/36092260#36092260

php - http_build_query not giving valid string -

$requestparams = [ 'aame_uuid' => 'aba627', 'currency' => 'test']; ksort($requestparams); $hashstring = http_build_query($requestparams); var_dump( $hashstring); gives string(30) "aame_uuid=aba627¤cy=test" so why currency transformed ¤cy , how can correct ? i think problem &curren html code. http://character-code.com/currency-html-codes.php &curren gets replaced char. maybe should add specific seperator &amp; http_build_query make sure replaced foo.php?aaaa_uid=aba627&amp;currency=test

svn : change commit message for selected files -

i working on 2 differents parts of project, , wanted commit changes 1 part, made mistake, , commited changes in second part. now in history revision, there files in first part have irrelevant commit message. can't change log message, because if do, first part fixed second suffer same problem. how can correct mistake ? you should revert commit because contains unrelated changes , commit again. not problem of commit message, of non-atomic commit.

java - ArrayList not updating inside onChildAdded function -

public class dataservice { private static dataservice ourinstance = new dataservice(); private databasereference mdatabase; public static dataservice getinstance() { return ourinstance; } public arraylist<userdatabase> getfriendlist() { mdatabase = firebasedatabase.getinstance().getreference().child("users"); final arraylist<userdatabase> list = new arraylist<>(); mdatabase.addchildeventlistener(new childeventlistener() { @override public void onchildadded(datasnapshot datasnapshot, string s) { userdatabase userdatabase = datasnapshot.getvalue(userdatabase.class); list.add(userdatabase); } @override public void onchildchanged(datasnapshot datasnapshot, string s) {} @override public void onchildremoved(datasnapshot datasnapshot) {} @override public void onch

ruby - Sinatra and a client-side routing -

i have simple application (server side sinatra, client side reactjs). the workflow basic: sinatra handles get "/" request , sends index.html client static stylesheet , scripts. scripts reactjs app consists of several components , reactrouter. each react's component distinct "page" own route/path in terms of reactrouter. for example: "/" => "index.html" (real html page renered components inside) , "/form" => (reactrouter points component <form/>, in fact render happens inside selector of "index.html") , "/finish" => (reactrouter points component <finish/>, in fact render happens inside selector of "index.html") . while implementing client side only, worked pretty well. now, when trying use sinatra server side stuff broken: when want go /form getting sinatra's default 404 page ("sinatra doesn’t know ditty."). i understand sinatra (or rack) interce

java - Join two jsons based on element -

i have 2 json files. need parse , join json single structure lineage.json { "lineage": [{ "sourcecolumnid": "vmb_bestaddress.snapshot_ts", "description": "", "targetcolumnid": "vmb_bestaddressusage.nxreins" }, { "sourcecolumnid": "dsl_record_sources.mamact", "description": "", "targetcolumnid": "g2_zumadf00.mamact" }, { "sourcecolumnid": "dsl_record_sources.mamade", "description": "", "targetcolumnid": "g2_zumadf00.hdf_s_pol_gen" }] } column.json { "column": [{ "id": 39700, "columnid": "vmb_bestaddress.snapshot_ts", "column": "snapshot_ts", "datatype": "string", "leng

c++ - gcc error when using a switch statement with a default case and a lambda function -

i not understand why code #include <iostream> class { public: void foo(){ char g = 'm'; switch(g){ case 'g': auto f = [](){std::printf("hello world\n");}; f(); break; // default: // std::printf("go hell\n"); // break; } }; }; int main(int iargc, char *iargv[]){ a; a.foo(); } compiles (and works) fine, whereas when uncommenting default statement #include <iostream> class { public: void foo(){ char g = 'm'; switch(g){ case 'g': auto f = [](){std::printf("hello world\n");}; f(); break; default: std::printf("go hell\n"); break; } }; }; int main(int iargc, char *iargv[]){ a; a.foo(); } gives me fo

xaml - Set platform specific control to only one platform in xamarin forms -

i have page contains listview , search bar control. there custom listview android. code following: <contentpage.content> <contentview> <onplatform x:typearguments="view"> <onplatform.ios> <stacklayout spacing="0"> <searchbar x:name="iossearch" placeholder="search" textchanged="iossearchbar_ontextchanged" searchbuttonpressed="onsearch" backgroundcolor="#19588f"> </searchbar> <listview x:name="emplistviewios" itemssource="{binding empmodel.groupeditems}" itemselected="onitemselected"

.net - SonarQube support for .sqlproj and .dtproj -

we have active sonarqube version 6.0 installation inspecting numerous c# projects e.g. .csproj extension. if .csproj contains sql file file inspected. in new solution have mixture of .csproj, .dtproj , .sqlproj projects. .csproj projects being inspected sonarqube though of .sqlproj made of sql files. can sonarqube inspect files in .sqlproj and/or .dtproj? sql server projects not supported sonarqube scanner msbuild . can track progress on via ticket sonarmsbru-243 .

elasticsearch - Why Elasicsearch query show partial results? -

i partial result search elasticsearch: curl -xget 'http://1.1.1.1:9200/my.index-*/api/_search?q=name:foo' i get: { "took": 14, "timed_out": false, "_shards": { "total": 204, "successful": 204, "failed": 0 }, "hits": { "total": 543, "max_score": 2.734601, "hits": [ ....... and show 10 hits...why? use , size, see documentation on elastic website. click here go documentation { "from" : 0, "size" : 10, "query" : { "match" : { "name" : "foo" } } } it defaults 0 , 10, reason you're getting 10 hits

How to get File objects that will be compiled after a rebuild in SCons? -

i have process log files generated during compilation. because compilers append errors logs created in previous builds, have delete error log files generated in previous build if files compiled again. i need list of file objects compiled during rebuild. builders return files compiled. is possible achieve scons ? you approaching problem angle lead "rabbit hole" of scons' internals fast. the main point here is: scons doesn't know log files, have teach it. in way, have mark (or tag) build steps being special such scons knows: "aha, when execute action create foo.o foo.cpp ...there foo.log afterwards , need know it." this methods sideeffect() , clean() there (see userguide , man page ). former designed situation several build steps write (log) file, use same file name. single build steps need run in sequence, if scons called " -j " option. haven't given further info whether case you, assume it's not...so sideeffect i