Posts

Showing posts from April, 2014

python - How do I implement a custom MIB in PySNMP? -

i have mib text file (do need make .py file somehow??). trying use pysnmp (not net-snmp). have been able connect device , print out info, info not helpful (just objectname, objectidentifier, etc). want able communicate device (send commands change , read values), of tutorials have seen seem of little help. know how can use custom mib communicate device? sites missing? http://pysnmp.sourceforge.net/ ok, need else... to use mibs pysnmp should first convert mib pysnmp format (which collection of python objects). conversion done pysnmp/tools/build-pysnmp-mib shell script in following manner: $ sh build-pysnmp-mib -h build-pysnmp-mib: illegal option -- h convert mib text file pysnmp-compliant module, see http://pysnmp.sf.net. usage: build-pysnmp-mib [-o pysnmp-mib-file ] [ mib-text-file ] make sure have libsmi installed (pysnmp scripts use smidump tool libsmi distribution). unless put new pysnmp mib file pysnmp/smi/mibs/ (which not idea), have point pysnmp location own m...

java - Specifying an applications number of work threads -

i'm working on application heavy number crunching. intended run on single computer. recently, we've started looking @ multithreading speed calculations. of algorithms can made run parallel without effort, , use fixed thread pool run each of sub tasks. what wondering is: how number of threads (the size of pool), typically specified these kinds of algorithms? suspect typically done using either configuration file, or commandline parameter, haven't seen examples that, wondering if there better ways. related this: relevant specify number of threads? thinking setting pool size number of assignable cores run fastest, thread-contention processing power in case of on assignment relevant performance? eg: setting 20 max threads on 4 core machine worse setting 4 max threads? edit: application intended sale, have no idea computers run on. i'm looking general guidelines, , best practices. a rule of thumb use number_of_cores + 1 threads (certain parallel build sy...

http - TCP Termination -

what happening tcp connection after end of http session? example, after loading static webpage webserver thanks a http session refers server keeping association specific user , potentially of length (using, instance, cookies association tokens). a http session therefore contains multiple tcp sessions. non persistent http connections, every request has own tcp session (and closed after). persistent http connections on other hand, multiple http resources fetched wihtin tcp session , either side close upon reached timeout threshold on either side. wikipedia article on persistent http connections (keep-alive: true)

Google Maps API V3 grey box on one site, works fine on another -

i have site http://beta.aico.co.uk/trained-installers.html , when loads grey box. have same code on following site (different template) http://joomla.bemoore.com/index.php?option=com_content&view=article&id=22&itemid=29 , works fine. therefore suppose must css issue, life of me can't figure out might be. has got idea problem is? thanks, bob it indeed css issue. here css rule culprit: div { overflow: hidden !important; overflow-y: hidden !important; overflow-x: hidden !important; } line 397 of trained-installers.html you'll need modify rule apply relevant divs, not divs.

Setting up django on apache (mod_wsgi, virtualenv) -

i'm putting django site in production first time please forgive ignorance. i'm trying put django site on apache. i've read documentation mod_wsgi , tried simple hello world configured ok. problem i'm having seems using virtualenvs it. wanna set things including virtualenvs , i'm ready future sites. to problem now. the error i'm getting in apache log is: no module named django.core.handlers.wsgi so seems not reading virtualenvs properly. this wsgi script: import os import sys import site site.addsitedir('/home/user/.virtualenvs/myapp/lib/python2.7/site-packages') path = '/home/user/django/myapp/myapp' if path not in sys.path: sys.path.append(path) sys.stdout = sys.stderr print sys.path os.environ['django_settings_module'] = 'myapp.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.wsgihandler() and error log apache. printed out sys.path can see looks like. [tue jun 05 14...

objective c - Whats different between two values -

this question has answer here: using iphone/objective c cgfloats: 0.1 okay, or should 0.1f? 1 answer what's different between: cgfloat gray[4] = {0.9f, 0.9f, 0.9f, 1.0f}; and cgfloat gray[4] = {0.9, 0.9, 0.9, 1.0}; ? i think same don't know sure. i believe indicating number float (i.e. single-precision floating point) opposed double (double-precision floating point),

java - Setting the value of a TextField to a Random number -

i writing android app has button calls selfdestruct() . there textview should show 1 or 2 , chosen randomly. however, if shows 1 , 1 set, same 2 . should create random number. this code, please me achieve this... public class mainactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); } @override public void selfdestruct(view view) { textview tx= (textview) findviewbyid(r.id.text); random r = new random(); int x=r.nextint(2-1) + 1; if(x==1) { tx.settext("1"); } else if(x==2) { tx.settext("2"); } } } this you: public class mainactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstance...

C# Reflection DateTime? -

i can't find on net me figure out, if please lifesaver. my function given property name , object. using reflection returns value of property. works if pass nullable datetime gives me null , no matter try cant work. public static string getpropvalue(string name, object obj) { type type = obj.gettype(); system.reflection.propertyinfo info = type.getproperty(name); if (info == null) { return null; } obj = info.getvalue(obj, null); return obj.tostring(); } in above function obj null. how read datetime? your code fine-- prints time of day: class program { public static string getpropvalue(string name, object obj) { type type = obj.gettype(); system.reflection.propertyinfo info = type.getproperty(name); if (info == null) { return null; } obj = info.getvalue(obj, null); return obj.tostring(); } static void main(string[] args) { var dt = getpropvalue("dtprop", new { dtprop = (datetime?...

