Posts

copy - Copying files in php -

i know copy() function not allow directories listed first, there way bypass this? attempting copy file 1 directory different directory, need able state file should copied , to. here code have: if ($_files["pdffile"]["type"] == "application/pdf") { if (file_exists("../pdf_new/".$rowapp['filename'])) { copy("../pdf_new/".$rowapp['filename'], "../pdf_new/backup/".$rowapp['filename']); } move_uploaded_file($_files["pdffile"]["tmp_name"], "../pdf_new/".$rowapp['filename']); } i tried replacing "../pdf_new" variable , adding "/" between variable , .$rowapp['filename'], still did not work. thoughts?

if statement - Adding string to variable powershell -

i trying create powershell script append character variable if variable not null. instance user fills out form, or spreadsheet cell in case , has data want append | variable when call variable in script display | contents of variable. have , not seem working. if ([string]::isnullorempty($field6)) {$field6 = $field6} else {$field6 = "| $field6" } } echo $field6 this should suffice: if ($field6 -ne $null) { $field6 = "| $field6" }

html - Struts2 Textarea Resize -

basically i'm trying 'hide' resize handle on struts2 textarea. attempt @ had , unexpected result. code told overflow in x & y direction scrollbar told resize 'none' i expected resize handle disappear did overflow wrapping down next line instead of scrolling. <s:textarea name="newsstring" cols="65" rows="17" style="overflow: scroll; resize: none;"></s:textarea> so how should go hiding resize handle , still having scroll? if @ possible. in struts2 tags, class , style attributes named cssclass , cssstyle . this work: <s:textarea name="newsstring" cols="65" rows="17" cssstyle="overflow: scroll; resize: none;" /> the fact wasn't getting compilation errors due inexistent attribute, because <s:textarea> tag (like <s:file> tag , maybe others), has dynamic attributes allowed: true ( as specified in official d...

java - Apache POI org.apache.poi.ss.formula.FormulaParseException -

i'm using apache poi , i'm facing issue when evaluating formula cell. this code: xssfcell cellvalue = sheet.getrow(6).getcell(2); if (cellvalue.getcelltype() == cellvalue.cell_type_formula) { evaluator.evaluateformulacell(cellvalue); } the formula: =c6/num_input , num_input = f36 the issue: org.apache.poi.ss.formula.formulaparseexception: cell reference expected after sheet name @ index 18. first, leave poi , check in excel if formula working fine. there no problem @ poi end. wrote sample code , it's working fine. xssfworkbook workbook = new xssfworkbook(); xssfsheet sheet = workbook.createsheet(); xssfformulaevaluator evaluator = new xssfformulaevaluator(workbook); xssfcell cellvalue = sheet.createrow(0).createcell(0); sheet.getrow(0).createcell(1).setcellvalue(2); sheet.getrow(0).createcell(2).setcellvalue(5); cellvalue.setcellformula("b1+c1"); if (cellvalue.getcelltype...

linux - How can I efficiently handle the result set of mysql from a bash script? -

i excited see how easy write bash script interact mysql . trying this: #!/bin/bash res=`mysql -u $user -p$pass students <<eof | tail -n +2 select name table age = 20 limit 1; eof` d in $res; echo result : $d done if result "john smith" get: result: john result: smith how can around issue space? seems treats 2 values while single column. one way ask adding before loop: ifs=$'\n' this change default bash internal field separator (ifs), default works spaces, tabs , new lines. my example work new lines, you're looking for.

javascript - Print PDF in IE using window.print -

i have pdf document i'm opening in new window using javascript , attempting print using window.print(). following code works in chrome, not ie. ideas? var pdfwindow = window.open('/mypdf.pdf', '_blank'); pdfwindow.print(); that not work. if ask me, best way of implementing pdf in browser following. create php file this: i'm calling first php file "firstfile.php" <?php header('content-type: application/pdf'); $file='yourpdffile.pdf'; @readfile($file); ?> then create php file , use iframe desired pdf file. sample code below <iframe src="http://localhost/domainfolder/firstfile.php>" height="400px" width="750px"> </iframe> hope helps

c# - Preventing SQL injection on insert -

i looking tips prevent sql injection. told on forum code not safe , looking nice enough me fix that. i have webform , on submit goes aspx.cs page , inserts data ms sql database. protected void submit_click(object sender, eventargs e) { string fullstarttime = starttimehourlist.selectedvalue + ":" + starttimeminutelist.selectedvalue + " " + starttimeamlist.selectedvalue; string fullendtime = endtimehourlist.selectedvalue + ":" + endtimeminutelist.selectedvalue + " " + endtimeamlist.selectedvalue; oledbconnection conn; oledbcommand cmd; conn = new system.data.oledb.oledbconnection(""); cmd = new system.data.oledb.oledbcommand(); conn.open(); cmd.connection = conn; var sql = string.format(@"insert formtable1 (nonprofit, contact, phone, email, event, startdate, enddate, starttime, endtime, place, comments, submitdate) values ...