Posts

Showing posts from June, 2015

java - Creating new text file using date and time as text file name -

can show me example code of how create new text file using date , time text file name. please show how save new text file in specific folder path in computer. try not working file f = new file("d://filepath//clear.dat"); string filename = f.getname(); filename = filename+new java.util.date() +".dat"; system.out.println(filename); first, date , time string formatted correctly. can use simpledateformat . , can use file(file, string) constructor give file correct folder. might use printstream(file) print something. , try-with-resources statement clean-up. finally, put like dateformat df = new simpledateformat("yyyymmddhhmmss"); file folder = new file("d://filepath"); file f = new file(folder, string.format("clear-%s.txt", df.format(new date()))); try (printstream ps = new printstream(f) { ps.println("hello, file!"); } catch (ioexception e) { e.printstacktrace(); }

math - how to define n-dimensional vector rotation and reflection in haskell? -

how define vector rotation , reflection in general function work in n dimensions in haskell? currently have dot product, normalization , projection done stuck on reflection , rotation. data vector s = vector {len::s,arr::a} normalize :: vector s → vector s normalize = tovector . uncurry (zipwith (/)) . (id&&&(repeat . sqrt . sum . map (^2))) . fromvector dot :: vector s → vector s → dot v = sum ∘ zipwith (*) (fromvector v) ∘ fromvector project :: vector s → vector s → vector s project v = tovector ∘ uncurry (zipwith (*)) ∘ (fromvector&&&(repeat ∘ (v`dot`))) i've been searhing days seems using haskell understand mathematics can cause problems when there no clear code (or no code @ all) , tutorials on n-dimensional vectors go past knowledge in mathematics. regarding mathematical aspects of n-dimensional rotations, might recommend publications of andrew j. hanson ...

angularjs - Creating multiple CanvasJS charts inside <div> with ng-repeat -

i trying create multiple canvasjs charts inside div. the div expects array of data controller, loops through it(using ng-repeat) , displays data in various controls. now when try put canvasjs chart inside div, chart not render , error see 'chart id not found' but same chart works outside div. sample code here: http://jsfiddle.net/dthewebdev/mozfsxpc/7/ app.js var m = { "india": "2", "australia": "3" }; function myctrl($scope) { $scope.items = m; } var dps = [{ x: 1, y: 10 }]; //datapoints. var chart = new canvasjs.chart("chartcontainer", { title: { text: "live data" }, axisx: { title: "axis x title" }, axisy: { title: "units" }, data: [{ type: "line", datapoints: dps }] }); chart.render(); var xval = dps.length - 1; var yval = 15; var updateinterval = 1000; var updatechart = function() { yval = yval + math.round(5 + mat...

c++ - Linker output while compiling custom libraries: File was built for archive which is not the architecture being linked -

i'm working simulation code uses custom libraries , archives, @ compilation time following message: ld: warning: ignoring file ../nr/libnr.a, file built archive not architecture being linked (x86_64): ../nr/libnr.a can give me leads how issue may come from?

Extract part of Xml document & convert it to Json in PHP -

i need save part of following xml document , convert json - that, nodes "row" data in it. <?xml version="1.0" encoding="utf-8"?> <report> <table> <row device="mobile devices full browsers" cost="3940000" avgposition="2.0" avgcpc="3940000" ctr="100.00%" clicks="1" impressions="1" convertedclicks="0" searchterm="purple jeep near elgin sale" keyword="jeepdealership" campaignstate="enabled" adgroupid="7751248218" campaign="zeigler cdj_dealer campaign" campaignid="134270778"/> <row device="mobile devices full browsers" cost="3930000" avgposition="1.0" avgcpc="3930000" ctr="100.00%" clicks="1" impressions="1" convertedclicks="0" searchterm="jeep wrangler rubicon 2015" keyword="jee...

java - jcmd - Meaning of last colum for `jcmd VM.flags -all` -

run following command list available jvm flags: jcmd 24468 vm.flags -all | less -n then in last column, found following values (using jdk1.8, on linux) : * product default value same on platform, * pd product default value platform-dependent, * manageable change dymanically in runtime, * * c1 product * c2 product * * c1 pd product * c2 pd product * * product rw * * lp64_product * arch product * * commercial * the question is: i know meaning of values, have give explanation, meaning of rest ones? anybody edit answer , create jcmd tag? don't have 1500 reputation that. the type of flag depends on location in hotspot source code flag declared / defined. flags declared in src/share/vm/runtime/globals.hpp . pd_product flags declared in globals.hpp, defined in 1 of platform-dependent files: src/cpu/x86/vm/globals_x86.hpp src/os/linux/vm/globals_linux.hpp src/os_cpu/linux_x86/vm/globals_linux_x86.hpp c1 product , c2 product flags sp...

What is the simplest, briefest way to convert an object or an ArrayLikeObject to an array using jQuery? -

given object var obj = {0: "a", 1: "b", 2: "c"}; and expected result var arr = ["a", "b", "c"]; or arraylikeobject var divs = document.queryselectorall("div"); with expected result var arr = [<div>a</div>, <div>b</div>, <div>c</div>]; the expected results returned using $.map() described @ converting json object javascript array converting js object array question: what simplest, briefest approach using jquery convert object or arraylikeobject array ? use $.merge() jquery.merge( first, second ) first type: arraylikeobject first array-like object merge, elements of second added. second type: arraylikeobject second array-like object merge first, unaltered. var obj = {0: "a", 1: "b", 2: "c"}; var arr = $.merge([], obj); console.log(arr); <script src="https://aja...

php - Unknown mysql syntax error -

i have mysql query , keep on getting syntax error. ran through different debugging tools , haven't found anything. tehre i'm missing. my query insert futureposts ( id, username, postedby, link, message, picture, name, caption, description, groups, type ) values ('','1','codecompiler','codecompiler,'','','','','','','default','daily') the error you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'default','daily')' @ line 1 you missed ' code after codecompiler change query from insert futureposts (id, username, postedby, link, message, picture, name, caption, description, groups, type) values ('','1','codecompiler','codecompiler,'','','','','','','default...

Accelerating 3-dimensional lookup table in an array in C -

i have 3-dimensional lookup table lut[width][height][depth]. have apply lut each pixel in large image (4k x 4k) , need improve performance. tried approach below: u8 lut[1024][1024][32]; u16 image[4096][4096]; u16 image2[4096][4096]; (z = 0; z < 32; z++) {    for (y = 0; y < 4096; y++) { (x = 0; x < 4096; x++) { ci1 = colorindex = image[x + y*4096] ci2 = colorindex2 = image2[x + y*4096] result_image[x + (y*4096) + (z*4096*4096)] = lut[ci + (1024*ci2) + (1024*1024)*z]; } } but results not good. there way improve this?

python - ipython: access notebook server remotely via a web browser -

i want access notebook server remotely via web browser, following shows how did setup notebook server: 1.generate config file $ jupyter-notebook --generate-config $ cd ~/.jupyter 2.use following command create ssl certificate(linux , windows). req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem 3.edit profile's configuration file, jupyter_notebook_config.py password has been generated.. c = get_config() # must give path certificate file. c.notebookapp.certfile = u'/home/azureuser/.jupyter/mycert.pem' # create own password indicated above c.notebookapp.password = u'sha1:b86e933199ad:a02e9592e5 etc... ' # network , browser details. use fixed port (9999) matches # our azure setup, we've allowed :wqtraffic on port c.notebookapp.ip = '*' c.notebookapp.port = 9999 c.notebookapp.open_browser = false 4.start $ jupyter-notebook server you should able access jupyter notebook @ address https://[public-ip-address]...

android - create new File in internal storage Exception : java.io.IOException: open failed: ENOENT (No such file or directory) -

i trying create new file in internal storage of android device getting exception of no such file or directory here code:- string app_path_sd_card = "/xyz/"; string app_thumbnail_path_sd_card = "demodir"; string fullpath = environment.getexternalstoragedirectory().getabsolutepath() + app_path_sd_card + app_thumbnail_path_sd_card; file myfile,dir; try { dir = new file(fullpath); if (!dir.exists()) { dir.mkdir(); } myfile = new file(fullpath, "vitals.txt"); if (myfile.exists()) { myfile.delete(); myfile.createnewfile(); } else { myfile.createnewfile(); } toast.maketext(getbasecontext(),"file 'vitals.txt' created",toast.length_short).show(); } catch (exception e) { toast.maketext(getbasecontext(), e.getmessage(),toast.length_short).show(); } androidmanifest.xml <uses-permission android:name="and...

sql server - Unique Constraint in SQL with Multiple NULL Values -

i read way ensure unique values in column in sql while allowing multiple nulls. done using filtered indexes: create unique index indexname on tablename(columns) include includecolumns columnname not null could explains how works? unique constraint created on column or not ? to answer first question: when index filtered, doesn't fix criteria in clause left out of index. if index unique, uniqueness enforced on data fits criteria in clause. to answer second question: in sql server unique constraints implemented creating unique indexes under hood, there not difference between them. in case uniqueness enforced on index , not directly on table column.

javascript - onunload not working as expected in IE10 -

i facing strange problem in environment, let me explain it. i have html page shown below - <!doctype html> <html> <head> <script type="text/javascript> window.onunload=function(){alert("unloading page");} </script> </head> <body> <a href="http://localhost:8080/abc">localhost</a> </body> </html> when opening page in ie10 , clicking on localhost link, can't see alert "unloading page". however, in ie7, it's working fine. however if use " http://google.co.in/ " instead, it's working in both ie10 , ie7. can please me resolve issue? in advance.

opencv - split a BGR matrix without use split() function -

i programming visual studio 2012 , opencv library, in 2.4.6 version. someone can me splitting bgr image 3 images, 1 every channel? i know there split function in opencv, causes me unhandled exception, because have 64 bit processor 32 bit library, or it's version of library, want know how iterate on pixel values of bgr matrix without use split(). thanks in advance. if don't want use split() can read each r,g,b pixel value source image , write destination image , should single channel. #include <stdio.h> #include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace std; int main( int argc, const char** argv ){ mat src = imread("ball.jpg", 1); mat r(src.rows,src.cols,cv_8uc1); mat g(src.rows,src.cols,cv_8uc1); mat b(src.rows,src.cols,cv_8uc1); for(int i=0;i<src.rows;i++){ for(int j=0;j<src.cols;j++){ vec3b pixel = src.at<vec3b>(i, j); b.at<uchar>(i,j) = pixel[0]; g.a...

c# - select query returning more rows than the parameter passed -

earlier tried one string query = "select top " + traineesperblock + @" * traineedetail subbr = '0' order maxm desc" ; in traineesperblock when value passesd 69 giving 110 record, should give 69 only.. maxm double field, there records having same maxm value. solution? first of all, i’d try find out whether trouble because of development environment or database. execute script in dbms shell, replace traineesperblock numbers 69,70. execute same operation in studio. also, if traineesperblock int, try cast string explicit.

linux - Echo variable name, not value, from for loop in bash? -

a=1 b=2 c=3 db in $a $b $c; echo variable name blah blah blah i need script writing. have client names set @ top database names varialble. running ps -ef , few other things, need echo out client name on in loop. in example above, echo out "a", other commands, on second loop echo "b" .....etc use variable indirection: for var in b c ; echo $var ${!var} done

javascript - backbone collection filtred in more views -

i have question can make more views 1 collection ? example: have menu restaurant there main menu , drink menu when click main menu there every item , when click drink there filtred items, same food menu , next .... right ? there not collisions ? thanks answer yes, can access collection more 1 view view should reading collection. there no collisions assuming hide mainmenuview dom when display drinkmenuview. alternatively, have 1 menu view , add logic function inside menu view filter.

need explanation on Hibernate criteria -

i new hibernate, when looking @ ancriteria example article; says: you have no way control sql query generated hibernate, if generated query slow, hard tune query, , database administrator may not it. but think criteria used generate clause of generated sql, , clause conditions added 1 one , has nothing query's performance, how understand above statement? first understand usage of hibernate criteria. used fetch data database , sql generated hibernate itself. due configuration of eager fetch, hibernate might unnecessarily generate sql lot of columns , joins hamper performance. in sense, using hql better or sql if cant achieve in hql (which should not case)

audio - SoX: How to noise gate? -

audacity has noise gate plugin works nicely. looking command line equivalent - unable figure out sox compand command it. tell me sox equivalent of audacity noise gate ? example, use in audacity "gate frequencies above: 0.0", level reduction: -12, gate threshold -48.0, attack/decay 250.0 ? have tried using compand command in sox? see http://sox.sourceforge.net/sox.html , scroll down section compand command, , see says: in next example, compand being used noise-gate when noise @ lower level signal: play infile compand .1,.2 −inf,−50.1,−inf,−50,−50 0 −90 .1

c# - Custom Action session.message not showing messagebox -

i creating msi based installer using wix. my custom action declaration goes this... <binary id="customactions" sourcefile="dlls\customactions.ca.dll" /> <customaction id="checkpath" return="check" execute="immediate" binarykey="customactions" dllentry="checkpath" /> and under wixui_installdir dialog ui, <ui id="wixui_installdir"> ..... <publish dialog="selectdirdlg" control="next" event="doaction" value="checkpath" order="2">1</publish> ..... </ui> and in c# file, [customaction] public static actionresult checkpath(session session) { record record2 = new record(); record.formatstring = "the path have selected invalid!"; session.message(installmessage.error | (installmessage)messagebuttons.ok, record); return actionresult.success; } i expecting message box via...

javascript - Does removing an element also remove its event listeners? -

Image
this question has answer here: if dom element removed, listeners removed memory? 7 answers an event associated item removed if remove element removechild() ? if item removed simple this.innerhtml ='' ? same applies event associated inline element <div onclick="/*this event*/"> </div> ? in advance. i made following test: <div class="wrapper"> <a href="#">link</a> </div> <script type="text/javascript"> window.onload = function() { var wrapper = document.queryselector(".wrapper"); var link = document.queryselector("a"); link.addeventlistener("click", function() { console.log("click"); }); settimeout(function() { wrapper.innerhtml = ""; }, 4000...

c++ - Template instantiation effect on compile duration -

writing template classes have inline method bodies in .h files (unless instantiating them in .cpp files). know modifying inlined method requires recompiling units included them. it'll make compiling long. technique implement template class instantiating in .cpp file. file test.h : template <typename t> class test { public: t data; void func(); }; file test.cpp : template <typename t> void test<t>::func() { } template class test<float>; // explicit instantiation well. technique effective reduce compilation time uses test<float> after modification on func() ? since definitions of member functions inside cpp , not available other translation units, functions won't implicitly instantiated , cost of compiling code limited single cpp. the problem approach limiting use of template type (or types) provide manual instantiations. external users cannot instantiate other types, if have it, need remember manually speciali...

html - Relative Spritesheet Animation in CSS -

i'm trying find best way animate sprite sheet in webpage using css; found example @ http://jsfiddle.net/simurai/cgmce/ , rendering frame in absolute pixels of 50x72. need sizing relative can downscale animated sprite smaller sizes @ smaller screen resolutions; have tried swapping out absolute pixel values relative sizes, , changing background-position property in keyframe animation relative value, not seem work (the animation becomes wonky, seemingly moving 1 frame another, instead of playing should). help/advice appreciated. .myanimationproperties { width: 25%; height: 25%; background-image: url("images/myspritesheet.png"); -webkit-animation: play .8s steps(6) infinite; -moz-animation: play .8s steps(6) infinite; -ms-animation: play .8s steps(6) infinite; -o-animation: play .8s steps(6) infinite; animation: play .8s steps(6) infinite; } @-webkit-keyframes play { { background-positio...

c++ - how can i read a series of character value as character and integer simultaneously and can compare it? -

i have file containing series of characters like: ......//////////0000000111111111222222222aaaaaaaaaaccccccccccccclllllllllllllllll i have scan 1 one character , have compare if number or not in form of integer. i used this: int x=0; fscanf(fp,"%d",&x) if (x>=0 && x<=9) i must have read numbers in file in integer form , have compare it. in c++: #include <iostream> #include <locale> char c; int i; while(std::cin >> c) { if(isdigit(c)) { = c - '0'; } else { //todo: } }

iOS 7 Critical failure: the LastResort font is unavailable -

when app first launches create bunch of custom uifonts (they correctly added .plist). custom fonts work until try create more 9 10 of them. after 9 or 10th custom font created, warning "critical failure: lastresort font unavailable. " warning on ios 7 devices , can't seem figure out why. has bug ios 7 because every custom font works on ios 6 devices, , i'm using 1 project. idea causing warning, , how fix it? it happened me ios 7..i removed fonts , added 1 one plist. there font "bad" ios 7 , caused mess. hope help) of course bug in apple's matrix

regex - PHP Backtrack_Limit_Error on preg_replace when matching nothing -

converting possibly nested html ul csv (4 fields) using php preg_replace run onto snag. following line takes care of part of nested lists go unchanged (except removed newlines) 1 of fields created topmost ul: $idx_string = preg_replace("|(<li>.*?)\n+(<ul>)\n+(.*?</li></ul></li>)|si","$1$2$3", $idx_string); now on large lists without nested lists (checked there's no such thing <ul> in @ point of conversion) fails due backtrack_limit_error. while know how on it, can't figure how matching nothing trigger backtrack limit @ all. according i've found, preg_replace returns either new string or unchanged old string (besides null/false on error). how backtrack in here? the list items this: <li><a href="9848.php">algeria - italy.</a></li> <li>go sailing<br> <a href="11434.php">anglesey / wight / guernsey / jersey</a></li> <li><a ...

python - How to change method in existing class -

i want following: i want change get_absolute_url method in user django.auth class. how can that? if using django 1.5 or greater, can redefine get_absolute_url instance method on custom user model class. prior 1.5, clean way accomplish create own proxy model stand in place of django.contrib.auth.models.user , get_aboslute_url instance method construct absolute urls don't follow /users/%username%/ pattern.

c# - How do you get a value from a TextField in DataGridView while the field is being updated -

i have datagridview text in there (i.e. datagridviewtextboxcolumn ), , every time text changes in 1 of these fields, update method has called somewhere else. however, noticed when updating textbox, value in cell not updated yet. class myform : form { private system.windows.forms.datagridview m_datagridview; private system.windows.forms.datagridviewtextboxcolumn m_textboxcolumn; private void m_datagridview_editingcontrolshowing(object sender, datagridvieweditingcontrolshowingeventargs editevent) { if (editevent.control textbox != null) { textbox textbox = editevent.control textbox; textbox.textchanged -= new eventhandler(textbox_textchanged); textbox.textchanged += new eventhandler(textbox_textchanged); } } private void textbox_textchanged(object sender, eventargs e) { updatetext(); } private void updatetext() { foreach (datagridviewrow row in m_datagridview.ro...

emacs - How to restore anything-like behavior for TAB autocomplete in helm? -

a related question asked here . answer used new way autocomplete works in helm. cannot used it, here's why. say, want open file /home/user/work/f.txt . c-x c-f , takes me current dir, /current/dir/ . hit backspace , notice autocomplete won't let me delete / . ok, turn off autocomplete c-backspace . kill line c-a c-k , start typing. notice autocomplete doesn't work, turn on c-backspace . type part know unique, e.g. /hom , hit tab . not here. type /ho , autocomplete resolves /home/ , since type fast, end /home/m , , continue typing meaningless characters until notice it. chances are, time got autocompleted directories had no intent of going. so have watch autocomplete doing, rather rely on type , checking suggested completions when hit tab . i find myself descending wrong directories due occasional typo, , having difficulty going level -- evil autocomplete won't let fix situation couple of backspace s. this interaction of autocomplete behavior , removal...

Scala manifest taken from variable and not instance? -

i'm not quite sure how phrase question because don't understand going on. expect manifest able tell me actual runtime type of instance, seems telling me runtime type of variable assigned to. // scala 2.10.1 trait base class impl1 extends base class impl2 extends base def showmanifest[t <: base](thing: t)(implicit ev: manifest[t]) = println(thing + ": " + ev.runtimeclass) val (impl1, impl2) = (new impl1, new impl2) println("=== impl1 , impl2 ===") showmanifest(impl1) showmanifest(impl2) val choose1 = if(true) impl1 else impl2 val choose2 = if(false) impl1 else impl2 println("=== choose1 , choose2 ===") showmanifest(choose1) showmanifest(choose2) output: === impl1 , impl2 === main$$anon$1$impl1@48ff2413: class main$$anon$1$impl1 main$$anon$1$impl2@669980d5: class main$$anon$1$impl2 === choose1 , choose2 === main$$anon$1$impl1@48ff2413: interface main$$anon$1$base main$$anon$1$impl2@669980d5: interface main$$anon$1$base so, type o...

Android - png resource converted to a ColorDrawable on android < 4.0 -

according documentation here , png resource should converted bitmapdrawable . i'm observing strange behavior wherein png file has only black pixels in resulting in crash because of classcastexception (wrapped in invocationtargetexception ) if try following in custom view's constructor : ... tempdrawable = typedarr.getdrawable(r.styleable.customview_src); // source points png file log.i("testpngtoresource", "canonical class name " + tempdrawable.getclass().getcanonicalname()); tempbitmap = ((bitmapdrawable) tempdrawable).getbitmap(); ... i see following logged on android 2.2 , 2.3 09-24 13:21:37.575: i/testpngtoresource(532): canonical class name android.graphics.drawable.colordrawable why resource not being converted bitmapdrawable? this optimization performed aapt. able recognize images made of single color , turn them into, well, single color instead of bitmap. more space-efficient, improves loading times, etc.

clipping - How can I clip INSIDE a shape in HTML5 canvas? -

Image
i've found number of examples clipping outside region of arc (e.g.: this example ). can't seem figure out how clip inside arc shape instead. here example of how i'm clipping outside region, opposite of want: ctx.save(); ctx.beginpath(); ctx.arc(x, y, radius, 0, math.pi * 2, false); ctx.clip(); ctx.beginpath(); ctx.linewidth = 1; ctx.shadowblur = 10; ctx.shadowoffsetx = shadowoffset; ctx.shadowcolor = '#000000'; ctx.strokestyle = '#000000'; ctx.arc(x, y, radius, 0, math.pi * 2, false); ctx.stroke(); ctx.restore(); available options for irregular shapes can use 2 techniques: composite mode clipping imho better choice use actual clipping mode or composite mode destination-out . as marke says in answer xor available too, xor inverts alpha pixels , doesn't remove rgb pixels. works solid images no transparency, have existing pixels transparency these might give opposite effect (becoming visible) or if later use xor...

java - Change ImageResource from a different activity in Android -

i need setimageresource in activity a's imageview after clicking button in activity b. i'm trying creating public static imageview. here's code of activity a: public class activitya extends activity { public static imageview image; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_activitya); image = (imageview) findviewbyid(r.id.image); } here's code of activity b: button.setonclicklistener(new onclicklistener() { @override public void onclick(view button) { if(edittext.gettext().tostring().equalsignorecase("mytext")) { activitya.image.setimageresource(r.drawable.other_image); intent act2= new intent(activityb.this,activitya.class); startactivity(act2); } }); } i can't understand why app crashes after button clicked (it works if remove ...

node.js - node library to construct demo pages to exhaustively test out API -

given api can imagine javascript library (serverside in node) may exist can construct demo-pages test out these api-methods exhaustively. something like: https://developers.google.com/apis-explorer anyone knows of library this?

c# - Expander View connected with NotifyCollectionChangedAction randomly expands items -

in windows phone 8 application i've created observable collection noticing when item changes in collection. here collection code: public class trulyobservablecollection<t> : observablecollection<t> t : inotifypropertychanged { public trulyobservablecollection() : base() { collectionchanged += new notifycollectionchangedeventhandler(trulyobservablecollection_collectionchanged); } void trulyobservablecollection_collectionchanged(object sender, notifycollectionchangedeventargs e) { if (e.newitems != null) { foreach (object item in e.newitems) { var test = item inotifypropertychanged; (item inotifypropertychanged).propertychanged += new propertychangedeventhandler(item_propertychanged); } } if (e.olditems != null) { foreach (object item in e.olditems) { (item inotifypropertychanged).pro...

javascript - Carousel breaking on initial redirect, but works properly on refresh -

i have nav bar 'about' link. when clicked should bring subnav , redirect 'about.philosophy' rather 'about.index', does. i have carousel partial i'm rendering on about.hbs template: <div class="row about-bg"> {{partial 'about/about-carousel'}} </div> {{outlet}} that being fired in aboutview: ew.aboutview = ember.view.extend({ didinsertelement : function(){ $(window).load(function() { $("#about-carousel").caroufredsel({ responsive: true, width: "100%", height: 'variable', items: { height: 'variable' } }); }); } }); however, when 'about' link first clicked, changing url '/about/philosophy', carousel broken -- images stacked on top of 1 , no movement -- js isn't being found or something. hit refresh on browser carousel renders fine. must redirect breaking it, b...

asp.net - In iis, what does having multiple authentication types on the same app enabled imply? -

i've gone long telling myself, works i'll treat black box. i can enable anonymous, forms, windows security, etc... if enable multiple of them on same path/app, mean? run? secure take role of verification? is there point enabling anonymous , windows authentication? is there way step through authentication process? this article older versions windows server, logic same http://support.microsoft.com/kb/264921 when browser makes request, considers first request anonymous. therefore, not send credentials. if server not accept anonymous or if anonymous user account set on server not have permissions file being requested, iis server responds "access denied" error message , sends list of authentication types supported using 1 of following scenarios: if windows integrated supported method (or if anonymous fails), browser must support method communicate server. if fails, server not try of other methods. if basic supported method (or if anonymous fails),...

rgraph - javascript animation of a water tank -

i trying use rgraph library manipulate vertical progress bar, i'm stuck because after creating progress bar can't manipulate properties, here's code have been using: window.onload = function () { // create object. arguments are: canvas id, indicated value , maximum value. var myprogress = new rgraph.vprogress('myprogress', 60, 100) // configure chart want. .set('chart.colors', ['blue']) .set('chart.tickmarks',['true']) .set('chart.tickmarks.color',['white']) .set('chart.title',"nivel") // call .draw() method draw chart. .draw(); } and after try read value property using click on button,but says undefined: function myfunction() { var valor= myprogress.value; alert(valor); } how can access properties of object created in function? idea change level of progress bar according control put in webpage. thanks in a...

how can i change the "character type" of a database in postgresql? -

i'm using postgresql 9.1 i've set collation , character type of database greek_greece.1253 , want change utf8 to change collation should use this , right? but how can change character type? thanks edit i ment wright c instead of utf8. change collation , character type c you cannot change default collation of existing database. need create database collation need , dump/restore schema , data it. if not want recreate database - can specify collation every text collumn in db. here detailed postgres manual on collations: collation support . first line of manual page states: lc_collate , lc_ctype settings of database cannot changed after creation. create database , pg_dump , pg_restore

ios - ABNewPersonViewController Address "Address" and "City" overlap -

new ios development—taking on existing project , trying of ui tweaks done ios7. we use contacts in our application. when users tap add contact in our contactslistmanagerview.m uiactionsheet instantiate new abnewpersonviewcontroller: abnewpersonviewcontroller *adder = [[abnewpersonviewcontroller alloc] init]; [adder setnewpersonviewdelegate:self]; we add single delegate method abnewpersonviewcontroller in contactslistmanagerview.m: newpersonviewcontroller:didcompletewithnewperson: i don't see other references viewcontroller. the problem i'm having when add address new person there "address" field overlaps "city" field. see screenshot here: http://cl.ly/image/0h3i0l3k3k1g i'm not sure field coming from, or properties available make kind of change. can provide appreciated.

loops - clojure.lang.Lazysez cannot be cast to clojure.lang.IFn -

hey im making a* search on 8 puzzle , have 2 main questions. fixed : first clojure.lang.lazysez cannot cast clojure.lang.ifn when run on line in second part of polymorph in loop im not sure why. here code: (defn a-star ([board history] (if (at-end? board) (println board) ( (let [options (filter #(possible-move? % board) *moves*) move (into (pm/priority-map) (for [move options] [move (global-man-dis (move-tile board move))]))] (for [pair move :let [next-move (key pair)]] (do (println (move-tile board next-move)) (a-star (move-tile board next-move) next-move (conj history board)) ) ) ) ))) ([board prev-move history] (if (or (at-end? board) (history-check history board)) (println board) ( (let [options (get-queue board (dont-go-back prev-move)) move (into (pm/priority-map) (for [move o...

Android make app active over custom lockscreen (Go Locker, etc) -

i have scoured internet answer, no luck. have tried numerous suggestions on site make app display , override custom lockscreen. can dislay app on stock lock screens no problem. again, problem custom lockscreen, go locker, lock screen 7, etc... here have tried w/ no luck. android activity on default lock screen requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); getwindow().addflags(windowmanager.layoutparams.flag_turn_screen_on); getwindow().addflags(windowmanager.layoutparams.flag_show_when_locked); getwindow().addflags(windowmanager.layoutparams.flag_keep_screen_on); window.addflags(windowmanager.layoutparams.flag_turn_screen_on); window.addflags(windowmanager.layoutparams.flag_show_when_locked); window.addflags(windowmanager.layoutparams.flag_keep_screen_on); window.addflags(windowmanager.layoutparams.flag...

java - line not showing on image jframe -

package carspeedometer; import java.awt.graphics; import javax.swing.imageicon; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; class a1 { a1() { jframe jf = new jframe("speedometer"); jf.setdefaultcloseoperation(jframe.exit_on_close); jpanel jp = new jpanel(); jlabel jb = new jlabel(new imageicon( "c:/users/vinayak/desktop/tester.jpg")); jp.add(jb); jf.add(jp); jf.setvisible(true); jf.setsize(700, 700); } public void paint(graphics g) { g.drawline(70, 70, 200, 200); } public static void main(string...s) { new a1(); } } line not showing on screen.i want show line on top of image.please help. here trying build speedometer first line needs displayed you can draw in swing if override drawing method of component. here paint method overrides nothing because class extends nothing. suggest that cr...

python - find biggest interval in list of time stamps ( Perl preferred ) -

i'd accept of interpreted languages perl, python, bash, etc.. i'd prefer perl because trying learn. have list of timestamps like: 17:31:16 17:31:16 17:31:18 17:31:29 i want find of largest intervals (top 5) between 2 consecutive lines, , return time stamps , line numbers. log file software build , trying determine steps took longest. example gave filtered, lines like: [15:57:42]: cc net/sunrpc/xprtsock.o if can give me program parses format little easier, , return line number biggest differences in time occurred. this used isolate timestamps log perl -lane 'print $1 if $_ =~ /^\[(\d+:\d+:\d+)\]:*/' the type of output achieve like: line 574 20:04:54 line 575 20:24:55 difference 00:20:01 if don't want solve problem, happy see pseudocode or advice @ all. have spent time , have no useful code show it. i'd upgrade time-matching regex bit, capture components of time separately. have worry builds started before midnig...

java - Html form submit both datastore entity and blobstore through app engine -

i've got jsp file uploads file. added name , email form. want able keep track of blob uploaded app engine blobstore person. have tie datastore take contact info? how done? can filter blob viewer type, filename, size, , creation time? can add more entries can regular datastore? i want submit both datastore information , file @ same time. can multiple action commands listed in html form. know little html. add datastore service action. <form action="<%= blobstoreservice.createuploadurl("/upload") %>" method="post" enctype="multipart/form-data"> first name: <input type="text" name="firstname"><br> last name: <input type="text" name="lastname"><br> email : <input type="text" name="email"><br> email again: <input type="text" name="emailagain"><br> <input type="text" name="foo...

Charlock_Holmes not returning anything in Ruby? -

i'm trying use gem charlock_holmes ( https://github.com/brianmario/charlock_holmes ) detect , correct character formatting errors. however, program doesn't return anything. my code is: require 'charlock_holmes' contents = file.read('./myfile.csv') detection = charlockholmes::encodingdetector.detect(contents) # => {:encoding => 'utf-8', :confidence => 100, :type => :text} as specified in documentation. when run in directory, nothing @ all: user$ ruby detector.rb user$ expected behavior returns detected encoding (and, if desired, can change well). i've got gems installed, think, , i've tried under both 1.9.2 , 2.0.0. any ideas i'm doing wrong or how find out? i'm afraid i'm new ruby, have tried pretty comprehensive search before asking , have come blank. i think should put p detection in file detector.rb . save code below : require 'charlock_holmes' contents = file.read('./myfile...

javascript - How to make a timeout between function calls? -

my code works fine, except opens links @ same time. use delay. this opens (more 1 function "open") @ same time: waitforkeyelements ("input.submit[onclick*='open']", clickopenbtn); but want delay between each function call ( clickopenbtn ). my complete code snippet: settimeout(checkforzero, 30000); // or call checkforzero() if don't need defer until processing complete function checkforzero() { waitforkeyelements ("input.submit[onclick*='open']", clickopenbtn); settimeout(checkforzero, 30000); } function clickopenbtn (jnode) { triggermouseevent (jnode[0], "click"); } function triggermouseevent (node, eventtype) { var clickevent = document.createevent ('mouseevents'); clickevent.initevent (eventtype, true, true); node.dispatchevent (clickevent); } can do? in case, push nodes fifo queue , use setinterval , not settimeout work queue. code becomes: var nodestoclick = [...

jquery - Percentage Progressing Bars -

i found animation progressing bars here i wonder how add number % running each bar while these progressing bars loading. please help. thank you! here css <style type='text/css'> .progress_container { height:25px; border-radius: 3px; overflow:hidden; background:red; width: 460px; } .progress_bar { height:25px; width: 0px; -moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; background:black; } .progress_container { margin-bottom: 30px; } } </style> here jquery <script type='text/javascript'>//<![cdata[ $(window).load(function(){ $("document").ready(function () { // animate progress bar onload $('.progress_bar').each(function () { $(this).animate({ width: this.title }, 1000); }) }); });//]]> </script> here body <div class="progress_container"> <div class=...

uiimageview - Landscape views only loading properly from portrait and after rotating, why? -

new ios developer here. have multiple views require different images displayed in portrait , landscape. have implemented , portrait image loads fine, and, upon rotation, landscape image loads fine. however, if device in landscape orientation switches view, loads improperly - wrong size, resolution, alignments, etc. code dealing orientation changes below: - (void)didrotatefrominterfaceorientation:(uiinterfaceorientation)frominterfaceorientation { if((self.interfaceorientation == uideviceorientationlandscapeleft) || (self.interfaceorientation == uideviceorientationlandscaperight)) { _image1.image = [uiimage imagenamed:@"landscape.png"]; } else if((self.interfaceorientation == uideviceorientationportrait) || (self.interfaceorientation == uideviceorientationportraitupsidedown)) { _image1.image = [uiimage imagenamed:@"portrait.png"]; } } i believe because method called upon rotation. if r...

python - Scrapy Endless Crawling -

i have built crawling spider using python scrapy agains distributor websites. trying collect urls under domain , each page, urls listed under page. , want use gephi visualize network connections domain. (1) how crawled url stored(memory or disk) , crawl limit? however, crawler has been running 4 days think , has crawled 700k pages. know scrapy not crawl page has crawled wondering: number of pages increases, there limit scrapy "remember" page has crawled? crawled url stay in memory or mechanism behind this? (2) will there end crawl single domain? if not? btw, should stop crawling right since don't know when end of spider, don't know if possible have dynamic page "domain crawling" endless task.... example, have parametric search box , combinations of search lead new page(javascript call) actually.. lead huge redundancy.. before know scrapy, tried figure out pattern in url first , populate urls, after that, go each url , using urllib2+bs4 scrape. ...

c# - How to modify a specific item in a collection using reflection -

i have item in collection need modify using reflection - i'm using reflection because don't know exact type of generic collection until runtime. i know how use setvalue() method set value of property retrieved through collection, can use setvalue() set actual object inside collection? ienumerable businessobjectcollection = businessobject ienumerable; foreach (object o in businessobjectcollection) { // want set "o" here replacement object in collection if // property on object equals type t = o.gettype(); propertyinfo identifierproperty = o.gettype().getproperty("identifier"); long entityid = (long)identifierproperty.getvalue(o, null); if (replacemententity.identifier == entityid) { // in case: set "o" replacemententity object // defined somewhere else. // can retrieve object using code, // set object setvalue? object item = businessobjectcollection.gettype().getmethod(...

oracle - emacs on Windows + sql + ssh -

our university runs oracle database server. log in using campus username/password on ssh, rlwrap sqlplus automatically started , have log in again, database application, using username , password. i use emacs on windows edit , run simple sql scripts on server. able edit files on other ssh servers using tramp, reason (most automatic launch of sqlplus ) i'm not able on database server. emacs hangs tramp: waiting prompts remote shell . i run interactive sql session in buffer, inserted code @ https://stackoverflow.com/a/17277015/1813487 .emacs appropriate modifications (namely, change occurrences of mysql oracle ). when m-x sql-oracle , emacs hangs tramp: sending password . is there way fix/configure this, or way convince admin disable automatic launch of sqlplus ? it may or may not important make tramp work re-compiling tramp.el suggested here . have little no knowledge of emacs lisp. tramp-over-ssh works starting ssh session , sending shell commands. if s...

vba - How can I trigger an event when multiple items added at once to Outlook Folder? -

i use event handlers in vba , outlook frequently. 1 of them 1 marks item deleted marked read. private sub deleteditems_itemadd(byval item object) application_startup on error resume next item.unread = false end sub declared via: private withevents deleteditems outlook.items and initialized in application_startup as: dim olnamespace outlook.namespace set olnamespace = olapp.getnamespace("mapi") set deleteditems = olnamespace.getdefaultfolder(olfolderdeleteditems).items unfortunately, not affect items if delete multiple items @ once. is there way can hijack process somehow? looked using _beforedelete event have set item correctly each time, if problem wouldn't exist anyways. apparently wasn't clear - use case have when delete messages via delete key inbox, drafts, whatever. you don't have to. i curious question opened outlook , wrote code in thisoutlooksession : private withevents items outlook.items public sub seti...

javascript - Adding values from a for loop inside an object with a custom structure -

here object structure need: var states = { 'countrycode1' : { 'statecode1' : 'statename1', 'statecode2' : 'statename2', .... } 'countrycode2' : { 'statecode1' : 'statename1', 'statecode2' : 'statename2', .... } ................................. }; from loop, have separate values countrycode, statecode , statename, how can build object above structure? for (var loop = 0; loop < statelinearray.length; loop++) { linearray = statelinearray[loop].split(":"); countrycode = this.trimstring(linearray[0]); statecode = this.trimstring(linearray[1]); statename = this.trimstring(linearray[2]); // how can add values countrycode, statecode , statename in states object, respecting it's structure? // spmething this: states[countrycode] = ....; } any ideas? here structure of statelinearray: var statelinearray = '\ antigua , barbuda:antigua:anti...

Creating a C++ Wrapper in Python using .dylib -

i'm trying develop wrapper in python can access library have developed in c++. @ minute, basic, testing purposes. in .h file have following: #include <iostream> class foo { public: void bar() { std::cout << "hello world"; } }; and in python file call using following: from ctypes import cdll lib = cdll.loadlibary('./libfoo.1.dylib') class foo(object): def __init__(self): self.obj = lib.foo_new(); def bar(self): lib.foo_bar(self.obj) f = foo(); f.bar(); i have created .dylib since don't believe possible create shared library in gcc on mac, but, wrong. i'm getting following errors: traceback (most recent call last): file "main.py", line 3, in <module> lib = cdll.loadlibary('./libfoo.1.dylib') file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/ctypes/__init__.py", line 423, in __getattr__ dll = self._dlltype(name) file "/sy...

jquery - Dropdown menu needs to stay open after .hover -

ok, have tried many things , nothing seems working. dropdown menu stay open few seconds after user has hovered on (which i'm thinking cause usability issues), how can make work current code? $(".dropdown .sub").hover(function () { $("#menu .holder").show(); }); check answer : add delay before .hide() w/jquery var my_timer; $(".item").hover( function () { cleartimeout(my_timer); $(this).show(); }, function () { var $this = $(this); my_timer = settimeout(function () { $this.hide(); }, 500); } );