Posts

Showing posts from July, 2010

cq5 - How to make textfield required using listeners -

cq5 - How to make textfield required using listeners - i have listener on selector hide , show textfield based upon selected value. want implement value show should mandatory fill in. used allowdblank true within listener didn't work. below listener. function(selection,record,path) { var dialog=selection.findparentbytype('panel'); var email = dialog.getcomponent('email1'); var url = dialog.getcomponent('url1'); if(record == 'email'){ url.hide(); url.setvalue(""); email.show(); //how create email manadory } if(record == 'link'){ email.hide(); email.setvalue(""); url.show(); } } thanks i've used "allowblank" on selectionchanged listener. i've used toggle fields required/not-required many times. here's working code adapted illustration (i omitted parts don't relate required field). using getfield method instead of getcomponent well: dialog: <

java - connection reset exception for large files -

java - connection reset exception for large files - i have custom http server seek read server's space browser. for big files (>10mb) "connection reset exception '. smaller files able write browser. my server reads zipped content, wrap zipinflaterinputstream within bufferedinputstream, , server reads bufferedinputstream. when extract zip , read fileinputstream it's working fine. for below code have. "data" variable of type bufferedinputstream , "outputstream" of instance of socketoutputstream. try { if (requestmethod != method.head && info != null) { int buffer_size = 16 * 1024; byte[] buff = new byte[buffer_size]; while (pending > 0) { int read = data.read(buff, 0, ((pending > buffer_size) ? buffer_size : pending)); if (read <= 0) { break; } outputs

python - Broken Korean strings when reading DataFrame from CSV -

python - Broken Korean strings when reading DataFrame from CSV - i korean user. when read .csv file pandas dataframe, korean strings broken this: ����� english good. input info sample: unnamed: 0 �������� �������ε����� ��x��Ç¥ ��y��Ç¥ �����Úµ� ������ ����߻��������� ����Ǽ� �������� 0 165244 20131201 �Ù»�62175541 962170 1955410 331 �������� 1 2 18224.03 why korean text corrupted? your text format unicode need decode utf-8 : import csv def unicode_reader('your_file_name',delimiter='your_delimiter', **kwargs): spamreader = csv.reader('your_file_name',delimiter='your_delimiter', **kwargs) row in spamreader: yield [unicode(w, 'utf-8') w in row] reader = unicode_csv_reader(open('your_file_name')) tex in reader: print tex python unicode pandas

php - RegExp for capturing "headline" trigger words in textarea -

php - RegExp for capturing "headline" trigger words in textarea - i'm trying write regexp php preg_split capture "headline" words in textarea im processing. i want utilize resulting array improve formatting user , create streamlined in review posts. $returnvalue = preg_split('/[^|\n]*[\t| ]*\b(pro|contra|conclusion)\b\:[\t| ]*/i', $data['review_text'], -1, preg_split_no_empty|preg_split_delim_capture); this sample text input intro line one, first part of array pro:pro:double pro 1, no space between pro: pro:double pro 2, space between pro: test pro:double pro 3, characters between pro: pro:double pro 4, linebreak betweem, should create empty pro entry contra: conclusion: lastly contra empty conclusion: contra: in row should not match! conclusion: test spaces between conclusion , : conclusion: conclusion prefixed space conclusion: conclusion pr

c++ - Why can't static_cast a double void pointer? -

c++ - Why can't static_cast a double void pointer? - consider next piece of code: void **v_dptr(nullptr); int **i_dptr = static_cast<int**>(v_dptr); the above illustration produces next compile error: static_cast 'void **' 'int **' not allowed live demo i know proper way cast void pointer other pointer type utilize static_cast . however, can't static_cast double void pointer double pointer of other type. q: why can't static_cast double void pointer? what's proper way cast double void pointer? when have void* , cast int* , there may or may not mathematical/width adjustment create instance of proper type, static_cast<> prepared do. when have pointer void* , want pointer int* , static_cast<> has no write access pointed-to void* object; not free adjust create sure it's valid int* such static_cast<> can succeed , homecoming pointer can used access valid int* . while on architect

python - How can I cast an long NUMERIC integer into a bit string in PostgreSQL? -

python - How can I cast an long NUMERIC integer into a bit string in PostgreSQL? - i'm trying calculate hamming distance pairs of long integers (20 digits each) in django app using pg_similarity extension postgres, , having hard time figuring out how this. django not seem have current bitstring field (which ideal, django_postgres seems defunct), trying cast integers bitstrings in sql query itself. current query: sql = ''' select id, hamming( "hashstring"::bit(255), %s::bit(255) ) hamming_distance images having hamming_distance < %s order hamming_distance;''' is throwing db error: cannot cast type numeric bit . doing wrong? else try? per the manual, casting right approach if "long integer" "long integer" i.e. bigint / int8: regress=> select ('1324'::bigint)::bit(64); bit --------------------------

date format - Java find DateFormat of a String -

date format - Java find DateFormat of a String - this question has reply here: java string date conversion 10 answers i having date in string say, "2014-10-09t06:33:50.765z". i know dateformat of it? do have api find out same or have go trial & error ?? it impossible guess date format in case 10th of september or 9th of october? but dont need "trial & error" there documentation on topic here java date-format

java - My simple custom listview show wrong items, not working as intented. Can't see what is wrong -

java - My simple custom listview show wrong items, not working as intented. Can't see what is wrong - i trying create this: http://i.stack.imgur.com/l8zoc.png however, ran problem. when create list adapter, supposed list of 8 items. however, shows first 4 of these items in random order 2 times. see wrong code? in advance. public class myactivity extends activity{ string headers[]; string image_urls[]; list<mymenuitem> menuitems; listview mylistview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_my); menuitems = new arraylist<mymenuitem>(); headers = getresources().getstringarray(r.array.header_names); image_urls = getresources().getstringarray(r.array.image_urls); (int = 0; < headers.length; i++) { mymenuitem item = new mymenuitem(headers[i], image_urls[i]); menuitems.add(

android - ERROR! It looks like your version of the NDK does not support API level -

android - ERROR! It looks like your version of the NDK does not support API level - i've followed instructions given @ http://www.rubymotion.com/developer-center/guides/getting-started when instruction rake device error: error! looks version of ndk not back upwards api level . switch lower api level or install more recent ndk. it seems when other people error they're given api level (level l seems popular problem causer). i've tried few different versions of ndk (9d, 10, 10b) , sdk (19, 20, l) no luck. i uninstalled android l stuff "android sdk manager" entirely. worked after that. (i might have had remove android 20 -- not near android development mac atm) android android-ndk rubymotion

Moving Identity Modules outside the ASP.NET MVC Project -

Moving Identity Modules outside the ASP.NET MVC Project - i'm using asp.net mvc 5 , identity 2.0 i moved identity 2.0 classes (classes defined in model/identitymodel.cs , startup/identityconfig.cs ) class library because models need reside outside website, , applicationuser class. after moving classes had install microsoft.aspnet.identity.entityframework , microsoft.aspnet.identity.owin nuget. now when run application, next error: an unhandled exception generated during execution of current web request. info regarding origin , location of exception can identified using exception stack trace below. stack trace here i don't know went wrong , where. seems work till startup.cs . i managed solve deleting database, , letting ef create new 1 me. applicationdbinitializer 's seed() called appropriately , worked fine. asp.net-mvc asp.net-identity owin

mongodb - Safe Methods in Meteor -

mongodb - Safe Methods in Meteor - i'm working on messaging app using meteor. disabled insert/update/remove called client security reasons. way insert messages using methods. meteor.methods({ sendmessage: function (text) { messages.insert({ userid: meteor.userid(), roomid: rooms.findone()._id, name: meteor.users.find(meteor.userid()).fetch()[0].profile.name , message: text }); } }); this approach asks content of message, there's no way user phone call method using other name or seek send same message other chat rooms. i'm beginner using meteor wonder, wouldn't real method (not stub) run on server different values userid , roomid? rooms.findone()._id on server random room document on db, userid user. if case have include parameters on function create much less secure. i'm not understanding methods here. you on right track. using rooms.findone() doesn't create sense on server, , frankly isn't on client either (if ever publi

android - Footerview not displaying always when scrolling the listview -

android - Footerview not displaying always when scrolling the listview - i have listview adapter. want add together footer , footer displayed when scrolling listview. right code footerview displayed when listview finished. in oncreate method of list have: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_listado_imagenes_subidas_main); // load list application listimagenes = (listview)findviewbyid(r.id.lvimages); layoutinflater inflater = getlayoutinflater(); viewgroup footer = (viewgroup) inflater.inflate(r.layout.footer3buttons, listimagenes, false); listimagenes.addfooterview(footer, null, false); // create new adapter imagenesadapter adapter = new imagenesadapter(this, listadoimagenes()); // set adapter list view listimagenes.setadapter(adapter); } could please help me issue? thank in advanced. if understood correctly wan't &quo

math - Postfix Expression? -

math - Postfix Expression? - i have question asks "what value of postfix look 6 3 2 4 + - * ?" options are: a. between -15 , -100 b. between -5 , -15 c. between 5 , -5 d. between 5 , 15 e. between 15 , 100 calculations, maintain getting 18 answer, e, reply a. am missing something? you missing order of operands "-" operator. in infix notation, evaluates 6*(3-(4+2)) = -18 . math expression

oracle - SSRS SQL Dataset Properties -

oracle - SSRS SQL Dataset Properties - is possible have "if" statement within sql query in ssrs dataset properties? for example, want run 1 query based on if parameter value true or not , query opposite. if parameters!studentid.count < 5 select * people else select * users end if; i don't know if possible mix ssrs look within sql script or not. you use parameters accomplish well, join 2 tables together in single info set , have parameters drive query result set. overhead on query minimal if cache report (which should). drive case statements. if info sets different, suggest making 2 different reports, encapsulation @ level in ssrs can become hard back upwards longer term multiple customers. case when studentidint > 5 people else studentid end you cannot mix in ssrs expressions sql query interface, different. here best cheat sheets on ssrs expressions here, here, , here. learn more parameter utilize in ssrs

c++ - UDP packet loss differs on package size -

c++ - UDP packet loss differs on package size - i have application test udp sockets in qt. simple. 1 socket binds port , listens incomming packages. other socket used send packages. first number in bundle packages sent sender, subsequent info test. when receiver gets bundle shows received/sent rate. can vary bundle size, , timeout of timer send packages. , have 2 computers behind 2 different routers, tested this: bind both sockets same port. add together port forwarding port. send packets 127.0.0.1 , router external ip. both computers showed, maximum size of bundle received 32kb - 28b. 28b udp header size. suppose. then seek test in same way between 2 computers. , test shows same results in 1 way(for illustration when send comp1 comp2), when send comp2 comp1 maximum size around 3kb(2975b). comp1 not bundle larger this. this code of program: mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow), receivesocket(),

html - array_push overwriting previously created object PHP -

html - array_push overwriting previously created object PHP - i trying create array of objects can display, objects beingness created when form has been submitted. the first object gets added, when add together object, overwrites lastly created object. can see going wrong? <?php require_once $_server['document_root'].'/includes/classes/goal.php'; ?> <?php require_once $_server['document_root'].'/global/head.php'; ?> <?php require_once $_server['document_root'].'/config/init.php'; ?> <?php $input['title'] = ""; $input['deadline'] = ""; $input['description'] = ""; if(!isset($_session['goals'])) {$_session['goals'] = array();} if (isset($_post['submit'])) { $_session['goalcount'] ++; $input['title'] = htmlentities($_post ['title'],ent_quotes); $input['deadline'] = htmlentities($_post ['dead

ruby on rails - How to go from a relation to a relation of associated model in Active Record -

ruby on rails - How to go from a relation to a relation of associated model in Active Record - i have had sort of situation class post has_many :comments end now if have relation of posts, how relation of comments on posts. what looking post.where(user: user).comments but wont work. missing obvious here? seems mutual utilize case. basically when post.where(user: user).includes(:comments) preloading requisite comments already, want access them directly, without post.where(user: user).includes(:comments).map{|p| p.comments}.flatten.uniq or that.. i'd define scope scope :comments_in_user_posts, -> (user) { where(user: user).includes(:comments).map{|p| p.comments}.flatten } then utilize post.comments_in_user_posts(user) . edit: another alternative utilize comment.where(post: post.where(user: user)) ruby-on-rails ruby rails-activerecord

azure - How to handle "The specified resource does not exist" exception while using Entity group transactions to purge WADLogs table -

azure - How to handle "The specified resource does not exist" exception while using Entity group transactions to purge WADLogs table - we have requirement purge azure wadlogs table on periodic basis. achieving using entity grouping transactions delete records older 15 days. logic this. bool recorddoesnotexistexceptionoccured = false; cloudtable wadlogstable = tableclient.gettablereference(wadlogstablename); partitionkey = "0" + datetime.utcnow.adddays(noofdays).ticks; tablequery<wadlogsentity> buildquery = new tablequery<wadlogsentity>().where( tablequery.generatefiltercondition("partitionkey", querycomparisons.lessthanorequal, partitionkey)); while (!recorddoesnotexistexceptionoccured) { ienumerable<wadlogsentity> result = wadlogstable.executequery(buildquery).take(1000); //// batch entity delete. if (result != null && result.count() &

ios - Xcode 6 interface builder - horizontally align labels -

ios - Xcode 6 interface builder - horizontally align labels - how can align 4 uilabels horizontally equal spacing between them using xcode 6 interface builder. labels little bit off top of view , central. each label has related label underneath needs align image below. is there other component easier utilize aligning in way. give these constraints labels : label1 (10) : top space container , leading space container label2 (10) : top space container , horizontal spacing - label1(10) label3 (days) : leading space container , verical spacing - label1(10) label4 (hours) : horizontal spacing - label3(days) , verical spacing - label2(10) ios swift interface-builder xcode6

java - Casting from JTable Object to int -

java - Casting from JTable Object to int - i attempting retrieve value jtable , getting java.lang.nullpointer exception. next line seems issue. trying take object, 25, , cast int. reason simple task seems extremely hard or impossible. looked @ stackoverflow users question similar problem never got response worked. the error codes read follows: exception in thread "awt-eventqueue-0" java.lang.nullpointerexception @ gradebook$5.actionperformed(gradebook.java:925)this sec line in loop. note: edited post provide additional code. for(int = 0; < 10; i++){ myclass[currentclass].getcategoryelement(i).setname((string)categoriestable.getmodel().getvalueat(i, 1)); myclass[currentclass].getcategoryelement(i).setweight(integer.valueof((string)(categoriestable.getmodel().getvalueat(i, 2))));//this line identified problem } categoriestable.setmodel(new defaulttablemodel( new object[][] { {"1&qu

sql - How to transfer data from local database to service-based database? -

sql - How to transfer data from local database to service-based database? - i'm new .net language although i've used vba lot. anyway, trying create next sql command work properly. help appreciated... "insert repsecurity (userid,creds) " _ & "select reps.userid, initusers.pwd " _ & "from reps inner bring together initusers " _ & "on reps.repid = initusers.repid" some parts left out. plus reps table service-based table ( .mdf ) , initusers table local table ( .sdf ) by way, i'm coding in visual studio 2012 using vb.net language. sql sql-server vb.net sql-server-ce

Getting a custom JPanel to show custom JComponents (Java Swing) -

Getting a custom JPanel to show custom JComponents (Java Swing) - i @ loss 1 guys. trying create custom led display show 7 bars arranged 8. got single custom jcomponent (bar) show within of jframe, cannot bars show within of custom panel creating. here code constructor methods , paint methods in classes main method using test these classes. the custom jcomponent: public class bar extends jcomponent { // instance variables - replace illustration below own private static boolean litup = false; private static boolean vertical = false; private static boolean rotated = false; private static boolean rotclockwise = false; private static int positionx; private static int positiony; public bar(boolean lit, boolean vert, int posx, int posy) { litup = lit; vertical = vert; positionx = posx; positiony = posy; repaint(); system.out.println("the bar beingness initialized"); } public

change upload folder and putting the location of the image in the api - sails.js -

change upload folder and putting the location of the image in the api - sails.js - i have client-side application register form send info sails.js based server. other basic info that's beingness send, have image upload uploads image ./tmp/uploads here server side code(in controller): upload: function (req, res) { req.file('avatar').upload({ dirname: 'uploads' }, function (err, uploadedfiles){ if (err) homecoming res.send(500, err); res.view({ items: uploadedfiles }); }); } 1) how alter folder files goes to? obiously dont want files saved in .tmp folder 2)how insert image location info api has beingness created? , speaking of image location, how access image file? usualy expected localhost:1337/.tmp/uploads/file.jpg work. 1) have set absolute path in prop 'dirname', example: var path = '/var/www/app/uploads'; req.file('avatar').upload({ dirname: path }, function (err, uploade

windows - passing a parameter from a vbscript to a batch file -

windows - passing a parameter from a vbscript to a batch file - i have batch file calling vbscript. vbscript homecoming current date time stamp. can please tell me how can pass datestamp value batch script . using wscript.echo dont want utilize : batch file : wscript "c:\script.vbs" "c:\log.txt" vb script : set objargs = wscript.arguments dim objfso, objfile, logfile logfile = wscript.arguments(0) set objfso = createobject("scripting.filesystemobject") set objfile = objfso.getfile(logfile) wscript.echo objfile.datelastmodified end if can 1 tell me can in above script pass datelastmodified batch file ? not want utilize wscript.echo ... @for /f "tokens=* delims=" %%# in ('cscript /nologo "c:\script.vbs" "c:\log.txt"') @set "result=%%#" now can utilize %result% variable. wscript pop-up result.from command line/bat improve utilize cscript. you can embed vbscript

char - Insert line break in postgresql when updating text field -

char - Insert line break in postgresql when updating text field - i trying update text field in table of postgresql database. update public.table set long_text = 'first line' + char(10) + 'second line.' id = 19; my intended result cell this: first line sec line the above syntax returns error. you want chr(10) instead of char(10) . be careful this, because might wrong newline. "right" newline depends on client consumes it. macs, windows, , linux utilize different newlines. browser expect <br /> . it might safest write update postgresql 9.1+. read docs linked below. update public.table set long_text = e'first line\nsecond line.' id = 19; the default value of 'standard_conforming_strings' 'on' in 9.1+. show standard_conforming_strings; postgresql char sql-update

javascript - Python selenium how to hiden webdriver detection -

javascript - Python selenium how to hiden webdriver detection - hi trying navigate web site using automation steps selenium when run script , check source-code. found <html webdriver="true"> and code blocks selenium script. think javascript code observe webdriver. how can hidden webdriver undetectable. any suggestion? thought or alternative? thanks lot. javascript python selenium webdriver

linux - Pipelines in C - Do I have to use fork? -

linux - Pipelines in C - Do I have to use fork? - let's assume i'm working c only, in linux environment. normally, if want utilize pipe() function, create pipe , fork it, thereby allowing parent communicate child, , vice-versa. but if it's not parent , child? if have old process that's running, possible communicate using pipe() function? process not parent of(or related in way to) current process, have it's pid. restricted file or socket interprocess communication? is there way can perchance specify pid , receive info without using sockets? for question but if it's not parent , child? if have old process that's running, possible communicate using pipe() function? you not able communicate other process, aren't created parent process. technically, shouldn't allowed to. you need go through os or utilize other ipc mechanisms attain functionality. the databases used because of primary reason. multiple processes able

google apps script - I want to set up a day timer that continues to count the days as soon as any data is entered into the row of spreadsheet -

google apps script - I want to set up a day timer that continues to count the days as soon as any data is entered into the row of spreadsheet - could please help me fallowing question? i set spreadsheet relate question below https://docs.google.com/spreadsheets/d/1sp8j2znzzr-lnkmpnyt_aukkm7vqf_31tq71de_xr04/edit?usp=sharing (im not sure fallowing possible. please advise) i want set day timer continues count days info entered row , stop when type word "x" or improve checkmark in checkbox. 1 time check mark or type word, want entire row greyout/blackout (highlight black) i trying set sheet work , appreciate help. to give more detail, built form through google utilize jot downwards called me, why called me , if high priority phone call or low priority call, if require service there machines etc... form creates spreadsheet, want able finish task phone call , checkmark or "something" blackout row letting me know have completed task, if have not,

docusignapi - RoutingOrder does not work -

docusignapi - RoutingOrder does not work - when getting envelope requeststatus recipients have same routing number. sure , debug provided different parameter each recipient. , recipients gets email in same time. how can send envelope each recipient according routingorder? sequential signing (api) enabled account: my examlple: webapi.recipient[] recipients = {new webapi.recipient(), new webapi.recipient()}; recipients[0].email = "johndo@gmail.com"; recipients[0].username = "john do"; recipients[0].type = webapi.recipienttypecode.signer; recipients[0].id = "2"; recipients[0].routingorder = 2; recipients[1].email = "johndo2@gmail.com"; recipients[1].username = "john do2"; recipients[1].type = webapi.recipienttypecode.signer; recipients[1].id = "1"; recipients[1].routingorder = 1; // create envelope webapi.envelop

javascript - Loop animation with velocity.js -

javascript - Loop animation with velocity.js - i'm trying kind of loop animation velocity.js: translate object on x axis 0 473, 0 473 , on. i've succeeded (code below) on android chrome , ios chrome browsers loop starts on delay (lag). can help? function start() { $(".el").velocity( { translatex: [ -473, 0 ] }, { duration: 8000, delay: 0, easing: "linear", complete: reset }); } function reset() { $(".el").css("transform", "translate(0px, 0px)"); start(); } start(); since you're using forcefeeding, .css() phone call redundant. removing line removes initial lag on chrome android: $el = $(".el"); function start() { $el.velocity( { translatex: [ -473, 0 ] }, { duration: 8000, delay: 0, easing: "linear", complete: start }); } start(); and can see live version here. java

php - Yii1: How to use concat function in mysq like query -

php - Yii1: How to use concat function in mysq like query - i want utilize mysql concat function in like expression . want merge firstname , lastname fullname , matched results according fullname . have tried in yii1. below code: $criteria = new cdbcriteria(); $criteria->select = "*"; $criteria->select = 'concat(firstname , "" , lastname) fullname'; $criteria->addcondition('fullname :match'); $criteria->params = array(':match' => $query); $models = user::model()->findall($criteria); below generated error message: cdbcommand failed execute sql statement: sqlstate[42s22]: column not found: 1054 unknown column 'fullname' in 'where clause' (error 500) cdbcommand::fetchcolumn() failed: sqlstate[42s22]: column not found: 1054 unknown column 'fullname' in 'where clause'. sql statement executed was: select count(*) `members` `t` fullname :match. tha

android - Timer in Asynchronous Task does not work as expected -

android - Timer in Asynchronous Task does not work as expected - i execute 1 task within asynchronous task , set time limit 15 seconds, hits 3, 5 , 10 seconds. don't know whats going wrong. if can help i'd appreciate it, thanks! public void callasynchronoustask() { final handler handler = new handler(); timer timer = new timer(); timertask doasynchronoustask = new timertask() { @override public void run() { handler.post(new runnable() { public void run() { seek { // task } grab (exception e) { } } }); } }; timer.schedule(doasynchronoustask, 15000, 15000); } i have done timer calculate proper time , if want stop mytimer.cancel(). , @pearsonartphoto referring :) timer mytimer; mytimer = new timer(); mytimer.schedule(new timertask() { @override public void ru

reporting services - SSRS Format to display as percent -

reporting services - SSRS Format to display as percent - i've gone through quite few examples on here , apologize if i'm asking repeat question, far can tell, not. i have ssrs study made shows gross sales aspects of our sales departments. broken down, in row, "cost, gross profit, gross turn a profit %, order count, total sales." columns aspects of our sales. web sales, phone sales, etc.... in tablix can format text box display results numbers, can see, have percentage , count in there. don't know how format within context of original text box format. know have shows under there number already, how handle getting percentage show percentage , count show count? for example, percentages show as, "$0.35" , various other numbers follow form. count's appear currency too. i've used illustration found on here, "=iif ( me.value = floor ( me.value ) , "0%" , "0.00%" )," did create showed in column, "

javascript - Regex to ensure valid querystring -

javascript - Regex to ensure valid querystring - i'm trying come regex look can utilize javascript .test create sure scheme accepting query strings in valid format. the format looks i=1&s1=122&s2=238&s3=167&s4=756&s5=13 can have unlimited number of s#= arguments in it, longer or shorter example. in english language format i=1&s[1+0]=[any number > 0]&s[1+1]=[any number > 0]&s[1+2]=[any number > 0] , on. right regex have /^([\w-]+(=[\w-]*)?(&[\w-]+(=[\w-]*)?)*)?$/ it's based on code provided in this answer. ok job of rejecting types of invalid strings, there still lot slip through. how can improve regex look more accurately rejects invalid data? if understand question correctly, can tighten things with: /^i=1(&s\d+=\d+)+$/ it allow, say, s14 come before s2 , query parameters supposed unordered anyway. javascript regex query-string

javascript - Entering Hash to reset password and not Actual User Password -

javascript - Entering Hash to reset password and not Actual User Password - i have update password page won't allow me come in actual current password current password field. instead, wants hashed password. 1 time changed however, new 1 hashed, thing. need able come in actual password , not hashed. yes know, no md5; more testing all. changepassword.js <script> function validatepassword() { var currentpassword,newpassword,confirmpassword,output = true; currentpassword = document.frmchange.currentpassword; newpassword = document.frmchange.newpassword; confirmpassword = document.frmchange.confirmpassword; if(!currentpassword.value) { currentpassword.focus(); document.getelementbyid("currentpassword").innerhtml = "required"; output = false; } else if(!newpassword.value) { newpassword.focus(); document.getelementbyid("newpassword").innerhtml = "required"; output = false; } else if(!confirmpassword.value) { confirmpassword.f

java - How to get AdnRecord size via an android application -

java - How to get AdnRecord size via an android application - the adnrecord main file contain contacts in sim card. i developing android application , want adnrecord size via application using adnrecord class, more intelligible , want adnrecord size on button click . the adnrecord class available open source code in internet. want create java code calls class 1 time click button. the button : <button android:id="@+id/third" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignright="@+id/premier" android:layout_below="@+id/second" android:layout_margintop="25dp" android:text="contact access" android:onclick="getadnrecordssize" /> i want create methode "getadnrecordsize" calls adnrecord class saved in same package. could help me ?! give thanks in advance . java android sim-card

java - Finding the index of each character in a substring -

java - Finding the index of each character in a substring - i sense logic decent here; don't sense i'm lost. however, know i'm doing wrong. can find index of start of substring, can never find total count (ex. 3,4,5,6) of index of whatever word user enters substring. i have been struggling week trying figure out how on own, can't right. import java.util.scanner; public class midterm { public static void main (string[] args) { scanner keyboard = new scanner(system.in); string simplephrase; string portionphrase; int portionindex; int portioncount; int portionindextotal; system.out.println("enter simple phrase:"); simplephrase = keyboard.nextline(); int phraselength = simplephrase.length(); system.out.println("phrase length:" +phraselength); system.out.println("enter portion of previous phrase:"); portionphrase = keybo

c# - Cannot use Enumerable.Count with List, compiler assumes List.Count -

c# - Cannot use Enumerable.Count with List, compiler assumes List.Count - i haven't noticed behaviour yet, maybe because prefer query syntax in vb.net , split query , execution-methods different statements. if seek compile next simple query: dim wordlist list(of string) = new list(of string) dim longwords int32 = wordlist.count(function(word) word.length > 100) the compiler doesn't because expects no arguments list.count : "public readonly property count integer" has no parameters , homecoming type cannot indexed. if declare ienumerable(of string) works expected: dim wordseq ienumerable(of string) = new list(of string) dim longwords int32 = wordseq.count(function(word) word.length > 100) why so? prevents compiler using enumerable extension method count instead of icollection.count property. note i've added imports system.linq , both option strict , option infer on . i'm using.net 4.0 (visual studio 2010). i'm co

"bad variable name" in bash script started by cron -

"bad variable name" in bash script started by cron - works fine when running manually on shell when setup cronjob run on reboot "bad variable name". #! /bin/sh # /etc/init.d/duplicitycleanup export passphrase=foo duplicity remove-older-than 30d --force --gio smb://remote/archiv/ duplicity remove-all-but-n-full 1 --force --gio smb://remote/archiv/ unset passphrase there space between #! , /bin/sh . don't think reported problem needs fixing i guess using version of unix or linux /bin/sh not bash export syntax wrong. alter script say passphrase=foo export passphrase see reply unix export command bash cron

javascript - Google Apps Script JDBC ResultSet to Array -

javascript - Google Apps Script JDBC ResultSet to Array - is there improve way of retrieving results resultset? calling getstring() on each value slow. takes 2.5 seconds set 400 rows, 16 columns array before can utilize it. the query takes 80ms faster accessing google sheet (about 2 seconds) takes long read data. this i'm using now. var results = stmt.executequery(); var numcols = results.getmetadata().getcolumncount(); var resultsarray = []; var count = 0; while(results.next()) { resultsarray.push([]); (var = 1; <= numcols; i++) resultsarray[count].push(results.getstring(i)); count++; } javascript jdbc google-apps-script

Java/Apache Velocity date.format giving wrong year -

Java/Apache Velocity date.format giving wrong year - i using next line of code in .vm files. particular date expect date returned 12/31/14, instead returning 12/31/15. know causing year come wrong? $date.format('mm/dd/yy', 'wed dec 31 07:23:45 cst 2014') in tools.xml file, have added comparisondatetool seen below: <tool class="org.apache.velocity.tools.generic.comparisondatetool" format="mm/dd/yyyy h:m:s" depth="1" skip="month,week" bundle="org.apache.velocity.tools.generic.times" timezone="cst"/> change format 'mm/dd/yy' (note lowercase y's) yy (capital y) week year the first week of calendar year earliest 7 day period starting on getfirstdayofweek() contains @ to the lowest degree getminimaldaysinfirstweek() days year. depends on values of getminimaldaysinfirstweek(), getfirstdayofweek(), , day of week of jan 1. weeks between week 1 of 1 ye

android - how to get my layout to be at the bottom of my activity -

android - how to get my layout to be at the bottom of my activity - hello working on ios styled app has layout out bottom can't seem layout in question @ bottom here's code: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightsum="10" tools:context=".myactivity" tools:ignore="uselessleaf,contentdescription" > <android.support.v4.view.viewpager android:id="@+id/pager" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_marginbottom="5dp" android:layout_weight="7" > </android

HttpClient fails to authenticate via NTLM on the second request when using the Sharepoint REST API on Windows Phone 8.1 -

HttpClient fails to authenticate via NTLM on the second request when using the Sharepoint REST API on Windows Phone 8.1 - sorry long title, seems best summary based on know far. we’re working on universal app needs access documents on sharepoint server via rest api using ntlm authentication, proves more hard should be. while able find workarounds problems (see below), don’t understand happening , why necessary. somehow httpclient class seems behave differently on phone , on pc. here’s figured out far. i started code: var credentials = new networkcredential(username, password); var handler = new httpclienthandler() { credentials = credentials }; var client = new httpclient(handler); var response = await client.getasync(url); this works fine in windows app, fails in windows phone app. server returns 401 unauthorized status code. some research revealed need provide domain networkcredential class. var credentials = new networkcredential(username, password, d

ios - xCode Navigation Back Button not popping detailview -

ios - xCode Navigation Back Button not popping detailview - whenever press on 'go back' button on final detail view, wont go table view. i have storyboard setup this: uitabviewcontroller -> uinavigationcontroller -> uitableview -> uinavigationcontroller -> uiview (the detailview). when run programme see button, clicking nothing. here code detailviewcontroller.m: - (void)viewdidload { [super viewdidload]; uibarbuttonitem *backbtn = [[uibarbuttonitem alloc] initwithtitle:@"go back" style:uibarbuttonitemstyleplain target:self action:@selector(gobackbtn)]; [self.navigationitem setleftbarbuttonitem:backbtn]; [self configureview]; } - (void)gobackbtn { [self.navigationcontroller popviewcontrolleranimated:yes]; } as if [self.navigationcontroller popviewcontrolleranimated:yes]; nothing. i'm out of ideas. why backbutton not 'pop' detailview? your detail view controller root view controller of navi

Formatting a bash cat pipe to mail command -

Formatting a bash cat pipe to mail command - when wrote script works fine. diffs 2 file , if diff fails indicates no alter between todays file , previous days file. menas the download stale. when email it not formatted. treid putting in newline email legible. mail service function not work. file garbled read. #!/bin/bash dayofweek=$(/bin/date +%w) today=$(/bin/date +%y.%m.%d_) yesterday=$(/bin/date -d '1 day ago' +%y.%m.%d_) destination="/sbclocal/stmevt3/dailymetrics/eq_performance/" file1=opts_trip_trip_csv_oct2014.csv file2=opts_tripnon-penny1-20_tripnon-penny1-20_oct2014.csv file3=opts_tripnon-penny21-50_tripnon-penny21-50_oct2014.csv file4=opts_tripnon-penny51-100_tripnon-penny51-100_oct2014.csv file5=opts_trippenny1-20_trippenny1-20_oct2014.csv file6=opts_trippenny21-50_trippenny21-50_oct2014.csv file7=opts_trippenny51-100_trippenny51-100_oct2014.csv in $file1 $file2 $file3 $file4 $file5 $file6 $file7 if diff $destination$today$i $destination$yest