Posts

Showing posts from June, 2012

What is the point of setLevel in a python logging handler? -

let's have following code: import logging import logging.handlers = logging.getlogger('myapp') h = logging.handlers.rotatingfilehandler('foo.log') h.setlevel(logging.debug) a.addhandler(h) # effective log level still logging.warn print a.geteffectivelevel() a.debug('foo message') a.warn('warning message') i expect setting logging.debug on handler cause debug-level messages written log file. however, prints 30 effective level (equal logging.warning , default), , logs warn message log file, not debug message. it appears handler's log level being dropped on floor, e.g. it's silently ignored. makes me wonder, why have setlevel on handler @ all? it allows finer control. default root logger has warning level set, means wont print messages lower level(no matter how handlers' levels set!). but, if set root logger's level debug , indeed message sent log file: import logging import logging.handlers = logging.getlogg

javascript - What does a ScriptManager script reference do? -

on previous project working on, noticed javascript files included inside script manager so: <asp:scriptreference path="~/scripts/jquery-1.7.1.min.js" /> <asp:scriptreference path="~/scripts/site.js" /> i've tried searching difference between script reference , regular <script src="/> in asp page can't seem find information. there advantage using script reference? thanks when using scriptmanager single composite script can created reduce number of browser requests asp.net. you can refer scriptreference class also about section of scriptmanager tells more details it: scriptmanager asp.net control manages asp.net ajax script libraries. scriptmanager performs following functions. enables partial page rendering eanbles client side script access web services enables use of authenication , profile services client only 1 scriptmanager can allowed per page. scenarios second scriptman

python - Reading a RAW image (.CR2) using numpy.fromfile -

i trying read raw image in .cr2 format ("canon raw format"). wanted opencv not work tried doing numpy function: img = np.fromfile('img.cr2', "uint16") the camera canon eos t5 18mp dslr. if run img.size return 10105415 seems small 18 mp camera. my first question, using np.fromfile() valid approach? secondly, recommend other python libraries same process in easier way/more efficient? have opencv installed if done there, great (i still want store numpy array). canon raw format not blob of data, has metadata need parse. luckily, others have implemented python parsers. raw image processing in python after using 1 of suggested solutions can load data numpy array.

ruby - Using cloc (count Lines of Codes) result -

