Posts

Showing posts from September, 2011

Scrapy: MySQL Pipeline -- Unexpected Errors Encountered -

i'm getting number of errors, depending upon being inserted/updated. here code processing item: def process_item(self, item, spider): try: if 'producer' in item: self.cursor.execute("""insert producers (title, producer) values (%s, %s)""", (item['title'], item['producer'])) elif 'actor' in item: self.cursor.execute("""insert actors (title, actor) values (%s, %s)""", (item['title'], item['actor'])) elif 'director' in item: self.cursor.execute("""insert directors (title, director) values (%s, %s)""", (item['title'], item['director'])) else: self.cursor.execute("""update example_movie set distributor=%s, rating=%s, genre=%s, budget=%s title=%s""", (item['distributor'], item['rating'], ite...

java - using ehcache in a dropwizard project -

i using dropwizard create restful service. avoid hammering database, looking caching solution in java. searching web lead me ehcache. have read documentation bit, not clear me how use ehcache in dropwizard project. for instance, configuration file go? need me start using cache. if difficult integrate, suited caching solution dropwizard project? thanks! if want simpler (than ehcache) cache framework/api, consider using cachebuidler guava: https://code.google.com/p/guava-libraries/wiki/cachesexplained a typical cache implementation , use requires few lines of code , no configuration files.

jsf - Setting commandLink value through ManagedBean -

i have been using primefaces in jsf , trying set commandlink value through managedbean class. <p:commandlink value="#{loginbean.userclass}" id="userclass" action="{user.userclassaction}" /> managedbean: public string getuserclass() { return "userclass"; } i asking that, correct way process server side any suggestion .. format correct , if how can use appropriate way. what want achieve? value text of link. "userclass" in case , i'm not sure makes sense here. if want change css class may via styleclass attribute. if want have kind of dynamic text link. yes, using managed bean (non-hacky) way so. if want care internationalization, better use standard java-way that. using .properties files, referencing them via #{msg['key']} , declaring them jsf via: <resource-bundle> <base-name>your.pkg.messagebundle</base-name> <var>msg</var> </resourc...

ios - Using variables defined in one method inside another in Objective-C -

