Posts

Showing posts from August, 2013

ruby - How do I get the <p> tag parent class name using Nokogiri? -

i'm trying <p> tag's parent class name? <div class="entry-content"> <p>some text...</p> </div> how can obtain this? some find using css , nokogiri parent method easier read/maintain xpath: html = %q{ <div class="entry-content"> <p>some text...</p> </div> } doc = nokogiri::html(html) doc.css('p').each |p| puts p.parent.attr('class') end

php - how to include two submit buttons for a form with different action -

here scenario : i have html form on main page user can enter data , and submitting form using post method. <form id="main" name="main" action="#text" method="post" > //codes goes here <input id="generate" type="submit" name="script" value="create output" /> </form> and php code process above form <?php echo '<form action="#text" method="post">'; echo '<textarea onclick="this.select()" name="output_textarea" id="output_textarea" cols="100" rows="25" readonly>'; //above form inputs echo in textarea <-------php codes download here----> <-------php codes email here----> <input type="submit" id="download" value="download" name="download"></input> <input type="submit" id="s...

ajax - jQuery if/else statements -

Image
i'm trying write if/else conditions within jquery ajax method. don't know jquery well, i'm making stupid small syntax error. here is: function swapcontent(count,product) { $.ajax( { type: "post", datatype: 'json', url: "includes/price-update.php", data: {countvar: count, productid: product}, success: function(data) { console.log(data); $('.cleardata').remove(); $.each(data, function () { $(".price-data").append( $("<tr class='cleardata'/>") if (data.instock == "in stock") { $('.in-stock-row').text ('yes'); } else if (data...

php - Compilation failed: unknown property name after \P or \p -

hi want match string: "\par hello \par world" against regexp pattern -> \\par however, compilation failed: unknown property name after \p or \p i believe regexp rule treated unicode character property. how escape , run pattern is? i including in pdo function so. function sqlite_regexp($sql,$db) { if($db->sqlitecreatefunction("regexp", "preg_match", 2) === false) exit("failed creating function!"); if($res = $db->query($sql)->fetchall()){ return $res; } else return false; } i calling function so sqlite_regexp("select count(*) table regexp('/\\par/',column) ",$db) you need 3 backslahes \\\ . check example: $string = "\par hello \par world"; $pattern = '/\\\par/'; preg_match_all($pattern, $string, $matches); var_dump($matches); you can find more info in php manual you have updated question, see aren't using preg_match using sql regexp function. however...

select - CSS highlight/selection color based on page focus -

so, isn't absolute need, curious , might use @ point if exists... i've developed site (not design) in areas of text have text-shadow, , noticed when said text highlighted, it's not legible. aware of , utilizing ::selection css selector along appropriate browser prefixes remove text-shadow on highlight. my question whether there's anything can override highlighting defaults when text remains selected , focus removed page ? example: select-all , default (mozilla), selected text gets blue background. ... say, start messing firebug, or open smaller window on browser. highlights turn gray. can change behavior of blue ::selection property (color, background, text-shadow, etc.), gray's behavior remains unchanged. such thing exist? yes can use selectors ::selection for example try specific paragraph class gray .gray p::-moz-selection { color: gold; background: red; } .gray p::selection { color: gold; background: red; } or div class g...

iis 7.5 - How can I set IIS Windows Auth Providers with powershell? -

is there way can add/remove/reorder windows authentication providers using powershell in iis 7.5? i told , , have found no evidence contrary, ntlm provider faster negotiate when used windows auth. may or may not in combination silverlight 4, .net 3.5, windows 2003 active directory , iis6. since statement told me, have upgraded iis7.5 ( server 2008r2 ), silverlight 5 , .net 4.5, ad still running @ 2003 function level. my goal ensure ntlm provider listed first in list of enabled providers in iis 7.5. thanks you can enable , disable authentication methods available under following section: system.webserver/authentication this because system.webserver/authentication not collection , not support add , remove config elements. have in iis configuration schema file in: c:\windows\system32\inetsrv\config\schema\iis_schema.xml search system.webserver/security/authentication , see each child element of section explicitly defined , there no definition syste...

