Posts

javascript - change input box into hyperlink -

i have code google map marker thing. im around couple of days. have code in map_process.php $mname = filter_var($_post["name"], filter_sanitize_string); $maddress = filter_var($_post["address"], filter_sanitize_string); $mtype = filter_var($_post["type"], filter_sanitize_string); $results = $mysqli->query("insert markers (name, address, lat, lng, type) values ('$mname','$maddress',$mlat, $mlng, '$mtype')"); if (!$results) { header('http/1.1 500 error: not create marker!'); exit(); } $output = '<h1 class="marker-heading">'.$mname.'</h1><p>'.$maddress.'</p><p>'.$mtype.'</p>'; exit($output); } and want change text inserted in input box clickable link. can me? i trying this <html> <head> <title>links</title> <script type="text/javascript"> function...

c# - Null Value Found. You must specify a NullValueAttribute -

i'm using filehelpers library import , process spreadsheet. i'm having problem couple of properties of entity. added [fieldnullvalue(null)] attribute both properties had no effect. still same error. did miss something? [fieldtrim(trimmode.both)] [fieldconverter(typeof(customdatetimeconverter))] [fieldnullvalue(null)] private datetime? _estduedate; [fieldoptional()] [fieldnullvalue(null)] private int? _id; update: went ahead , set default values in attribute [fieldnullvalue(typeof(datetime), "2000-1-1] when send service call write database checked field , set null if it's default date not optimal solution it's not overhead. can deal default value id being 0 indicates service it's new record anyway

google app engine - Objectify - ofy() in method defined outside of transaction -

a basic transaction looks this: import static com.googlecode.objectify.objectifyservice.ofy; import com.googlecode.objectify.work; // if don't need return value, can use voidwork thing th = ofy().transact(new work<thing>() { public thing run() { thing thing = ofy().load().key(thingkey).now(); thing.modify(); ofy().save().entity(thing); } }); when ofy().load() , other ofy() methods called within transaction have benefits of transaction, such being atomic. however, using util method contains ofy() method escape transaction? following. // if don't need return value, can use voidwork thing th = ofy().transact(new work<thing>() { public thing run() { util.modify(thingkey); } }); where util defined somewhere so. public class util { public static modify(thingkey) { thing thing = ofy().load().key(thingkey).now(); thing.modify(); ofy().save().entity(thing); } } the 2 ca...

Is there a do-while loop in bash? -

this question has answer here: emulating do-while loop in bash 3 answers is there do - while loop in bash? i know how program while loop in bash: while [[ condition ]]; body done is there similar construct, do - while loop, body executed @ least once irrespective of while condition? while loops flexible enough serve do-while loops: while body condition true; done for example, ask input , loop until it's integer, can use: while echo "enter number: " read n [[ -z $n || $n == *[^0-9]* ]] true; done this better normal do-while loops, because can have commands executed after first iteration: replace true echo "please enter valid number" .

windows - win7 express js: 'express' is not recognized in cmd -

i have node.js installed , running fine on windows 7 computer. run > npm install -g express > npm install -g express-generator > npm install -g express-generator@3 and install successfully. when go new folder , try: > express myproject i get: 'express' not recognized internal or external command, operable program or batch file i see 'express', 'express.cmd', , 'node_modules' directory 'express' , 'express-generator' folders in c:\users\me\appdata\roaming\npm directory i added npm directory path in case missed. i tried solutions find: 'express' not recognized command (windows) https://groups.google.com/forum/#!topic/express-js/cr92_lc_puk what else can try express working? check have path express folder in path. remember need reopen cmd apply changes in environment variables modifying them not modify variables of working processes, afaik. if changing system-wide environment variables, ma...

html - Override device-width -

i'm working on website , i'm trying make mobile friendly including <meta name="viewport" content="width=device-width"> in html. unfortunately have element needs larger device width. going use media queries hard code values element on different screen sizes seems not able override elements width. this element width want override: <div id="menu_bar"> currently way can override elements width doing: <div id="menu_bar" style=" width: 1024px;"> however if do: <style> #menu_bar {width : 1024px;} </style> <div id="menu_bar"> it not work. adding !important not work. need able second way because need use media queries. just reference have menu bar ruby on rails partial because on every page of website. any idea how override width of menu bar can use media queries? any appreciated. try going http://atmedia.info/ -- scan device (refresh rescan in portra...

algorithm - Using Insertion Sort return in sorted order the k smallest elements of an array -

i'm prepping software developer job interviews , reviewing algorithm questions. can't figure out how modify insertion sort algorithm returns in sorted order k smallest elements of array of size n . insertion sort algorithm for = 1 n j = while j > 0 , a[j-1] > a[j] swap a[j] , a[j-1] j = j - 1 adding loop end of algorithm first k elements doesn't count. with normal insertion sort, loop start end, , each item moved until it's in place. insertion sort, still loop start end, if item you're on >= kth item, leave it; if less, move position k , move until it's in place. for = 1 k j = while j > 1 , a[j-1] > a[j] swap a[j] , a[j-1] j = j - 1 first k items sorted. for = k + 1 n if a[i] < a[k] swap a[i] , a[k] j = k while j > 1 , a[j-1] > a[j] swap a[j] , a[j-1] j = j - 1