Posts

Showing posts from June, 2012

HTML5 live video Apple iOS -

so far understand it, there no way (yet) play live video streams using html5 video on apple device , have 1-1.5 second latency or less. streaming protocol apple seems support hls , involves dividing video chunks, downloading them 1 one, , having downloaded enough pieces ( 3 default) start playing it. if each of these pieces 3 seconds long, looking @ 9-10 second latency. reducing length of piece causes constant disruption when streaming , reducing bitrate of video doesn't seem reduce said marker. is there other viable solution streaming truly live video using html5 on apple mobile devices? if anybody's wondering - there still hacky workaround avoid using hls @ all. you can convert video stream sequence of images in mpeg1 format (using ffmpeg example) , download them @ client side using javascript library , use canvas element display them. can achieved using jsmpeg , streaming-server code runs on node.js i able 30 fps 540x320 resolution 150ms lat

php - Checkboxes with FormData.Append -

i using javascript formdata.append pass values php file, cannot check boxes working. example html <input type="checkbox" name="xxx" value="xxx" /><label>xxx option</label> js formdata.append( 'xxx', $('input[name=xxx]').val()); php if (isset($_post['xxx'])) { echo "checked!";} whether check box or not, response - checked! or php $xxx= $_post['xxx']; the var $xxx shows value xxx whether checked or not. how can pass checkboxes using method can differentiate if checkbox ticked or not! try using document.getelementsbyname('xxx')[0].checked to check status of whether it's checked or not.

How to get src of image in androids ImageView -

in application need find out source of image in 1 imageview can put same image on imageview. need actual source, , not resource id, because need other actions it. i tried with: imageview image = (imageview) view; string src = view2.getdrawable().tostring(); but want returned value like: some_packages/image.png same in c# image.source.tostring() . posible? sorry english , thank answer. is posible? not way going it. imageview not have populated resource. can using sort of drawable . drawable can created either in java code or resource. so, neither imageview nor drawable inside of able tell resource used, there may not such resource. either: hold onto source somewhere else, or put source in tag of imageview via settag() , retrieve later via gettag()

javascript - Django and autocomplete quick and dirty approach -

can suggest simple quick , dirty method of providing autocomplete text field example. may consider drop down later on. can think of few strategies doing this, i'd stay away non-standard django packages. are there js libraries help? thinking speed, need query options - i.e. text fields , let js/jquery figure out 1 works best , i'll expose js/jquery library list of keywords. any suggestions save time? there pretty 1 option i'd suggest : django-autocomplete-light’s purpose enable autocompletes , in django project: fruit of half decade of r&d , thousands of contributions. designed django every part overridable or reusable independently. stable, tested, documented , supported: tries neighbour in django ecosystem. its easy setup, has no dependencies , plays django.

data insertion in 2D array in jquery -