c# - Asp.NET Updatepanel not working as expected -

here with.. i uploading images through fileupload control.. when give trigger updatepanel fileupload control shows empty.. don't know why.. and here need.. i need update updatepanel when click upload button , other don't want update contents.. changes need in coding here aspx code.. <form id="form1" runat="server"> <asp:scriptmanager id="scriptmanager1" runat="server" enablepartialrendering="true"/> <div> <fieldset style="width:50%; margin-left:300px"> <legend>upload files</legend> <asp:fileupload runat="server" id="uploadimages" style="background-color:white; position:relative; font-family:'palatino linotype'; font-size:medium" width="500px" allowmultiple="true"/> <asp:button runat="server" id="uploadedfile" style=...

jquery - Cloud SQL Console SQL Prompt -> Only returns a single column -

Image
if execute queries in google cloud console, single column. see first screenshot. table contains lots of columns , select * article should return of columns. if specify specific column select text article , column (see second screenshot). if select multiple columns separated comma ( select id, test article ), first specified column. what going wrong here? kind of bug in console? think worked @ point. or there setting change? after creating new sql instance, working again.

java - Using Joda-Time to form correct ISODate for Mongo insert -

i trying update date fields in mongo require isodate format. in mongo, looks this: "crdt" : isodate("2013-08-19t17:21:57.549z") the java framework using has me restricted using strings test parameters, trying use string datetimeformatter correct isodatetimeformat , pass mongo. cannot pass in string looks have above. trying screws field in mongo. relevant bits of joda-time code using this: //i can't right. string crdt = "2013-01-19t15:28:58.851z"; datetimeformatter parser = isodatetimeformat.datehourminutesecondmillis(); parser.parsedatetime(crdt); // method updates record in mongo. method totally works, no // point in pasting here, can't parser object correct // in correct format once inserted, needs correct isodate form. mongo.setcrdt(recordid, parser); and when code runs errors these .parsedatetime method: java.lang.illegalargumentexception: invalid format: "2013-01-19t15:28:58.851z" malformed @ "z" @...

VBScript cut off end of filename after space but keep extension -

i've been searching online. there way cut off space , rest of filename leave extension vbscript. say have filename this: filename file.txt could vbscript cut off space , afterwards leave extension this: filename.txt sure, can surgery string functions available in vbscript. dim s dim s2 s = "filename file.txt" s2 = left(s, instr(s, " ")-1) & right(s, len(s) - instrrev(s, ".") + 1) msgbox s2

EMACS pasting html tags twice when copying source code -

when copy source code website emacs, it's pasting html tags in twice. have web-mode.el installed, i'm assuming has auto-completion, i'm not sure how fix this. what copy: ga('create', 'ua-43298913-1', 'site'); ga('send', 'pageview'); </script>script> </body> </html> what gets pasted: ga('create', 'ua-43298913-1', 'site'); ga('send', 'pageview'); </script>script>script> </body>body> </html>html> i have "similar" extension in vim. it tag completion attempt whenever enter </ text in html file. my guess "cut/paste" being "typed" out emacs , types ' my idea try changing how cut , paste completed in emacs. of course if haven't changed begin sucks. my second idea @ settings html tag completer extension have , see if there keep triggering on cut , paste.

android - Matching the text layout on the viewFlipper layout -

Image
i have viewflipper 2 buttons, left , right of view flipper. there text being projected on viewflipper. when run emulator text comes on viewflipper pushes 2 buttons out of screen en takes entire space. how can make sure layout of text on viewflipper doesn't push out buttons , sticks within layout of viewflipper? this xml layout of viewflipper <button android:id="@+id/button_left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toleftof="@+id/promoflipper" android:background="@drawable/button_left" android:layout_below="@+id/titel1" android:layout_alignparentleft="true" /> <button android:id="@+id/button_right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_torightof="@+id/promoflipper" android:background="@draw...

mathematical optimization - How to minimize multivariate function in Matlab by using derivatives? -