i writing script research, , want total number of lines in source file. came around cloc , think going use in script. however, cloc gives result many information (unfortunately since new member cannot upload photo). gives number of files, number of lines, number of blank lines, number of comment lines, , other graphical representation stuff. i interested in number of lines use on calculations. there way number (maybe performing options in command line (although went through available options , didn't find useful case))? i thought regular expression on result number; however, first time using cloc , there might better/professional way of doing it. any thought? regards, arwa i not sure cloc. worth using default shell command. please have @ this question . number of lines of code individually find . -name '*.*' | xargs wc -l to total number of lines of code in directory. (find ./ -name '*.*' -print0 | xargs -0 cat) | wc -l please note

How to create rewrite rule to Rename PDF file on the fly while Downloading using nginx? -

i working on site allowing users download pdf files. each pdf file stored on server using random hash names, eg. file 768e1f881783bd61583d64422797632a35b6804c.pdf stored in /usr/share/nginx/html/contents/7/6/8/e/1/768e1f881783bd61583d64422797632a35b6804c.pdf now can try give users direct location of file , file name after being downloaded shown 768e1f881783bd61583d64422797632a35b6804c.pdf , rename file on fly, can achive using php this <?php // we'll outputting pdf header('content-type: application/pdf'); // called downloaded.pdf header('content-disposition: attachment; filename="downloaded.pdf"'); // pdf source in original.pdf readfile('original.pdf'); ?> ref: rename pdf file downloaded on fly but lloking nginx rules directly can rewrite download urls path , rename on fly. how can ? i have tried this. location ^/download-pdf { alias /usr/share/nginx/html/contents; if ($request_filename ~ ^.*?/[^/]*?_(.*?

r - Why does summarise on grouped data result in only overall summary in dplyr? -

suppose have following data: dfx <- data.frame( group = c(rep('a', 8), rep('b', 15), rep('c', 6)), sex = sample(c("m", "f"), size = 29, replace = true), age = runif(n = 29, min = 18, max = 54) ) with old plyr can create little table summarizing data following code: require(plyr) ddply(dfx, .(group, sex), summarize, mean = round(mean(age), 2), sd = round(sd(age), 2)) the output this: group sex mean sd 1 f 49.68 5.68 2 m 32.21 6.27 3 b f 31.87 9.80 4 b m 37.54 9.73 5 c f 40.61 15.21 6 c m 36.33 11.33 i'm trying move code dplyr , %>% operator. code takes df group group , sex , summarise it. is: dfx %>% group_by(group, sex) %>% summarise(mean = round(mean(age), 2), sd = round(sd(age), 2)) but output is: mean sd 1 35.56 9.92 what doing wrong? thanks! the problem here loading dplyr first , plyr, plyr's function summarise

windows installer - How to detect that Wix bundle is being uninstalled? -

i have wix bootstrapper bundle installs couple of msi packages.i want delete registry values when bundle being uninstalled. problem values should deleted when whole bundle uninstalled (not 1 of msi packages). tried use wixbundleaction wix variable detect case , pass msiproperty packages, allways evaluates 0 <msipackage id="pac" sourcefile="$(var.so)" compressed="yes" vital="yes"> <msiproperty name="remove_reg" value="[wixbundleaction]"/> </msipackage> is there proper way detect when bundle uninstalling? the direct answer question bug 0, should fixed in latest build of v3.10 , v4.0. the real answer should doing registry operations inside msi, not bootstrapper. let windows installer keep track of ref counting, rollback, etc.

c++ - Crossplatform reproducible number generator -

i need "random" number generator, produces same result given seed on windows, mac, linux, ios , android. tried std::rand , boost::random_int_generator boost::mt19937 sadly result different between windows , mac. does know of (c++) implementation, works reliably on platforms? edit 1: to more specific, diff between numbers boost::mt19937 on windows , mac shows, on windows there (2) additional blocks of numbers being generated. looks strange because majority of numbers same these blocks being present on windows. edit 2: boost::mt19937 works reliably on platforms. our problems not bug there. if don't need too-high-quality rng, can implement one-liner according description here: https://en.wikipedia.org/wiki/linear_congruential_generator linear congruential gens got quite bad name recently, many practical purposes they're fine. as long you're careful using guaranteed-size types (uint32_t etc.), should fine on platforms. if need better-q

html - CSS grid containing divs of different height -

Image
i'm trying grid work want to. contains 2 different sizes of elements , want layout masonry without using lib, since it's quite simple layout can't head around. see on image 2 small items jump down float. can me here? grid gonna repeatable same structure. reference image: .grid { width: 100%; } .half { float: left; width: 50%; max-width: 1000px; border: 1px solid #000000; } .forth { float: left; width: 25%; max-width: 500px; border: 1px solid #000000; } <section class="grid"> <div class="half"> <img src="http://placehold.it/1000x1000"> </div> <div class="forth"> <img src="http://placehold.it/500x500"> </div> <div class="forth"> <img src="http://placehold.it/500x500"> </div> <div class="half"> <img src="http://placehold.it/1000x1000"

php - SQL Server Prepared Statement saying invalid column count -

so i'm working on project here , i"m trying prepared statement can handle odd objects slashes , not raw data comes through. however, when go execute statement provides same error on , on again: sqlstate: 07002 code: 0 message: [microsoft][sql server native client 11.0]count field incorrect or syntax error it says field count incorrect, checked variables , made sure supposed there, is. i'm little confused guess. note first time working sqlsrv prepared statements, awesome! here code below: <?php $servername = "localhost"; $connectioninfo = array( "database"=>"devel", "uid"=>"root", "pwd"=>""); $conn = sqlsrv_connect( $servername, $connectioninfo); $error_message = ""; $xml = trim(file_get_contents('/file.xml')); $xml = new simplexmlelement($xml); $truck_number; $date_time; $speed; $heading; $gps_quality; $latitude;

tcp - Malformed DNS Request Packet -

i've been working on project involves sending dns requests information (not actual domains) in questions (2 of them). i've been tracking packets wireshark . here tcp dump of packet created. 00000000 00 02 01 00 00 02 00 00 00 00 00 00 01 32 03 65 00000010 6e 64 03 63 6f 6d 00 00 01 00 01 01 32 04 73 61 00000020 76 65 03 63 6f 6d 00 00 01 00 01 ........ .....2.e nd.com.. ....2.sa ve.com.. ... the i.d. , qdcount should 2, recursion desired, , domains shown correct. wireshark saying malformed dns packet. idea wrong packet? ok, so: if you're doing transport-layer networking yourself, code determine whether it's going on udp or tcp, specifying, when creating socket on send packet, whether it's udp or tcp socket; tcp used if packet won't fit in maximum-sized udp packet; if you're sending on tcp, need precede header, per section 4.2.2 "tcp usage" in rfc 1035 . "maximum-sized&quo

How to organize git in projects with overlapping dependencies? -

currently working on converting monolithic svn repository (all applications , libraries in single repository) c++ code git repository. have organize libraries , applications in own repository. i am, however, struggling find way handle internal (i.e. our own code) , overlapping dependencies. problem exists because many libraries , applications depend on each other - quite deep. for instance, imagine following (quite simple) project structure: app1 depends on lib1 lib2 lib1 depends on lib2 lib3 lib2 depends on lib3 lib3 not have dependencies app1 game, lib1 graphics library, lib2 math library , lib3 utility library. keep in mind libraries used in many other applications , updated. ideally want have situation following directory structure when clone app1: app1 libs lib1 lib2 lib3 and following when clone, instance, lib2: lib2 libs lib3 i have thought using git subtree or submodules, whereby each project records own dependencies. however, project di

android - App crash using intent to switch activity -

it's simple login activity when must switch activity, app crash. tried use normal form pubic void onclick() {...} doesn't work. login.java package com.example.corrado_mattia_danny.face_offbrains; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; import android.widget.checkedtextview; import android.widget.edittext; import android.widget.toast; public class login extends activity { private player player; private button login; private edittext username; private edittext password; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); login=(button)findviewbyid(r.id.button_sign_in); username=(edittext)findviewbyid(r.id.nickname); password=(edittext)findviewbyid(r.id.password);

encryption - Partial support in VS 2013 for certificates and symmetric keys in azure v12 -

in visual studio 2013 project targeting azure v12, sql70015 errors (statement x not supported in targeted platform) when creating key , certificate artifacts. however, before creating independent key , certificate objects in project, i'd had postdeploy script add them if didn't exist. postdeploy script worked flawlessly...but of course, i'd sql71502 warnings (unresolved objects) when refer key in other artifacts such triggers , procedures...hence desire move plain ol' vs key , certificate objects. i wonder if i'm doing wrong or if have misconfigured development environment. have visual studio 2013 on windows 8.1, azure sdk v 2.6, sql 2012 , sql 2014 installed locally , deploying azure. sure normalize project, i'm stuck using postdeploy , living warnings. to clear, postdeploy has: if not exists ( select * sys.symmetric_keys symmetric_key_id = 101 ) create master key encryption password = '$(masterkeyencryption)' go if not exists ( select

javascript - Summing Percent Changes in a Series -

i have large data set different subsets , number of variables. the data looks this: set.seed(362) day <- rep(seq(1:35), times = 3) variable.1 <- round(rnorm(n = day, mean = 1200, sd = 300),0) variable.2 <- round(rnorm(n = day, mean = 100, sd = 20), 0) variable.3 <- round(rnorm(n = day, mean = 20, sd = 5), 1) data <- data.frame(day, variable.1, variable.2, variable.3) bob <- sample("bob", 35, replace = t) jeff <- sample("jeff", 35, replace = t) kevin <- sample("kevin", 35, replace = t) names <- array(c(bob, jeff, kevin), dim = c(105,1)) data <- cbind(names, data) data names day variable.1 variable.2 variable.3 1 bob 1 1369 91 20.6 2 bob 2 1155 96 18.8 3 bob 3 999 97 22.4 4 bob 4 947 93 11.4 5 bob 5 1442 90 20.1 6 bob 6 1170 125 17.8 7 bob 7 1028

java - Eclipse - Not able to run TestNG tests -

i using eclipse kepler 4.3.2 , have installed testng plug-in not able run testng program testng console displaying below error. " plug-in org.testng.eclipse unable load class org.testng.eclipse.ui.testrunnerviewpart. " i not able resolve after reinstalling eclipse , creating projects in new workspace.

mysql - Could it make sense to schedule an export of SQL database to NoSQL for graphical data mining? -

would make sense me schedule export sql database graph database (such neo4j) in order generate interactive graphics of relationships such here ? update: or extension, should looking move on graph database altogeher? my graphical database not need live reflection of relational database - extract every few days more sufficient. in case, have relational database (mysql) i’m recording stock items pass between individuals/depots. concept follows: items: stockid dispatchdate 0001 2014-01-01 0002 2015-06-03 individuals: userid firstname 0001 tom 0002 jones depots: depotid zipcode 0001 50421 0002 71028 owners: stock_id user_id received dispatched 0001 0001 2015-05-01 2015-05-10 0001 0002 2015-05-11 2015-05-20 from nosql database able visually see things such as: the flow of people item has passed through (and dates of each relationship) which items @ each individual/depot (on given date) which individuals @ depots (on given date

c# - How to wait for a database command to complete one iteration before continuing in foreach loop -

i know how wait database command complete before going next iteration in each loop. the following code send sql statement "exec ups_storedproc" without waiting next 1 complete: foreach (var guid in anuseridlist) { database.executecmd(string.format("exec dbo.usp_storedproc @membercontactid = '{0}'", guid), con); } i've tried result of stored proc in variable returns 0 though command did not complete yet. int result = database.executecmd(string.format("exec dbo.usp_storedproc @membercontactid = '{0}'", guid), con); thank you you'd have check on documentation call. from comment, see method signature is: public static int executecmd(string sqlcommand, idbconnection con, params dbparam[] params); from experience, hazard guess already blocking call, , returns number of affected rows. if that's case, you've got should work. what makes think stored procedure sh

Delphi - THashedStringList incremental search -

i have thashedstringlist 200k items on it(strings , objects). list heavy used on searching items on it. in cases need incremental search on it. i've wrote rudimentary example incremental search using startstext routine unit unit1; interface uses winapi.windows, winapi.messages, system.sysutils, system.variants, system.classes, vcl.graphics, vcl.controls, vcl.forms, vcl.dialogs, system.inifiles, vcl.stdctrls, system.strutils; type tform1 = class(tform) memo1: tmemo; edit1: tedit; memo2: tmemo; procedure formcreate(sender: tobject); procedure edit1keyup(sender: tobject; var key: word; shift: tshiftstate); private { private declarations } public ahsstrlst : thashedstringlist; { public declarations } end; var form1: tform1; implementation {$r *.dfm} function generate(cantidad: integer): string; const letras_mi = 'abcdefghijklmnopqrstuvwxyz'; var i: integer; begin result := ''; := 0 cantidad-1 res

c# - Open file Dialog Filter Hides Everything WPF -

i have openfiledialog. when set filter opd show files 'x' extension hide every thing. im new wpf. didnt put opd control (like in winform) inside wpf because couldnt find it. openfiledialog works fine when set filter * . * show files. i checked extension of files , correct. also searched in problem , didnt find anything. thanks help. openfiledialog opd = new openfiledialog { filename = "x file", defaultext = ".x", filter = "x files (*.x)|*.x | files (*.*)|*.*", multiselect = true }; bool? result = opd.showdialog(); if (result == true) { //... } you should change filter from "x files (*.x)|*.x | files (*.*)|*.*" to "x files (*.x)|*.x|all files (*.*)|*.*" as stated in msdn : do not put spaces before or after vertical bars in filter string. cause incorrect behavior in filter.

if-else block in JMeter -

Image
i expect 2 possible cases in application: search successful , search failed. in both cases have 2 different sets of http requests, jmeter should execute. how can implement if-else block in jmeter scenario? i've tried use if controller regular expression extractor, relying on results of debug sampler, kind of extractors doesn't attached current thread. hence, 1 thread can override result of thread. bug or feature? there workarounds? my regular expression extractor: my first if controller: my second if controller: order of execution: always fires first controller , never second. when customer search failed, page not contains word "daniel" , expect ${customer_name} 0 length. moreover, debug sampler returns customer_name filled value after unsuccessful search. looks other thread overrides , extractor not thread safe. your second condition flaky. for instance have ${foo} variable. if not set, it's value ${foo} (surprisingly) , it's leng

excel - How to use For/Next loops to print range based on check box status -

i having trouble putting code allows me @ status of check box , print specified range on worksheet if check box equals true , repeat loop given number of check boxes , ranges. i utilizing 2 different - next loops try , accomplish task. below current code. sub printgraphs() dim integer dim r integer = 16 18 if activesheet.oleobjects("checkbox" & i).object.value = true r = 1 3 worksheets("cut tables graphs").activate range("rangeset" & r).select activesheet.pagesetup.printarea = ("rangeset" & r) activesheet.pagesetup .papersize = xlpaperletter .orientation = xllandscape .zoom = false .fittopageswide = 1 .fittopagestall = 1 .leftmargin = application.inchestopoints(0.25)

if statement - Multiple conditions in Java -

is there way test multiple conditions in java in short way? let's use following example: if(height == 1 && width == 3 && visible && running && users<3) dothis(); this rather short test, if there's more? i'm aware of nested if(test) can structure, becomes hard follow after 10 tests. imagine test varies in code, no standardised method can called. stated way decent possibility?

excel - Python xlrd transforms integers and strings into floats -

i tried succesfully convers excel file csv converted numbers (despite fact integers or text in excel file) floats. i know python reads default numbers floats. is there chance turn numbers strings? my code bellow def excel2csv(excelfile, sheetname, csvfile): import xlrd import csv workbook = xlrd.open_workbook(excelfile) worksheet = workbook.sheet_by_name(sheetname) csvfile = open(csvfile, 'wb') wr = csv.writer(csvfile, delimiter=';', quoting=csv.quote_nonnumeric) rownum in xrange(worksheet.nrows): wr.writerow( list(x.encode('utf-8') if type(x) == type(u'') else x x in worksheet.row_values(rownum))) csvfile.close() thank time my work-around has been treat excel file cell-by-cell first through new nested list, , writing nested list csv file. by accessing individual cell values, can convert them string data types leaves internals of cell as-is in csv file ( string quotation marks removed of cour

crash - Selenium IDE - waitForTextPresent -

i have problem selenium ide's command - waitfortextpresent . <tr> <td>waitfortextpresent</td> <td>*saved successfully</td> <td></td> </tr> i had couple of tests using command. tests worked fine, now, during executing command web application freeze, after while firefox crashed, whole firefox freezed , received selenium ide timeout exception after while. question is, why happening? didn't change tests or selenium settings. one time received error: script on page may busy, or may have stopped responding. can stop script now, open script in debugger, or let script continue. script: chrome://selenium-ide/content/…nium-core/scripts/htmlutils.js:679 windows 7 firefox 38.0.5 selenium ide: 2.8.0 using couple of add-ons related selenium (e.g.: sel block). waitfortextpresent deprecated command, try using waitfortext css locator target, , '*saved successfully' bit value.

vbscript - Dynamic Link in UFT automation? -

i want write dynamic vbscript web automation in uft 12.02. pass dynamic value part of link. here sample line code: set objexcel = createobject("excel.application") objexcel.workbooks.open "f:\automation\web\business\webtestdata.xls" curr= 1 20 usd = objexcel.sheets(1).cells(curr,1).value if browser("...").page("...").exist browser("...").page("...").webelement("webelement").click 'attempt click on drop down link browser("...").page("...").link("usd").click end if next "usd" keep changing, i.e. picking excel. expected result: generate script attempt click on different links below: browser("...").page("...").link("euro").click browser("...").page("...").link("bp").click browser("...").page("...").link("aed").click browser("...").

html - CSS Selectors to Apply Border to h4 -

on http://adasportsandrackets.com/wordpress , trying add css add border under h4 heading "best sellers." it's not working , it's not caching issue i've tried in major browsers after deleting cache. here html: <div class="wpb_text_column wpb_content_element best-sellers"> <div class="wpb_wrapper"> <h4>best sellers</h4> and here css: .best-sellers h4 { border-bottom: 1px solid #eee; padding: 7px 0px; } i tried: .best-sellers { border-bottom: 1px solid #eee; padding: 7px 0px; } this worked me: .page-template-template-home-default-php .wpb_wrapper h4 { border-bottom: 5px solid #999; } or try: .best-sellers h4 {border-bottom: 5px solid #999;}

r - Get (multiple) custom icons in leaflet from rCharts -

i looking create map using rcharts/leaflet cannot figure out how create custom icons , use them. here solution, not work: https://github.com/ramnathv/rcharts/issues/301 l1$geojson(togeojson(data_), pointtolayer = "#! function(feature, latlng){ return l.marker(latlng, {icon: l.icon.extend({ options: { shadowurl: 'leaf-shadow.png', iconsize: [38, 95], shadowsize: [50, 64], iconanchor: [22, 94], shadowanchor: [4, 62], popupanchor: [-3, -76] }}) }) } !#" ) but not work. , iconurl not defined here not changed right? glad have reproducable example. ps: best case multiple icons. has clue on that? /edit: ok figured out. had place *.png files in same folder index.html file located, not project folder. there way include them can use rstudio viewer that? you can create new icons var mynewicon = l.icon({ iconurl: 'my-icon.png', iconretinaurl: 'my-ico

php - regex pattern needed to get data from html source -

i'm reading html source of online shop , can find below information shows stock availability each sku. '{"sku-sv023435_b_m":8,"sku-sv023435_bl_m":10,"sku-sv023435_pu_m":11}' i need retrieve each sku , it's quantity in array. please me php code. thanks edit: here source link source i guess want this: $a = '{"sku-sv023435_b_m":8,"sku-sv023435_bl_m":10,"sku-sv023435_pu_m":11}'; $a = json_decode($a) echo "<pre>"; print_r($a)

ios - SpriteKit (Swift) orientation change -

i making/made game in landscape orientation , have facebook , twitter button in main menu either open app or safari. problem have app or safari opens in portrait mode , when switch game briefly shows in portrait before changing landscape. shows multitasking preview in portrait. it not big deal brief 1-2 seconds game in portrait mode squashed , looks sort of ugly , unprofessional. happens when use 2 social media buttons, when switch portrait app via multitasking game stay in landscape upon return. i have being trying figure out cannot find anything, swift. appreciated. thanks ps. code used social media parts, think pretty straight forward , boiler plate. //mark: - load social media func loadfacebook() { var appurl = nsurl(string: "app id here") var weburl = nsurl(string: "web id here") if(uiapplication.sharedapplication().canopenurl(appurl!)) { // app uiapplication.sharedapplication().openurl(appurl!) } else { //

php - Symfony2 Load content based on device used with LiipThemeBundle -

i need make controller load different skin information based on device being used with. can load templates liipbundle. wonder if can load content too?? example controller: public function mainaction() { $em = $this->getdoctrine()->getmanager(); $skins = $em->getrepository('mediaparkltskinbundle:skin')->findoneby( array('id' => 1)); return $this->render('mediaparkltmainbundle:main:main.html.twig', array('skin' => $skins)); return array(); } right loads skin id 1 on theme. need make if statement , check if user on desktop, if load theme skin... how can that??? here idea: public function mainaction() { (if using desktop) { $em = $this->getdoctrine()->getmanager(); $skins = $em->getrepository('mediaparkltskinbundle:skin')->findoneby( array('id' => 1)); return $this->render('mediaparkltmainbundle:main:main.html.twig', array('ski

Why SLAB SqlDatabaseSink stopped writing to Traces table? -

Image
slab sqldatabasesink stopped writing traces table i added flatfilesink in parallel make sure listener not issue, writes fine file. have unit test sqldatabasesink works fine, when subscribing main project via global.asax flatfilesink works. screenshots below. added slab internal event listener per @manikrish 's suggestion (thank that), here underlying sqldatabasesink error log "could not load file or assembly 'newtonsoft.json, version=4.5.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed'" - details below, slab internal log. next, compared reference properties of newtonsoft.json between main project , unit test project (who's sqldatabasesink works) , both using version 6.0.8 (i believe webapi 5.2.3 came it), noticed specific version false in latter . so, i made same change in main project , still no luck . also, main project's web.config , unit test project's app.config have same assembly binding also: <dependentassembly>

ruby on rails - React-router: component undefined -

Image
i've been running through react-router tutorial found here , i'm puzzled... react-router doesn't recognise component. (i'm using react.js rails) here's code: var defaultroute = reactrouter.defaultroute; var link = reactrouter.link; var route = reactrouter.route; var routehandler = reactrouter.routehandler; var app = react.createclass({ getinitialstate: function () { return { showtags: false, current_user: this.props.current_user }; }, _handletoggletags: function() { this.setstate({ showtags: !this.state.showtags }) }, render: function () { return <div> <header ontoggletags={ this._handletoggletags } user={this.props.current_user} /> <routehandler/> <div id="images"> <imagebox/> </div> </div>; } }); var routes = ( <route name="app" path="/" handler={app}>

java - How to upload files to server using JSP/Servlet? -

how can upload files server using jsp/servlet? tried this: <form action="upload" method="post"> <input type="text" name="description" /> <input type="file" name="file" /> <input type="submit" /> </form> however, file name, not file content. when add enctype="multipart/form-data" <form> , request.getparameter() returns null . during research stumbled upon apache common fileupload . tried this: fileitemfactory factory = new diskfileitemfactory(); servletfileupload upload = new servletfileupload(factory); list items = upload.parserequest(request); // line died. unfortunately, servlet threw exception without clear message , cause. here stacktrace: severe: servlet.service() servlet uploadservlet threw exception javax.servlet.servletexception: servlet execution threw exception @ org.apache.catalina.core.applicationfilterchain.internaldofilter(