i want insert data in array through jquery below: means @ first time insert values on first position , second time insert values on second postion (i.e not insert values @ time on both positions) var custarr = new array(); custarr.push(["structure", "select parent"]); custarr.push(["a", ""]); custarr.push(["b", ""]); var sel = $('<select>').appendto('body'); (var = 0; < custarr.length; i++) { custarr.push("", sel.append($("<option>").attr('value', "some values"); } expected result is: custarr.push(["structure", sel.append($("<option>").attr('value', "some values")]); i cannot insert them both problem firstly in first loop. can insert structure values , in second loop need insert dropdown in front of structure values.

javascript - jQuery undefined value of an existing html element -

i have jquery code check whether html element particular id exists or not. have written if , else clause of existing , non existing html element. when element exists why jquery returns value undefined ? you can see jquery code below. variable start_time defined, because enters clause condition value detected undefined. wrong code? var count = 0; for(i=1; i<=n_day; i++){ count = count + 1 ; var start_time = jquery("#txtstarttime_detail"+i); var end_time = jquery("#txtendtime_detail"+i); var start_location = jquery("#txtstartlocation_detail"+i); var end_location = jquery("#txtendlocation_detail"+i); var start_location_coor = jquery('#txtstartlocation_coordinates_detail'+i); var end_location_coor = jquery('#txtendlocation_coordinates_detail'+i); //var day = jquery('#txtday'+i); if(typeof start_t

java - Convert int, long, boolean, String, double in List (two variants), Set(two variants), Queue, Deque -

i have method convert array arraylist follows: public class main { //https://docs.oracle.com/javase/tutorial/extra/generics/methods.html public static <t> void fromarraytocollection(t[] a, collection<t> c) { (t o : a) { c.add(o); } } public static void main(string[] args) { car [] cars = new car[2]; cars[0] = new car(1, "volvo", "2612axa"); cars[1] = new car(2, "toyota", "1861axa"); int [] = new int[2]; i[0] = 1; i[1] = 1; long [] l = new long[2]; l[0] = 122342141; l[1] = 214214211; double [] d = new double[2]; d[0] = 1.0; d[1] = 2.0; boolean [] b = new boolean[2]; b[0] = true; b[1] = false; string [] s = new string[2]; s[0] = "one"; s[1] = "two"; collection<string> sc = new arraylist<string>();

javascript - Twig assets unable to find js files -

i use symfony 2.7. have tried load javascript file via javascript block. twig throws following error message: an exception has been thrown during compilation of template ("unable find file "@appbundle/resources/public/js/".") in "security/registration.html.twig". so here registration.html.twig : {% block body %} //divs. {% endblock %} {% block javascripts %} {% javascripts '@appbundle/resources/public/js/*' %} <script src="{{ asset_url }}"></script> {% endjavascripts %} {% endblock %} i have checked folder path, , okay, in view: /var/www/html/userauthentication/app/resources/public/js/registration.js and here index.twig.html include registration.twig.html : {% extends '::base.html.twig' %} {% block body %} <div id="wrapper"> <div id="container"> {{ render(controller('appbundle:security:login')) }}

c++ - g++ linking local libraries -

new c++ , new compiled languages in general. i've been passed university specific code library class use in completing assignments. however, cannot figure out how link it. directories laid out follows: assignment lib universitycpplib .cpp , .h files res src .cpp assignment just calling g++ -o assignment.cpp assignment gives me no such file or directory and not sure how use -l specify local library. *edit: also, relatively new in general. mind telling me why keep getting downvotes? still learning here , gladly correct myself if breaking of rules here. to - l option give complete path until lib directory . use - l option name of library without suffix.

html - PHP adds "<head/>" to any xml output -

not sure whats going on here code: $template = ' <?xml version="1.0" encoding="utf-8" standalone="yes"?> <categories> <category> </category> </categories>'; echo $template; but comes out on web browser <?xml version="1.0" encoding="utf-8" standalone="yes"?> <head/><categories> <category> </category> </categories> and when change code slightly <?xml version="1.0" encoding="utf-8" standalone="yes"?> categories> <head/><category> </category> </categories> notice removed "<" , head attached next "<". on earth going on here? know is? are setting content type header before outputting content in browser? if not, browser default text/html , add header tag (not sure though). header("content-type: text/xml"); and i

javascript - How to start a Server-Sent Event "only once" inside a SharedWorker to push message for any open script? -

i have server-sent event (sse) implementation working no issues. issue having "one user can have many connections server". basically, if user opens more 1 web browser's tab, each tab create brand new server-sent event request server cause many requests run single user. to solve problem, run sse inside javascript's sharedworker . this means have 1 sse communicating sharedworker. then, every page/web browser communication sharedworker. gives me advantage of allowing 1 sse per user. this how sse working without type of worker. $(function(){ //connect server read messages $(window).load(function(){ startpolling( new eventsource("poll.php") ); }); //function listen new messages server function startpolling(evtsource){ evtsource.addeventlistener("getmessagingqueue", function(e) { var data = json.parse(e.data); //handle recieved messages processserverdata(data);

vb.net - Loop through listbox items -

i making program automate entering data website im building. can enter 1 line of data @ time. want have listbox 8 items, want take listbox item 1 enter html feild value datafield, click send, navigate site "mysite.com", enter listbox item 2 datafield, click send , loop until listbox items have been entered. if set textbox, works enter single line data textbox 1, how loop go go through listbox items. 'paste url textbox datafield webbrowser1.document.getelementbyid("datafield").setattribute("value", textbox1.text) 'click search button dim allelements htmlelementcollection = webbrowser1.document.all each webpageelement htmlelement in allelements if webpageelement.getattribute("type") = "submit" webpageelement.invokemember("click") end if also there way when navigate "mysite.com" wait until sites loaded enter next

vb.net - Batch start with parameters Error -

Image
i'm trying make small program includes 2 steps decompile , start .java file. can't run .bat file correctly because dos doesn't accept spaces want. here's code: process.start("cmd.exe", "/c start "" """ & textboxjavacpath.text & _ """" & " " & """" & textboxfile.text & """") that's string comes out: (it's right) /c "c:\program files\java\jdk1.8.0_60\bin\javac.exe" "c:\users\niklas\desktop\java\kap06\src\eingabe\letsreadline.java" if enter typing in console works, via vb.net doesn't work. the error following: the command "c:/program" written incorrect or couldn't found. try using code (i don't know if it'll work) : private sub start(javacpath string, file string) using p new process { .startinfo = new processstartinfo { .workingdirec

graph - sorting algorithm for the following? -

so, trying solve following problem: http://codeforces.com/contest/510/problem/b i solve way: create graph g each vertex represents letter alphabet. insert directed edge v1 v2 g iff there exist 2 words in given sequence such w1 = prefix v1 suffix1 , w2 = prefix v2 suffix2 , w1 precedes w2 in given sequence. should figure out how make step efficient. believe can done in o(sum on length of each word) return true if g can sorted topologicaly.

osx - brew update permission error yosemite -

when run brew update following error message $ brew update permission denied (publickey). fatal: not read remote repository. please make sure have correct access rights , repository exists. error: failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master i on os x yosemite. github isn't able authenticate you. so, either aren't setup ssh key, because haven't set 1 on machine, or key isn't associated github account.

python - Django sending email with google SMTP -

i have been trying emails working django application , have not been able to. ive been reading around on similar questions , still haven't been able pin point error. my settings.py looks : email_host = 'smtp.gmail.com' email_host_user = 'email@domain' email_host_password = 'pass' email_port = 587 email_use_tls = true email_backend = 'django.core.mail.backends.smtp.emailbackend' my code send email looks : def application(request): if request.method == 'get': form = applyform() else: form = applyform(request.post) if (form.is_valid()): try: subject = 'overland application' from_email = form.cleaned_data['useremail'] phone = form.cleaned_data['phone'] names = form.cleaned_data['names']

python - How to figure out which command line parameters have been set in plac? -

my python script takes configuration values in order: command line argument (possibility overwrite user defined values in configuration file) configuration file value (user defined values) default value in source code i need figure out option has been set on command line in order determine whether default value has been set explicitly or not. plac [not?] transparent , don't see how it's possible. avoid parse sys.argv because writing command line parser in order use command line parser doesn't seem idea. i'm using plac 0.9.1 on ubuntu 15.04 . could give simple example of plac setup? used know well, know underlying argparse better. are using plac invoke function (s) directly, e.g . plac.call(main) internally plac creates argparse.argumentparser (actually own subclass), populates arguments derived functions signature. , calls function values parsed. if working argparse directly, create parser, populate it, , invoke with args = p

node.js - Deploying Deployd to Heroku Dashboard Key -

i have deployd application trying deploy heroku. have been able deploy application , able hit via it's url. trying access dashboard. in order access dashboard , requires have key generated server. understand there 2 ways this. the first method described here generates key locally , pushes heroku. feel method unsecure in sense keys published vcs. the second method use procfile , list dpd keygen , dpd showkey . reason method not work me. see commands executed in heroku logs doesn't print out keys , cannot see executing heroku run dpd showkey . i figure out why listing commands in procfile not work. please find file listed out below: web: node app.js cmd: dpd keygen cmd: dpd showkey my log file follows: 2015-08-30t19:18:25.012474+00:00 heroku[api]: starting process command `dpd showkey` [email] 2015-08-30t19:18:28.196008+00:00 heroku[run.5122]: starting process command `dpd showkey` 2015-08-30t19:18:28.168161+00:00 heroku[run.5122]: awaiting client 2015-08-30t1

Obtaining off-road location on an android device -

i using following code location: location mypos = locationservices.fusedlocationapi.getlastlocation(googleapiclient); this seems try , snap location road (not always, often), not want @ all. there way "last known/best location" without snapping roads?

ruby on rails 4 - Can't route to /logout with Authlogic -

Image
i've been trying set user authentication in app using authlogic, , i'm sure problem in code can't seem find it. when hit /login link, works expected, /logout wants use instead of delete. routing.db rails.application.routes.draw root 'comments#index' resources :roles resources :subjects resources :comments resources :topics resources :users resources :user_sessions, only: [:create, :destroy] delete '/logout', to: 'user_sessions#destroy', as: :logout '/login', to: 'user_sessions#new', as: :login end user_sessions_controller class usersessionscontroller < applicationcontroller before_filter :require_no_user, :only => [:new, :create] before_filter :require_user, :only => :destroy def new @user_session = usersession.new end def create @user_session = usersession.new(user_session_params) if @user_session.save flash[:success] = "welcome back!" redire

apache - .htaccess - redirect request to directory and any of it's files and subdirectories to single URL -

redirect /product/ , of it's files or subdirectories http://example.com without appending file, subdirectory or params it. example: http://example.com/something/product -> http://example.com http://example.com/something/product/some-dir/ -> http://example.com http://example.com/something/product/?foo=bar -> http://example.com http://example.com/something/product/some-dir/some-file.html -> http://example.com i've tried quite few rewriterule solutions i've found on stackoverflow (most of can found here ) append subdirectories, files or params. example: http://example.com/something/product/some-dir/ redirects http://example.com/some-dir where i'd (and else under , including products ) redirect http://example.com here's example of 1 of .htaccess files tired failed: rewriteengine on rewriterule ^products\/.+ http://example.com [nc,l] update i've deleted .htaccess file on local machine i'm still getting redirects

git - Gitweb - 404 - No projects found -

i have digitalocean droplet centos 7 can't see repos on droplet. i have user git , inside respective home folder have folder "projects": /home/git/projects inside folder test repo initialized with: git init --bare here gitweb.conf $projectroot = "/home/git/projects"; $git_temp = "/tmp"; $home_link = $my_uri || "/"; $home_text = "indextext.html"; $projects_list = $projectroot; here sites-availables file: server { listen 80; server_name git.apselom.com; access_log /var/log/nginx/git.apselom.com.access_log main; error_log /var/log/nginx/git.apselom.com.error_log info; location /gitweb.cgi { root /var/www/git/; include fastcgi_params; gzip off; fastcgi_param script_name $uri; fastcgi_param gitweb_config /etc/gitweb.conf; fastcgi_pass unix:/var/run/fcgiwrap.socket;

html - How to make images appear side by side on one row on desktop, but responsive and centered above each other on mobile? -

we have 2 pages we're trying have images appear in 1 row side-by-side when viewing on desktop , tablet, responsive , centered above 1 on mobile. it's working on 1 page , not on other-- i'm assuming because images wide on pages breaks, makes me think entire code faulty. tips? suggestions? the pages are-- http://www.vaporfresh.com/pages/retailers http://www.vaporfresh.com/ the css-- div.jumbo { background-color: #fff; width: 100%; margin: 6px auto; padding: 2px; text-align: center; } .jumbo img { padding: 8px; display: inline; } @media (max-width: 768px) { .jumbo img { display: block; margin: 5px auto; } } the html-- <div class="jumbo"> <a href="http://www.amazon.com/gp/aag/main/ref=as_li_ss_tl?ie=utf8&amp;asin=&amp;camp=1789&amp;creative=390957&amp;isamazonfulfilled=1&amp;iscba=&amp;linkcode=ur2&amp;marketplaceid=atvpdkikx0der&amp;orderid=&amp;seller=a1zsbt0hod7th4&amp;sshmpath=&am

c# - In C # how to pass string.empty in a list of string -

i have list of string emails = new list<string>() { "r.dun@domain.co.nz", "s.dun@domain.co.nz" } now want pass string.empty first value of list something like policy.emails = new list<string>(){string.empty}; how put loop e.g. each value of list something. you can directly set first element string.empty: policy.emails[0]=string.empty;

java - Why some programmers like to add final keyword in the method params? -

recently,i found in projects add final keyword in method parameters like: public static string getsuffix(final string filename) { if (filename.indexof('.') >= 0) { return filename.substring(filename.lastindexof('.')); } return emtpy_string; } public httpresult(final int statuscode) { this.statuscode = statuscode; } it can catch bugs. for example, if write : public httpresult(final int statuscode) { statuscode = statuscode; } you compilation error, since assigning value local final variable, while if write public httpresult(int statuscode) { statuscode = statuscode; } you won't compilation error, statuscode member won't assigned.

svn - Configuring Apache 2 ubuntu default page and Xampp in Ubuntu 14.04? -

i've installed xampp 5.6.11-0 in ubuntu 14.04 os. few days ago install , configure apache subversion. now, when try run xampp via terminal (with command : sudo /opt/lampp/lampp start), xampp failed run , shows following message in terminal : starting xampp linux 5.6.11-0... xampp: starting apache...fail. xampp: web server running. xampp: starting mysql...ok. xampp: starting proftpd...fail. xampp: ftp daemon running. when visit localhost in browser, display "apache 2 ubuntu default page". how can run xampp again? there missed configuration? help/clue appreciated. probably used port. 80. run: netstat -tulpn check ports in use, , free 1 need running kill process number in last column of output of first command.

node.js - Loading static assets in Nodejs -

what correct approach loading static files. i'm trying use semantic ui. have followed basic steps here: http://semantic-ui.com/introduction/getting-started.html . have node installed, npm installed, ran gulp process , built files. have required files this: link(rel='stylesheet', type='text/css', href='/semantic/dist/semantic.min.css') script(src='semantic/dist/semantic.min.js') my project structure this: server.js views/ index.jade semantic/ dist/ semantic.min.css semantic.min.js i have checked in browser , there no console error files aren't listed resource. have checked server logs , there's no error. the thing can think of, need set public directory serve static files like: app.use(express.static(path.join(__dirname, 'public'))); edit have attempted this: app.use(express.static('public')); and have moved files public directory. loads because can navigate them in browser aren't b

Android - Animate RecyclerView Item of Fragment Inside ViewPager -

i using viewpager fragments . each fragment have recyclerview gridlayoutmanager . inside recyclerview adapter have set animation on onbindviewholder . problem : as viewpager loads 2 fragments @ once, animation second fragments gets completed if view not visible expected output : when swipe on viewpager recyclerview item should animate. recyclerview adapter public void onbindviewholder(viewholder viewholder, final int position) { viewholder.getserviceimageview().setimageresource(mservices.get(position).getimageresource()); viewholder.getservicenameview().settext(mservices.get(position).getservicename()); viewholder.getpriceperhourview().settext(string.valueof(mservices.get(position).getpriceperhour())); setanimation(viewholder.serviceitemcontainer, position); } private void setanimation(view viewtoanimate, int position) { // if bound view wasn't displayed on screen, it's animated if (position > lastposition) { animation

node.js - What is the different between http module and express modle -

i'm learning nodejs from: http://www.tutorialspoint.com/nodejs/ and cant understand different between using http module (get/post methods) vs using express module (get/post methods) it seems express module rapid development. are there advantages use http module compared express module ? are there advantages use express module compared http module ? thanks express not "module" , it's framework: gives api, submodules, and methodology , conventions , tying components necessary put modern, functional web server conveniences necessary (static asset hosting, templating, handling xsrf, cors, cookie parsing, post parsing, name it, lets use it). the http api that's baked node.js , on other hand, just http module: can set http connections , send , receive data, long uses hypertext transfer protocol (with relevant http verb) , that's... that's really. they different things. many articles can find searching web details on both tell you.

php - mail() function cannot work with two email filters? -

i have function send email. working fine until added additional check input email (besides filter_var()) coming form check specific domain names , reject them accordingly. i cannot understand why isn't working now. i've added top of file: ini_set('display_errors', true); error_reporting(e_all); it won't show me error message nor send email. the part fills parameter ($correo) hasn't changed: <?php function enviarmails($correo) { $mimensaje = "bláh, bláh"; if (!filter_var($_post['emailremitente'], filter_validate_email)) { echo "<br>oops! email incorrecto"; } else { $rejecteddomains = array('midominio.org', 'midominio.com'); $emailparts = explode('@',$_post['emailremitente']); if (in_array(strtolower($emailparts[1]), $rejecteddomains)) { echo "<br>oops! email incorrecto"; } else{

objective c - How to fix Memory Leak in Custom WifiStatus file in IOS -

Image
please suggest how fix below memory leak. note : using arc in project. compiled using arc only. i tried take temporary dict , bool , return variables. still memory leak doesn't fix... thanks in advance...! this should it, passes xcode menu: "product" >> "analyze" this showing 0 potential or realized memory leaks: -(bool)iswificonnected { return wifidetails() == nil ? no : yes; } nsdictionary *wifidetails() { cfarrayref interfaces = cncopysupportedinterfaces(); cfdictionaryref captiventwrkdict = cncopycurrentnetworkinfo(cfarraygetvalueatindex(interfaces, 0)); nsdictionary *dict = ( __bridge_transfer nsdictionary*) captiventwrkdict; cfrelease(interfaces); return dict; }

c++ - Are character pointer allowed in python? -

i using c++ based library return type char pointer. calling c++ function within python. my question can delete memory allocated in c++ function python? python code lib.taggetname.restype = c_char_p lib.taggetname.argtypes=[c_int] data = 1 cmt = (b"this comment voltage") result = lib.taggetname(data) python output kernel process terminated restart. (0) python 3.4.3 (v3.4.3:9b73f1c3e601, feb 24 2015, 22:43:06) on windows (32 bits). iep interpreter. type 'help' help, type '?' list of *magic* commands. running script: "d:\qtdev\test.py" 1 select stagname tagdatainfo itagid = 1; return value--> b'voltage\xfd\xfd\xfd\xfd\xdd`\x18x' print ("return value-->" , result) c++ function code use_math char* taggetname(int itagid) { char* cname; //string cname = ""; sqlite3_stmt *stmtcreate = null; sqlite3 *m_pdbobj; cout<<itagid

peoplesoft - Adding a font in CKEditor -

i peoplesoft developer. ckeditor rich text editor in our product , delivered feature of product. have make modification delivered feature of ckeditor. need add additional font delivered fonts of tool. have made changes mentioned in blogs- file name : \ckeditor_source\plugins\font\plugin.js ckeditor.config.font_names = 'arial/arial, helvetica, sans-serif;' + 'comic sans ms/comic sans ms, cursive;' + 'courier new/courier new, courier, monospace;' + 'georgia/georgia, serif;' + 'lucida sans unicode/lucida sans unicode, lucida grande, sans-serif;' + 'tahoma/tahoma, geneva, sans-serif;' + 'times new roman/times new roman, times, serif;' + 'trebuchet ms/trebuchet ms, helvetica, sans-serif;' + 'verdana/verdana, geneva, sans-serif;' + 'futura ltcn bt/futura ltcn bt'; even after making above change not able view new font in rte. new javasript. kindly assis me in files m

Use of $scope.$on() function in angularjs -

i new angularjs. saw $scope.$on() function. can't understand this. can explain me $scope.$on used listed events triggered $scope.$broadcast or $scope.$emit

Java: Find string in array list -

my arraylist consists of array list of strings, each string inside separated commas, want split 1 of strings substrings divided commas, know how arrays using split method, im having trouble finding similar array lists, heres code: string[] widgets2 = { "1,john,smith,john1989@gmail.com,20,88,79,59", "2,suzan,erickson,erickson_1990@gmailcom,19,91,72,85", "3,jack,napoli,the_lawyer99yahoo.com,19,85,84,87", "4,erin,black,erin.black@comcast.net,22,91,98,82", "5,adan,ramirez,networkturtle66@gmail.com,100,100,100" }; arraylist<string> jim = new arraylist<string>(arrays.aslist(widgets2)); system.out.println(jim.split(0)); it similar arrays . implementation different. values loop through them: list<string> jim = new arraylist<string>(arrays.aslist(widgets2)); for(string currentstring : jim){//arraylist looping string

php - How to stop doctrine from updating my entity during is lifecycle -

i'm working on 1 of entity in symfony 2. i'm trying make if upload zip file, entity open zip file, find file name _projet , generate name. thing need stop entire uploading , updating process if error happen, isn't able open zip or doesn't find file named _projet. i'm tweaking showed in cookbook: http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html it said @ 1 point that: // if there error when moving file, exception // automatically thrown move(). prevent // entity being persisted database on error so want same thing if bad happens , maybe somehow tell controller there problem (i use flush() in controller) here code far: /** * @orm\prepersist() * @orm\preupdate() */ public function preupload() { //if there file project if (null !== $this->getfichierfile()) { //create uniq name $nomfichierprojet = sha1(uniqid(mt_rand(), true)); //check if it's zip if($this->getfichierfile()->gu

sql server - TSQL - Grab valid URLs -

i have table looking this: url ============== www.google.com http://www.yahoo.com/ www.192.168.1.1.com 192.168.1.5 www.192.168.5.149/service.ir test.sitename.com so question seperats 2 sections: getting urls based on pattern ( (http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])? ). formatting urls aren't valid (based on pattern) so came query part one: select url userwebsites url '%(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?%' but have no idea how format urls. is there more elegant way this? t-sql isn't tool doing string parsing--you're far better off writing clr function , doing work there. there tons of things can regex in simple function--and more efficient code (because writing resembling regex functionality t-sql string operators going long , involved).

javascript - How can I send text to from one route (/client/1) to another route (/client/2) using ajax in rails? -

i making simple rails (4) application , realize need send text each other sit on different routes (/client/1 , /client/2) without reloading page. got far. route (/client/1) there input tag , made form rails form helper send xhr request associated controller in controller, grab text params , assigned variable i made js file named after action , append variable tag this working in client/1 cannot figure out how send text route (/client/2). please me make possible. i appreciate in advance. thanks !! you need streaming mechanism. first, understand about, suggest watch railscast. it's old 1 explain basic principle of http://railscasts.com/episodes/316-private-pub then can read pretty article http://www.sitepoint.com/streaming-with-rails-4/ once understand principles, have @ faye , actioncontroller::streaming

I want to send image from java server to android using image url -

i want make image url image path like, http://api.androidhive.info/feed/img/nat.jpg . i stored image in local server /home/image/a.jpg you can install web server on system has images, change web server's root directory directory in you've stored images. then, android app, download image using url can construct using web server's address , path image relative web server's root directory. ex: if root directory /home/image/ url be: www.example.com/a.jpg

regex - gsub replace and preserve case -

i've been using gsub abbreviate words in longer strings. i'd abbreviate word , inherit of capitalization of input can. example, turn hello hi in this: x <- c("hello world", "hello world", "hello world", "hello world") but respect case of hello in original c("hi world", "hi world", "hi world", "hi world") most of examples want match "hi" "hi" , "hi". don't care "hi", completeness, leave possibility. to done until now, have tedious approach of maintaining vectors of strings of targets , replacements xin <- c("hello\ ", "hello\ ", "hello\ ", "hello\ ") xout <- c("hi ", "hi ", "hi ", "hi ") mapply(gsub, xin, xout, x) that gives correct answer, see: hello hello hello hello "hi world" "hi world" "hi world&qu

c# - Need Regex pattern to validate password pattern -

we need validate password against following pattern. “xabcdef99*” [1st char uppercase, 2nd 7th chars lowercase, 8th 9th digits , last char symbol ] can provide me regex same? how can validate following password against regex in c#. userpcs12* --> valid testeur333 --> invalid (because last char not symbol) userpcs12* --> invalid (because first char not uppercase) you may try this, ^[a-z][a-z]{6}\d{2}[~!@#$%^&*]$ add symbols want inside last character class. or ^[a-z][a-z]{6}\d{2}\w$ \w matches non-word character. change [\w_] if treat _ special charcater.

c# - The left-hand side of an assignment must be a variable, a property or an indexer -

hey i'm kinda new unity , i've been trying butt off error right can't seem it. using unityengine; using unityengine.ui; using system.collections; using unityengine.eventsystems; public class dropzone : monobehaviour, idrophandler, ipointerenterhandler, ipointerexithandler { public gameobject gameboard; void awake() { if (gameboard.getcomponent<rules>().yourturna = false) { dropzone = null; } } void start() { } public void onpointerenter(pointereventdata eventdata) { //debug.log("onpointerenter"); if (eventdata.pointerdrag == null) return; draggable d = eventdata.pointerdrag.getcomponent<draggable>(); if (d != null) { d.placeholderparent = this.transform; } } public void onpointerexit(pointereventdata eventdata) { //debug.log("onpointerexit"); if (eventdata.point

node.js - Adaptive Cards doesn't work in MBF's Emulator running in Ubuntu 16.04 -

i trying implement adaptivecard 1 of dialogs using node.js. once run emulator following message instead of rendered adaptivecard : [file of type 'application/vnd.microsoft.card.adaptive'] . can tell me can problem? i running on ubuntu 16.04, mbf emulator v.3.5.31-alpha, microsoft-adaptivecards v.0.6.1. here code inside of 1 of dialogs: var msg = new builder.message(session) .addattachment({ contenttype: "application/vnd.microsoft.card.adaptive", content: { type: "adaptivecard", body: [ { "type": "textblock", "text": msg_text, }, { "type": "input.choiceset", "id": "mycolor4", "ismultiselect": true, "value": "1", "style": "expanded", "choic

php - preg_match: can't find substring which has trailing special characters -

i have function uses preg_match check if substring in string. today realize if substring has trailing special characters special regular expression characters (. \ + * ? [ ^ ] $ ( ) { } = ! < > | : -) or @, preg_match can't find substring though there. this works, returns "a match found." $find = "website scripting"; $string = "php website scripting language of choice."; if (preg_match("/\b" . $find . "\b/i", $string)) { echo "a match found."; } else { echo "a match not found."; } but doesn't, returns "a match not found." $find = "website scripting @"; $string = "php website scripting @ language of choice."; if (preg_match("/\b" . $find . "\b/i", $string)) { echo "a match found."; } else { echo "a match not found."; } i have tried preg_quote, doesn't help. thank suggestions! edit: word boundar

c# - intellisense in vb6 doens't work with Interop and UnmanagedType.Struct -

this question has answer here: how pass decimal c# vb6 interop 1 answer i have c# interop class property: decimal importodocumento { [return: marshalas(unmanagedtype.struct)] get; [param: marshalas(unmanagedtype.struct)] set; } in vb6 should variant/decimal. if try use it, works. can assign value , can value. problem vb6 intellisense doesn't work. can see other properties of class not importodocumento. intellisense important because class used other people. how can do? thanks the reason why method missing intellisense because type library exporter gives 2 warnings: type library exporter warning processing 'classlibrary1.class1.get_importodocumento(#0), classlibrary1'. warning: method or field has invalid element_type/native_type combination. type library exporter warning processing 'classlibrary1.class1.set_importodocum

translate - svg text translating and moving are not correct -

it's part of code roate each text. .selectall("text") .attr("y", 0) .attr("x", 9) .attr("dy", ".35em") .style("text-anchor", "start") .attr("transform", function(d) { return "rotate(90)"; }) it seems works don't know why .attr("y", 0) is move left , right and .attr("x", 9) is move , down. and why text set center code, not without .attr("y", 0) line. you have rotated text 90 degrees. now, if move text "right" increasing x coordinate, move downwards (because of 90 degree rotation)

html - Multiple images on the page and showing success text from ajax under each image -

i have multiple images on page. every image has option "add favorites". everything work fine except message showing above image if image added or not favorites . success/fail message showing on top above first image only. know must use unique id each image can't understand how exactly. here html part show images. echo ' <article class="main-post" id="'.$row['image_id'].'" > <div class="article-top"> <hr /> <h1><a href="imagepreview.php?image_id='.$row['image_id'].'">'.$row['image_caption'].'</a></h1> <div class="counters-line"> <div class="pull-left"> <span id="message_favorites"></span> </div> <div id="'.$row['image_id'].'" class="pull-right">