Cannot see Routes when mounting Rails 3 Engine -

i have created rails engine (as per rails guides ) using: rails plugin new address_book --full --mountable i proceeded create controller engine called pages single action (called temp ) display single view, namely app/views/address_book/pages/temp.html.erb the engine's config/routes.rb is: addressbook::engine.routes.draw match :temp, to: "pages#temp" end in parent application added following in it's routes.rb file: mount addressbook::engine => "/address_book", as: "address_book" in action of 1 of parent application's controllers have following call view belonging engine: redirect_to address_book.temp_path now, though rake routes displays engine's path, when try execute action browser keep getting error: undefined local variable or method `address_book' for line redirect_to address_book.temp_path the result of rake routes contains following: address_book /address_book addressbook::engi...

continuous integration - How do I setup Jenkins to build all of my versions of a project? -

i'm learning whole version control thing subversion , using trunk, branch, tags etc different workings/versions of project. i'm trying speed using continuous integration jenkins (tried ccnet, nightmare setup!). so question is, if have following areas in project svn: file:///e:/data/svn/myproject/trunk file:///e:/data/svn/myproject/tags/version_1.0 file:///e:/data/svn/myproject/branch/version_1.1 .. best practice regarding setting build project in jenkins of different areas in svn continuously monitored , changes built? would setup 1 project several source code repositories, 1 each version/trunk etc? or setup multiple build projects? how do it? edit: should using matrix project (build multi-configuration project)? set multiple jobs, 1 each branch/tag want build. once 1 job working well, can copy create rest, changing svn url. you should rid of old jobs stop maintaining tags/branches jenkins configuration doesn't out of control.

asp.net mvc 3 - Link in validation summary message -

is possible put html link in validation summary message? example want put link page in case there validation error: @html.validationsummary(false, "read <a href=""anotherpage.html"">more</a>") or @html.validationsummary(false, "read " & html.actionlink("more", "helpforerror").tohtmlstring) but in browser tag escaped doesn't form link. i know have accepted answer, think solution more simple , require less rewriting if want add links existing validation summaries. you need put {0} type format item in validation message below, replaced link. modelstate.addmodelerror("", "some error message link here {0}."); then in view call validation summary so: @string.format(html.validationsummary().tostring(), html.actionlink("click here", "action_to_link_to")).tohtmlstring() in case have used extension method added string object .tohtmlstring() ...

java - multiple threads performing different tasks -

this first time writing multiple threaded program. have doubt multiple thread i'l create point same run method , perform task written in run(). want different threads perform different tasks e.g 1 thread insert database other update , etc. question how create different threads perform different tasks create threads different jobs: public class job1thread extends thread { @override public void run() { // job 1 here } } public class job2thread extends thread { @override public void run() { // job 2 here } } start threads , work you: job1thread job1 = new job1thread(); job2thread job2 = new job2thread(); job1.start(); job2.start();

java - Compiling without assertions -

i know assertions can enabled/disabled @ runtime debugging , production, respectively. found assertions increase size of generated binary (about 100-200 bytes in example below). in c , c++, can @ compile time having #define ndebug before #include <assert.h> . is there way java compiler automatically this? i'd leave them in source code debugging purposes later on. don't want resultant binary larger necessary (we have size limit design requirement). c code: //#define ndebug #include <assert.h> int main(void) { assert(0); // +200 bytes without ndebug, 0 ndebug return 0; } java code: public class test { public static void main(string[] args) { assert(system.nanotime()==0); // increases binary size 200 bytes } } in response bn.'s answer: public class test2 { public static final boolean assertions = false; public static void main(string[] args) { if(assertions) { assert(system.nanotime()==0);...

c++ - Am I missing something? I keep outputting "No file found!" -

void getbookdata(booktype books[], int& noofbooks) { ifstream infile; string file = "bookdata.txt"; infile.open(file.c_str()); if (infile.fail()) { cout << "no file found!" << endl; infile.clear(); } while (true) { string line; getline(infile, line, '\r'); if (infile.fail()) { break; } cout << "line: " << line << endl; } infile.close(); } i've tried putting file in every location can think of, somehow it's not loading in. or, more likely, i'm doing else wrong. isn't end result of code supposed like, right i'm trying read out file line line. i guess need debugging why happening you. try adding more code routine determine going on. 1 thing try call getcwd . #include <unistd.h> ... char buf[path_max]; std::cout << "cwd: " << getcwd(buf, sizeof(buf)) ...

What is "" in JavaScript really? -

this 1 says false , meaning "" number: alert(isnan("")); this 1 says nan , meaning "" not number , cannot converted: alert(parsefloat("")); i expecting second code convert "" 0 since "" number when tested in isnan wrong! getting crazy or missed something? parsefloat tries parse number string isnan converts argument number before checking it: number("") //0 http://ecma-international.org/ecma-262/5.1/#sec-9.3.1 parsefloat("") //nan http://ecma-international.org/ecma-262/5.1/#sec-15.1.2.3 apparently "broken" or "confusing", specs: a reliable way ecmascript code test if value x nan expression of form x !== x. result true if , if x nan. 0 !== 0 // false nan !== nan //true function isexactlynan(x) { return x !== x; }

css float - Horizontal gap between floated tables in Outlook 2007/2010 -

Image
i've spent 2 weeks find solution this, can't came across. if float tables after each, there 1 pixel gap in microsoft outlook 2007/2010, uses microsoft word 2007 html render engine: i'd thank working solution – which not put tables in separated <td> 's . here html code reproduce it: <html> <head> <title>outlook 2007/2010 horizontal gap</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style type="text/css"> table { mso-table-lspace: 0pt; mso-table-rspace: 0pt; } </style> </head> <body bgcolor="#000000"> <table bgcolor="#ffff00" align="left"><tr><td>&nbsp;</td></tr></table> <table bgcolor="#ffff00" align="left"><tr><td>&nbsp;</td></tr></table> </body> </html> what i...

Text input stealing focus when a jQuery tab is clicked -

i building web interface built around jquery tabs, first tab contains text input can used quick search through other tabs. i want textbox gain focus first tab selected , user can start typing asap. currently i'm trying use tabsselect event bind focus-stealing function, seems i'm missing something. my current code: $("#usertabs").tabs().bind("tabsselect",function( event, ui){ if(ui.index == 0){ alert('fire'); $('#barcodeselect').focus(); } }); when click first tab, alert pops up, , dismiss it, first tab shown, textbox not have focus. calling $('#barcodeselect').focus(); console have desired effect, shouldn't typo or that.. could changing of tab steals focus textbox ? if so, there way bind on tab change being finished instead of beginning ? or being oblivious? you should use tabsshow instead of tabsselect . tab select happens when tab clicked (so can cancel tab change returnin...

Php: remove (different cases) duplicates from array -

probably discussed topic, in php did not found answer there simpler way realize in follows: $a = array("hello","hello","hello","world","world"); $p=array(); foreach( $a $v ){ $p[strtolower($v)] = ""; } print_r($p); keep 1 single element, in small-case, array something like: $p = array_unique(array_map('strtolower', $a));

php - Webserver cannot write to directory when installing CMS -

i have local stand-alone lamp stack i'm using local web development. i've tried install multiple cms's use php write data mysql database , files on webserver (concrete5, symphony, getsimple cms). however when try install of these error messages each state along lines of "the files need change not writeable webserver." concrete5 error message: error: web server access files , configuration directories /config /packages , /files directories must writable webserver symphony error message: missing log file symphony tried create log file , failed. make sure install folder writable. obviously permissions issue, i've tried changing owner & group (recursively of course) of apache's www directory many different combinations of root, apache user & group , own user & group set permissions way 777 using chmod, , still same error systems. i can drop regular static file (like phpinfo) www directory , apache serves fine, no...

c# - Using Reflection when an assembly contains types referencing another assembly -

i getting reflectiontypeloadexception following code : var myassembly = assembly.loadfrom(mydll); var types = myassembly.gettypes()) mydll references class in file in other assembly ("mydependency.dll") made sure file resides in application directory , in same folder "mydll" file. how able load mydll in case ? i'd try calling: assemblyname[] referenced = myassembly.getreferencedassemblies(); then iterate on assemblyname objects , attempt load those, prior calling myassembly.gettypes()

java - How to randomly settext in texviews in android? -

i have 4 string arrays,each of these array's length 4. have 4 textviews . want randomly settext of array's indexes in textviews. have done this: ansone.settext(answera[0]); anstwo.settext(answerb[0]); ansthree.settext(answerc[0]); ansfour.settext(answerd[0]); but keeps same sequence everytime run application, want randomly select arrays in different textviews time 'ansone' textview set text of answerb[0], or 'anstwo' textview set text of answerd[0] , on. everytime run application textviews randomly select arrays set text. how can make random? create arraylist array: arraylist<string> tmp = new arraylist<string>(); tmp.add(answera[0]); tmp.add(answerb[0]); tmp.add(answerc[0]); tmp.add(answerd[0]); and shuffle it: collections.shuffle(tmp); next, put result each textviews: ansone.settext(tmp.get(0)); anstwo.settext(tmp.get(1)); ansthree.settext(tmp.get(2)); ansfour.settext(tmp.get(3));

sitecore6 - Copy only reference of item in Sitecore 6 tree structure -

i have item in sitecore 6 backend containing rendering , data render itself. item child of other item in sitecore tree structure. tree looks this: home parent item item parent item need reference item here is there way copy reference of item? idea have same content different url, without copy/pasting. because after while content writer change content , doesn't want search copies , change them too. if on sitecore 6.4 or later, can accomplish using clones. select item copied, , click "clone" button on "configure" ribbon. clone shows values original item, allows override them, @ field level, should need arise. for sitecore 6.3 , earlier, can use proxies. these not allow option of overiding fields, can lead performance issues if used extensively, , have been deprecated sitecore 6.4. you can learn more both techniques @ http://sdn.sitecore.net/upload/sitecore6/64/reusing_and_sharing_data-a4.pdf , http://bit.ly/clonetal...

c# - Determining the page number of an inline element while using FlowDocumentPageViewer? -

i have flowdocumentpageviewer control in application programmatically advances through each block , inline element in flowdocument (this because it's part of typing application , doing gives visual cues tell user type). each time change inline element i'm focused on, want check page inline element on, , if it's not on current page, navigate page on. if not possible, please suggest alternate solutions. also, if matters, every inline element i'm dealing run element. are trying automatically navigate page? if don't need know page number , should able use bringintoview? i'm assuming have reference block? the following code navigates page 301st block on when button pressed public partial class mainwindow : window { public mainwindow() { initializecomponent(); this.loaded += new routedeventhandler(mainwindow_loaded); } void mainwindow_loaded(object sender, routedeventargs e) { flowdocument fd = new flo...

ios - Look for a drop-in image resize/crop view controller -

i looking third-party view controller can used resize/crop uiimage provided. using profile avatar editing before upload. aviary's photo editor awesome ( https://github.com/aviaryinc/mobile-feather-sdk-for-ios ), has 28mb libaviarysdk.a file, doesn't make sense contains aviarysdkresources.bundle file. can recommend alternatives? https://github.com/ardalahmet/ssphotocropperviewcontroller https://github.com/mattgemmell/mgimageutilities

javascript - Blueimp Jquery File Upload : Doesn't show thumbnail preview image -

i used blueimp jquery file upload in rails application. when user select files, want show thumbnail of image , name of image before uploading files server. i have been referring demo customize plugin. able print name of file on screen not able show thumbnail. here generated html <!doctype html> <html> <head> <title>fileupload</title> <link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/jquery.fileupload-ui.css?body=1" media="all" rel="stylesheet" type="text/css" /> <script src="/assets/jquery.js?body=1" type="text/javascript"></script> <script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script> <script src="/assets/jquery.ui.widget.js?body=1" type="text/javascript"></script> <scr...

arguments - Clojure: Pass 'expanded' optional args to function -

i'm new clojure , i'm stuck on how 'expand' function's optional args can sent function uses optional args (but wants args keywords not seq of keywords). i'm parsing xml , if hard code values below function works, walks xml , finds value of 'title': ; zd required [clojure.data.zip.xml :as zd] ; ... (defn get-node-value [parsed-xml & node-path] (zd/xml-> (zip/xml-zip parsed-xml) :item :title zd/text)) (get-node-value parsed-xml) what want use 'node-path' pass in number of keywords, when written below comes in sequence of keywords throws exception: (defn get-node-value [parsed-xml & node-path] (zd/xml-> (zip/xml-zip parsed-xml) node-path zd/text)) (get-node-value parsed-xml :item :title) ; classcastexception clojure.lang.arrayseq cannot cast clojure.lang.ifn clojure.data.zip/fixup-apply (zip.clj:73) thanks! i think looking apply (http://clojuredocs.org/clojure_core/clojure.core/apply) (defn get-node-valu...

asp.net mvc - MVC3 - Input and Output value -

i learned mvc3 example haven't found i'm looking for. in asp.net webforms: public void something() { string = textboxa.text; string b = textboxb.text; textboxc.text = + b; } how in mvc ? tried create actionresult don't want redirect view. you might want @ client side i.e. using jquery etc. in mvc, has managed @ controller side updating required properties of viewmodel. viewmodel intern binded controls on actual view //model public class addviewmodel { public int 1 { get; set; } public int 2 { get; set; } public int result { get; set; } } //controller public actionresult index() { addviewmodel obj = new addviewmodel(); obj.one = 1; obj.two = 2; obj.result = obj.one + obj.two; return view(obj); } //view @model mvcapplication3.models.addviewmodel @html.editorfor(model => model.one) @html.editorfor(model => model.two) @html.editorfor(model => model.result) <input type="submit" value="sa...

php - In Android How to show message when data is Changed into Database? -

i need show message in android java class when data changed database. method has used this?? please me , dont have idea this. this php code: <?php $tableid=$_post['tableid']; $status=$_post['status']; include '../../dbconnect.php'; if($status=='all') { $oidquery="select orderid, orderstatus din_orders tableid=$tableid && orderstatus!='pending'"; } else { $oidquery="select orderid,orderstatus din_orders tableid=$tableid && orderstatus='$status'"; } $result=mysql_query($oidquery); while($ordersrow=mysql_fetch_object($result)) { $ordersarray[]=$ordersrow; } echo json_encode(array('orders'=>$ordersarray)); ?> for example: in table "orderstatus" shows "pending" later manually change "pending" "delivered". when change takes place in database should message i...

ruby on rails - Can't make devise after_sign_up redirection -

excuse me this, can't find error. here registrations_controller.rb code: class registrationscontroller < devise::registrationscontroller protected def after_sign_up_path_for(resource) edit_user_registration_path(current_user) end end in routes: devise_for :users, :controllers => { :registrations => "registrations" } and redirection isn't working... have tried: class registrationscontroller < devise::registrationscontroller protected def after_sign_up_path_for(resource) '/an/example/path' end end ...then adding routes: devise_for :users, :controllers => { :registrations => "registrations" } all this , took 30 minutes of searching googles run across that. thing worked me. edit: might add after poking through code, doesn't results in actual redirect (despite docs say); i'm getting 200 back.

caching - Android: storage location for data to be shared with other Apps? -

i'm familar concepts of application-own storage location , external storage location resides on sd-card. i'm not sure in scenario: i'm writing kind of library/open source classes can used other applications too. these classes download data , have cache them on public place. when other application uses same classes started first checks if required data available or not. if yes, cached data have used, elsewhere downloads data own , stores them @ same public location others can access them too. my question: best place kind of public data? external storage suitable because files in internal storage private application. you can path external storage environment.getexternalstoragedirectory();

c# - update 2 fields using linq foreach -

can update 2 fields using linq foreach loop @ once? sample snippet : have userdata name, email, createtime, lastupdatetime fields. have reset createtime , lastupdatetime users. to update using 2 calls below users.foreach(x => x.createtime= datetime.now.addmonths(-1)); users.foreach(x => x.lastupdatetime = datetime.now); instead can in single using linq foreach loop? well start with, assuming list<t>.foreach , isn't using linq. yes, can create lambda expression using statement body: users.foreach(x => { x.createtime = datetime.now.addmonths(-1); x.lastupdatetime = datetime.now; }); however, may also want use 1 consistent time updates: datetime updatetime = datetime.now; datetime createtime = updatetime.addmonths(-1); users.foreach(x => { x.createtime = createtime; x.lastupdatetime = updatetime; }); it's not clear why want achieve way though. suggest using foreach loop instead: datetime updatetime = datetime.no...

Is it possible to show the "Enter symbol" in windows xp? -

i want show symbol enter key in windows xp. there key combination displays symbol? windows key code alt+8626 downwards_arrow_with_tip_leftwards

python - Showing line numbers in IPython/Jupyter Notebooks -

error reports language kernels running in ipython/jupyter notebooks indicate line on error occurred; (at least default) no line numbers indicated in notebooks. is possibile add line numbers ipython/jupyter notebooks? ctrl - m l toggles line numbers in codemirror area. see quickhelp other keyboard shortcuts. in more details ctrl - m (or esc ) bring command mode, pressing l keys should toggle visibility of current cell line numbers. in more recent notebook versions shift-l should toggle cells. if can't remember shortcut, bring command palette ctrl-shift+p ( cmd+shift+p on mac), , search "line numbers"), should allow toggle , show shortcut.

floating point - Matlab - "0:.1:1" unexpected precision behaviour -

possible duplicate: matlab gives wrong answer can explain me why following happens, when use 0:.1:1 -range function? >> veca = 0:.1:1; >> vecb = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1]; >> veca == vecb ans = 1 1 1 0 1 1 1 1 1 1 1 why veca(4) not equal 0.3? look quite same ;) veca = columns 1 through 7 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 columns 8 through 11 0.7000 0.8000 0.9000 1.0000 >> vecb vecb = columns 1 through 7 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 columns 8 through 11 0.7000 0.8000 0.9000 1.0000 i think there problem precision here? or have problem in understanding? computers binary, native floating-point format can't store decimal fractions. (you use ratio type, or fixed-point decimal type, computations using these far slower.) as consequence, testing f...

c# - HttpWebResponse difference between Headers and GetResponseHeader -

when i've got httpwebresponse object, there 2 ways access response headers: string dateheader = webresponse.headers["date"]; string dateheader = webresponse.getresponseheader("date"); they both return same value, why there 2 ways obtain header information? looking @ .net sources, if found implementation both in httpwebreponse: // retreives response header object /// <devdoc> /// <para> /// gets /// headers associated response server. /// </para> /// </devdoc> public override webheadercollection headers { { checkdisposed(); return m_httpresponseheaders; } } /// <devdoc> /// <para> /// gets specified header value returned response. /// </para> /// </devdoc> public string getresponseheader( string headername ) { checkdisposed(); string headervalue = m_...

Correct order of resources in Rails routes.rb -

i keep getting strange errors because of way routes.rb file organized. latest 1 function cannot find action "show" in model relations controller (the action there). guess because adding custom actions via collection , order in routes declared messed up.. can please have @ , wrong? yapp::application.routes.draw require 'resque/server' match 'login' => 'user_sessions#new', :as => :login match 'logout' => 'user_sessions#destroy', :as => :logout match '/get_idx', :to => 'nodes#get_idx' resource :relations collection post 'this_relation' post "iframize" end end resource :words 'page/:page', :action => :index, :on => :collection collection 'front' 'index' end end resource :recommendations collection 'find_votes' end end "connotation/create" ...

aiContactSafe change field order in PHP -

Image
i created form using aicontactsafe. field order different. how change field order? please tell me procedure step step. do simple thing crate form fields in same order want , search query fetching fields db , change order condition id in asc order.the query might in model or in helper....hopefully you....

css - Chrome does not redraw <div> after it is hidden -

i have div s show on hover, , hidden. however, in chrome (19.0.1084.56 m, windows xp) when unhover, chrome doesn't redraw them gone until scroll or resize window. http://jsfiddle.net/y7ndr/3/ i aware modifications css fix problem, e.g. removing position or z-index , overflow properties, don't want that--the jsfiddle paired down full site need them. can shed light on why redraw problem happening in chrome? have tips fix without messing css need? clearly, webkit bug. i found adding -webkit-transform: scale3d(1,1,1); fixes it: http://jsfiddle.net/thirtydot/y7ndr/5/ i'm not sure if there downsides fix. guess works because inside webkit, different code used render 3d transforms.

android - Retrieve the http code of the response in java -

i have following code make post url retrieve response string. i'd http response code (404,503, etc). can recover it? i've tried methods offered httpreponse class didn't find it. thanks public static string post(string url, list<basicnamevaluepair> postvalues) { try { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); if ((postvalues == null)) { postvalues = new arraylist<basicnamevaluepair>(); } httppost.setentity(new urlencodedformentity(postvalues, "utf-8")); // execute http post request httpresponse response = httpclient.execute(httppost); return requesttostring(response); } catch (exception e) { e.printstacktrace(); return null; } } private static string requesttostring(httpresponse response) { string result = ""; try { inputstream in = response.getentity().getcontent(); ...

c# - Can I change the format of a Zedgraph axis without redrawing each curve? -

basically, application has zedgraph plot, curve loaded. intrinsically (i.e. in database curve points stored x-y pairs), each point's x-value double represents time (in seconds) has elapsed particular point variable datetime initialtime, 'december 15, 2005 12:45:02pm'. i give user option of displaying x-axis 'relative time' (time elapsed since initialtime original values) or 'actual time' (full date/time of each point). currently, every time user switches time views, have iterate through each pointpair on pointpairlist of curve , translate x-values to/from original values , zedgraphs xdate format. is there way more efficiently? thinking changing zgc.graphpane.xaxis.scale.format in way such accounts translation, couldn't find anything. i thinking changing zgc.graphpane.xaxis.scale.format could change axis labels under zgc.graphpane.xaxis.scale.textlabels (which array of strings)?

JSON Parsing Exception in Android -

i have following problem: have json file on server try parse in android. following error message: 06-13 19:24:39.025: e/json parser(17169): error parsing data org.json.jsonexception: value  of type java.lang.string cannot converted jsonobject here json file: { "settings":[ { "rss":"true", "rss_feed":"http://test.com/rss.rss" } ], "map_locations":[ { "title":"büro toronto", "address":"123 younge street toronto" }, { "title":"büro new york", "address":"time square new york" } ] } and code: jsonparser jparser = new jsonparser(); jsonobject json = jparser.getjsonfromurl(settings_url); try { jsonobject c = json.getjsonarray("settings").getjsonobject(0); rss = c.getboolean("rss"); jsonarray jmap = jso...

html - Recursive directory parsing with Pandoc on Mac -

i found question had answer question of performing batch conversions pandoc, doesn't answer question of how make recursive. stipulate front i'm not programmer, i'm seeking on here. the pandoc documentation slim on details regarding passing batches of files executable, , based on script looks pandoc not capable of parsing more single file @ time. script below works fine in mac os x, processes files in local directory , outputs results in same place. find . -name \*.md -type f -exec pandoc -o {}.txt {} \; i used following code of result hoping for: find . -name \*.html -type f -exec pandoc -o {}.markdown {} \; this simple script, run using pandoc installed on mac os x 10.7.4 converts matching files in directory run in markdown , saves them in same directory. example, if had file named apps.html , convert file apps.html.markdown in same directory source files. while i'm pleased makes conversion, , it's fast, need process files located in 1 directory...

How to uninstall yaml-cpp (build from source) -

i tried install yaml-cpp0.2.6 on oneric 11.10 server (on pandaboard / armel architecture). so used: $ hg clone http://code.google.com/p/yaml-cpp/ (which appers yaml-cpp0.5.0) $ mkdir build $ cd build $ cmake -dbuild_shared_libs=on .. $ make $ sudo make install everything without problem. unfortunately needed 0.2.6 version of it. therefore uninstall 0.3.0 version with: $ sudo make uninstall but gives me failure *** no rule make target `uninstall'. stop.' is there way uninstall it? or modify it, system don't need/want yaml0.2.6 anymore? the installer copies header files directory $prefix/include/yaml-cpp , library files $prefix/lib/libyaml-cpp.so . ( $prefix /usr/local ) just remove header directory , library files , should uninstalled.

