Posts

php - how to set path for uploaded files using zend framework? -

i trying upload video , convert in php using zend framework , have bit of problem logic. i have directory, locally, needs hold uploaded files: c:/xampp/htdocs/zend/videos/ fist need convert video move in directory. for conversion im using this: exec("ffmpeg -i video.avi -ar 22050 -ab 32 -f flv -s 320x240 video.flv", $out); here part of form: $file = new zend_form_element_file('file'); $file->setlabel('file') ->setrequired(true) //->setdestination('/var/www/tmp') use in real life ->setdestination('c:/xampp/htdocs/zend/tmp') ->addvalidator('size', false, array('min' => '10kb', 'max' => '100mb')); when upload file goes directory fine. do need convert file in tmp directory , move other main one, delete original one? isn't there way hold original file in temp directory temporary until gets conv...

pdf - Creating a long TCPDF document without timeout (so long running php process) -

i'm building feature of site generate pdf (using tcpdf) booklet of 500+ pages. layout simple due number of records think qualifies "long running php process". need done handful of times per year , if have run in background , email admin when done, perfect. considered cron user-generated type of feature. what can keep pdf rendering long takes? "good" php not *nix. tutorial link helpful. what need change allowed maximum execution time php scripts. can several means script (you should prefer if work) or changing php.ini. beware - changing execution time might lower performance of server. script allowed run time (30sec default) before terminated parser. helps prevent poorly written scripts tying server. should know doing before this. you can find more info about: setting max-execution-time in php.ini here http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time limiting maximum execution time set_time_limit() here http://ph...

model view controller - When does Javascript break the MVC pattern -

i having argument colleague other day. building our javascript video player. i wanted pass xml annotations file player , have parsed file, have displayed annotations in configurable ways. thought it'd easier embed everywhere way. myplayer("divid").setup({ videofile: "/video.mp4", annotationfile: "/annotations.rdf", annotationstyle: "overlay" }); my colleague argued break pure mvc pattern have been following. rather parse annotation file server side , display through view. what think? keep in mind intend let other projects use player we'd make reusable possible. you colleague confusing mvc one-m, one-v , one-c. model, view , controller can structured in number of arbitrary layers want. , being here cpu involved in browser, might use (so @ least 2 layers of view). might decide parse on server many reasons, "not breaking mvc" wouldn't 1 of them.

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -

import pyodbc,nltk,array cnxn = pyodbc.connect('driver={mysql odbc 5.1 driver};server=127.0.0.1;port=3306;database=information_schema;user=root; password=1234;option=3;') cursor = cnxn.cursor() cursor.execute("use collegedatabase ;") cursor.execute("select * sampledata ; ") cnxn.commit() s=[] j=[] x=[] words = [] w = [] sfq = [] pos=[] entry in cursor: s.append(entry.injury_type),j.append(entry.injury_desc) nltk.tokenize import punktwordtokenizer nltk.corpus import stopwords tokenizer = punktwordtokenizer() english_stops = set(stopwords.words('english')) in range(0,26): # filter stop words tokenizer.tokenize(j[i]) w.append([word word in tokenizer.tokenize(j[i]) if word not in english_stops]) in range(0 , 26):#converting tokenzied text ito string sfq.append(" ".join(w[a])) replacers import regexpreplacer replacer = regexpreplacer() in range (0,26):#pos tagging replacer.repl...

Function and data format for doing vector-based clustering in R -

i need run clustering on correlations of data row vectors, is, instead of using individual variables clustering predictor variables, intend use correlations between vector of variables between data rows. is there function in r vector-based clustering. if not , need manually, right data format feed in function such cmeans or kmeans? say, have m variables , n data rows, m variables constitute 1 vector each data row. have n x n matrix correlation or cosine. can matrix plugged in clustering function directly or processing required? many thanks. you can transform correlation matrix dissimilarity matrix, instance 1-cor(x) (or 2-cor(x) or 1-abs(cor(x)) ). # sample data n <- 200 k <- 10 x <- matrix( rnorm(n*k), nr=k ) x <- x * row(x) # 10 dimensions, less information in of them # clustering library(cluster) r <- pam(1-cor(x), diss=true, k=5) # check results plot(prcomp(t(x))$x[,1:2], col=r$clustering, pch=16, cex=3)

Google maps api v3 LatLng conversion error -

i'm doing ajax call request position , move marker relative position is. problem latlng command returns (nan,nan) though variable "data" contains position. doing wrong here? function marker() { $.get("ajax.php", { do: "getpos" }, function(data){ var latlng = new google.maps.latlng(data); alert(latlng); beachmarker.setposition(latlng); }); //settimeout( "marker()", 10000); } as documentation says, latlng constructor should have 2 parameters, both must numbers. ajax response can't of number type. string, should split , parse numbers passing latlng constructor.

c# - Capturing javascript popups -

in webbrowser, there anyway capture stupid popups generated javascript? the ones "success" or watever , have "ok" button. i tried webbrowser "newwindow" event, not being fired. any tips? you redefine global javascript alert function this: function alert() {} then nothing happen when other code calls alert. update: to add following page code: <script> function alert() {} </script> if injecting pages may wish @ greasemonkey , add script using that: https://addons.mozilla.org/en-us/firefox/addon/greasemonkey/ there similar addons browsers.