how minimize multivariate function in matlab using derivatives? so far, minimizing single variable functions used fminunc, need work multivariate functions. thank you use fminunc . if want use gradient, return 2nd output of objective function. you'll need indicate in options object passing gradient. options = optimoptions('fminunc','gradobj','on'); i believe documentation has info on passing hessian (if 1 exists).

java - Does JSR 298 facilitate communication between a computer device and an OBD 2 scan tool? -

i browsing web obd-2 applications in java when stumbled on jsr 298:telematics api java me. know exact purpose of jsr? i want build java application using can extract data continuously elm 327 using bluetooth. jsr me ? if yes, how?

java - Deserialise a generic list in Gson -

i want write generic function deserialise generic type list gson here code: private <t> list<t> getlistfromfile(string filename) { //read textfile bufferedreader reader; string data=""; try { reader = new bufferedreader(new filereader(filename)); data = reader.readline(); reader.close(); } catch (filenotfoundexception ex) { } catch (ioexception ex) { } if (data == null) { list<t> spiel = new arraylist<t>(); return spiel; } else { //get list deserialise gson gson = new gson(); list<t> = gson.fromjson(data, new typetoken<list<t>>(){}.gettype()); return something; } } but code not working, strange structure not list of type when i'am using: list<concretety...

python - Plot using pandas -

Image
i have event times in list , plot exponentially weighted moving average of them. can using following code. import numpy np import matplotlib.pyplot plt print "code runnning" a=0.01 l = [3.0,7.0,10.0,20.0,200.0] y = np.zeros(1000) item in l: y[item]=1 s = np.zeros(1000) x = np.linspace(0,1000,1000) in xrange(1000): s[i] = a*y[i-1]+(1-a)*s[i-1] plt.plot(x, s) plt.show() this horrible way use python however. what's right way this? possible without making these sparse arrays? the output should this. pandas comes mind task: import pandas pd l = [3.0,7.0,10.0,20.0,200.0] s = pd.series(np.ones_like(l), index=l) y = s.reindex(range(1000), fill_value=0) pd.ewma(y, 199).plot() the period 199 related parameter alpha 0.01 n=2/(a+1) . result:

node.js - Going in production: how to serve my static assets without NodeJS? -

in development used have node server serve static files (img, pdf, etc.) production getting closer, feel inefficient , puts unneeded load on node. right way have assets served different server? there ready-made solution? should use "good old" apache-php stack? should know ports forwarding , stuff that? thanks lot! i've seen done several ways. use nginx serve static assets. faster apache static assets. use s3 , cloudfront serve static assets. you'll upload assets s3 , enable cloudfront cdn. use cloudflare , i'm less experienced method can't tell accept handle cdn , believe caching. hope helps.

css - android @media query width issue -

i read nice article on @media queries , i'm trying use them format site based on browser width. when test on android phone (android 4.0 browser) seems giving width of 800 pixels when actual width 480. 800 width if phone rotated landscape. right way detect current width in css? the css used testing: @media , (max-width: 800px) { div.testit800 { display: block; } } @media , (max-width: 799px) { div.testit799 { display: block; } } @media , (max-width: 768px) { div.testit768 { display: block; } } the html: <div class="testit800"> max width 800 </div> <div class="testit799"> max width 799 </div> <div class="testit768"> max width 768 </div> the android shows: max width 800 regardless of orientation. update: found this page demonstrates several javascript ways of detecting width. window.outerwidth seems work android. reliable across devices , browsers? rea...

asp.net mvc - javascript unhandled exception in skelJs in ASP MVC 4 -

i tried use template html5 web site view of mvc 4 application. template here: http://html5up.net/helios/ unfortunately have problem this. tried put main frame of these template in _layout page. put other parts in index.chtml problem when run program visual studio says there unhandled exception in skel.min.js : this.insertbefore(b,a.me) my _layout page here : </script> <script src="@url.content("~/scripts/js/jquery.min.js")" type="text/javascript"></script> <script src="@url.content("~/scripts/js/jquery.dropotron.js")"type="text/javascript"></script> <script src="@url.content("~/scripts/js/skel.min.js")"type="text/javascript"></script> <script src="@url.content("~/scripts/js/skel-panels.min.js")"type="text/javascript"></script> ...

php - Uploads directory is not writable -

i've moved server new host , i'm having problems php upload form. files can not uploaded. error is: warning: move_uploaded_file(/public_html/site/abc/uploads/aplication.doc) [function.move-uploaded-file]: failed open stream: no such file or directory in /long/path/apply.php on line 389 warning: move_uploaded_file() [function.move-uploaded-file]: unable move '/tmp/phpdaz5qp' '/public_html/site/uploads/1908131216_application.doc' in /long/path/apply.php on line 389 problem: not move file destination directory not writable /tmp/phpdaz5qp - /public_html/site/abc/uploads/1908131216__application.doc i have little test see if directory writable, , it's not. $upload_dir = "/public_html/site/$companyfolder/uploads"; if(!is_writable($upload_dir)) { $writable = 'not writable'; } else { $writable = 'writable'; } echo $writable; i have uploads folder set 777 permissions. ideas of why directory not wr...

ruby - rails parsing xml data from openweathermap -

i try read openweathermap data xml file xml code: <weatherdata> <location> <name>tokyo</name> <type/> <country>jp</country> <timezone/> <location altitude="0" latitude="35.689499" longitude="139.691711" geobase="geonames" geobaseid="0"/> </location> <credit/> <meta> <lastupdate>2013-08-19t19:30:49</lastupdate> <calctime>0.0119</calctime> <nextupdate>2013-08-19t22:30:49</nextupdate> </meta> <sun rise="2013-08-18t20:03:32" set="2013-08-19t09:26:02"/> <forecast> <time day="2013-08-19"> <symbol number="800" name="sky clear" var="01n"/> <precipitation/> <winddirection deg="197" code="ssw" name="south-southwest"/> <windspeed mps="3.25" name="light breeze"/> <temperature ...

ASP.NET MVC lookup for form field -

we've got asp.net mvc-based business form multiple text boxes fill out (e.g. use-case "register person" -> form contains: name, ..., father, mother, ...) the data entry clerk should not forced input father/mother himself, should able search person in system. not enough have kind of autocomplete field or popup, should able make use of full-fledged search page implemented (person controller has searchindex & searchperson action, user has kind of search options). the final ui should this: register person form has button "select father" switches ui search page, user searches person , has ability click "select" on row in result table returns ui register person form, father-data filled read-only fields (hidden id, name & birth date visible not editable). our problem/question: recommended way to a) save entered data in original form when opening search form? necessary open search form in jquery dialog iframe inside stay on same page , ...

oauth 2.0 - How do I configure ServiceStack.net to authenticate using the OAuthProvider against Google -

i'd configure servicestack.net authenticate using oauthprovider against google. here current configuration: plugins.add(new authfeature(() => new authusersession(), new iauthprovider[] { new oauthprovider(appsettings, "https://accounts.google.com/o/oauth2/auth", "google", "google client id", "google client secret") })); however, following error: response status error code argumentnullexception message string reference not set instance of string. parameter name: s stack trace [auth: 8/19/2013 7:48:47 pm]: [request: {provider:google}] system.argumentnullexception: string reference not set instance of string. parameter name: s @ system.text.encoding.getbytes(string s) @ servicestack.serviceinterface.auth.oauthutils.percentencode(string s) @ servicestack.serviceinterface.aut...

python - Adding Multiple ZODB Databases Together -

i have 3 python object databases i've constructed through zodb module, merge one. reason have 3 , not 1 because each object belongs 1 of 3 populations, , added database once code conducted analysis of said object. analysis of each object can done in parallel. code takes few days run, prevent being week long endeavor, have 3 computers each processing objects 1 of 3 populations, , outputting single zodb database once has completed. couldn't have 3 computers adding analysis of objects different populations same database because of way zodb handles conflicts. essentially, until close database, locked inside. my questions are: 1) how can merge multiple .fs database files single master database? structure of each database same - meaning dictionary structures same between each. example, mydb may represent zodb database structure of first population: root.['mydb']['id123456']['property1'] ... ['id123456']['property2'] ....