iphone - How to add Drop Down list? -

i need create 1 drop down list contains languages. selecting language of list, should list out corresponding language details, example, if select english, list english songs. details coming url. i think need accordion view, take @ this question , this sample give right idea.

Javadoc does not recognize doctitle option/flag -

i running javadoc doclet through gradle, , when running javadoc/doclet task, receiving next error: error - invalid flag: -doctitle and after that, next usage table usage: javadoc [options] [packagenames] [sourcefiles] [@files] -overview <file> read overview documentation html file -public show public classes , members -protected show protected/public classes , members (default) -package show package/protected/public classes , members -private show classes , members -help display command line options , exit -doclet <class> generate output via alternate doclet -docletpath <path> specify find doclet class files -sourcepath <pathlist> specify find source files -classpath <pathlist> specify find user class files -exclude <pkglist> specify list of packages exclude -subpackages <subpkglist> specify subpackages recurs...

c# - Keep url encoded while using URI class -

i'm trying public profile information linkedin. achieve have provide http://api.linkedin.com/v1/people/url=public-profile-url , public-profile-url must url encoded. the issue .net classes such httpclient, webrequest etc use uri class seems "canonize" provided url, can't proper formatted request sent. the uri must be: http://api.linkedin.com/v1/people/url=http%3a%2f%2fwww.linkedin.com%2fin%2fiftachragoler but is: http://api.linkedin.com/v1/people/url=http://www.linkedin.com/in/iftachragoler in way, 'bad request' linkedin. is there way can have uri/uribuilder not decode url? there report on microsoft connect. default escaped slashes not allowed due security reasons. http://connect.microsoft.com/visualstudio/feedback/details/94109/ cites there: i try use linkedin api, need following link: http://api.linkedin.com/v1/people/url=http%3a%2f%2fwww.linkedin.com%2fin%2fyourlinkedinname:public as can see url field needs escape...