i have function so: (and ps - new ios development) - (void)loadjson { dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ nsurl *url = [nsurl urlwithstring:@"http://jamessuske.com/isthedomeopen/isthedomeopengetdata.php"]; nsdata *data = [nsdata datawithcontentsofurl:url options:0 error:nil]; nsarray *array = [nsjsonserialization jsonobjectwithdata:data options:0 error:nil]; nsarray *firstitemarray = array[0]; nsstring *yesnostring = firstitemarray[0]; nsstring *datestring = firstitemarray[1]; nsstring *timestring = firstitemarray[2]; nsstring *homestring = firstitemarray[3]; nsstring *awaystring = firstitemarray[4]; nsstring *lastupdatedstring = firstitemarray[5]; nsstring *previousisopen = firstitemarray[6]; nsstring *previousdate = firstitemarray[7]; nsstring *previoushome ...

objective c - Custom accessoryView image and accessoryButtonTappedForRowWithIndexPath -

i trying custom image working accessorybuttontappedforrowwithindexpath function. understand in order this, have use uibutton , adding uiimageview on uitableviewcellaccessorydetaildisclosurebutton not work. my problem how touch gesture uitableviewcell subclass parent uitableview function. here code in uitableviewcell subclass: upvote = [uibutton buttonwithtype:uibuttontypecustom]; uiimage *upvoteimg = [uiimage imagenamed:@"vote.png"]; upvote.frame = cgrectmake(self.frame.size.width-upvoteimg.size.width, 0, upvoteimg.size.width , upvoteimg.size.height); [upvote setbackgroundimage:upvoteimg forstate:uicontrolstatenormal]; [self.contentview addsubview:upvote]; [upvote addtarget:self action:@selector(checkbuttontapped:event:) forcontrolevents:uicontroleventtouchupinside]; the calling function (also inside subclass of uitableviewcell ) - (void)checkbuttontapped:(id)sender event:(id)event { uitableview *tableview = (uitableview *)self.superview; [tablev...

c# - Why this file "ProjectName_TemporaryKey.pfx" gets created in my project? -

why file "projectname_temporarykey.pfx" gets created in project? , use in project. have edm in project , forms, etc. thanks in advance. this file used code signing: assembly signing (also called strong-name signing) gives application or component unique identity other software can use identify , refer explicitly it. strong name consists of simple text name, version number, culture information (if provided), plus public/private key pair. information stored in key file; can personal information exchange (pfx) file or certificate current user's windows certificate store here bit more info.

javascript - Pointing to div of other page -

i have 2 html pages (say 1.html , 2.html) want display in 2 different frames. 1.html contains table rows. each row contains details have stored in 2.html using div each row. want hide these div's nothing should displayed in 2.html. when select row 1.html, respective details (div) in 2.html should displayed. any thoughts. here's guideline: you can address window.parent of iframe , trigger functions in it. functions can address child iframe . for instance: right frame javascript: window.parent.changeleftiframe(); parent javascript: function changeleftiframe() { document.getelementbyid("leftframe").change(); } left frame javascript: function change() { document.getelementbyid("leftframe").style = "background-color: red"; } and there go, can manipulate 1 iframe one.

how to fetch the active record by passing the ID in Sql server -

i have following database design: table content id status replacedid 1 c null 2 c 1 3 c 2 4 3 5 null 6 null 7 null the logic here follows id "1" canceled , instead id "2" created record 2 has reference id "1" in replacedid column. id 2 canceled , id "3" created , "3" canceled , "4" created. canceled records status "c" , active records status "a" my requirement : i have show active record id passing id (1) if canceled record othere wise same record if active record. declare @table table( recordid int, status varchar(20), parentid int ) insert @table select 1,'c',null insert @table select 2,'c',1 insert @table select 3,'c',2 insert @table select 4,'a',3 insert @table select 5,'a',null insert @table select 6,'a',null declare...

java - Allignment of elements on JFrame -

here code excerpt jbutton browse,upload; jpanel panel; jlabel username,path; final jtextfield usernametext,pathtext; final jtextarea statustext; inputwindow() { username = new jlabel(); username.settext("username:"); usernametext = new jtextfield(15); startdate = new jlabel(); startdate.settext("start date :"); startdatetext = new jpasswordfield(15); path = new jlabel(); path.settext("file path :"); pathtext = new jpasswordfield(15); browse=new jbutton("browse.."); upload=new jbutton("upload.."); statustext = new jtextarea(35, 35); } how should add jframe or jpanel align in folowing ways row 1 ---> username , username text row 2 ---> startdate , startdatetext row 3 ---> path, pathtext, browse , upload row 4 ---> statustext i have though time aligning elements. please guide. not best way, easiest understandable way! put want in row in 1 jtable, example: j...

date - Java 7 NIO.2 Files.getLastModifiedTime time zone -

i'm writing program needs determine files/directories last modified time. want handle time using joda time, , i'm using java 7 nio.2 class files file last modified time. getlastmodifiedtime() method returns instance of filetime class, has convenient method tomillis() , result pass joda time datetime class constructor: new datetime(files.getlastmodifiedtime(path).tomillis()); however, have feeling i'm doing wrong, since datetime(long) constructor explicitly mentions datetime instance created default time zone. filetime docs, however, not mention time zone anywhere. looked through filetime code; seems simple, , tostring() method suggests using utc time zone (it creates calendar in utc time zone , sets milliseconds directly). so, filetime uses utc or local time? correct way convert filetime datetime ? a java millisecond timestamp utc timestamp. it's filetime.tomillis() returns, , datetime constructor expects. same applies other java api m...

c++ - How to cast from hex to int and char? -

is there way convert/cast hex decimal , form hex char? example if have: string hexfile = string(argv[1]); ifstream ifile; if(ifile) ifile.open(hexfile, ios::binary); int = ifile.get(); // getting hex form hexfile , want char c = ifile.get(); // convert decimal representation int , char thank you. std::string s="1f"; int x; std::stringstream ss; ss << std::hex << s; ss >> x; std::cout<<x<<std::endl; //this base 10 value std::cout<<static_cast<char> (x)<<std::endl; //this ascii equivalent

Save disabled CSS properties in Chrome Developer Tools -

when inspecting element using developer tools in chrome have option disable style properties unchecking it. once uncheck box (let's border: 1px solid ) border disappear , style property in editor appear strikethrough click on 'sources' tab save changes out of editor unchecked styles return. have once noticed when going on 'sources' tab save out changes, unchecked styles commented out allowing me save changes without manually removing code. does know how save out unchecked (removed) styles? update: okay i've figured out. here's example: this in devtools editor; #content .text { display: block; font-weight: 700; margin: 0 0 8px; } if uncheck of these styles, take effect in browser immediately, , hit source tab styles still there in stylesheet: #content .text { display: block; font-weight: 700; margin: 0 0 8px; } but, if make edit 1 of other properties, let's say, changing margin read 7px, whilst unchecking ...

javascript - jquery : add option value in array object -

i using jquery datatables , have 2x table aocolumns option , 1x without aocolumns so want following if(aocolumns != false) add option in array i tried didnt work function data_table_function(file,language,serverparams,row_call_back,pagation,columns_sort,aocolumndefs){ var options_data_table = {}; options_data_table = { "bprocessing": true, "bserverside": true, "sajaxsource": file, "spaginationtype": "full_numbers", "bpaginate": true, "olanguage": language, "idisplaylength": 25, "alengthmenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "الكل"] ], "fnserverparams": serverparams, "aasorting": [[ 0, "desc" ]], "fnrowcallback": row_call_back, "fndrawcallback": pagation, "binfo": false...

python 2.7 - How to get the item inside dd? -

i want things inside dd only. have code: import urllib bs4 import beautifulsoup url = 'http://www.brothersoft.com/windows/mp3_audio/' pagehtml = urllib.urlopen(url).read() soup = beautifulsoup(pagehtml) in soup.select('div.coleft.cate.mbottom a[href]'): print "http://www.brothersoft.com"+ a['href'] but output give inside class. need item inside dd only. how that? just put dd inbetween: for in soup.select('div.coleft.cate.mbottom dd a[href]'): # ^^ print "http://www.brothersoft.com"+ a['href']

ibm mobilefirst - How to implement OAUTH 2.0 in IBM Worklight 6.0 -

in app have implemented login module auth security implementing security realms. thinking of implementing oauth2.0 authentication user authenticated once token , re-validate on app starts. so please 1 guide prerequisites implement this. can achieve creating custom authentication module ? guide sample code helpful. there article published shows how use oauth inappbrowser , worklgiht using linkedin found @ following location: http://www.ibm.com/developerworks/library/mo-worklight-linkedin/ this article great sample getting started using worklight , oauth. let me know if have further questions

Grabbing a part of a string using regex in python 3.x -

so trying have input field named a. have line of regex checks 'i (something)' (note chain of words.) , prints how long have been (something)? this code far: if re.findall(r"i am", a): print('how long have been {}'.format(re.findall(r"i am", a))) but returns me list of [i, am] not (something). how return me (something?) thanks, a n00b @ python do mean this? >>> import re >>> = "i programmer" >>> reg = re.compile(r'i (.*?)$') >>> print('how long have been {}'.format(*reg.findall(a))) how long have been programmer r'i (.*?)$' matches i am , else end of string. to match 1 word after, can do: >>> = "i apple" >>> reg = re.compile(r'i (\w+).*?$') >>> print('how long have been {}'.format(*reg.findall(a))) how long have been

php - in codeigniter2.1.4,is it mandatory pass the file's field name in do_upload function or not -

i'm curious know in $this->upload->do_upload('img') field name passing mandotory not.i have seen several example in stackoverflow do_upload() not taking argument file field name.but in case of mine without field name file not uploaded.i want know correct syntax? 2)how bypass file upload validation when there no file being uploaded.if there no file(image) in form $this->upload->display_errors() not called.my code below function add() { if ($this->input->server('request_method') === 'post') { $this->form_validation->set_rules('category', 'category name', 'required'); if ($this->form_validation->run()) { $data_to_store = array( 'category' => $this->input->post('category'), 'description' => $this->input->post('description'), 'parent'=>'0' ); $last_i...

php - $_POST is empty while posting with file -

i using php. facing issue $_post global array. when send or add 1 record without file , enctype removed form tag working correctly. upload file , enctype set multipart/form-data $_post variable not set.i done far following code upload file. index.php <form action="add.php" method="post" enctype="multipart/form-data"> <input type="text" name="artist_name" /> <input type="text" name="title" /> <input type="file" name="track_file" /> </form> add.php <?php $artist=$_post['artist_name']; $title=$_post['title']; $song=$_files['track_file']['name']; echo $artist; echo $song; ?> you should use isset function check if post values set. avoid notifications

vba - Run-time error '-2032465766 (86db089a)' "Requested operation is presently disabled." -

this weird. why visio throw exception? scenario: open new instance of visio. press ctrl+n blank new document. goto vb editor. open default "thisdocument" code file. paste following code. sub test() application.activewindow.selectall end sub execute subroutine "test". you observe exception code line " application.activewindow.selectall ": --------------------------- microsoft visual basic applications --------------------------- run-time error '-2032465766 (86db089a)': requested operation presently disabled. --------------------------- ok --------------------------- does know why? the error "requested operation presently disabled" means literally - requested operation disabled (in menu) @ moment (because makes no sense). in case, can't "select all" because there nothing select (you have no shapes). command "select all" disabled. if had shapes on drawing, code run fine...

javascript - What is the sense of IE's blocking activex content on my C drive? -

i have tested (in 5 minutes) in firefox , chrome webpages on c drive uploading website. have spent past hour trying test same pages in ie9. default, ie blocks pages because there few lines of javascript. if click b"allow active content" warning, ie either hangs or allows active x content 5 minutes, hangs again. if check "allow active x run on computer" in advanced settings, doesn't load page @ all, or claims page not found, or - once - warned me script long. removed every darn script in homepage, , i've got blank screen. tried microsoft solution , give me this: http://msdn.microsoft.com/en-us/library/ms537628.aspx , didn't make difference. other advice includes editing registry, playing security settings etc. etc. this has been happening ie far remember, although once click "allow" on popup , it'd run page. reasoning? how come it's safe in firefox , chrome , ie blocks everything, since it's on own frigging c drive? ...

How can I pass multiple named parameters using ODBC to a DB2 database -

i have query db2 database using existing odbc connection. executing simple queries works expected, try execute parameterised query doesn't work: select columna, columnb mytable columna = ? , columnb = ? using ? suggested in other posts, empty results (no error messages though). when try standard sql way named parameters (and changing sql statement columna = @columna , columnb = @columnb shown below odbccommand.parameters.addwithvalue( columna", 1234 ); odbccommand.parameters.addwithvalue( columnb", 9999); the following error message shown: system.data.odbc.odbcexception: error [42s22] [ibm][cli driver][db2] sql0206n "@columna" not valid in context used. sqlstate=42703... using odbccommand.parameters.add( new odbcparameter( "columna", integer ){ value = 1234 } ); instead shows deprecated (and doesn't work). i'd avoid using concatenated sql statements, can't find way parameterised queries working against...

android - getting java.lang.ArrayIndexOutOfBoundsException -

ares = null; adob = null; ares = tres.split("-"); if (!ares[0].tostring().equals("0")) { (int = 0; <= ares.length - 1; i++) { adob = ares[i].tostring().split(","); // txtv = new textview(albums.this); valuetv = new textview(albums.this); valuetv.settext(adob[0].tostring() + "[" + adob[1].tostring() + "]"); // here getting exception ! // valuetv.setid(i); valuetv.setgravity(gravity.center); valuetv.setlayoutparams(new layoutparams( layoutparams.fill_parent, layoutparams.wrap_content)); valuetv.settextsize(20); valuetv.settextcolor(color.blue); valuetv.setclickable(true); error logcat is 08-26 14:35:00.945: w/dalvikvm(21180): threadid=1: thread exiting uncaught exception (group=0x409e61f8) 08-26 14:35:00.975: d/dalvikvm(21180): gc_concurrent freed...

html - Bootstrap Tabbable Issue -

i have html page b.html tab navigation. made tabs tabbable in html page below. <div class="tabbable"> <ul class="nav nav-tabs"> <li class="active"><a href="#tab1" data-toggle="tab">section 1</a></li> <li><a href="#tab2" data-toggle="tab">section 2</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="tab1"> <p>i'm in section 1.</p> </div> <div class="tab-pane" id="tab2"> <p>howdy, i'm in section 2.</p> </div> </div> </div> i have html page a.html . in a.html page, there 2 a tags t1 , t2 . when click t1 , need redirect b.html , show content own tab 1 , when click t2 , need redirect b.html , show content own tab 2 . i have tried below. <a href=...

timer - How to pause and resume a Qtimer (Qt 5) -

Image
i need on usage of qtimer. i work qt 5.0.2 , here problem : i trying develop timer, , interface simple : there 2 button : button "start", launch timer, , "pause" button, , qtimeedit display time. this screenshot shows how looks : http://img834.imageshack.us/img834/1046/5ks6.png the problem pause function doesn't work. have read documentation qtimer here : http://harmattan-dev.nokia.com/docs/library/html/qt4/qtimer.html , here : qt.developpez.com/doc/5.0-snapshot/qtimer/ , no result. this source code have : (i put needed) // creation of buttons , time area void mainwindow::createbottom() { bottom = new qwidget(); play = new qpushbutton("launch",this); pause = new qpushbutton("pause",this); play->setdisabled(false); pause->setdisabled(true); timeedit = new qtimeedit(this); timeedit->setdisplayformat("mm:ss"); layout->addwidget(play); layout->addwidget(pause); ...

php - CodeIgniter: Is possible to have current page link by pagination library? -

i have created pagination item codeigniter pagination library following code: echo $this->pagination->create_links() everything working well. now want load data ajax , have done ajax part. problem make clicked item current item , arrange link current item no longer current. suppose have pagination following: [1] 2 [3] [4] [5] [6] [>] [last >] now 2 current item , 4 clicked item. i have checked codeigniter pagination library , doesn't have option enable or disable current page link. possible have current page link without modifying library? thanks in advance. i take back. pagination library need changed. https://github.com/ellislab/codeigniter/blob/develop/system/libraries/pagination.php line 560 $output .= $this->cur_tag_open.$loop.$this->cur_tag_close will need replaced $append = $this->prefix.$i.$this->suffix; $output .= $this->num_tag_open.'<a href="'.$this->base_url.$append.'"'....

How to force Jmeter proxy server to listen only for specified page -

i using jmeter proxy record steps take in browser. there possibility set proxy server listen 1 specific page? i want record steps taken on www.test123.com thanks use include pattern restrict requests recorded. as per http://jmeter.apache.org/usermanual/component_reference.html#http_proxy_server the include , exclude patterns treated regular expressions (using jakarta oro). matched against host name, port (actual or implied) path , query (if any) of each browser request. if url browsing "http://jmeter.apache.org/jmeter/index.html?username=xxxx" , regular expression tested against string: "jmeter.apache.org:80/jmeter/index.html?username=xxxx" . thus, if want include .html files, regular expression might like: ".*\.html(\?.*)?" - or ".*\.html" if know there no query string or want html pages without query strings. "www.test123.com.*" should record requests given url.

sql - I have ASP.NET GridView in my web app and would like to bind 3 columns with values based on one column -

i have asp.net gridview in web app , bind 3 columns values based on 1 column. providing example below, possible implement gridview? my gridview fields are name|score1|score2|score3 i display name how fill score fields based on name.there 3 scores corresponding each name,that taken same table single score field.the 3 scores provided 3 different persons.also want display corresponding score providers name in header portion of gridview. ie, name|ram score1|raju score2|mohan score3 how can this... plz provide query this consider rather calculate scoring fields in database. create stored procedure , bind grid view.

actionscript 3 - Correct method of incorporating Starling with Preloader -

hi know best method of adding preloader. when content loaded create instance of starling framework. here have: import flash.display.loader; import flash.display.sprite; import flash.events.event; import loaders.preloader; import starling.core.starling; //main class container public class game extends sprite { //preloader class private var _loader:preloader; //starling instance private var _starling:starling; //constructor initialise game public function game():void { this.addeventlistener(event.added_to_stage, onaddedtostage) } private function onaddedtostage(e:event):void { this.removeeventlistener(event.added_to_stage, onaddedtostage); _loader = new preloader(); addchild(_loader); _loader.addeventlistener("loaded_game", ongameloaded); } private function ongameloaded(e:event):void { trace("game loaded"); _starling = new starling(game,sta...

jquery - Manipulating the page scroll -

i want able move user between div elements depending on if user scrolled or down (to see effect, checkout ) my initial code is; var lastscrolltop = 0; $(window).scroll(function(event){ var st = $(this).scrolltop(); if (st > lastscrolltop){ $('html, body').animate({ scrolltop: 1000 }, 'slow'); return false; } else { $('html, body').animate({ scrolltop: 0 }, 'slow'); return false; } lastscrolltop = st; return false; }); i have yet put in code move next sequential div, problem have once scroll or down has been triggered can't escape capture next scroll event. any breaking out of event appreciated.

How to transform and apply a partial function using Scala Macros? -

i want implement scala macro takes partial function, performs transformations on patterns of function, , applies given expression. to so, started following code: def mymatchimpl[a: c.weaktypetag, b: c.weaktypetag](c: context)(expr: c.expr[a])(patterns: c.expr[partialfunction[a, b]]): c.expr[b] = { import c.universe._ /* * deconstruct partial function , select relevant case definitions. * * partial, anonymus function translated new class of following form: * * { @serialversionuid(0) final <synthetic> class $anonfun extends scala.runtime.abstractpartialfunction[a,b] serializable { * * def <init>(): anonymous class $anonfun = ... * * final override def applyorelse[...](x1: ..., default: ...): ... = ... match { * case ... => ... * case (defaultcase$ @ _) => default.apply(x1) * } * * def isdefined ... * } * new $anonfun() * }: partialfunction[a,b] * */ val typed(block...

Fitting an exponential approach/asymptotic power law in R/Python -

how can fit data asymptotic power law curve or exponential approach curve in r or python? my data shows the y-axis increases continuously delta (increase) decreases increase in x. any appreciated. using python, if have numpy , scipy installed, use curve_fit of the scipy package. takes user-defined function , x- y-values (x_values , y_values in code), , returns optimized parameters , covariance of parameters. import numpy import scipy def exponential(x,a,b): return a*numpy.exp(b*x) fit_data, covariance = scipy.optimize.curve_fit(exponential, x_values, y_values, (1.,1.)) this answer assumes have data one-dimensional numpy-array. convert data 1 of these, though. the last argument contains starting values optimization. if dont supply them, there might problems in determining number of parameters.

sql - How to split a list of values into a variable and how to make a insert function work under a for each loop in postgreSQL -

i having 2 tables. partylist create table partylist ( sno serial not null, party_title text, party_venue text, party_date date, party_list character varying, amount_list text ); list create table list( sno integer, participant_name text, amount_paid integer ); this full sql fiddle . i want call function can insert values both tables. , output should . partylist table | sno | party_title | party_venue | party_date | party_list | |amount_list --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 1 | games | indoor stadium | august, 10 2013 00:00:00+0000 | ronald;sania;sachin;pointing;samueal;gibbs;gayle;smith; | 100;200;100;100;200;100;100;100; | | 2 | dance | stage | august, 15 2013 00:00:...

wordpress - How to change header & footer to full width? -

i'm using sleketon theme on website. what i'd have header & footer "fill" horizontal space of screen, while having main content staying is. actually, i'd background color fill full width of screen(dark blue , red lines header, dark blue, red , green lines footer). i'd content stay is. i've looked @ several other threads, couldn't manage make way solution skeleton theme. can guys please me out ? thanks edit : realized didn't add website url . if have css file linked can target class .header / .footer , add line : width:auto; suggest adding container/wrapper div , place contents in it. should this: html, body { margin:0px; padding:0px; } .wrapper { margin:auto; width:auto; } .header { margin:auto; height:200px; width:auto; background-color:#0000ff; border:1px solid #df0101; } .content{ margin:auto; height:500px; width:800px; } .footer { margin:auto; height:100px; width:auto; background-color:#0...

c# 4.0 - Get html from MVC 4 view into a string -

i trying use accepted answer this question . it seems looking for, have problem. don't know how call it. have far: first copying code solution mentioned: public string tohtml(string viewtorender, viewdatadictionary viewdata, controllercontext controllercontext) { var result = viewengines.engines.findview(controllercontext, viewtorender, null); stringwriter output; using (output = new stringwriter()) { var viewcontext = new viewcontext(controllercontext, result.view, viewdata, controllercontext.controller.tempdata, output); result.view.render(viewcontext, output); result.viewengine.releaseview(controllercontext, result.view); } return output.tostring(); } this have: string viewtorender = "..."; int data1 = ...; int data2 = ...; system.web.mvc.viewdatadictionary viewdata = new system.web.mvc.viewdatadictionary(); viewdata.add("data1",data1); viewdata.add("data2",data2); string html = tohtm...

How to expose a C++ class to Python without building a module -

i want know if there way expose c++ class python without building intermediate shared library. here desirable scenario. example have following c++ class: class toto { public: toto(int ivalue1_, int ivalue2_): ivalue1(ivalue1_), ivalue2(ivalue2_) {} int addition(void) const {if (!this) return 0; return ivalue1 + ivalue2;} private: int ivalue1; int ivalue2; }; i convert somehow class (or intance) pyobject* in order send paremter (args) example pyobject_callobject: pyobject* pyobject_callobject(pyobject* wrapperfunction, pyobject* args) in other hand in python side, i'll have wrapperfunction gets pointer on c++ class (or instance) parameter , calls methods or uses properties: def wrapper_function(cplusplusclass): instance = cplusplusclass(4, 5) result = instance.addition() as can see, don't need/want have separate shared library or build module boost python. need find way convert c++ code pyobject , se...

javascript - AngularJS $resource sending out an extra "registration" hash? -

new angularjs here , have trouble getting $resource work. i've created factory , hardcoded $resource object backend needs in order create new plumber. however, when call function, instead of passing params i've entered, creates 'sort of' duplicate content in form of registration hash, shown in hte backend of app (bolded below). it's exact duplicate of params. did come from??? the create() function called button in plumbers/new.html template <button data-ng-click="create()">create</button> where did hash come from??? new.js angular.module('ngappapp') .controller('plumbersnewctrl', function ($scope, $window, $resource, plumbers) { $scope.create = function(){ var test1 = new plumbers({ "business[email]": "superhero@super.com", "business[password]": "123123", "business[name]": "alice cullen", "business[company]": "alice pty ...

javascript - How to drag images / objects within Canvas after zooming / scaling them? -

following complete code. edited per link how drag images / objects within canvas? . requirement : basically doing is, first drawing svg file on canvas drawsvg of canvg. on file plotting images(green1.png , orange1.png) through json present in markers.js. scenario 1: if pan without zooming/scaling able drag images(green1.png, orange1.png) , able pan canvas properly. but if zoom after panning images not translating on proper position because of panx , pany points. panx , pany point want panning. scenario 2: : if scale/zoom first , if pan images(orange1.png, green1.png) changing position , not able drag images (orange1.png, green1.png). what can done in these scenarios? html code : <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <script sr...

java - Function result-document() leaves file open -

i have simple question: i have , xslt 2.0 transformation using saxon. part of tranformation information written file using xsl:result-document function. after transformation completed, result file copied directory , should deleted, not successful. my associates across atlantic respobnsible copy / delete mechanizm , convinced xslt transforamtion (that provide) leave result file open / locked can't deleted. i 1 think somehow fail close file after copied. that being said, raises obvious question me: question: is possible function creates file leaves open / locked after transformation? unable find relevant information on internet. thanks lot! i think saxon xslt transformation: how close outputstream when failing during transformation suggests file might not closed if dynamic error occurs during xslt transformation. there suggestion "you work around problem registering own outputuriresolver (perhaps based on standard one) keeps track of open output st...

c# - Opening a document in PDF as opposed to Word with code on a button click -

i have copied code used throughout system working on. code opens content in word document. looking opened in pdf. i have tried changing string declaration 'filename' end in (.pdf) opposed (.doc) when attempting open it says " could not open document because either not spported file type or because file has been damaged.... ". what changes need made code in order open adope pdf. wouldnt imagine alot. string content = sw.getstringbuilder().tostring(); string filename = "irpbestpracticearticle.doc"; response.appendheader("content-type", "application/msword; charset=utf-8"); response.appendheader("content-disposition", "attachment; filename=" + filename); response.charset = "utf-8"; response.write(content); i cannot certain, going assume you're trying save data pdf , have open in whatever application system uses read pdf files? //note change application/msword application/pdf respo...

bash - How to sort all csv files in a directory -

i have directory csv files inside . example: dir a->dir1-> .csv dir2-> .csv wish sort of csv file according 4 column how go threw of directories inside dir a. thank you i understood, that want csv files under specific directory sorted based on 4th column, you looking word recursively , i assume csv files below, trying sort based on 4th column 1,apple,red,2765 2,mango,green,100 3,pineapple,yellow,900 if csv files parent directory "/home/think/csvs", try below, # setting path of parent directory path="/home/think/csvs" # finding .csv files under path in `find $path -type f -name '*.csv'` # sorting based on 4th columns(k4) using comma(,) field separator sort -t"," -k4 $i done not tested, going this.

plsql - How can I use Oracle (PL/SQL) dynamic sql to query data into a %rowtype variable -

the problem: i have table contains clob fixed length record external source. positions 1-5 = fielda, positions 6-12 = fieldb, etc. i have table (layoutdefinition)that defines record layout, fieldname = 'fielda' fieldstart = 1 fieldlength = 5 fieldname = 'fieldb' fieldstart = 6 fieldlength = 6 i need retrieve data clob , put %rowtype variable such "tablea_rec tablea%rowtype." i have implemented routine uses massive case statement, , loop each row in layoutdefiniton table moves area of clob proper variable in tablea_rec like; case layoutdefiniton.fieldname when 'fielda' tablea_rec.fielda:= substr(inputclob,layoutdefiniton.fieldstart,layoutdefiniton.fieldlength); when 'fieldb' tablea_rec.fieldb:= substr(inputclob,layoutdefiniton.fieldstart,layoutdefiniton.fieldlength); this of course inefficient, need loop through layout each record picking apart data. what create dynamic sql select statement once retrieve data table proper var...

VBA & MS Excel 2010 Run-time error '13' -

i have got project colleague. when try run macro, error 'run-time error '13': type mismatch' any ideas causing this? code causing in vba is: worksheets("model").range("a" & + 5).value = worksheets("model").range("a" & + 5).value + rating * worksheets("parameters").range("e" & paramerange).value thanks help! have set value of , paramerange whole number value? can 0 in formular paramerange must positive whole number. you can check different parts of line try find error. sub testline1() dim integer dim rating integer dim paramerange integer rating = 2 paramerange = 13 = 1 msgbox(worksheets("model").range("a" & + 5).value) msgbox cstr(worksheets("model").range("a" & + 5).value + rating * worksheets("parameters").range("e" & paramerange).value) end sub

css - why do modern browsers still put spaces between inline block if there is whitespace -

if have markup this: <div class="inlineblock">one</div> <div class="inlineblock">two</div> <div class="inlineblock">three</div> and css this: .inlineblock{ display: inline-block; } you spaces between elements. 4px of space. unless markup looks this: <div class="inlineblock">one</div><div class="inlineblock">two</div><div class="inlineblock">three</div> now, know why? what technical reason "good" browsers still this, latest firefox, chrome, , opera @ time of posting still this. assume there technical reason behind it, otherwise have been fixed now? thanks! this should do. spaces between inline elements no different spaces between words. if don't want that, use block elements, or set font size zero.