Posts

Showing posts from January, 2010

php - preg_match for select string like #__james_name -

i need regular expression select text #__james_name in php tried : (^#__[a-z]*)* but did not succeed. please update tried : \#__([a-z]*)_([a-z]*) how using in preg_match ? preg_match('/(^#__[a-z_]*)/', '#__james_name', $matches);

javascript - AngularJS: Temporarily disable data binding. -

is possible temporarily disable data binding in angularjs. have list items render using ng-repeat . want list operations on items , while data-binding temporarily disabled, intermediary changes not reflected on page thereby slowing down. instead want perform operations on list , thereafter re-enable data binding. var items = angular.copy($scope.items); .. .. .. /* perform operations on items */ .. .. .. $scope.items = angular.copy(items);

asp.net - How to Set Selection start Date grater than Today date in Telerik raddatepiker -

i try set selection start date in telerik raddatepicker in design side using rangeselectionenddate propriety. <telerik:raddatepicker id="dateffectivedate" runat="server" enabled="false" width="200px"> <calendar id="caleffectivedate" runat="server" enablekeyboardnavigation="true" rangeselectionstartdate=<%# eval(datetime.now, 'mm/dd/yyyy' %> > </calendar> </telerik:raddatepicker> please how set seletion start date should greater equal today date in telerik raddatepiker on html side. please check following code . <telerik:raddatepicker id="dateffectivedate" runat="server" enabled="true" width="200px" mindate="<%# datetime.today.date %>"> when using databinding expression such <%# datetime.today.date %>, have call page.data

c# - HttpPost Action method is not called from Edit save button -

here's action method [httppost] [authorizeprivileges(privileges = "manage waiting room")] public actionresult editbillingcharges(int id, billingchargesmodel billingchargemodel, string hdnglobalpostvar, string hdnbillingchargesdetailsid) { if (!isactive) return logout(); viewdata["currentpage"] = "edit billing charge sheet"; billingcharges billing = new billingcharges(); billing = billingchargesbo.findbyid(id); if (hdnglobalpostvar.tolower().tostring() == "edit") { if (billingchargemodel != null) { billing.name = billingchargemodel.billingcharges.name; billing.modifiedby = user.identity.name; billing.datecreated = datetime.now; billing.datemodified = datetime.now; billingchargesbo.saveorupdate(b

ios - iAD doesn't show on 3.5" screen? -

Image
i built app 4" screen. in order show on 3.5" screen checked option use autolayout . i have iad banner view @ bottom of 4" storyboard screen. whether or not check use autolayout button, ad doesn't show when run app on 3.5" simulator. if move banner view shows on 3.5" moves on 4" simulator. how iad shows @ bottom of both 3.5" , 4" screens , autolayout still checked saves me lot of time. set constraints on iad banner

postgresql - Can't connect to pgpool -

i'm playing around pgpool2 . i'm connecting postgresql running on port 5432 command psql -u postgres -p 5432 , it's connecting normally. when i'm connecting pgpool2 running on 9999 port command psql -u postgres -p 9999 - returns dialog like: psql: root@master:/linux/path# what i'm doing wrong? there way connect pgpool using psql? cannot connect application also. upd i've got following error pool_do_auth: maybe protocol version mismatch (current version 3) solved : problem in pgpool auth on backends. editing pg_hba.conf fixed problem. this error message , behavior because of problem pgpool authenticating postgres , not authenticating pgpool might suspect. if check postgres logs, tell line in postgres pg_hba.conf being rejected. however, since (iirc) pgpool cannot peer authentication, one, says local (unix socket) connections authenticated pretending system username postgres username: local all peer you want change to: loca

c# - prevent freeze gif file at the same time searching text in database -