c++ - Different types assignment in switch state cases, inside template function -

apple.h class apple { public: apple(int); static int typeid; private: int id_; }; apple.cpp #include "apple.h" apple::apple(int pid) { id_ = pid; } potato.h, potato.cpp identical apple storage.h #pragma once #include "apple.h" #include "potato.h" #include <vector> class storage { public: storage(); template<typename foodname> void store(foodname * object){ (*getbasket<foodname>()).push_back(object); }; template<typename foodname> int countsize(){ return (*getbasket<foodname>()).size(); }; private: std::vector<apple*> applebasket_; std::vector<potato*> potatobasket_; template <typename foodname> std::vector<foodname*> * getbasket(){ std::vector<foodname*> * result; switch(foodname::typeid){ case 0: result = &applebasket_; break; case 1: ...

java - Basic Incrementation -

i know basic question but. i understand concept behind. n++, ++n, n--, --n. however public static void main(string[] args){ int count = 1; for(int =1;i<=10;++i){ count = count * i; system.out.print(count); } } so print: 1 2 3 4 5 6 7 8 9 10. my question is. why if incremented ++i isnt treated 2, instead of 1. inst point of ++i, increment before it's manipulated operation? is point of ++i, increment before it's manipulated operation? the difference between ++i , i++ matters when it's used part of bigger expression, e.g. int j = ++i; // increment use new value assignment int k = i++; // increment, use old value assignment in case operation occurs @ end of each iteration of loop, on own . loop equivalent to: int count = 1; // introduce new scope i, loop { // declaration , initialization int = 1; // condition while (i <= 10) { count = count * i; system.out.print(count); /...