githooks - Git hook: add a new file to repo if a new branch is created -

i writing git hook checks if new branch created, , if add predefined files repo new branch(some config files). because branch in process of being created, logic fails. currently doing in post-receive hook, looks this: #!/bin/sh read oldrev newrev refname branch=$(git rev-parse --symbolic --abbrev-ref $refname) echo "branch $branch" echo "oldrev $oldrev , newrev $newrev" # if $oldrev 0000...0000, it's new branch # check if branch of format "feature_<name>" zero="0000000000000000000000000000000000000000" if [ "$oldrev" = "$zero" ] && [[ $branch =~ feature_.+ ]]; #create temp repo temp_repo=`mktemp -d /tmp/repo.xxxxx` cd $temp_repo git clone $git_url #here create config file needed, called file_name git checkout "$branch" git add "$file_name" git commit -m "added config file" git push origin $branch fi this works existing branch, newl...

Embedded google maps doesn't show in HTML page -

i'm playing around google map apis following google maps tutorial https://developers.google.com/maps/tutorials/fundamentals/adding-a-google-map following code map doesn't show in html code example. any suggestions? regards <html> <head> <style> #map_canvas { width: 500px; height: 400px; } </style> <script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script> function initialize() { var map_canvas = document.getelementbyid('map_canvas'); var map_options = { center: new google.maps.latlng(44.5403, -78.5463), zoom: 8, maptypeid: google.maps.maptypeid.roadmap } var map = new google.maps.map(map_canvas, map_options) } google.maps.event.adddomlistener(window, ‘load’, initialize); </script> </head> ...

