Posts

php - preg_match a hyperlink -

i looked everywhere answer, seems cannot head around preg_match functionality. want preg_match link below numbers part (the id) dynamic. link: http://video.cnbc.com/gallery/?video=3000024508 here goes have come until now: preg_match( '/^http://video.cnbc.com/gallery/?video=([0-9_-]/', $content ) but won't work. preg_match('#^http://video\.cnbc\.com/gallery/\?video=([0-9_-]+)$#', $content); regexr demo besides problems others mentioned (escaping ? , . , using # instead of / ) missing + after number group ( [0-9_-] ), means group can repeated. if need check if string includes kind of link or not, remove ^ , $ : preg_match('#http://video\.cnbc\.com/gallery/\?video=([0-9_-]+)#', $content);

Can I embed HTML into an HTML5 SVG fragment? -

html5 supports <svg> tag, allowing embed svg html. digging little deeper, can nest html inside <svg> fragment? example, i'd put css'ed <table> in part of svg graphics. i made small test , chrome12 didn't html <p> inside <svg> . there technique make work (such maybe html container tag?)? yes, <foreignobject> element, see this question examples. alternatively, if have html5 document can use css positioning , z-index make parts of html visible want laid out on top of svg. if don't need nest html inside svg fragment. give consistent behaviour across browsers in experience.

css - Whitespace is being added to an overlay in IE9, but not in Fx5 -

i'm trying overlay "search box" on google maps api v3. overlay works fine in fx5, in ie9 not work quite right. white space added ie9 between map , gray div . see difference, go to: http://www.trailheadfinder.com/trail_search/trail_map the "search box" should aligned map / sattelite / mytopo buttons. html <div id="maplayers"> select information shown: trails: <input type="checkbox" id="trailsbox" onclick="boxclick(this,'trails')" /> campgrounds: <input type="checkbox" id="campgroundsbox" onclick="boxclick(this,'campgrounds')" /> panoramio: <input type="checkbox" id="panoramiobox" /> </div> <div> <div id="mapsearchbar"> <input id="searchtextfield" type="text" size="50"> </div> <div id="map" style="width: 100%; height: 500px...

lua - LuaJIT and Rocks? -

just small question "lua newbie"...i have been using luajit , awesome, no question since luajit lua 5.1 compatible mean can use "luarocks" standard lua uses in luajit? for instance if wanted install 1 of sqlite libraries (e.g. http://luaforge.net/projects/luasqlite/ ) - how install in luajit? do available "luarocks" work out box luajit? luajit designed drop-in compatible lua stand-alone. there no reason why purely lua-based rocks shouldn't work. dll-based rocks ought work well, since luajit stand-alone dll compatible original dll.

linux - Detect if an open file/device has been replaced/deleted -

assume following situation under linux: a process continuously reading usb-serial converter device ( /dev/ttyusb0 ). device suddenly unplugged , plugged in again (or resetting reason). process continues have valid file handle /dev/ttyusb0 won't receive data device unless process re-opens device (because udev has deleted , re-created device node). is there direct way detect such situation (ie. not indirectly detecting timeout in data flow) process knows has re-open device? reliable monitor modification time of /dev/ttyusb0 using stat() ? additional details: the process opens device file using standard open() function. /dev tmpfs controlled udev . note: not want use udev rules , prefer solution implemented directly in process. if usb device hot-unplugged, operations on device begin failing -eio ; can detect , take appropriate action.

entity framework - stored procedure with EF 4.1 -

i have parameterized stored procedure executing view , return results. view showing results of join of 2 tables. need pass parameters stored procedure , call mvc3 controller action using ef 4.1 code first approach , return results. how can this. please suggest step step. thanks. i don't know part of "code first doesn't support stored procedures" people don't understand, keeps coming , shouldn't. can muddle way around (kind of), if need execute stored procedures shouldn't using code first @ point.

How to upload to FTP server in Java? -

i have following method upload_files ftp server, not receiving errors yet file not appearing on server after run. problem? public static void upload_files(string un, string pw, string ip, string dir, string fn){ ftpclient client = new ftpclient(); fileinputstream fis = null; try { client.connect(ip); client.login(un, pw); string filename = dir+"/"+fn; fis = new fileinputstream(filename); client.storefile(filename, fis); client.logout(); } catch (ioexception e) { e.printstacktrace(); } { try { if (fis != null) { fis.close(); } client.disconnect(); system.out.println("uploaded"); } catch (ioexception e) { e.printstacktrace(); } } } there number of possible issues. assumption using ftpclient 3.x apache commons-net. if using else, should indicate in question. ideas: che...