c# - How to use System.Windows in Mono / MonoDevelop? -

i'm trying use rect structure system.windows in monodevelop, can't find system.windows in packages list when try add reference it. there lots of things system.windows.controls.... , system.windows.forms... not system.windows itself. how access rect in monodevelop? the rect structure defined in windowsbase.dll (if targetting .net 4). need add reference assembly access it.

magento - How to get Fedex testing tracking number? -

i'm configuring fedex shipping in magento website. got test account number, password, api key , meter number login in test fedex account. configured myself in magento. looks fine. don't know how test track order. so can tracking number shipping methods? should enter randomly or how can that? tried forum suggested numbers. got below error in popup: tracking information not available i checked shipping_fedex log file in magento. got logged error codes in printed array. that's give in below. **error log** [result] => stdclass object ( [highestseverity] => error [notifications] => stdclass object ( [severity] => error [source] => trck [code] => 6035 [message] => invalid tracking numbers. please check following numbers , resubmit. [localizedmessage] => invalid tracking numbers. please check following numbers , resubmit. ) [version] => stdclass object ( [serviceid] => trck [major] => 5 [intermediate] => 0 [minor] => 0 ) ) fed...

osx - How to get the lyrics of a song from the song file -

Image
itunes lyrics information song file, , want ask if there methods or apis lyrics song file(not use network!),in cocoa or carbon.thank much. :) and there no easy way this. you need use third-party library. and, while there third-party libraries transparently handle reading tags variety of different formats, handle "basic set" of tags way; else, have know formats. for example, taglib , artist, this: taglib::fileref f1("myfile.mp3"); cout << f1.tag()->artist(); taglib::fileref f2("myotherfile.aac"); cout << f2.tag()->artist(); but lyrics, it's this: taglib::mpeg::file f1("myfile.mp3"); taglib::id3v2::framelist frames = f1.id3v2tag()->framelistmap()["uslt"]; if (!frames.isempty()) { taglib::id3v2::unsynchronizedlyricsframe *frame = dynamic_cast<taglib::id3v2::unsynchronizedlyricsframe *>(frames.front()); // there multiple frames here; may want @ language // and/or description...

