Posts

php - How many days since sign up in mysql with new column -

i'd add column database displays amount of time in days since user signed up. currently have field displays date signed in unix. is possible new column increase fields 1 each day? you can basic sql information dynamically. datediff() need: select datediff(current_date, from_unixtime(date_signed_up)) days_since_signup tablename

Excel VBA script to prefill online form using IE? -

i in need of assistance. trying write vba script take value in column , place on online form in input element no id name ("oldurl"). vba script take value in adjacent cell in column b , place in same form ("digishop") in input field named ("newurl"). the form on secure server have gotten far window pulling , form selected. having trouble finding way target input field since have no id. below code , thank help. sub redirect() dim ie object dim doc object dim form object dim oldurl object dim newurl object set ie = createobject("internetexplorer.application") ie .visible = true .navigate "https://...." until .readystate = 4: doevents: loop set doc = ie.document set form = doc.forms("digishop") set oldurl = doc.getelementbyid("oldurl")'error occurs here. element has no id oldurl.value = range("a2") set newurl = doc.getelementbyid("newurl") newurl.va...

windows phone 8 - Mvvm How to get the value txtNmItem with TextChanged method -

how value txtnmitem textchanged method? <textbox grid.column="1" name="txtnmitem" background="#f3f3f3" borderbrush="#f3f3f3" verticalalignment="top" text="{binding path=snmitem, mode=twoway}"> <i:interaction.triggers> <i:eventtrigger eventname="textchanged"> <cmd:eventtocommand command="{binding elementname=listaitem,path=datacontext.salvarcommand}" passeventargstocommand="true"/> </i:eventtrigger> </i:interaction.triggers> </textbox> viewmodel public relaycommand<object> salvarcommand { { return new relaycommand<object>(salvar); } } private async void salvar(object e) { i ...

python - PyYAML Basic config file writeback -

i'm new python, , i'm looking basic things pyyaml. want take yaml file: #lets test out logfile config --- filepath: c:\users\me\documents\python\yaml_test1\ filename: logfile_ log_no: 1 now i'm shooting way control path logfile, root name of log, , number log we're on appended filename (to rollover new log when hit kb file size). import yaml import os rootdir = os.getcwd() c_filename = rootdir + "\\config.yml" c_filein = open(c_filename,'r+') conf = yaml.load(c_filein) = conf['log_no'] += 1 print conf['log_no'] = print yaml.dump(conf['log_no']) yaml.dump(conf,c_filein) c_filein.close() my problem dumping file dumps full (though updated) yaml file, @ end of config. suggestions? ninja edit: i'm open , suggestions, it's use other yaml. reading , wanted give shot. so i'm going close since have found configparser module looking rotating logfile

c++ - comma separated stream into struct -

i have structure int , 2 strings. when reading in file comma seperated first 2 values , last value terminated newline. third argument empty however. ex data: 7, john doe, 123-456-7891 123 fake st. i want make program grab first number , put in int, find comma , put second number in struct's string etc. first question should use class instead? have seen getline(stream, mystring, ','); arguments different data types can't throw them vector. my code: struct person{ int id;//dont care if unique string name; string extrainfo; }; int main(int argc, char* argv[]){ assert( argc ==2 && "invalid number of command line arguments"); ifstream inputfile (argv[1]); assert( inputfile.is_open() && "unable open file"); } what best way of storing information , retrieving file comma separated first 2 , ends newline? want program ignore blank lines in file. i'd read file line-by-line using normal ge...

java - Making a client-server chat - running into issues with connecting client to client -

i trying learn how make multiple-client chatting program. im following oracle tutorial on custom networking, not looking for. far, have no code of own share, of copied oracle tutorial , think pasting here copyright infringement(??). link at: http://docs.oracle.com/javase/tutorial/networking/sockets/clientserver.html+ client code link: http://docs.oracle.com/javase/tutorial/displaycode.html?code=http://docs.oracle.com/javase/tutorial/networking/sockets/examples/knockknockclient.java anyway, have server-client working server tells knock knock jokes, client reads , prints, user replies , on. how start edit have client talk other clients directly? im sorry, have no background networking @ all. if can direct me informative source better suited goals appreciate it. as in knock-knock example, each client connects server, not mutually directly connected. there solution make forwarding sever :arrange each client id, , clients use id identify talking partners. to this, h...

Create a Second Activity in Android Studio -

this question has answer here: how add new activity existing project in android studio? 3 answers i have started playing android studio. cannot figure out how add second activity project. know in beta phase, appreciated. you need create second java file extends activity base class , add reference in androidmanifest.xml