Posts

Linux Command: Find & Replace using regex not woking as expected -

i trying replace path in php files using regex command, isn't working expected! i want replace '/home/example/public_html $_server['document_root'] . ' i using below command in ssh: find /var/www/advertise/ -name '*.php' -type f -exec sed -i 's/\'\/home\/example\/public_html/\$\_server\[\'document\_root\'\]\ \.\ \'/g' {} \; when enter command , hit return, > sign follows like: > > > .. on keep hitting return execute command. where below command works (for replacing home/example/public_html var/www ): find /var/www/advertise/ -name '*.php' -type f -exec sed -i 's/home\/example\/public_html/var\/www/g' {} \; you're messing quotes. use separator other / don't need escape / you don't need escape in replacement since have ' in replacement, better use "s#..#..#" (i.e. double quotes). however, you'll need escape $ in replacement prevent shel...

c++ - std::bind a member function to an instance at nullptr causing seemingly random this pointer -

i've tested following program on gcc-4.8 (via coliru) , on visual studio 2013 rc: #include <iostream> #include <functional> using namespace std; struct foo { void bar() { cout << "this = " << << endl; } }; int main() { try { foo *ptr = nullptr; function<void ()> fun = bind(&foo::bar, *ptr); fun(); } catch (const bad_function_call &e) { // never reached cout << "bad_function_call thrown: " << e.what() << endl; } cin.get(); } i understand i'm causing undefined behavior here dereferencing nullptr, don't understand output of code. in understanding should either cause bad_function_call (because should thrown when calling std::function, guessed) or @ least print "this = 0". it doesn't. output "this = " followed pointer not nullptr on both compilers tested. accessing causes segmentation faul...

outlook vba - Extract AddressEntry object details for Exchange User -

is there way extract details in dialog box via vba? details dialog box http://i.msdn.microsoft.com/dynimg/ic84336.gif i need, content in e-mail address tab. i have go function of reading address-book: function get_mail(absender string) dim outapp outlook.application dim outti outlook.taskitem dim outrec outlook.recipient set outapp = new outlook.application set outti = outapp.createitem(3) outti.assign set outrec = outti.recipients.add(absender) outrec.resolve if outrec.resolved on error goto exit_function get_mail = outrec.addressentry.getexchangeuser.primarysmtpaddress end if exit_function: exit function set outapp = nothing set outti = nothing end function as far know can read out primary mail-address mail-addresses-tab; see else there ist delete part ".primarysmtpaddress", mahe dot , should list of other properties. i quite sure need reference on microsoft outlook 14.0 object library. the input "absender...

PHP: cannot pass single quoted string to mysqli query -

this question has answer here: mysql query not inserted when php variable contains single quotes 7 answers i fighting hours thing: $var=var; $result = "select column1, column2 $db column3 = '$var' "; the error is: have error in sql syntax; check manual corresponds mysql server version right syntax use near '\'var\'' @ line 1 names correct, works in mysql query. think tried possible quoting options, wrong? update: requested used escaping, error remains same $var=var; $var = $conn->real_escape_string($var); $result = "select column1, column2 {$db} column3 = '{$var}' "; there must $var = $mysqli->real_escape_string($var); $sql = "select column1, column2 {$db} column3 = '{$var}' "; instead of: $result = "select column1, column2 $db column3 = '$var' ...

javascript - Temporarily animate input type text when hovering -

i want show contents of input type text if text wider current input width. when hover field, want text scroll left or similar, in order view hidden text. thank you. note: tell me if have add/change question's tags, please. i thought how , came with. on input hover i'm going take input value , put in div (or other element). width of div , compare width of input. if div wider input i'm going animate inputs text-indent difference of widths. $('input').hover(function(){ var temp = $('div').html($(this).val()).width(); if($(this).width() < temp){ $(this).animate({ textindent: $(this).width()-temp }, 100); } }); you can see full solution here: http://jsfiddle.net/taneleero/tb5c5/2/ should enough going.

ios - Issue migrating from AFNetworking 1.3 to AFNetworking 2.0 -

i'm trying migrate project afnetworking 1.3 afnetworking 2.0. in afnetworking 1.3 project have code: - (void) downloadjson:(id)sender { nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwithstring:@"http://myserver/api/call?param1=string1&param2=string2"]]; afjsonrequestoperation *operation = [afjsonrequestoperation jsonrequestoperationwithrequest:request success:^(nsurlrequest *request, nshttpurlresponse *response, id json) { // handle success } failure:^(nsurlrequest *request, nshttpurlresponse *response, nserror *error, id json) { nslog(@"%ld", (long)[response statuscode]); nsdictionary *data = json; nsstring *errormsg = [data objectforkey:@"descriptiveerrormessage"]; // handle failure }]; [operation start]; } when client sends url not formatted or bad parameters server sends 400 error , includes json “descriptiveerrormessage” read in failure block. use ...

xml - Dropdownlist folder files php -

please, need help, how can load folder files uploader before in directory, dropdownlist on php??? now have code, doesnt work... <form action="" method="post"> <select name="seleccionarchivo"> <?php $dir = $_get["/repositorio"]; $files = scandir($dir); // prepare select box echo echo "<select name=\"files\">"; foreach ($files $file) { // return files if ( is_file($dir. $file) ) echo "<option value=\"$file\">$file</option>"; } echo "</select>"; ?> </select> <input type="submit" value="ir al examen"> </form> i try removing echo "" within php script. have select withi...