this question has answer here: prevent winforms picturebox animated gif pausing during processing? 2 answers i want search data in database , show result. when searching word in db, want show group box( gbloading ) label , gif image control, gif file freeze when searching word. how can change code prevent freezing gif image in group box of form. my code : private void btsearch_click(object sender, eventargs e) { gbloading.location = new point(this.width / 2 - 100, this.height / 2 - 30); gbloading.visible = true; application.doevents(); list<bookauthorsfieldset> resources = db.search(resourceorautor, txsearch.text.trim()); datatable dt = convertlisttodatatable(resources); dgvresourcesorauthors.datasource = dt; dgvresourcesorauthorscount.text = "result count : " + dgvresourcesorauthors.rows.count.tostring(); applic

javascript - Ajax call keeps getting blocked by browser -

i bit stuck issue. i developing small mobile website. trying call webservice using ajax call, browser keeps blocking call. if start chrome using tags... "--allow-file-access-from-files --disable-web-security​​" call works perfectly. have no issues whatsoever. now problem if host website, browser going block ajax call , user cannot example login or retrieve information. present ajax call below... $.ajax({ async: true, beforesend: function () { }, complete: function () { }, type: 'post', url: 'https://mysecreturl.com/login?format=json', contenttype: 'application/json', datatype: 'json', data: '{"userid":"mysecretuserid","password":"mysecretpassowrd"}', success: function (resultmessage) { if (resultmessage.wassuc

android - How to change the height of a switch widget? -

i want have switch widget larger , have change height of switch. but have no solution this. i looked @ question: change height of switch and made drawable this: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:width="0dp" android:height="30dp"> <solid android:color="#ff4444" /> </shape> then setted switch this: <switch android:id="@+id/sw_tracklivedata" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/tv_livedata" android:layout_alignright="@+id/btn_stoptrip1" android:layout_alignleft="@+id/btn_stoptrip1" android:layout_margintop="10dp" android:thumbtextpadding="25dp" android:switchminwidth="56dp" android:track="@drawable/roundedbu

cordova - which solution should i use to build an app? -

you've heard million times, think got pretty cool idea app. the problem don't no start, tool best , can give me want. my skills: - html, css, jquery what app needs: - local database store text , photos (or links photo, stored in folder) - camera access - gps access (this might not make v1) how database globally like: - user add event - in event: add sub events - in sub event: add text and/or photo user can see events in table or something. should go phonegap or something? or titanium? or completly else? and what's starting point? i've tried phonegap half our, i'm stuck database, don't see happen. thanks answers! have @ christophe coenraets' blog , doesn't detail database part provides samples can play contain different implementations of local data storage phonegap apps.

gremlin - Common ancestor in a titan graph.. -

in titan(hbase) graph, common ancestors given nodes. using gremlin there way can common ancestors? or other utils / libs available find common ancestors in titan graph given nodes? i'll make assumptions on you're looking here, maybe answer inspire come looking for. used toy graph demonstrate approach , assumed edges directionally pointed children. isn't perfect tree, there's enough data there @ least demonstrate traversal. following shows "children" whom wanted find ancestors: gremlin> g = tinkergraphfactory.createtinkergraph() ==>tinkergraph[vertices:6 edges:6] gremlin> children = [g.v(2),g.v(5),g.v(6)] ==>v[2] ==>v[5] ==>v[6] i can recursively loop through tree through ancestors , see paths follows: gremlin> children._().in.loop(1){it.loops<5}{true}.path ==>[v[2], v[1]] ==>[v[5], v[4]] ==>[v[5], v[4], v[1]] the above line caps loop @ 5 steps away ancestor , {true} closure means output values @ step

java - How to use Log4j2 xml Rewrite appender for modifying LogEvent before it logs in file -

i want use rewrite appender in log4j2.xml file before logging can modify logs. have not helps google. per log4j2 documents rewrite interface has rewrite method , maprewritepolicy implementation class, when run able see web3.log file generating not seeing modification in log content. seen maprewritepolicy source code , created local implementation class maprewritepolicyimpl.java in project , put system.out see code flow coming class log4j2.xml file. have modified log4j2.xml use maprewritepolicyimpl.java code flow not going maprewritepolicyimpl.java class. <rewrite name="rewrite" > <appender-ref ref="web3" /> <maprewritepolicyimpl"> <keyvaluepair key="creditcard" value="new12345"/> </maprewritepolicyimpl> </rewrite> <configuration monitorinterval="5" status="debug" strict="true"> <appende

shell - Searching Pattern after a specific pattern in bash script -

i have search 100 files of following format. <dependencies> <a1 build="true"> <a2 build="false"> <a3 build="false"> <deployments> <a1 build="false"> <a2 build="true"> <a3 build="false"> i have find files have atleast 1 deployment build="true". problem how should start search after string deployment dependencies build="true" doesnot come search. awk 'fnr == 0 { dep = 0; } /<deployments>/ { dep = 1; } /build="true"/ && dep { print filename; nextfile; }' file1 file2 ...

android get view hierarchy for all windows in activity -

i making skd automation. needs different normal app development. requirement : viewhierarchy of current activity. problem : correct when spinner not open. not details of spinner when open. i use following code hierarchy. questions is: spinner hosted in different window why not getting it? way it? //this how start recursion view hierarchy view view = getwindow().getdecorview().getrootview(); if (view instanceof viewgroup) { viewgroup group = (viewgroup) view; dumpviewhierarchywithproperties( group, 0); } //functions hierarchy private void dumpviewhierarchywithproperties(viewgroup group,int level) { if (!dumpviewwithproperties(group, level)) { return; } final int count = group.getchildcount(); (int = 0; < count; i++) { final view view = group.getchildat(i); if (view instanceof viewgroup) { dumpviewhierarchywithproperties((viewgroup) view, level + 1); } else { dumpvieww

Delegate between Java and C# -

i'm new c# , running slight problem. i've got java library provides alot of functionality need (and sadly no c# equivalent). came across ikvm , thought might need. i can make dll java class, no problem there. need dll callback c# class in case of event. have searched bit , found question on here handles same problem (and gives answer). problem is, answer not complete. have @ other question , answer here: ikvm c# java interop callback using ikvm so far understand author uses self made library handle callback via delegate. can't figure out what's in library, contents of not listed in answer. can me out on maybe?

JavaScript insert new line to any space in the middle of string -

i insert 1 new line character in middle of string: for (var i=0; i<labels.length; i++){ if (labels[i].length > 30) { //the split occur here } } is there js function this? any ideas? edit to replace spaces in string new line: string.replace(/ /g, '\n'); / /g refers global replace of spaces found. say string follows: var string = 'the quick brown fox jumps on lazy dog'; you need find length of string, middle point, , nearest space middle: var length = string.length; var middle = math.round(length / 2); var spacenearmiddle = string.indexof(' ', middle); var string1 = string.substring(0, spacenearmiddle); var string2 = string.substring(spacenearmiddle + 1, length); the result of string1 , string2 "the quick brown fox" , "jumps on lazy dog".

symfony - Using PHP global variable inside yml file -

i'm trying use $_server global variable inside yml file cant find anywhere how php. online examples doing ruby. possible php? you can server variables same way $_get , $_post . $request->server->get('your_variable') // specific $_server variable $request->server->all() // $_server variables update: to them in config files following (taken openshift symfony2 distribution - https://github.com/hasinhayder/openshift-symfony-2.3.0/tree/master/php/app/config ) set parameters in php file, in example above it's called params.php <?php $container->setparameter('parameter_one', $_server['parameter_one']); then include in config.yml file imports: - { resource: parameters.yml } - { resource: security.yml } - { resource: params.php } and should able use them if had been set in regular linked yml file like %parameter_one%

What is basic reason behind creating objects in the powerful programming languages -

what basic need of creating object in programming language have come acrossed 3-4 programming languages posses feature of object creating. following languages :- 1.c++ 2.java 3.php 4.js question root need programmers built concept of object bought focus , practiced , after magic happened powerful programming language support function of object conclusion from: en.wikipedia.org/wiki/object-oriented_programming the object-oriented approach in reality logical extension of design practices it's logical extension of older techniques such structured programming , abstract data types. the new technique hyped lot , commercialized 'sell' programming language. (hence major languages have concept, , implemented in older languages because of this.)

jquery - redirect to another page using a href and spring mvc -

i want change page when click on item in bootstrap navbar. i'm trying this. <li><a href="javascript:" name="mainpage"><span class="glyphicon glyphicon-home"></span> main</a> and onclick method a is. $("ul > li > a").click(function() { $.post("redirect.html", { page : this.name } ); }); and spring controller is @requestmapping("/redirect.html") public string redirect(@requestparam map<string, string> allrequestparams, model model) { logger.debug("attempt redirect"); string next_page = allrequestparams.get("page"); logger.debug("parameter page: " + next_page); return "redirect: events"; } in debug window shows enters method redirect properly. page doesn't change. what's problem? the whole navbar looks this <div id="navbaritems" class="collapse navbar-collapse"

Linux AHCI PRD allocation -

i hardware developer creating ahci interface embedded system. know prd dma data created , allocated prds. sata uses dwords assuming data aligned multiples of 4 bytes. dont have experience of linux grateful if can point me in right direction. thanks ahci controller acts data movement engine between system memory , sata devices. take read operation example, rough sequence follows: software "builds" command in memory(command header, command table, , corresponding prds) software issues command configuring port register, pxci(and pxsact if ncq) ahci controller fetch , process command(including data transfer...) software interrupt service called process command completion software read prds device content prd entries created/allocated software(driver) , can located/retrieved via command table, is, hardware can locate command table retrieve prd entries. besides, ahci spec defines both prd address , byte count word-aligned(minimum)

hadoop - How to add partition using hive by a specific date? -

i'm using hive (with external tables) process data stored on amazon s3. my data partitioned follows: dir s3://test.com/2014-03-01/ dir s3://test.com/2014-03-02/ dir s3://test.com/2014-03-03/ dir s3://test.com/2014-03-04/ dir s3://test.com/2014-03-05/ s3://test.com/2014-03-05/ip-foo-request-2014-03-05_04-20_00-49.log s3://test.com/2014-03-05/ip-foo-request-2014-03-05_06-26_19-56.log s3://test.com/2014-03-05/ip-foo-request-2014-03-05_15-20_12-53.log s3://test.com/2014-03-05/ip-foo-request-2014-03-05_22-54_27-19.log how create partition table using hive? create external table test ( foo string, time string, bar string ) partitioned (? string) row format delimited fields terminated '\t' location 's3://test.com/'; could answer question ? thanks! first start right table definition. in case i

hadoop parallel processing examples or documentation -

i'm new hadoop , i'm not able find basic examples can required start. don't know if right place ask or not feel professionals related can me. please me on examples or documentation. thanks in advance pawan what mean "not able find basic examples"? there thousands of examples if google them. here "hello world" sort of word count example straight apache hadoop documentation.

Windows phone 8 emulator -

windows phone 8 emulator: doesn't connect vpn. i'm trying connect internet via windows phone 8 emulator using vpn connection. doesn't connect vpn, uses local watchguard. please advice. first connect vpn , add bridge using hyper-v switch manager , set primary connection. try start emulator again.

c# - Separate values from a string -

i have string, data shown below. how read separately each property values. ie pciaas_cardid=value; billingfirstname=value; pciaas_cardid=value&billingfirstname=value&billinglastname=value&billingcompanynamevalues=&billingaddress1=value&billingaddress2=values&billingcity=value that looks http query string, can use httputility.parsequerystring .

php - mpdf not supporting arabic and chinese fonts -

i using mpdf. when supplied arabic , chinese words writehtml(), resulting pdf containing square boxes instead of fonts. please suggest! sample fonts: i testing أنا العالم 我的世界 on mpdf 6.0, found made cantonese work us: $mpdf->autoscripttolang = true; $mpdf->autolangtofont = true; seems setautofont deprecated.

Dynamically changing an image in jquery to match the css image -

hopefully i'll explain problem correctly, if not let me know , i'll make edit. i'm created slide menu when shown, background blurred, working ok when it's static image, issue i'm having when it's slideshow. this give better understanding of i'm trying do. http://jsfiddle.net/djm3v/23/ if click red button, background of slide appears blurred, if click next or previous button , show different slide, blurred image remains same, need match slide image. here's jquery code below. jquery(document).ready(function($) { $(".trigger-wrapper").click(function () { $("#menu-wrapper-left").stop().animate({width: 'toggle'}); $('#hero-container').css('background-image','url(http://dummyimage.com/600x400/000/fff.jpg)'); return false; }); }); the important line is $('#hero-container').css('background-image','url(http://dummyimage.com/600x400/000/fff.jpg)'); th

php - show job title inside category but same category dont repeat -

the following code: $services = $this->find('all', array( 'contain' => array('category','country'), 'joins' => array( array('table' => 'services_to_categories', 'alias' => 'servicecategory', 'type' => 'inner', 'conditions' => array( 'servicecategory.service_id = service.id' ) ) ), 'group' => 'service.id' )); return $services; gives me output: array ( [0] => array ( [service] => array ( [id] => 6 [job_title] => director ) [category] => array (

imagemagick - Conversion CMYK => RGB has incorrect colors although using color profiles -

i have cmyk tif image , want convert rgb jpeg/png using imagemagick. tif image has profile integrated not converted correctly (colors incorrect) imagemagick if specify srgb profile manually. currently using test file: http://www.file-upload.net/download-8686107/testimage.tif.html i tried following commands (without success): convert testimage.tif test.jpg convert testimage.tif -colorspace rgb test.jpg convert testimage.tif -colorspace srgb test.jpg convert testimage.tif -profile srgb.icm test.jpg convert testimage.tif -profile uswebcoatedswop.icc -profile srgb.icm test.jpg does has idea why none of converts image correctly? using version: imagemagick 6.6.9-7 2012-08-17 q16 http://www.imagemagick.org

datetime - Compare string in format HH:MM to time now in python -

i have string of format "hh:mm" , need compare time in python. i did read through datetime documentation not figure out elegant perform comparison (being total rookie not either:)) thanks reading this! you can use datetimes 's strptime() function convert string valid datetime : >>>d=datetime.datetime.strptime('15:30','%h:%m') and later compare now 's time() : >>>dnow=datetime.datetime.now() #11:42 here ;) >>>dnow.time() < d.time() true you can read doc's strftime() , strptime() behavior explained these methods , have table resuming directives parse dates.

php - Uploaded files are getting deleted in Drupal? -

i have administer drupal website, didn't set , honestly, haven't experience drupal yet. but have serious problem: if upload file (it's pdf) not attached node, deleted every few hours. apparently, need indicate permanent manually file overview page. is there way set permanent automatically? hope can me! thanks! you need set status parameter on file object use file_save save it: // first obtain file object, example file_load... $file = file_load(10); // or example, result of file_save_upload... $file = file_save_upload('upload', array(), 'public://', file_exists_replace); // can set status $file->status = file_status_permanent; // , save status. file_save($file);

android - Unity 3d project apk file is getting installed but not running? -

i deleted textures , images, dont use assets. , apk file build started dont work. can install phone ( note 2 ) not running. can not see in applications. can uninstall it. changed player settings , did not worked, built web , works fine, looked android manifest xml , same working apk old version. thank help. manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:theme="@android:style/theme.notitlebar" android:versioncode="1" android:versionname="1.0" package="com.unity3d.player" android:installlocation="auto"> <supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:smallscreens="true" android:xlargescreens="true" /> <application android:icon="@drawable/app_icon" android:label="@string/app

autocomplete - how to modify ~/.inputrc for brackets autocompletion in bash vi mode? -

with emacs mode following works: "(": "\c-v()\e[d" but if add following @ beginning: set editing-mode vi it not work anymore. solutions? also, can find reference editing inputrc file? adding following ~/.inputrc solves problem: set editing-mode vi set keymap vi-insert "\c-b": backward-char "(": "\c-v()\c-b" "[": "\c-v[]\c-b" "{": "\c-v{}\c-b" "\"": "\c-v\"\c-v\"\c-b" "\047": "\c-v\047\c-v\047\c-b" or in ~/.bashrc: set -o vi bind -m vi-insert '"(" "\c-v()\ei"' bind -m vi-insert '"[" "\c-v[]\ei"' bind -m vi-insert '"{" "\c-v{}\ei"' bind -m vi-insert '"\"" "\c-v\"\c-v\"\ei"' bind -m vi-insert '"\047" "\c-v\047\c-v\047\ei"'

.net - Setting priority on console applications -

is there way start console application low priority? have forms-application running on windows mobile 6.5 (.net cf 2.0) calls console application this: dim myprocess new processstartinfo() myprocess.filename = "myprocess.exe" myprocess.arguments = "myarguments" myprocess.useshellexecute = false process.start(myprocess) how set priority of process after starting it? system.diagnostics.processpriorityclass indicates priority system associates process. value, priority value of each thread of process, determines each thread's base priority level. belownormal specifies process has priority above idle below normal. invoke before load form or anywhere want change process priority. dim myprocess system.diagnostics.process = _ system.diagnostics.process.getcurrentprocess() myprocess.priorityclass = system.diagnostics.processpriorityclass.belownormal update .net compact framework 2.0 supports threading can set thread priority. off top o

c# - Web Service Client(Console App) not working on Windows Server 2008 R2 Standard Edition -

i trying consume asmx web service in console app, working fine in windows 7,windows server 2012 standard,windows server 2008 r2 datacenter,windows server 2008 r2 enterprise, not working in windows server 2008 r2 standard edition deployment server. i tried consuming asmx web service using web reference , service reference not helping. throwing following error, message:there error in xml document (1, 331491). inner exception : system.xml.xmlexception: '.', hexadecimal value 0x00, invalid character. line 1, position 331491. the scenario call web service , returns me xml not able receive xml on windows server 2008 r2 standard edition. please provide suggestions on need resolve asap. this caused due missing certificate on windows server 2008 r2 standard edition had figured out looking @ certificate in ie while web service site opened , web service changed wcf getting different errors , when authorized myself connect internet client app threw exception saying c

jquery - Css : move the information frame below the graph -

Image
i have graph : i framed information in red. and graph this, information frame: enter link description here you can see information below graph. here css : /*plugin styles*/ .visualize { border: 1px solid #888; position: relative; background: #fafafa; margin-left :100px} .visualize canvas { position: absolute;} .visualize ul,.visualize li { margin: 0; padding: 0;} /*table title, key elements*/ .visualize .visualize-info { padding: -30px 5px; background: #fafafa; border: 1px solid #888; position: absolute; opacity: .6; margin-left:10px } .visualize .visualize-title { display: block; color: #333; margin-bottom: 3px; font-size: 1.1em; } .visualize ul.visualize-key { list-style: none; } .visualize ul.visualize-key li { list-style: none; float: left; margin-right: 10px; padding-left: 10px; position: relative;} .visualize ul.visualize-key .visualize-key-color { width: 6px; height: 6px; left: 0; position: absolute; top: 50%; margin-top: -3px; } .visualize ul.visualize-key

java - Optimal merging of triplets -

i'm trying come algorithm following problem : i've got collection of triplets of integers - let's call these integers a, b, c. value stored inside can big, it's impossible create array of size a, b, or c. goal minimize size of collection. this, we're provided simple rule allows merge triplets : for 2 triplets (a, b, c) , (a', b', c'), remove original triplets , place triplet (a | a', b, c) if b == b' , c = c', | bitwise or. similar rules hold b , c also. in other words, if 2 values of 2 triplets equal, remove these 2 triplets, bitwise or third values , place result collection. the greedy approach misleading in similar cases , problem, can't find simple counterexample that'd lead correct solution. list 250 items correct solution 14, average size computed greedy merging 30 (varies 20 70). sub-optimal overhead gets bigger list size increases. i've tried playing around set bit counts, i've found no meaningful resul

c# - Is there a better way of shortening this LINQ statement? -

var filtereditemnumber = 0; if (!string.isnullorempty(searchterm)) { filtereditemnumber = this._objectsrep.find( r => r.objecttitle.startswith(searchterm) && r.createddate >= timeperiod.start && r.createddate <= timeperiod.end).count(); } else { filtereditemnumber = this._objectsrep.find(t => t.createddate >= timeperiod.start && t.createddate <= timeperiod.end) .count(); } i sure there must shorten way rid of if statement cannot figure out how. when use following code filtering returns different result expecting. maybe parentheses not in right place ? this._objectsrep.find(r => searchterm == null || r.objecttitle.startswith(searchterm) && r.createddate >= timeperiod.start && r.createddate <= timeperi

java - Why JVM does't execute the code? -

i'm testing branch prediction, code this: //first loop int sortedsum = 0; long sortedstarttime = system.nanotime(); (int = 0; < sortedarray.length; i++) { if (sortedarray[i] < 0) { sortedsum += sortedarray[i]; } } long sortedtime = system.nanotime() - sortedstarttime; //second loop int randomsum = 0; long randomstarttime = system.nanotime(); (int = 0; < randomarray.length; i++) { if (randomarray[i] < 0) { randomsum += randomarray[i]; } } long randomtime = system.nanotime() - randomstarttime; system.out.println("random time: " + randomtime); system.out.println("sorted time: " + sortedtime); it's simple print time each loop. note sortedsum , randomsum assigned in loop never accessed. we don't talk branch prediction here, output result. output is: random time: 32 sorted time: 1595942 then, put second loop before first(first randomarray loop, second sortedarray). output is: random time: 154191

javascript - Tab Validation for Required Field in MVC4 Razor -

i want implement tab validation in mvc.i have 2 textbox password , confirm password , confirm password should same password .till have done compare validation , validating getting validation message when form submitting. want on tab means after entering confirm password on tab if not same password want validation message approach want use either jquery or javascript.can please me this.i sharing code. view @using (html.beginform("save", "saveinfo", formmethod.post)) { @html.validationsummary(true) <div style="color:red; text-align:center" > <fieldset> <legend>validation summary</legend> @html.validationmessagefor(m => m.password) <br /> @html.validationmessagefor(m=>m.confirmpassword) </fieldset> </div> <br /> <br /

javascript - How to use part of the Id or Class of DOM element with jQuery selector? -

how use part of id or class of dom element jquery selector? i.e. have id="some_extra_name" can use "extra" elements jquery? yes, can do $elements = $('[id*=extra]'); if wanted elements id starts "extra" , you'd $elements = $('[id^=extra]'); and elements id ends "extra" : $elements = $('[id$=extra]'); relevant documentation

javascript - My displayError() function is not working at all -

i made function should display error or remove error. unfortunately, when use function in way, example displayerror(true, "test"); , it's not working. when check html code see if changes, nothing changed. function displayerror(display, string, xhr) { $("div#error").fadeout(300, function() { if(arguments.length == 1 && typeof display === "boolean" && display == false) { //do nothing } else if(arguments.length == 2 && typeof display === "boolean" && display == true && typeof string == "string") { $("div#error").html('<b style="color: #ce1919;">(!)</b> '+string).fadein(300); } else if(arguments.length == 3 && typeof display === "boolean" && display == true && typeof string == "string" && typeof xhr === "object") { $("d

mysql - PHP - input a list of input fields into a database -

new.php (form) has section can clone input fields , values go array. when posting, these values added database via foreach loop. e.g. <input type="text" name="number[]" /> edit.php (form) extract rows data , put them list of input fields. how update mysql entry particular value? ajax , jquery, can rowid 'data-rowid' generated , update rowid = x. on submit. need go array or how can check against row id? your appreciated. you need submit rowid hidden input field posted along other information. way when edit.php have information need. <input type="hidden" name="rowid" value="1"> and on edit can : $rowid = $_post['rowid'];

android - Passing value from Main Activity to Broadcast Receiver class on button click -

i want pass value mainactivity class broadcast receiver class. coding done in mainactivity.do have mention action("android.intent.action.airplane_mode") in manifest file also?? public void broadcastintent(view v){ if(togglebutton.ischecked()){ intent i=new intent("android.intent.action.airplane_mode"); string x="heyo"; i.putextra("xx", x); sendbroadcast(i); }else{ } class x extending broadcastreceiver.... public void onreceive(context context, intent in) { // todo auto-generated method stub in.getextras(); string action=in.getaction(); if(action.equals("android.intent.action.airplane_mode")){ string u=in.getextras().get("xx").tostring(); toast.maketext(context,"hi " +u, toast.le

python - matpltolib navigation toolbar edit curves and parameters line color automatically changes issue -

let's consider axis has multiple lines colors such blue, green, yellow, red, magenta, cyan etc. when user selects curve , presses ok without changing anything, automatically yellow , green colors changed slight difference. this happens yellow, green colors. import sys import numpy np matplotlib.figure import figure import matplotlib matplotlib.use("qt4agg") matplotlib.rcparams['backend.qt4']='pyside' matplotlib.backends.backend_qt4agg import figurecanvasqtagg figurecanvas, navigationtoolbar2qtagg navigationtoolbar matplotlib.figure import figure import pyside pyside import qtgui, qtcore class myapp(qtgui.qmainwindow): def __init__(self, parent=none): qtgui.qmainwindow.__init__(self, parent) self.widget = qtgui.qwidget() self.fig = figure((5.0, 4.0), dpi=100) self.canvas = figurecanvas(self.fig) self.toolbar = navigationtoolbar(self.can

c# - How to prevent the inner ListBox's scrolling in nested ListBoxes? (WP8) -

i have nested listboxes: <listbox name="listbox" padding="0,0,0,100" loaded="listbox_loaded" foreground="black"> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="vertical"> <textblock text="{binding name}" fontsize="30" fontweight="bold"/> <listbox itemssource="{binding categories}" foreground="black"> <listbox.itemtemplate> <datatemplate> <textblock text="{binding name}"/> </datatemplate> </listbox.itemtemplate> </listbox> </stackpanel> </datatemplate> </listbox.itemtemplate> </listbox> when touch , drag items inner listbox plays scroll animation inner