css selectors - CSS select multiple descendants of another element -

is possible select multiple elements have ancestor of class, id, etc in css? e.g: table.exams caption, tbody, tfoot, thead, tr, th, td if not, there way select descendants of element? is possible select multiple elements have ancestor of class, id, etc in css? currently, not without duplicating entire ancestor selector , specifying of descendants, unfortunately 1 : table.exams caption, table.exams tbody, table.exams tfoot, table.exams thead, table.exams tr, table.exams th, table.exams td it until late after selectors 3 being finalized proposed pseudo-class notation this, , basic implementations have started showing up. see this answer little history lesson. in short, pseudo-class that's entered standard known :matches() . in distant future, once browsers start implementing :matches() , able this: table.exams :matches(caption, tbody, tfoot, thead, tr, th, td) if not, there way select descendants of class? well, can use asterisk * , repre...

c++ - Android native executable linker segfault -

i'm cross-compiling large open-source library android. i've set build tools use android cross-compilers, linker, archivers etc. project builds no errors , creates executable. i've set appropriate sysroot , linked necessary android versions of libraries (gnustl, supc++, , gcc). when attempt run program on emulator, segmentation fault. after hooking gdb server , accessing remotely, error sigsegv: classify_object_over_fdes (ob=0x8929da8, this_fde=0x108b1b8b) @ /users/andrewhsieh/ndk-andrewhsieh/src.1-with-cherrypicks//build/../gcc/gcc-4.4.3/libgcc/../gcc/unwind-dw2-fde.h:175 175 /users/andrewhsieh/ndk-andrewhsieh/src.1-with-cherrypicks//build/../gcc/gcc-4.4.3/libgcc/../gcc/unwind-dw2-fde.h: no such file or directory. in /users/andrewhsieh/ndk-andrewhsieh/src.1-with-cherrypicks//build/../gcc/gcc-4.4.3/libgcc/../gcc/unwind-dw2-fde.h no clue andrew hsieh i'm assuming hes guy build ndk. if grep in android-ndk root directory "unwind-dw2-fde.h" found in lib...