php - oci_fetch vs. oci_fetch_array -

when advantageous use oci_fetch on oci_fetch_array ? oci_fetch_array returns actual array, oci_fetch stores fetched memory somewhere in internal buffers. are there performance differences between 2 should know about? with oci_fetch() , next result row read internal buffers can read oci_result() . call this: $st_handle = oci_parse($oci_conn, 'select some_field, another_field some_table'); oci_execute($st_handle); while(oci_fetch($st_handle)) { $some_field = oci_result($st_handle, 'some_field'); var_dump($some_field); $another_field = oci_result($st_handle, 'another_field'); var_dump($another_field); } alternately, instead of using oci_result() can pre-define variables load internal buffer using oci_define_by_name() this: $st_handle = oci_parse($oci_conn, 'select some_field, another_field some_table'); oci_define_by_name($st_handle, 'some_field', $some_field); oci_define_by_name($st_handle, 'another_field...

git - How do I download a single directory from android.googlesource.com or github.com? -

Image
i want download either: https://android.googlesource.com/platform/frameworks/base.git/+/master/tools/aapt/ or https://github.com/android/platform_frameworks_base/tree/master/tools/aapt as of today, android.googlesource.com has link [tgz] on each directory page, in small font, works: you cannot download separate file, can download directory.

javascript - radio buttons checked with jquery not holding proper value on post -

i have html form, radio buttons dynamically set jquery. posts asp.net mvc application. lets have 3 radio buttons, lets value modelbind radiooption :         name             id          checked?      disabled?      model value option1       #opt1             ✓                   ✗                       0 option2       #opt2             ✗        ...

Java equivalent for Python pool.map/ Multiprocessing -

i wondering if point me simple equivalent of python's multiprocessing module in java. i have simple parallel processing scenario (where no 2 processes interact): take data set , split 12 , apply java method 12 datasets, collect results , join them in list of sort same ordering. java being "pro" language appears have multiple libraries , methods - can java newbie started? i minimal of coding - said requirement pretty straightforward. update: how multiprocessing in java, , speed gains expect? this seems indicate threads way go. expect have no choice wade bunch of locks (pun unintended) , wait ship sail. simple examples welcome nevertheless. there's no exactly-compatible class, executorservice gives need implement it. in particular, there's no function map callable on collection , wait on results, can build collection<callable<t>> out of callable<t> , collection<t> , call invokeall , returns list<future<t...

Tooltip Not Showing Up When No Validation Error WPF -

i searched , did not see solution. i can validation show tooltip if not set tooltip in combo box tooltip property. see validation error tooltip when 1 present otherwise show tooltip combobox property. validation tooltip shows fine when remove text tooltip property (i.e. property panel combo box). the xaml in application.resources (app.xaml)for tooltip show validation error <style x:key="standardcomboboxstyle" targettype="{x:type combobox}"> <style.triggers> <trigger property="validation.haserror" value="true"> <setter property="tooltip" value="{binding relativesource={x:static relativesource.self}, path=(validation.errors)[0].errorcontent}"/> </trigger> </style.triggers> </style> i use validation template combobox follows. in usercontrol.resources section within user control cs file. <controltemplate x:key="comboboxvalidatio...

c - Finding Allocated Memory -

platform: x86 linux 3.2.0 (debian 7.1) compiler: gcc 4.7.2 (debian 4.7.2-5) i writing function generates "random" integer reading allocated portions of memory "random" values. idea based on fact uninitialized variables have undefined values. initial idea allocate array using malloc() , use uninitialized elements generate random number. malloc() tends return null blocks of memory cannot guarantee there read. thought reading separate processes memory in order guarantee values other null. current idea somehow finding first valid memory address , reading there down not know how this. tried initializing pointer null , incrementing 1 if attempt print referenced memory location segmentation fault occurs. question how read separate processes memory. not need memory other read it. the idea based on fact uninitialized variables have undefined values. they undefined in far cannot predict contain. os dependent contain. back in old dos days, maybe rely ...

ruby on rails - In Spree admin how could I pull in all orders completed for a state? -

i'm trying create custom report , want pull in completed orders specific state. something like: orders = spree::order.complete.for_state("utah") how this? the part confuses me fact state 3 part assocoation. order has_one ship_address, address instance, belongs_to state. try this: spree::order.complete.joins(:bill_address).where("state_name = 'utah'") spree::order.complete.joins(:ship_address).where("state_name = 'utah'") depending on 1 looking for.

javascript - Positioning two D3 plots -

i trying position 2 plots in 2 1 column using in d3. the first plot scatter plot , second plot histogram. eventually, data shown on 1 depend on region selected in other. right now, i'm having problems positioning 2 plots. my attempt . why 2 plots overlap? i tried changing "transform" attribute of histogram ( var histo ) account width of first figure, made histogram disappear.

What are my options for always on NFC in my Android app? -

i create app listens nfc tag scans several hours. new nfc intent happen every 2-3 minutes 10-15 minutes apart. the phone may sitting in users pocket while running there possibility of accidental touch interface. what options have stop phone going sleep in between each nfc intent user not need continually wake phone scan new nfc tag? rooting users phones enable nfc not option in scenario. the thing can think of create blank screen custom unlock code/swipe there no accidental pushes... use lot of battery? some phones keep scanning nfc when screen locked, won't. there security reasons (some tag payload can forged attack nfc stack), , obvious battery saving reasons. current gsma recommendation in area nfc scanning turned off long screen off. impact of battery depend on chip embedded in phone, impact should noticeable. depending on use case doing card emulation phone or uicc might more efficient.

jquery - Bootstrap 3 Collapse show state with Chevron icon -

Image
using core example taken bootstrap 3 javascript examples page collapse , have been able show state of collapse using chevron icons. i have working using: $('#accordion .accordion-toggle').click(function (e) { var chevstate = $(e.target).siblings("i.indicator").toggleclass('glyphicon-chevron-down glyphicon-chevron-up'); $("i.indicator").not(chevstate).removeclass("glyphicon-chevron-down").addclass("glyphicon-chevron-up"); }); this works (not tested in browsers), i'm wondering if there's more elegant solution this? ideally i'd use core function, i'm not sure how achieve same results it. $('#accordion').on('hidden.bs.collapse', function () { //do something... }) here's working version in jsfiddle . for following html (from bootstrap 3 examples ): <div class="panel-group" id="accordion"> <div class="panel panel-default"...

Extjs add chart to grid column -

Image
i had grid view in extjs, need show bar chart in each row show percentage of values. how can achieve in extjs? maybe image want build. one way accomplish through deferred rendering of chart. this: create grid column custom renderer. in renderer, output div known id. div contain chart. you defer call (with ext.defer ) custom function, passing in id (and required info chart). function render chart. inside function, create chart , make renderto element passed-in id. this code approximates should do. want refactor more sensibly. ext.create('ext.grid.panel', { height: 300, store: main_data, columns: [ { text: 'name', dataindex: 'name', sortable: true }, { text: 'chart', renderer: function (value, meta, record) { var id = ext.id(); ext.defer(function (id) { var chart = ext.create('ext.chart.chart', { store: chart_data, ...

when to use weak pointer (wp) in android native framework (AOSP) -

i know different between sp & wp, , sp automatically recollect dynamically allocated memory. not know when , how wp used? can give me example? thx~ you must know using sp increase ref count of object, while using wp won't. wp store of address, cannot used access fields of object, unless promote it. if object released, wp.promote() return null pointer. so, wp used in scenarios want have reference cache of memory object not want hold it. access data promote wp every time, , if object not available more, need (ask other code to) create again.

algorithm - Complexity of non-recursiveDFS code -

i think complexity of code is: time : o (v) : v vertex space: o (v) : v vertex public void dfs() { stack<integer> stack = new stack<integer>(); stack.add(source); while (!stack.empty()) { int vertex = stack.pop(); system.out.println(" print v: " + vertex); (int v : graph.adj(vertex)) { if (!visited[v]) { visited[v] = true; stack.add(v); edgeto[v] = vertex; } } } } please correct me if wrong assuming graph.adj() produce bounded number of vertices (maybe one), right. however, if depends in way on total number of vertices present in system, not. if dependency linear, algorithm o(n^2). generalizing, if f(n) average number of graph.adj() per vertex, answer o(n*f(n)).

internet explorer 9 - ie9 is clearing the developer console after the page finishes loading -

if have developer console open while page loads, can see console.log statements logging. page finished loading (with or without errors), console cleared automatically , can't see of messages. how stop unwanted behaviour? want see log messages , objects. the console clearing on mistake because it's received (inaccurate) notification page has been navigated. can turn off behavior f12 menu: tools -> clear entries on navigate -> console (untick) does workaround issue?

ios - NSNumber in NSDictionary is always null -

Image
i'm building project , want add nsnumber nsdictionary. crashed because of null value. so, created small program check happened. can see in snapshot: why the value of nsnumber in nsdictionary null? i've run code , reproduce problem. seems debugger problem. instance, if after dictionary created, go console , try printing dictionary. po dictionary my result like: $4 = 0x2083e770 { number = 1; } so it's not null @ all. also, after that, anum assigned correctly , b set yes. looks debugger issue instead of bug you.

github - Is it possible to set two remote urls for a git repository? -

i using bitbucket , my local server , planning github remoteservers. so possible set these remote urls. so when single git push push code remote servers. , other members can clone project of these servers , when use git push push remote servers too. create remote , give multiple urls. in project's .git/config . [remote "everyone"] url = local url = bitbucket

Click event not registering with jQuery -

i have mvc 4 application basic template. in _layout.cshtml have code: <script type="text/javascript"> $(window).load(function () { $("body").on({ // when ajaxstart fired, add 'loading' body class ajaxstart: function () { $(this).addclass("loading"); }, // when ajaxstop fired, remove 'loading' body class ajaxstop: function () { $(this).removeclass("loading"); } }); $("a").click(function () { $(this).addclass("loading"); }); }); </script> and html in same: <body> @renderbody() @scripts.render("~/bundles/jquery") @rendersection("scripts", required: false) <div class="modal"></div> </body> i created home...