Posts

Showing posts from June, 2015

gssapi requires Ruby version >= 1.9.1. on gem install -

i'm trying install knife-cloudstack plugin using gem install on ubuntu 12.04 chef-client configured , got error said in title. >gem install knife-cloudstack error: error installing knife-cloudstack: gssapi requires ruby version >= 1.9.1 so tried installing apt-get install ruby1.9.3 , still same error. also, version of ruby shown 1.9.3 ruby --version ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux] to more confused, when run sudo update-alternatives --config ruby , showing output as: there 2 choices alternative ruby (providing /usr/bin/ruby). selection path priority status ------------------------------------------------------------ 0 /usr/bin/ruby1.8 50 auto mode 1 /usr/bin/ruby1.8 50 manual mode * 2 /usr/bin/ruby1.9.1 10 manual mode press enter keep current choice[*], or type selection number: ps: * on selection:0, changed la...

java - RSS Feed Parsing, extracting field value -

i totally new in rss feed parsing. trying, duration of mp3 file. unable value specific tag <itunes:duration>01:00:00</itunes:duration> here parsing code: public list<rssitem> parse() { final rssitem currentmessage = new rssitem(); rootelement root = new rootelement("rss"); final list<rssitem> messages = new arraylist<rssitem>(); element channel = root.getchild("channel"); element item = channel.getchild(item); item.setendelementlistener(new endelementlistener() { public void end() { messages.add(currentmessage.copy()); } }); item.getchild(title).setendtextelementlistener( new endtextelementlistener() { public void end(string body) { currentmessage.settitle(body); } }); item.getchild(link).setendtextelementlistener( new endtextelementlistener() { public void end...

c++ - How to debug crashes that occur in release builds only -

i have weird race condition in 1 of programs causes crash in release mode , outside visual studio environment. if launch process in release mode inside visual studio f5 (either release or debug), works. if create release copy debug information doesn't crash. i'm wondering how 1 debug such problem.. , why isn't crashing inside visual studio? visual studio slow down executable when launching release version of it? the question how debug application without changing runtime behavior causes crash. answer better post-mortem diagnostics you can improve exception handling code , if production application, should. install custom termination handler using std::set_terminate if want debug problem locally, run endless loop inside termination handler , output text console notify std::terminate has been called. attach debugger , check call stack. in production application might want send error report home, ideally small memory dump allows analyze problem....

sql - Ridiculously huge impact of comparison operator on query execution duration -

i have following views defined: dsplit_base - union of 4 queries each of simple join between fact , mapping tables (contains call statistics); consists of 201 columns calls_check - view derived dsplit_base meant used in data consistency check. here definition: select a.brand, a.[call center] , c.date, c.weekday, count(*) vol, cast((count(*)-g.vol) real)/g.vol*100 vol_diff , sum(abncalls+acdcalls) calls , case when g.calls<>0 cast((sum(abncalls+acdcalls)-g.calls) real)/g.calls*100 else case when sum(abncalls+acdcalls)<>0 100 else 0 end end calls_diff dsplit_base join calendar c on a.row_date=c.date join ( select t.brand, t.[call center], c.weekday, avg(cast(vol bigint)) vol, avg(cast(calls bigint)) calls ( select brand, [call center], row_date, count(*) vol, sum(ab...

html - Move div inside new child in Jquery -

how move div (keeping instantiated js) new child div same div? lets have this: <div id="container"> /*lots of content draggables, scrolls, ..*/ </div> i want this: <div id="container"> <div class="innerzone"> /*lots of content draggables, scrolls, ..*/ </div> </div> use: .wrapinner() $('#container').wrapinner('<div class="innerzone" />');

java - Null pointer exception when ran outside netbeans -

when run bit of code outside of netbeans null pointer exception. i'm trying read .dat file. works fine in netbeans. i've checked path many times , right. class loader or supposed used? static string filename = "src/frogger/highscores.dat"; try { //make filereader object read file file = new filereader(new file(filename)); filestream = new bufferedreader(file); } catch (exception e) { system.out.println("file not found"); } i imagining being used images, doesn't work. file = new filereader(new file(this.getclass().getresource(filename))); or file = new filereader(this.getclass().getresource(filename)); error microsoft windows [version 6.1.7601] copyright (c) 2009 microsoft corporation. rights reserved. c:\users\michael>java -jar "c:\users\michael\documents\netbeansprojects\frogger\ dist\frogger.jar" file not found exception in thread "main" java.lang.nullpointerexcepti...

nginx/plesk, nodejs+apache - rooting -

facts: -ubuntu -plesk 11.0.9 -node.js/apache -nginx i want run node/apache on same server, thought nginx wld right way so installed nginx via plesk the problem dont find fitting tutorial/ don't know data edit problem solved the setting should easy - subdoma.dom.com => apache subdomb.dom.com => node so need simple if or whatever changes port either apache or node sth like if(subdom) if(subdoma) changeport 1111 (apache) else if(subdomb) changeport 2222 (node) else changeport 1111 (apache) there plesk extension allows run node applications. http://ext.plesk.com/packages/28f799af-1ff4-4bb8-9c87-a04f0f23d32e-jxcore-support

python - pickling dict inherited class is missing internal values -

i've played around bit code , reason failure when setting 'wham' value instance of class testdict works fine long don't try pickle , unpickle it. because if self.test missing. traceback: traceback (most recent call last): file "test.py", line 30, in <module> loads_a = loads(dumps_a) file "test.py", line 15, in __setitem__ if self.test == false: attributeerror: 'testdict' object has no attribute 'test' the code: from pickle import dumps, loads class testdict(dict): def __init__(self, test=false, data={}): super().__init__(data) self.test = test def __getitem__(self, k): if self.test == false: pass return dict.__getitem__(self, k) def __setitem__(self, k, v): if self.test == false: pass if type(v) == dict: super().__setitem__(k, testdict(false, v)) else: super().__setitem__(k, v) if __...

ios - CTFont with CTStringAttributes and NSMutableAttributedString crashes my app in xamarin -

i'm trying create nsmutableattributedstring , set properties setproperties method. app crashes error, monotouch.foundation.monotouchexception exception - nsinvalidargumentexception reason: unrecognized selector sent instance 0xc305d00.* code: var richtask = new nsmutableattributedstring ("random"); var fda = new ctfontdescriptorattributes { familyname = "courier", stylename = "bold", size = 18f }; var fd = new ctfontdescriptor (fda); var font = new ctfont (fd, 0); var attrs = new ctstringattributes { font = font }; var range = new nsrange (0, 3); richtask.setattributes(attrs, range); _label.attributedtext = richtask; this code in getcell method of uitableviewcontroller . want able change font or color of first 3-4 letters of string. i figured out if eliminate font component , set property, example, strokewidth , works fine var attrs = new ctstringattributes { /*font = font*/ strokewidth = 5f }; so seems font initial...

vs2008 compiler and dubuger work in wrong way -

recently ,my vs2008 work in wrong way ,for instance : int avalue =30; int tempvalue=avalue; if (avalue>25) { tempvalue =avalue+5; } running in debuger way,what has happen compiler, value of "avalue" change 35,i try time ,but there nothing happen.and restart vs2008 compiler ,the value of "avalue" 35.it work in fine way since restart computer. 1>e:\learnprj\towerdefence\towerdefence\classes\helloworldscene.cpp(148) : error c2143: 语法错误 : 缺少“;”(在“{”的前面) 1>e:\learnprj\towerdefence\towerdefence\classes\helloworldscene.cpp(150) : error c2143: 语法错误 : 缺少“;”(在“{”的前面) 1>e:\learnprj\towerdefence\towerdefence\classes\helloworldscene.cpp(155) : error c2143: 语法错误 : 缺少“;”(在“}”的前面) 1>e:\learnprj\towerdefence\towerdefence\classes\helloworldscene.cpp(156) : error c2143: 语法错误 : 缺少“;”(在“}”的前面) 1>e:\learnprj\towerdefence\towerdefence\classes\helloworldscene.cpp(157) : error c2143: 语法错误 : 缺少“;”(在“}”的前面) 1>e:\learnprj\towerdefen...

php - Magento AHT Slideshow plugin - Fatal error: Call to a member function setProductsRelated() on a non-object -

Image
we using aht magento plugin manage slideshows, , when selecting static blocks menu item on left, error: fatal error: call member function setproductsrelated() on non-object in /www/app/code/local/aht/aslideshow/controllers/adminhtml/slideshowcontroller.php on line 270 the line in question looks (the getlayout one): `public function staticblockaction() { $this->_initaction(); $this->loadlayout(); $this->getlayout()->getblock('aslideshow.slideshow.edit.tab.staticblocks') ->setproductsrelated($this->getrequest()->getpost('staticblocks_slideshow', null)); $this->renderlayout(); } `

Buildbot: Is there a way to force all the builders to build? -

so, problem: have buildbot set build @ 3 pm, altho when work during night, in situation need trigger builders. i aware use buildmaster make fake commit , trigger build, trying achieve here "mass rebuild", if go in each specific builder, select build, , push "rebuild" button. i can't figure out button doing, looking @ page code (i no html expert), , in documentation of buildbot seems there no trace of how standard pages came buildbot structured , operate. i wish add button in waterfall can force builders (they 26, can imagine effort trigger them 1 one). does knows command used "rebuild" button, , how can take advantage of build builders? thanks! at bottom of builders page have (or can configure) "force selected builds" , "force builds" menus if don't have can configure users = [(user, password)] authz_cfg=authz.authz(auth=basicauth(users), forcebuild = 'auth', forceallbuilds = true, ca...

Proxying Android webview (not on system level) -

are there anyways programmatically proxy android webview requests within application only? (i want requests passed through embedded proxy) of solutions have found far system level , change proxy settings whole android device, not want.

winapi - Shell Extensions: Static-Linking vs. Dynamic-Linking of C/C++ Run-Time DLLs -

when building windows explorer shell extensions (currently using vs2010 sp1), suggest static-linking (to crt, c++ run-time , other support libraries atl) or dynamic-linking ? one of benefits of static-linking option make deployment easier (in fact, in way, it's possible deploy shell extension in-proc com server dll, without external dependencies on other c/c++ run-time dlls). in case of dynamic-linking , if msvcr100.dll , msvcp100.dll , etc. dlls in windows\system32 used shell extension, thing if microsoft fixes (e.g. security fixes) in dlls, the fixes automatically used custom shell extension . however, bad thing "global" fixes may introduce bugs , break things in dependant code. as app-local deployment of vcredist dlls, i'm not sure how might work in case of shell extension. kind of manifest should embedded in shell extension com dll refer vcredist dlls under shell extension's folder? having use dll version of crt pretty hard requirem...

sphinx - Sphinxsearch maintain sql ordering -

so have query similar https://stackoverflow.com/a/18462040/1768337 , can see, rows ordered according likes. let's create index using sql statement in link above. there way output sql statement gives? is, maintain ordering set in sql statement? tried rank rows following, source popular { type = mysql sql_host = -------- sql_user = -------- sql_pass = -------- sql_db = -------- sql_port = 3306 # optional, default 3306 sql_query = \ set @rank=0; \ select *, @rank := @rank + 1 rank \ \ ( \ select p.id id, p.search search, count(case when li.date > date_sub(curdate(), interval 1 day) li.id end) daily_likes, count(case when li.date > date_sub(curdate(), interval 7 day) li.id end) weekly_likes, count(li.id) total_likes \ `photo` p \ join `like` li \ on p.id = li.photo_id \ \ li.date > d...

jquery - Is it possible to get the target css property value during a css3 transition in Javascript? -

i've 2 divs positioned absolutly , position them relative each other. when width of 1 change, recalculate , set positions. while use css3 transition on ' width ' property, when try ' width ' of animated one, gives me current value on dom. want target value of transition set positions correctly on begin of transition effect. possible target value via javascript or other ways? edit below jsfiddle demonstrates issue. alerts '100px' need '300px'. http://jsfiddle.net/mdbgs/ thanks. that's because .css('width') calling getcomputedstyle on element, return transitioning value. if did directly access style, had set: document.getelementbyid('transition_div').style.width $('#transition_div').prop('style').width $('#transition_div')[0].style.width ( updated fiddle )

android - Unable to connect to xmpp server in phonegap with openfire server using strophe.js -

i new phonegap.iam using coredova latest version 2.9.0 developing chatting application connecting xmpp server open fire server..i have been searching related storph.js code in phonegap since last 2 days.i didn't running code in phonegap,getting status '1' means connecting..can helps...thanks in advace. <html> <head> <title> phonegap xmpp tutorial </title> </head> <script type="text/javascript" charset="utf-8" src="coredova-2.9.0.js"></script> <script type="text/javascript" charset="utf-8" src="strophe.js"></script> <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js'></script> <script> function connect() { var username="xxx"; var host_domain="xxx"; var password="xxx"; var bosh_service = "xxxxx"; connection = new strophe.connection(bosh_service...

MS Word VBA - Finding a word and changing its style -

i'm trying find instances of key words in ms word document , change style. key words stored within array , want change style of particular word only. ideally happen type not crucial. attempt 1 - based on recording macro , changing search term sub woohoo() dim mykeywords mykeywords= array("word1","word2","word3") myword= lbound(mykeywords) ubound(mykeywords) selection.find.clearformatting selection.find.replacement.clearformatting selection.find.replacement.style = activedocument.styles("newstyle") selection.find .text = mykeywords(myword) .replacement.text = mykeywords(myword) .forward = true .wrap = wdfindcontinue .format = true .matchcase = false .matchwholeword = true .matchwildcards = false .matchsoundslike = false .matchallwordforms = false end selection.find.execute replace:=wdreplaceall next end sub this changes style of...

java - JDesktopPane resize -

we have application 2 jframes 2 jdesktoppanes. need move internal frame 1 frame another. the problem have after move internalframe first window second window, when resize fist window, internal frame of second window gets resized. import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.beans.propertyvetoexception; import javax.swing.jdesktoppane; import javax.swing.jframe; import javax.swing.jinternalframe; import javax.swing.jmenu; import javax.swing.jmenubar; import javax.swing.jmenuitem; class firstframe extends jframe { jdesktoppane desktoppane = new jdesktoppane(); secondframe secondframe; public firstframe(secondframe secondframe) { this.secondframe = secondframe; settitle("firstframe example"); setdefaultcloseoperation(exit_on_close); add(desktoppane); jmenubar menubar = new jmenubar(); jmenu menu = new jmenu("file"); jmenuitem item = new jmenuitem("move"); item.addact...

numpy - Python SciPy Possible cases of n choose k -

a = [1, 2, 3, 4, 5, 6] # or ! = ['one', 'two', 'three', 'four', 'five', 'six'] in situation, want know possible combinations; choose k elements among a . if use b = scipy.misc.comb(a, 1) , shows: b = [1, 2, 3, 4, 5, 6] where b i a i choose 1. , doesn't work if a array of strings. what wanted is: b = [[1], [2], [3], [4], [5], [6]] # or ! b = [['one'], ['two'], ['three'], ['four'], ['five'], ['six']] which means, possible set of 1 chosen element among elements in array a it easy if use matlab. i'm trying use scipy stack. any reason using scipy , not itertools particular problem? looking itertools.combinations or itertools.permutations may provide more adequate solution.

iphone - IOS error compiling source code? -

i downloaded source code ios coloring book from github : when try compile these errors, , don't understand mean: 0 clang 0x0000000100c57bb2 main + 12932498 clang: error: unable execute command: segmentation fault: 11 clang: error: clang frontend command failed due signal (use -v see invocation) apple llvm version 4.2 (clang-425.0.28) (based on llvm 3.2svn) target: i386-apple-darwin11.4.2 thread model: posix clang: note: diagnostic msg: please submit bug report http://developer.apple.com/bugreporter/ , include crash backtrace, preprocessed source, , associated run script. clang: error: unable execute command: segmentation fault: 11 clang: note: diagnostic msg: error generating preprocessed source(s). command /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang failed exit code 254 did follow instructions? tried build after cloning primary directory, got lots of problems, re-read instructions , found this: instructions ...

sql - How can i use INSERT as subquery in SELECT statement in sqlite? -

i want this. dont know proper syntax. select id table1 name = (insert table1 (name) values ('value_abcd')) so have table autoincrementing primary key, , want know value after have inserted record. in sql, can use last_insert_rowid function: insert table1(name) values('value_abcd'); select last_insert_rowid(); however, in cases not need execute separate select query because libraries have function return value. example, sqlite's c api has sqlite3_last_insert_rowid function, , android's insert function returns id directly.

variables - How to subtract db values using php -

how subtract values database using php? see plenty of examples using static variables such <?php $first_number = 10; $second_number = 2; $third_number = 3; $sum_total = $third_number + $second_number * $first_number; print ($sum_total); ?> however i'm looking subtract 1 database value another, multiply value db value. give more detail, have inventory database i'm echoing values table, i'm attempting subtract total quantity of item minimum quantity, see how many need ordered, multiply number of parts need order cost of part. i've dug around , found few possible methods such as $query = "select `db`, (`minimumquantity` - `totalquantity`) `quantitytoorder` `db` id ='".$id."';" and <?php $minimumquantity = $_get['minimumquantity']; $totalquantity = $_get['totalquantity']; $quantitytoorder = $minimumquantity - $totalquantity; print ($quantitytoorder); ?> please before laugh, i...

Java. InetAddress.getLocalHost returns strange IP -

i'm don't understand, why code below prints 0.0.9.229 instead 127.0.0.1. can tell me, hot fix that? string ha = inetaddress.getlocalhost().gethostaddress(); system.out.println(ha); upd: code running on ubuntu /etc/hosts 127.0.0.1 localhost 127.0.1.1 2533 inetaddress.getlocalhost() doesn't people think does. returns hostname of machine, , ip address associated hostname. may address used connect outside world. may not. depends on how have system configured. on windowsbox gets machine name , external ip address. on linux box returns hostname , 127.0.0.1 because have set in /etc/hosts

javascript - Creating Windows 8 tiles using CSS? -

i'm on mission create site looks windows 8 start menu . will possible create tiles , grid layout using purely css , floats, or javascript required positioning? creating tiles straightforward using css. as position, again use div's careful planning. for scrolling tiles, css3 transitions, or jquery animate(). as pointed out above, grid layout idea. edit: @above comments, wouldn't html5 drag & drop viable alternative user wouldn't want use js/jquery?

printing - Thermal Printer - Laptop via FTDI Basic Board and C# -

i'm attempting set link between laptop thermal printer (bought sparkfun) through ftdi basic board using c# (running mono 3.2 under mac 10.8). i've been using .net library from: http://electronicfields.wordpress.com/2011/09/29/thermal-printer-dot-net/ https://github.com/yukimizake/thermaldotnet the code doesn't seem have errors (i've changed serial ports , baudrate match settings) , seems run through whole program on terminal. however, fails interact printer , consequence nothing printed. this exact code i'm using: using system; using system.io; using system.text; using system.threading; using system.io.ports; //using system.collections.generic; //using system.drawing; using thermaldotnet; using microsoft.spot; namespace thermalprintertestapp { class printerclass { serialport printerport; thermalprinter printer; public printerclass(string printerportname = "/dev/tty.usbserial-ad025hp0") { //serial port init p...

c# - What is the best practice for capturing all inner exception details? -

this question has answer here: what proper way display full innerexception? 5 answers what best practice logging complete exception details including possible inner exceptions? currently, use following code: try { //some code throws exception } catch(exception ex) { { console.writeline(ex.message+ex.stacktrace); ex=ex.innerexception; }while(ex!=null) } are there scenarios code may fail? have tried using ex.tostring() ? gives (if not all) of data need diagnose - including message details, stack trace, , inner exceptions: from msdn : tostring returns representation of current exception intended understood humans. exception contains culture-sensitive data, string representation returned tostring required take account current system culture. although there no exact requirements format of returned string, s...

vhdl - generate targets in makefile depending on input text file -

i'm new here , @ using makefiles. have question please: i had3 tests execute: i added manually test1, test2 , test3 targets in make file this: test1: compile_design compile test1_testname.vhd >> log_file.log simulate test1_testname i did samething test2 , 3. also added all : test1 test2 test3 this works wonderfully. now, want make makefile more portable: input file contains following information: test1_testname test2_testname test3_testname i want 3 targets added automatically , in general n targets if input file contains n lines. you don't need use source file. may easier list targets @ top of makefile. then, using pattern rules, can have want following. tests=test1_testname test2_testname test3_testname all: $(tests) %_testname: compile_design compile $@.vhd >> log_file.log simulate $@ you can note pattern rule defines targets test1_testname instead of shorter test1 . avoid having % pattern rule. if want use fi...

c# - Claims permission check fails when ClaimsPrincipalPermission is applied to class & method within it -

i have following class: [claimsprincipalpermission(securityaction.demand, operation = "view", resource = "agreement")] public class agreementviewmodel : screen { [claimsprincipalpermission(securityaction.assert, operation = "save", resource = "agreement")] public async void save() { } } my problem though principal has both claims specified above, call save fails. if take off claims class level works fine. class instantiates fine. "manual" check figure out if user can execute action works fine, it's actual execution fails. manual check defined following: public bool canexecute(object sender, [callermembername] string callermethod = null) { string targetmethodname = callermethod; if (callermethod == null) return true; if (callermethod.startswith("can")) targetmethodname = callermethod.substring(3, callermethod.length - 3); if (string.is...

sql server - SQL query to fast data generation -

i have created query generate data sql databases, generation of 1 gb data takes 45 minutes. how increase performance of data generation? declare @rowcount int declare @rowstring varchar(10) declare @random int declare @upper int declare @lower int declare @insertdate datetime set @lower = -730 set @upper = -1 set @rowcount = 0 while @rowcount < 3000000 begin set @rowstring = cast(@rowcount varchar(10)) select @random = round(((@upper - @lower -1) * rand() + @lower), 0) set @insertdate = dateadd(dd, @random, getdate()) insert table_1 (q ,w ,e ,r ,t ,y) values (replicate('0', 10 - datalength(@rowstring)) + @rowstring , @insertdate ,dateadd(dd, 1, @insertdate) ,dateadd(dd, 2, @insertdate) ,dateadd(dd, 3, @insertdate) ,dateadd(dd, 4, @insertdate)) set @rowcount = @rowcount + 1 end you may try following also: ;with seq ( select top (3000000) n = row_number() on (order @@spid) - 1 sys.all_columns c1, sys.all_columns c2 ) inser...

PHP square brackets syntax -

given code snippet: $nodes[$record->nid]->group = $record->group; i not understand first part (to left of equals sign) means? thanks. $nodes array, , $record->nid index in array. code valid, $record->nid must either string or integer. calling $nodes[$record->nid] return object, calling group on.

javascript - Conditional Loading of CSS files based on test condition in JQuery plugin -

i'm looking best approach conditionally load files based on specific set of conditions. i have 3 css files , 2 javascript files i'm loading so: <link href="core.min.css" rel="stylesheet" type="text/css"> <link href="add_regular.min.css" rel="stylesheet" type="text/css"> <link href="add_retina.min.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="jquery-plugin.min.js"></script> as evident fourth file jquery , fifth jquery plugin. inside jquery plugin series of functions tests e.g. ismobile , isretina , isphone , etc. however, let's focus on isretina . what trying accomplish follows: load jquery , jquery plugin first use isretina function inside jquery plugin check whether device has retina display loa...

php sanitize an array with a given function -

i have simple sanitize function nests switch statement inside of foreach statement read somewhere bad practice, haven't been able come better solution, code follows, appreciated... public static function db_sanitize($input, $santype = 'sql', $cleankeys = false) { $type = strtoupper($santype); if (!is_array($input)) { $input = array($input); } foreach ($input $key => $value) { switch ($type) { case 'sql': if ($cleankeys) { $key = $this->_mysqli->escape_string($key); } $value = $this->_mysqli->escape_string($value); $clean[$key] = $value; break; case 'html': if ($cleankeys) { $key = htmlentities($key); } $value = htmlentities($value); $clean[$key] = $value; break; default: ...

php - How to limit content with html tags in a DIV -

i have text editor in website , customer's job is: "text pasting microsoft office". , microsoft office embed many tags in background , tags destroy page view. i can't use bbcode , can't limit users. how can limit tags in div when html tags crashed, page view not destroy? how keep page style without attention pasted text form microsoft office? recommend? you can use ckeditor support cut,copy , paste word document text editor. this manual http://docs.cksource.com/ckeditor_3.x/users_guide/document/cut,_copy_and_paste

python - Django MVT design: Should I have all the code in models or views? -

i'm pretty novice i'll try explain in way can understand mean. i'm coding simple application in django track cash operations, track amounts, etc. so have account model (with amount field track how many money inside) , operation model(with amount field well). i've created model helper called account.add_operation(amount). here question: should include inside code create new operation inside account.add_operation(amount) or should in views? and, should call save() method in models (for example @ end of account.add_operation() or must called in views?) what's best approach, have code inside models or inside views? thanks attention , patience. experienced django users seem err on side of putting code in models. in part, that's because it's lot easier unit test models - they're pretty self-contained, whereas views touch both models , templates. beyond that, ask if code pertains model or whether it's specific way it's being...

zos - Sending AMQP messages from an IBM Mainframe -

we looking put mainframe on bus. believe as400. want have cics mainframe send amqp message broker. there dozens of amqp clients including jms client. don’t know enough possible on mainframe if can use 1 of these client send amqp message mainframe broker. has done , if advise in doing this? ibm i series (as/400) not mainframes. considered midrange machine. ibm z series mainframes. i regularly use apache activemq on ibm i. has excellent java support ibm jdk. it understanding ibm z series has excellent java support. ibm offers websphere mq can't find information on whether supports amqp protocol.

python - telnet to several devices and return command output -

i running python (ver. 2.6.2) on linux machine , need able telnet long list of devices (about 300) send command "sho ser" , return resulting output of command file , each sequential device down list add it's output new line. devices listed on separate lines in file i found code got me started post not sure go here. can open list have called "hostlist" im not sure how tell python telnet 1 device, run command, exit, go next. appreciated import getpass import sys import telnetlib f = open('hostlist', 'r') host = "%s" % f user = raw_input("enter login name: ") password = getpass.getpass() tn = telnetlib.telnet(host) tn.read_until("login: ") tn.write(user + "\n") if password: tn.read_until("password: ") tn.write(password + "\n") tn.write("show ver\n") tn.write("exit\n") print tn.read_all() receiving error enter login name: k3grb6hj9ld93a2 password...

c# - Specifying Area to search for Views in -

i have mvc4 app uses 1 area (in addition normal location). working fine routing, have need code in 'root' location find partial view inside area. the relevant parts of solution's files are: /areas /areas/admin /areas/admin/views /areas/admin/views/shared/_adminpartialview.cshtml /views /views/shared/_rootpartialview.cshtml and failing code is: var viewengine = new razorviewengine(); var ccontext = new controllercontext(context, new routedata(), new emptycontroller()); // works: var rootview = viewengine.findpartialview(ccontext, "_rootpartialview", false); if (rootview == null) { throw new exception("root view not found"); } // throws error: var adminview = viewengine.findpartialview(ccontext, "_adminpartialview", false); if (adminview == null) { throw new exception("admin view not found"); } ( context above coming indirectly httpcontext.current) ... makes sense, without area specified admin area shouldn't searc...

java - GWT- SingleSelectionModel celltable- how to change selected cell's CSS? -

i have cell table here: http://gwt.googleusercontent.com/samples/showcase/showcase.html#!cwcelltable but without ui binder (not sure thats about, project not use it) anyways, need way edit cell row selection css , cant find way. right when select row outlines row, need way change cells background color , edit default behavior. i know can set css table using celltable.setstylename("mycssfile") how set individual cell row? have no individual cell reference currently, , reference try put in front of celltable not compile. when construct celltable, grabs default clientbundle implementation (see gwt clientbundle details ), adds celltablekeyboardselectedrow css class name selected row. clientbundle obfuscates class names, shows strange alphanumeric name if @ source. css class name defined in celltable.css , located in gwt-user.jar/com/google/gwt/user/cellview/client/celltable.css . if don't way looks, can implement own clientbundle (or extend celltable...

java - Calculating perimeter and area of a rectangle -

i need able input length , width of rectangle console , calculate perimeter , area. have working other accepting inputs calculations. know i'm close, can't seem figure out. in advance help. keep in mind i'm novice put nicely, answers may not make sense me @ first. cannot calculate values input console. package edu.purdue.cnit325_lab1; public class rectangle { private static double length; private static double width; public rectangle() { length=0.0; width=0.0; } public rectangle(double l, double w) { length = l; width = w; } public double findarea() { return length*width; } public double findperim() { return length*2 + width*2; } } package edu.purdue.cnit325_lab1; import java.util.scanner; public class testrectangle { /** * @param args */ public static void main(string[] args) { // todo auto-generated method stub scanner scanl = ...

html - why the gray background push information to the right? -

Image
as saw example image posted, gray box push information far right. don't want that. want information display right next menu column on left side. how can rid of gray background? i put example on jsfiddle, http://jsfiddle.net/4efjh/ here html codes, <!-- #include file="../common.inc" --> <!-- #include file="dbconn.inc" --> <% response.buffer=true theuid = right(lcase(request.servervariables("logon_user")),7) 'response.write vadminrole if instr(ucase(vadminrole),ucase("admin")) = 0 oconn.close set oconn = nothing response.redirect "../denied.asp" end if %> <!-- #include file="../includes/send_mail.inc" --> <!-- #include file="../includes/dspfunctions.inc" --> <!-- #include file="emails.inc" --> <html> <head> <link rel="stylesheet" href="http://usmdlcdoww002.intranet.dow.com/common/dow/includes/default.cs...