Posts

javascript - Search 2 text fields as 1 field -

i'm search users name , i've properties: firstname , lastname . if had property fullname trivial don't have it. i want search "peter robert" , need combine theses 2 fields 1 before searching. how do it? sounds want "text search" . text indexes can span on multiple fields terms entered searched indexed fields: db.collection.ensureindex({ "firstname": "text", "lastname": "text" }) db.collection.find({ "$text": { "$search": "peter robert" } }) that 1 way handle this. return other matches exact matches have highest score can rank them. alternately, if know getting string "peter robert" in order can "split" , tokenize input: var input = "peter robert"; var parts = input.split(/ /); // splits on space db.collection.find({ "firstname": parts[0], "lastname" parts[1] ]) which pretty basic. or apply $reg...

google chrome - html base tag with different domain from the top domain gives security issue -

i've website displays , edits contents of different web pages adding css codes them. it works this, use curl contents of webpages edit content , add base tag href attribute points url got contents of it. put edited content iframe on website. working year, yesterday noticed error google chrome shows me security warning page. i've tried many things fix problem couldn't fix it. when use base tag different domain top domain, shows warning page. u have idea how can pass problem. have use base tag different domain base tag. it looks google side error :d contact them , problem fixed :)

sqlite - Yii - protected - (403 Forbidden Error) -

is possible change configuration of yii, to: 1- make yii , database accessible outside folder 'protected' 2- send data outside folder 'protected' files inside 'protected' or there other solution ? thank help. it possible since protected folder protected .htaccess file. if eliminate "defensive rules" , have right directory/file permissions, protected folder can made accessible outside. however recommend not this, because direct access protected folder (as name suggests) should made inaccessible standard users.

javascript - Cannot get all possible overlapping regular expression matches -

i have string started: 11.11.2014 11:19:28.376<br/>ended: 1.1.4<br/>1:9:8.378<br/>request took: 0:0:0.2 i need add zeros in case encounter 1:1:8 should 01:01:08 same goes date. tried using /((:|\.|\s)[0-9](:|\.))/g but did not give possible overlapping matches. how fix it? var str = "started: 11.11.2014 11:19:28.376<br/>ended: 11.11.2014<br/>11:19:28.378<br/>request took: 0:0:0.2"; var re = /((:|\.|\s)[0-9](:|\.))/g while ((match = re.exec(str)) != null) { //alert("match found @ " + match.index); str = [str.slice(0,match.index), '0', str.slice(match.index+1,str.length)]; } alert(str); this want: str.replace(/\b\d\b/g, "0$&") it searches lone digits \d , , pad 0 in front. the first word boundary \b checks there no [a-za-z0-9_] in front, , second checks there no [a-za-z0-9_] behind digit. $& in replacement string refers whole match. if want pad 0 ...

ios - objective-c : Use a array to point to another array -

i have 2 mutable arrays. "friendsarray" contains whole list os users , "inviteindex" contains indexes (indexpath.row) of of them (get using uiswitch button table list). the fill inviteindex array as: [inviteindex addobject:[nsnumber numberwithinteger:indexpath.row]]; in order have selected users do: (int =0; i< [inviteindex count]; i++) { myelement *friend =[friendsarray objectatindex:[inviteindex objectatindex:i] ]; nslog(@"button pressed %@", friend.friendid); } but app crash message: [__nsarraym objectatindex:]: index 400931632 beyond bounds [0 .. 4]' i trid used myelement *friend =[friendsarray objectatindex:(nsinteger)[inviteindex objectatindex:i] ]; same result. any please? in advance. [inviteindex objectatindex:i] return nsnumber object. want nsinteger value within nsnumber object: for (int =0; i< [inviteindex count]; i++) { nsinteger index = [[inviteindex objecta...

embedded - rasberry pi B+ not booting for yocto -

i have rasberry pi b+ board , downloaded 12 mb compressed image of yocto link (www.cnx-software.com/raspberry-pi/rpi-basic-image-raspberrypi-20130702123605.rootfs.rpi-sdimg.7z). after decompressing issued following command terminal of ubuntu 14.04 sudo dd if=./rpi-basic-image-raspberrypi-20130702123605.rootfs.rpi-sdimg of=/dev/sdb bs=1m my sd card of 8 gb , attachd machine. now have inserted sd card on board , attached keyboard , monitor it. my issue when give power board nothing comes up. can ?? i guess waiting x server start. rpi-basic-image doesn't provide that. should log rpi ssh. can detect rpi ip scanning ssh servers in subnet. nmap -p 22 --open -sv your_subnet_address/subnet_size example: nmap -p 22 --open -sv 192.168.1.0/24 ayman

pig latin - load with text qualifier -

i trying load datafile in pig latin script, data has 2 columns there text qualifier in 2nd column , sample data below : device_id,supported_tech a2334,"gsm900,gsm1500,gsm200" a54623,"gsm900,gsm1500" a86646,"gsm1500,gsm200" when try loading date below, 2nd column not recognized 1 column devicelist = load 'devicelist.csv' using pigstorage(',') (device_id:chararray, supported_tech:chararray ); how can define text qualifier while loading data set ? try , let me know if need different output format input.txt device_id,supported_tech a2334,"gsm900,gsm1500,gsm200" a54623,"gsm900,gsm1500" a86646,"gsm1500,gsm200 pigscript: a = load 'input.txt' line; devicelist = foreach generate flatten(regex_extract_all(line,'^(\\w+),(.*)$')) (device_id:chararray, supported_tech:chararray ); dump devicelist; output: (device_id,supported_tech) (a2334,"gsm900,gsm1500,gsm200") (a54623,...