Posts

Showing posts from August, 2012

Display the latest images in a directory php -

i've had can find how display latest image, or display them all. need display 5 latest images. my current code display 1 image is <?php $dir = 'images/other'; $base_url = '/images/other'; $newest_mtime = 0; if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if (($file != '.') && ($file != '..')) { $mtime = filemtime("$dir/$file"); if ($mtime > $newest_mtime) { $newest_mtime = $mtime; $show_file = "$base_url/$file"; } } } } print '<img src="' .$show_file. '" alt="code">'; ?> this should work you: (first files glob() , sort them last modification filemtime() , usort() . after 5 newest array_slice() . , @ end loop through them , print images) <?php $dir = "images/other"; $files = glob($dir . "/*.*");

android - How To Create a Simple Universal Image Loader via URL(Only one image) -

i done don't know why image does't desplay. , told me after how can put images grid views.) public class mainactivity extends actionbaractivity { private imageview imageview; private bitmap bitmap; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); imageview = (imageview) findviewbyid(r.id.imageview1); bitmap=getbitmapfromurl("http://cs596.vk.me/u78792285/a_98dc2d1e.jpg"); imageview.setimagebitmap(bitmap); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); return true; } public bitmap getbitmapfromurl(string src) { try { url url=new url(src); httpurlconnection connection= (httpurlconnection) url.openconnection(); connection.setdoinput(true); connection.connect(); inputstream

multiprocessing - Passing multiple parameters to pool.map() function in Python -

this question has answer here: python multiprocessing pool.map multiple arguments 13 answers i need way use function within pool.map() accepts more 1 parameter. per understanding, target function of pool.map() can have 1 iterable parameter there way can pass other parameters in well? in case, need pass in few configuration variables, lock() , logging information target function. i have tried research , think may able use partial functions work? don't understand how these work. appreciated! here simple example of want do: def target(items, lock): item in items: # cool stuff if (... condition here ...): lock.acquire() # write stdout or logfile, etc. lock.release() def main(): iterable = [1, 2, 3, 4, 5] pool = multiprocessing.pool() pool.map(target(pass params here), iterable) pool.close()

php - Why WordPress HTML editor remove <p> tag and <br>? Can we stop this? -

i need make static pages in wordpress make through html editor need change text regularly. page layout not looking html editor removing <p> , <br> tags. for example if entering below html in editor through 'text' mode. <p>some text</p> <a>google.com</a> click on 'visual' tab , again switch 'text' mode, html change below. some text <a>google.com</a> i have installed "tinymce-advanced" , configured setting stop removing <p> tag , <br/> tag. stop removing <p> tag editor start adding <p> tags randomly example above html code looking below. <p>some text</p> <p><a>google.com</a></p> kindly share suggestions

What does the Alignment clause in Ada do? -

i'm not clear alignment clause in ada does. see example below. have 40 bit sized record, , i'm not sure happens when use clause. type knots_status_record record value : knots; status : statuses; end record; knots_status_record use record value @ 0 range 0 .. 31; -- 32 status @ 0 range 32 .. 39; -- 8 end record; knots_status_record'alignment use 1; attribute alignment alignment of x ensure address divisible x data'aligment = x <=> data'address mod x = 0 implication some processors requires data address aligned specific alignment. some processors accesses data faster if data address aligned specific alignment. example address behavior with ada.integer_text_io; use ada.integer_text_io; ada.text_io; use ada.text_io; system.storage_elements; use system.storage_elements; ada.assertions; use ada.assertions; ada.command_line; use ada.command_line; procedure m

Access to clipboard for Chrome extension using JavaScript -

i writing chrome extension. every time user copies something, extension should capture copied text. read access clipboard security concern. there clipboardread , clipboardwrite permission according https://developer.chrome.com/extensions/declare_permissions is possible in way? it says in link posted permission used document.execcommand('paste'), write function monitor changes in clipboard, , more when find modified since last check.

r - set default device (png) with default height and width -

i'm setting default device png options(device="png") . for 1 plot, can make png in r particular dimensions using png(...) : v <- 1:10 png("squared.png", width = 960, height = 480) plot(v, v**2) dev.off() but want set default height/width (just i'm setting default device) plots come out desired height , width. why don't re-define png? if type png console, r display function code. can copy , paste r script, changing defaults. then, autocomplete of function arguments still work.

linkedin - Request failed: unauthorized (401) IOS LinkedinAPI -

i've looked @ similar questions none seem solve problem. use query below access information linkedin. know url correct because i've tested on apigee.com keep getting same error. after user has logged in , i've been authorized. doing wrong? pfquery *query = [pfquery querywithclassname:@"linkedinuser"]; [query wherekey:@"user" equalto:user]; [query getfirstobjectinbackgroundwithblock:^(pfobject *linkedinresults, nserror *error) { if (!error) { [pflinkedinutils.linkedinhttpclient get:[nsstring stringwithformat:@"https://api.linkedin.com/v1/people/~:(first-name)?oauth2_access_token=%@&format=json", linkedinresults[@"accesstoken"]] parameters:nil success:^(afhttprequestoperation *operation, id result) { nslog(@"response json: %@", result); you logged in? means server have given authentication key have supply in following requests. didn't, why error. look @ response get. statu

F#: Generating a word count summary -

i new programming , f# first .net language. i read contents of text file, count number of occurrences of each word, , return 10 common words , number of times each of them appears. my questions are: using dictionary encouraged in f#? how write code if wish use dictionary? (i have browsed through dictionary class on msdn, still puzzling on how can update value key.) have resort using map in functional programming? while there's nothing wrong other answers, i'd point out there's specialized function number of unique keys in sequence: seq.countby . plumbing relevant parts of reed 's , torbonde 's answers together: let countwordstopten (s : string) = s.split([|','|]) |> seq.countby (fun s -> s.trim()) |> seq.sortby (snd >> (~-)) |> seq.truncate 10 "one, two, one, three, four, one, two, four, five" |> countwordstopten |> printfn "%a" // seq [("one", 3); ("two", 2)

javascript - Floor-plan in Android and svg -

Image
i want show simple custom floor-plan in android app, similar image below: the target colour area in (i info in app): it perfect if each of these areas clickable set onclicklistener or similar , able zoom in/out images. the main restriction want local, is, no connection internet service import image. i have tried loading html contains svg floor-plan, don't know how change colour of area android when move 1 area another. how can approach this? you can create simple html page within webview , attach svg , add javascript, when tapping on elements in svg call javascript function. can sent events native java code in android app if app native or handle in html. i believe article question interfacing svg

windows - USB interface in Python -

Image
i have ( http://www.gesytec.de/en/download/easylon/p/16/ ) usb device connected win7. trying read vendor id , product id. have python 2.7. here code, import usb busses = usb.busses() bus in busses: devices = bus.devices dev in devices: print "device:", dev.filename print " idvendor: %d (0x%04x)" % (dev.idvendor, dev.idvendor) print " idproduct: %d (0x%04x)" % (dev.idproduct, dev.idproduct) i getting following error, "file "<stdin>", line 1, in <module> file "c:\python27\lib\usb\core.py", line 846, in find raise valueerror('no backend available') valueerror: no backend available" doing wrong here? did install usb library package? if may need add path.

javascript - Protractor - How to get actual values from the Repeater, not the Elements? -

i creating protractor script test quiz game puts random questions , answers, need script able figure out answer correct, can click it. i can't figure out how values directly model, instead of elements, since correct/incorrect not exposed element on page. the model provides answers in choice in question.choices , , need find choice choice.iscorrect true. how access value? i wouldn't use element() function, right? element(by.repeater('choice in question.choices').row(0).column('choice.iscorrect')) the idea use element.all() in conjunction filter() , evaluate() : var correctchoices = element.all(by.repeater('choice in question.choices')).filter(function (elm) { return elm.evaluate('choice.iscorrect').then(function (value) { return value; }); }); as result correctchoices contain elements choice.iscorrect truthy. if need array of values correct choices, use map() , getattribute() : correctchoices.m

excel - VBA use Find to find value within another workbook and return row number -

taking values in sing.range("j" & i) , looking them in range amountrage. it's working find match, when want return row number, keeps giving me "0". for = 2 singlast on error resume next set findstringsing = amountrange.find(sing.range("j" & i)) if findstringsing nothing else x = findstring.row msgbox x avisarsing end if next

c# - How to check rectangle collision on a line -

i have line drawn 2 rectangles, spanning xpos, ypos xpos2, ypos2 . i'm trying detect if rectangle (stored in 4 arrays of x/y pos , random speed in 2 directions) collides line. i've tried (vector2.distance(new vector2(xpos + 13, ypos + 13), new vector2(enx[index], eny[index])) + vector2.distance(new vector2(xpos2 + 13, ypos2 + 13), new vector2(enx[index], eny[index])) == vector2.distance(new vector2(xpos + 13, ypos + 13), new vector2(xpos2 + 13, ypos2 + 13))) in if statement, doesn't work. edit: i've tried m = (ypos2 + 13 - ypos + 13) / (xpos2 + 13 - xpos + 13); b = ((m * xpos2 + 13) - ypos2 + 13); if (eny[index] == m * enx[index] + b) where xpos/2 , ypos/2 line starting points. enx[] , eny[] "enemy" x , y positions, i'm trying check if they're hitting line. i assume have rectangle's corner positions 2d vectors: vector2[] corners; the rectangle intersects line if 2 corner points lie on opposite si

How to declare a function that returns value and has parameters x86 assembly MASM -

i'm trying declare function using proc , far not work: inputarray(lpintegerarray:dword,lpstrnum:dword,lpstrprompt:dword):dword proc and neither this inputarray proc lpintegerarray:dword,lpstrnum:dword,lpstrprompt:dword:dword how declare function in x86 assembly masm takes parameters and returns dword value? i'm using .model flat well, chisx, if astronomy, can tell assembler language planet, different other. next code little 8086 assembler program intel syntax has 1 function calculate factorial, gets 1 parameter si register , returns value in ax register (made emu8086) : .stack 100h .data .code ;initialize data segment. mov ax,@data mov ds,ax mov si, 5 ;parameter function. call non_recursive_factorial ;results returns in ax. ;finish program properly. mov ax, 4c00h int 21h ;----------------------------------------- ;function calculate factorial. ;parameter : si. ;returns

three.js - Why does this ThreeJs plane appear to get a kink in it as the camera moves down the y-axis? -

i have instance of three.planebuffergeometry apply image texture this: var camera, scene, renderer; var geometry, material, mesh, light, floor; scene = new three.scene(); three.imageutils.loadtexture( "someimage.png", undefined, handleloaded, handleerror ); function handleloaded(texture) { var geometry = new three.planebuffergeometry( texture.image.naturalwidth, texture.image.naturalheight, 1, 1 ); var material = new three.meshbasicmaterial({ map: texture, overdraw: true }); floor = new three.mesh( geometry, material ); floor.material.side = three.doubleside; scene.add( floor ); camera = new three.perspectivecamera( 75, window.innerwidth / window.innerheight, 1, texture.image.naturalheight * a_bunch ); camera.position.z = texture.image.naturalwidth * 0.5; camera.position.y = some_int; camera.lookat(floor.position); renderer = new three.canvasrenderer(); renderer.setsize(window.innerwidth,window.innerheight); appe

c++ - click event of WindowsFormsControlLibrary button in MFC Dialog based app -

i'm using windows forms control library elements in app. my question is: how perform button click event element comes windows forms control library? so, can *library* textbox value in programdlg.cpp file this: void cmfcapplication1dlg::onbnclickedbutton1() { // todo: add control notification handler code here afxmessagebox(cstring(m_ctrl1.getcontrol()->textbox1->text)); // m_ctrl1.getcontrol()->button1->click(); // how can write above line perform click event? } i defined m_ctrl1 in programdlg.h : // .... public: cmfcapplication1dlg(cwnd* pparent = null); // standard constructor // data member .net user control: cwinformscontrol<windowsformscontrollibrary1::usercontrol1> m_ctrl1; // .... p.s sorry bad english. thanks. i solved problem visiting this link . hope useful other developers.

python - What is causing my Deferred to fire, having done nothing but add a callback, start the reactor, and connected an endpoint? -

i'm using if -statement decide whether or not fire deferred . has fired before check runs. output, looks deferred firing upon running reactor.run() . doesn't have trigger callback happening? relevant code snippets: class outpostburrownew(amp.amp, protocol): protocol = outpostgopher ... def rfidtest(self): print('checking tag - deferred called: %s' % str(self.defer.called)) (status,tagtype) = mifarereader.mfrc522_request(mifarereader.picc_reqidl) if status == mifarereader.mi_ok: status,uid = self.verify_card() cardid = '-'.join([str(x) x in uid]) print('card detected: %s' % str(cardid)) self.defer.callback() def main3(): ''' main3() testing reactor usage of rfid-card reading ''' burrow = outpostburrownew('client') burrow.protocol = outpostgopher burrow.connectendpoint() # deferred created, set on burrow.defer d

java - new Obj, always or sometimes? -

should make new objects out of in java if know use one? obj = new obj(); obj.method(); or just classofobject.method(); why should bother creation of new obj in situation this? classofobject.method() works if method static . having said that, if class represents "thing", user, car, whatever, should make method non-static , use new make object , invoke information on it. if class container methods don't have objects themselves, e.g. utils class stringutils , can use static methods, e.g. stringutils.touppercase() , , happy it.

parallel processing - Anonymous Functions Dont Work inside parfor loops in matlab? -

i'm not sure if found matlab bug or doing wrong, seems calling anonymous functions inside parfor loop slow down (even slower serial performance) is correct? see code: tic; parfor i=1:6, min(randn(10000000,1)); end; toc tic; i=1:6, min(randn(10000000,1)); end; toc parallel elapsed time 0.510345 seconds. serial elapsed time 0.932137 seconds. same thing except using anon function: q = @(x) min(randn(10000000,1)); tic; parfor i=1:6, q([]); end; toc %parelel tic; i=1:6, q([]); end; toc %serial parallel elapsed time 4.208346 seconds. serial elapsed time 0.933594 seconds.

python - Undo feature in tkinter text widget -

i trying use undo function on text widget in tkinter without luck. tried way: from tkinter import * ttk import notebook def onvsb(*args): text.yview(*args) numbers.yview(*args) def onmousewheel(event): text.yview("scroll", event.delta,"units") numbers.yview("scroll",event.delta,"units") return "break" def undo(*argv): text.edit_undo() root = tk() defaultbg = root.cget('bg') root.bind('<control-z>', undo) note = notebook(root) frame = frame(note, bd=5, relief=groove, padx=5, pady=5) frame.pack() bar = scrollbar(frame, command=onvsb) bar.pack(side=right, fill=y) numbers = listbox(frame, width=5, height=30,bg=defaultbg,relief=flat, yscrollcommand=bar.set) numbers.pack(side=left, fill=y) text = text(frame,bd=3, width=145, height=30, yscrollcommand=bar.set) text.pack(side=left, fill=y) text.bind("<mousewheel>", onmousewheel) text.tag_config("attr", foregro

web services - Disable excel UDF calculation in "insert function" prompt -

is there way disable excel udf function (i´m using excel dna library) when called "insert function" prompt? my excel ufd function makes webservice calls , behavior on "insert function" prompt overloading server (as each user typing invoke function). does know how disable function? you can detect function being called insert function dialog calling exceldnautil.isinfunctionwizard() . you'll have like: public static object slowfunction() { if (exceldnautil.isinfunctionwizard()) return "!!! in function wizard"; // real work otherwise .... }

php - Wordpress Giving Random 404 on Custom Rewrite Rules -

i've got site giving intermittent (but rare) 404 errors pages trigger custom rewrite written in wordpress. pretty url work of time , refresh of page make load correctly if 404. links have been rewritten using following function: function my_post_type_link( $link, $post = 0 ) { $type = $post->post_type; switch( $type ) { case 'sfwd-courses': //change courses links modules return home_url( 'module/' . $post->id . '/' . $post->post_name ); case 'sfwd-lessons': //change lessons links focuses return home_url( 'focus/' . $post->id . '/' . $post->post_name ); case 'sfwd-topic': //change topics links lessons return home_url( 'lesson/' . $post->id . '/' . $post->post_name ); case 'my_course': return home_url( 'course/' . $post->id . '/' . $post-&

osx - Unable to upgrade Perl's CPAN on OS X -

i'm unable upgrade cpan using cpan , typing install cpan on mac os x v10.10 (yosemite). this error i'm receiving: all tests successful. files=30, tests=438, 8 wallclock secs ( 0.13 usr 0.05 sys + 6.80 cusr 1.34 csys = 8.32 cpu) result: pass andk/cpan-2.10.tar.gz tests succeeded 1 dependency not ok (file::homedir) andk/cpan-2.10.tar.gz [dependencies] -- na running make install make test had returned bad status, won't install without force failed during command: adamk/test-script-1.07.tar.gz : make_test no 2 dependencies missing (probe::perl,ipc::run3); additionally test harness failed adamk/file-which-1.09.tar.gz : make_test no 1 dependency not ok (test::script); additionally test harness failed adamk/file-homedir-1.00.tar.gz : make_test no 2 dependencies missing (mac::systemdirectory,file::which); additionally test harness failed andk/cpan-2.10.tar.gz : make_test no 1 dependency

random - Python generate data based on archives -

i'm working on operations research project. i created heuristic method , need test method intensively assess performance. i have past data, in form of 3 fields; date, amount, type what want generate new data, similar the existing data. i'm doing "+/- random". i there method or lib generate original data, similar existing data analysing statistics , trends of old data. per comment, can use pandas. example, first generate dummy data: data = [{'date': 'dummy', 'amount':1, 'type': 'a'}, {'date': 'dummy' , 'amount':2, 'type': 'a'}, {'date': 'dummy', 'amount':1, 'type': 'b'}, {'date': 'dummy', 'amount':1, 'type': 'b'}, {'date': 'dummy', 'amount':2, 'type': 'c'}] import appropriate libraries: import pandas pd import r

amazon ec2 - Can't decompress csv: "No space left on device", but using EC2 m3.2xlarge? -

i'm attempting decompress csv file on ec2 instance. instance should large enough guess has partitioning, new stuff , don't understand posts i've found here , here , or whether apply me. (i'm not using hadoop nor have full "/tmp" folder). .csv.gz file 1.6 gb , should 14 gb decompressed. executing gzip -d data.csv.gz , error gzip: data.csv: no space left on device , , df -h shows: filesystem size used avail use% mounted on /dev/xvda1 7.8g 2.8g 5.0g 36% / devtmpfs 15g 56k 15g 1% /dev tmpfs 15g 0 15g 0% /dev/shm thanks help!

Cash register java using a random number generator and queue structure -

im trying make simulation of random number of customers going cash register. each cash register can hold 10 customers. during each random wave customer attended maximum of 5 lines. random rand = new random(20041995); (int j = 0; j < 10; j++) { int pick = rand.nextint(10); system.out.println(pick); } this rng i'm using , i'm trying integrate standard queue structure adds , deletes items in list. this might point in right direction: public static void main(string[] args) { random randomcustomer = new random(); list<integer> generatedcustomers = new arraylist<integer>(); //counter went 50 because each register holds 10 people for(int counter=1; counter<=50;counter++) { int customer = randomcustomer.nextint(20041995); //the random generated customers added generatedcustomers.add(customer); } //used sublist method once got size of array , split 5 parts (int start =0; start &

windows - Tuning tesseract command line to OCR prices -

Image
i have small images prices in them following: but getting empty output file when try command: tesseract image.png output.txt are there special commands should use ocr such small images this? also, can specify possible results dollar sign, period, , numbers 0-9? i have tried "letters" method adding config file, haven't found data on whether dollar sign or period need escaped. in case, getting 0 response simple version of command above. what version of tesseract using? using following command: tesseract image.png output -psm 8 i result. $12705 note dot missing. may able dot pre-processing image using dilation algorithm. version info: tesseract 3.03.00 (windows 7) leptonica-1.70 (aug 5 2014, 21:29:11) [msc v.1800 dll release x86] libgif 4.1.6(?) : libjpeg 8c : libpng 1.4.3 : libtiff 3.9.4 : zlib 1.2.8

fpga - NIOS II system + PWM logic -

i quite new designing systems fpgas, vhdl , nios ii , first post in forum. i trying develop system nios ii system + pwms developed using vhdl. problema not sure how control pwms modelues system mean, how create signals comunicate vhdl logic nios ii system. first though pio seem used comunicate fpga external devices. another issue have not sure how use uart implemented qsys , how develop application in c. don't know diferrent commands or directives send or receive data. saw , write 1 example web found quite simple , doesn't provide enough info application. can this?? thanks! omar two options there, declaring pio, said earlier, work avalon interface communicate. for avalon protocol, either can written understanding same or use template provided. altera providing avalon memory mapped template easier use. https://www.altera.com/support/support-resources/design-examples/intellectual-property/embedded/nios-ii/exm-avalon-memory-slave.html

html - Bootstrap Template Migration to ASP.NET 4.5 Forms- Full Width Rendering Issue -

http://www.petcenters.com/htmlpage1.html re-build of bootstrap template purchased. copied template htmlpage1.html added project. runs fine. i have attempted migrate htmlpage1.html asp.net 4.5 web forms project separating out masterpage , default.aspx. http://www.petcenters.com i'm having issue layerslider , footer not rendering full-width shown in http://www.petcenters.com/htmlpage1.html here master page: <body class="header-fixed"> <form runat="server"> <div class="wrapper"> <div class="header header-sticky"> <div class="container"> ..... </div> </div> <div class="container body-content"> <asp:contentplaceholder id="maincontent" runat="server"> </asp:contentplaceholder> <div class="footer-v1"> .....

Spring MVC fail to pass large data in JSONArray from controller to JSP page -

i have list of department names needed passed controller view. following code works fine if there few department names passed, ex. 3 names. doesn't work when number of departments becomes large, example, 300 names, first alert in jsp code doesn't invoked in case. printed length of jsonarray depnamejsonlist controller, shows correct number of names. reason used json because need use in jquery datatable. why can't passed view if there 300 names? many thanks! controller: @requestmapping(value = "/getdepartment", method = { requestmethod.post, requestmethod.get }) public modelandview getdepartment() { modelandview mv = new modelandview(); jsonarray depnamejsonlist= new jsonarray(departmentnames); logger.debug("depnamejsonlist size: " + depnamejsonlist.length()); // printed 309 mv.addobject("depnamejsonlist", depnamejsonlist); mv.setviewname("displaydepartment"); return mv; } jsp: $(doc

PostgreSql propagate changes across databases -

i'm newbie databases , i'm facing seems simple problem. have , old database db_a contains table table_a , want use table in new database db_b . found out referential integrity across databases in postgresql not practice. solution copy table table_a db_b , use referential integrity. so far good! the problem is: want update new table in db_b changes in old table in db_a . 2 tables remain similar on time. what best solution such classic issue? the classic solution use multiple schemas (as in create schema... ) instead of multiple databases. foreign key references, including on update cascade , on delete cascade work. can alter default privileges each schema if need to.

xcode - How would I add a "+1" animation when my node comes in contact with a coin? -

i got node collect coins want type of animation when happens. how add "+1" animation every time node collects coin? dont know if should use skaction , have run action every time contact occurs between node , coins. yes did skaction (when put code in "update" method show everytime earn coin): if cgrectintersectsrect(player.frame, coin.frame) { coins++ //your variable let addcoinslabel = sklabelnode(fontnamed: "chalkboardse-regular") addcoinslabel.text = "+1" addcoinslabel.fontsize = 40 addcoinslabel.fontcolor = uicolor.redcolor() addcoinslabel.zposition = 200 addcoinslabel.position = cgpoint(x: cgrectgetmidx(self.frame), y: self.frame.size.height*0.7) self.addchild(addcoinslabel) let actionlabelfadein = skaction.fadeinwithduration(0.5) let actionlabelmove = skaction.moveby(cgvector(dx: 0.0, dy: 100), duration: 0.5) let actionremovefromparent =

node.js with http and https routing -

currently make node.js project create both http , https server. var httpserver = http.createserver(app); httpserver.listen(3000); var httpsoptions = { ca: fs.readfilesync(config.https.ssl.ca, 'utf8'), key: fs.readfilesync(config.https.ssl.key, 'utf8'), cert: fs.readfilesync(config.https.ssl.cert, 'utf8') }; var httpsserver = https.createserver(httpsoptions, app); httpsserver.listen(8000); also used middleware redirect http traffic https. app.all('*', function(req, res, next){ var host = req.header("host"); if (host && host.indexof('localhost') !== -1) { next() } else if (req.connection.encrypted) { next(); } else { res.redirect('https://' + host + req.url); } }); but pages not need https connections, http://www.domain.com/shops/ route. can make route use http method , other routes use https still? p.s: page request resources other routes bower_components, public, ... etc.

python - How can I create a 2-d scrolling tiled map in pygame? -

i creating rpg game, however, have absolutely no idea how scroll through map player in centre. other suggestions may have appreciated too! help! here's code: import pygame pytmx import load_pygame pygame.init() transparent = (0,0,0,0) black = (0,0,0) white = (255,255,255) x,y = 0,0 movespeed = 5 #create window screensize = (800,600) screen = pygame.display.set_mode(screensize) pygame.display.set_caption("frozen") gamemap = load_pygame("frozen.tmx") def getmap(layer): #creates list of single tiles images = [] y in range(50): x in range(50): image = gamemap.get_tile_image(x,y,layer) images.append(image) #displays tiles in locations = 0 y in range(50): x in range(50): screen.blit(images[i],(x*32,y*32)) += 1 def getproperties(): #gets properties of tiles in map properties = [] y in range(50): x in range(50): tileproperties

What is meant by Error 1451 in MySQL database? -

i ran delete query in sql-yog , carried away error. can give me explanation error. cannot delete or update parent row: foreign key constraint fails (`db_lakshyaassets3`.`lss_entity`, constraint `fk_lss_entity_aid` foreign key (`address_id`) references `lss_address` (`address_id`)) one of properties of foreign key constraint is used prevent actions destroy links between tables. therefore cannot delete rows in table shares foreign key constraints table without deleting in parent first. you can handle in 2 ways: use foreign key on delete cascade (which delete child rows if parent deleted) reference use foreign key on delete no action (which deletes parent without exceptions, data become meaningless) you getting error because default property on delete restrict hth

Execute a sql string in sql server -

my code below, somehow there error near @name declare @name nvarchar(max) = '(mm.dll, ben , jerry.exe)' declare @sql nvarchar(max)= 'select ordername, customer.version, count(distinct company.cid) counts [companydata] company inner join [vendor] mav on company.cid = mav.cid left outer join [customer] customer on company.vendorid = customer.vendorid , company.did = customer.did ordername in' + @name+ ' group customer.version, ordername' exec sp_executesql @sql put single quote in declaration of @name , remove hashes(#) in it: declare @name nvarchar(max)='(''mm.dll'', ''ben , jerry.exe'')' declare @sql nvarchar(max)= 'select ordername, customer.version, count(distinct company.cid) counts [companydata] company inner join [vendor] mav on company.cid = mav.cid left outer join [customer] customer on company.

How to copy one column data into another column in oracle -

i want copy 1 column data column without replacing old data. example : table-1 column1 column2 sony sony desc lenovo lenovo desc nokia nokia desc i result column 1 column2 sony sony desc sony desc lenovo lenovo desc lenovo desc nokia nokia desc nokia desc i have tried query not match update table1 set column1 = column2 if column1 has not null constraint , or if has primary key constraint , won't able insert null values. need filter out null values: insert table1 (column1) select column2 table1 column2 not null;

php - Need custom pagination for wordpress loop -

i using following code, display post particular category <?php $random_post = new wp_query(); $random_post->query('cat='2'); while ($random_post->have_posts()) : $random_post->the_post(); the_title(); endwhile; wp_reset_postdata(); ?> and working fine need custom pagination , want display 5 post in page.if have idea please let me know asap.

php - insert html table multiple row to database -

i have tried insert html table multiple row data database not success without error. please refer below code , kindly advice missed. retrieve data dropdown selection <?php //including database connection file include_once("config_db.php"); $gettminfo=mysql_query("select * tb_tm order tm_abb"); ?> html code table <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css/spa_invoice.css"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> </head> <body> <!--add & delete rows table dynamically-->

mysql - Update table's column value and showing it at the same time (PHP) -

first of all, system working on virtual hr system. now, have profile.php page form applicant located. form consists of her/his basic profile , requires him/her set skills applicant has. when applicant press submit button, go test.php page display possible jobs applicant qualified based on skills of applicant he/she entered in profile.php . now, i'm having error you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'specialist fname=jamie' @ line 2 here's code in test.php i'm trying update , show job column value in employee table. $last = mysql_query("select * employee ") or die(mysql_error()); echo "<table border='0' cellpadding='15' text-align = 'center' >"; echo "<tr>"; echo "<th>name</th>"; echo "</tr>"; while($row2 = mysql_fetch_array( $last

php - How to make this MySQL query execute faster? -

select * (`collection_series`) join `datadatexnumericy` on `collection_series`.`series_id` = `datadatexnumericy`.`series_id` join `saved_users_chart` on `collection_series`.`collection_id` = `saved_users_chart`.`chart_id` `saved_users_chart`.`chart_id` = '265' , `saved_users_chart`.`id` = '6' , `datadatexnumericy`.`x` >= '1973-09-30' , `datadatexnumericy`.`x` <= '2014-06-30' , `datadatexnumericy`.`series_id` != '43538' , `datadatexnumericy`.`series_id` != '43541' group year(datadatexnumericy.x) this sql query , result of query getting ajax response query working fine getting response slow bit think problem in sql query. i want matching records collection_series , datadatexnumericy table , matching row saved_users_chart there possible way optimize query in more efficient way can ajax response faster. in opinion query optimized. should test result of query in sql server see

winapi - item not getting created at the end of list view control created using C++ -

i trying add item @ end of list view control getting added random location in list view control created using c++. may reason? have attached code below. hwnd hwndlocallist = getdlgitem(hwnd, filelistname); int itemno=listview_getitemcount(hwndlocallist); lvitem lvi; memset(&lvi,0,sizeof(lvi)); lvi.mask = lvif_text | lvif_image |lvif_state; lvi.iitem = itemno; lvi.isubitem = 0; lvi.state = lvis_selected; lvi.psztext = "new folder"; lvi.iimage=0; int x=listview_insertitem(hwndlocallist, &lvi); my psychic powers tell me have either lvs_sortascending or lvs_sortdescending styles set on listview control. if turn them off, item added end.

android - PHP receive http post request as $_POST -

Image
i trying receive image data in php using $_post if trying post small string "abc" getting response when try post huge data 108 kb it's not showing response might need increase limit don't have access in php.ini file. is there other way? and posting data android there string shorten encoding in android , decoding in php available. used base64 image data. my php code echo return. <?php header('access-control-allow-origin: *'); header('access-control-allow-methods: put, get, post, delete, options'); header('access-control-allow-headers: content-type'); if(isset($_post['incidentdetails'])) { echo 'responce server: ' . $_post['incidentdetails']; } else { echo 'request without paramenter'; } ?> the url - http://bumba27.byethost16.com/incidentmanagments/api/adding_incident_details.php i need post parameter name incidentdetails- http://www.filedropper.com/log_2 android code // cre

alassetslibrary - fetching photos by date - iOS -

disclaimer –i’m new ios , forum too. have need pictures taken in specific dates (let’s january 9-january 12) . don't want go on photos in photo library enhance app performance. looking public api full fill requirement. apple photo framework supports fetching photo collection date? phfetchoptions solution , if right way use ? you can create predicate specify dates: phfetchoptions *fetchoptions = [phfetchoptions new]; fetchoptions.predicate = [nspredicate predicatewithformat:@"creationdate > %@ , creationdate < %@", startdate, enddate]; phfetchresult *fetchresult = [phasset fetchassetswithoptions:fetchoptions];

xslt - Split XML to Multiple Htmls using XSL -

i have huge xml file , there "entryheaderheader" tag repeats more 9000 rows. wanted split 9 html documents (split 1000 rows) i tried use xsl:result-document , mod operations failed. thank helps all lines of xsl file <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:gl-bus="http://www.xbrl.org/int/gl/bus/2006-10-25" xmlns:gl-cor="http://www.xbrl.org/int/gl/cor/2006-10-25" xmlns:gl-gen="http://www.xbrl.org/int/gl/gen/2006-10-25" xmlns:iso4217="http://www.xbrl.org/2003/iso4217" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:xbrli="http://www.xbrl.org/2003/instance&quo