c# - Must declare the scalar variable "@lblCmpUserName" -

when user logs in username , send username next page below code in page_load lblcmpusername.text = server.urldecode(request.querystring["parameter"].tostring()); and want store "company details" username in sql server 2008 table. i got error must declare scalar variable "@lblcmpusername" code: protected void btncmpapproval_click(object sender, eventargs e) { sqlconnection sqlcon = new sqlconnection(getconnectionstring()); string query = "insert company_info2 values (@lblcmpusername, @txtcmpname, @txtregcountry, @txtcmpregno, @txtcmpestdate,@afu1, @txtcmpaddress, @ddladdrin)"; try { sqlcon.open(); sqlcommand cmd = new sqlcommand(query, sqlcon); cmd.commandtype = commandtype.text; cmd.parameters.addwithvalue("@username", lblcmpusername.text); cmd.parameters.addwithvalue("@cmp_name", txtcmpname.text); cmd.parame...

powershell - rdesktop shell escaping issue -

i'm trying send this: get-wmiobject win32_pnpentity |where{$_.deviceid.startswith("pci\ven_10de") -or $_.deviceid.startswith("pci\ven_1002")} over rdesktop like: rdesktop -a8 209.** -u ** -p ** -s "cmd.exe /k powershell.exe get-wmiobject win32_pnpentity |where{\$_.deviceid.startswith("pci\ven_10de") -or $_.deviceid.startswith("pci\ven_1002")}" but windows' shell says: 'where{$_.deviceid.startswith' not recognized internal or externa.... what doing wrong? why not using powershell wmi remoting? $cred = get-credential get-wmiobject win32_pnpentity -computername myremotecomputername - credential $cred |where{$_.deviceid.startswith("pci\ven_10de") -or $_.deviceid.startswith("pci\ven_1002")} -credential needed if actual user running powershell isn't administrator of remote machine.

windows - proc_open is disabled. But not in php.ini -

hello trying use php's proc_open() function on personal windows server, getting error like, php warning : proc_open disabled security reasons. but in php.ini have commented disable_functions , removed blocking these functions. still getting these errors. what wrong? i using zpanel , windows 2008. the problem lied in zpanel's httpd-vhosts.conf file, have windows 2008 server zpanel , suhosin installed, in httpd-vhosts.conf file there php suhosin.func.blackblist = proc_open, commented line, , restarted apache services, working flawlessly fine. thanks taking time read , answer!

sockets - Python TCPServer, error 98, Address already in use -

i faced error 98, address in use problem while kill running python tcpserver server , try re-start it. i noticed there other article , suggest sock.setsockopt(socket.sol_socket, socket.so_reuseaddr, 1) or set tcpserver.allow_reuse_address = true. but still faced same problem, there other reason this? i using redhat el 6.2, python 2.6. thanks the code used was: tcpserver.allow_reuse_address = true tcpserver.__init__(self, (gethostname(), self.server_port),scheddrequesthandler) this keeps on getting me error 98. however if changed to: tcpserver.allow_reuse_address = true tcpserver((gethostname(),self.server_port),scheddrequesthandler) the error gone. i not quite clear why happened?

mime types - text/css transferred as text/plain -

i have webpage transferring stylesheet text/plain mime type. possible reasons occur , tips on how resolve problem. im linking css <link href="/css/app.css" rel="stylesheet" type='text/css'> server misconfiguration. depend on overall configuration error, or on more limited, badly written .htaccess file in css directory, if server running apache.

Since which version is the conditional operator available in Java -

i have used conditional operator in many places within java application. have doubt whether compatible java versions or not. in other words, wanna know since version conditional operator available in java. it available since first release of java. mean java 1.0

java - Troubles with ArrayList -

i having trouble storing objects in arraylist . i want populate arraylist simple object called variable . has 2 string attributes: name , value. problem when add new variable object list, attributes of added variable objects appear null. also, instead of being added end of list, new object inserted @ first position. here code : arraylist<variable> variables = new arraylist<variable>(); variable author = new variable(); author.setname("author"); author.setvalue("lusyo"); variables.add(author); system.out.println(variables.get(0).getname()); variable scenario = new variable(); author.setname("scenario"); author.setvalue("login"); variables.add(scenario); system.out.println(variables.get(0).getname()); system.out.println(variables.get(1).getname()); the output : author scenario null as can see, scenario located @ index 0, should not be. can't figure out what's going on code. thank in advance ! ...