Posts

php - regex match string of exactly 6 numbers in text that has telephone numbers as well -

i have blocks of free text contain phone numbers , multiple 6 digit numbers need capture. 6 digit number has optional ','. examples of 6 digit numbers 123456, or 123,456, need differentiate phone number 1 234 456 8901 i have : preg_match_all(",\[\w_][0-9]{3}(?:,)[0-9]{3}[\w_][\d]\d",$html, $value); is there better way this? it's bit difficult review regex without sample input couple of observations: [0-9] can replaced \d (since, you're using @ end) [\d] same \d . it's character class , unless have more characters include it'ss fine without being enclosed in [] . (?:,) should , because neither want capture nor has quantifiers . ,\[\w_] here seems want use character class \ escape first [ . if need literal \ there; need escape \\ since it's special character.

objective c - Launch WebKit Inspector from Cocoa IBAction? -

i know it's possible include webkit dev tools web inspector in os x application uses webview. i'm using: [[nsuserdefaults standarduserdefaults] setbool:true forkey:@"webkitdeveloperextras"]; [[nsuserdefaults standarduserdefaults] synchronize]; this allows me activate inspector right-click in webview. is there way launch web inspector button or menu item well? can't find documentation on this. thanks, charlie this not possible. filed bug apple api, , showed duplicate bug. have been aware of since 2007. assume if interested in api well, file duplicate bug report.

jquery - .height() .width() doesn't adjust to change in size -

i have image adjusts screen size .height , .width() doesn't adjust, leaving margin-left , margin-top changing. there way make adjust? var $src = $(this).attr("href"); $('#overlay').append('<img class="image" src="' + $src + '" />'); var $image = $('img'); $('.image').css('max-height','80%'); $('.image').css('max-width','90%'); $('.image').css('position', 'fixed'); $('.image').css('top', '50%'); $('.image').css('left', '50%'); var $height = $image.height(); var $width = $image.width(); $('.image').css('margin-top', (($height/2)*-1)); $('.image').css('margin-left', (($width/2)*-1)); http://jsfiddle.net/a8a4y/ the problem image isn't loaded when messure it. height, width zero. http://jsfiddle....

Find layergroup of a specific layer in photoshop with javascript -

is way retrieve name of layer group name on inner layer? ask because i'm trying trim content of folder specific layer inside, please? if layer name , group name both unique can retrieve with: app.activedocument.activelayer = app.activedocument.layersets.getbyname("my group name").artlayers.getbyname("my layer name"); where "my group name" name of group , "my layer name" name of layer within "my group name".

ios - Present UIPopoverController with navigation controller -

i attempting present uipopovercontroller similar bookmark selector in safari title above , ability go , forward. found tutorial: http://mobiforge.com/designing/story/using-popoverview-ipad-app-development , have followed it, yet navigation bar not appearing should be. instead, appearing recessed in popover controller , not part of popover controller. below code have far. appreciated. code: - (ibaction)addapreplan:(id)sender { if (![self.preplanpopovercontroller ispopovervisible]) { // initiate popover controller uitableviewcontroller *pp = [[uitableviewcontroller alloc] init]; pp.navigationitem.title = @"add preplan"; uinavigationcontroller *nav = [[uinavigationcontroller alloc] initwithrootviewcontroller:pp]; uipopovercontroller *popover = [[uipopovercontroller alloc] initwithcontentviewcontroller:nav]; popover.delegate = self; self.preplanpopovercontroller = popover; } else { // dissmiss...

libcurl - PHP Curl followlocation working from command line but not from browser -

i have written small script scrape data website using curl in php. when curl executed, there 301-redirect issued site taken care of : curl_setopt($ch, curlopt_followlocation, true); however, when run same code browser, redirect not working. here complete curl request: $ch = curl_init(); curl_setopt($ch, curlopt_url, $arr_params['url']); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_httpauth, curlauth_any); curl_setopt($ch, curlopt_followlocation, true); curl_setopt($ch, curlopt_timeout, 60); curl_setopt($ch, curlopt_useragent, "mozilla/4.0 (compatible; msie 5.01; windows nt 5.0)"); curl_setopt($ch, curlopt_verbose, true); curl_setopt($ch, curlopt_stderr, $arr_params['error_file']); curl_setopt($ch, curlopt_maxredirs, 5); //curl_setopt($ch, curlopt_http_version, curl_http_version_1_0); in above code, $arr_params set previously....

url - Send my current location via SMS - Android -

im new android developer. want send sms contains current location. know how location coordinates. want send url, , user open , see am(for example: waze can share location , think google maps app). tried google maps api didnt find option generate url. can give ideas?or api? thanks everyone!!! i guess need. public void sendlocationsms(string phonenumber, location currentlocation) { smsmanager smsmanager = smsmanager.getdefault(); stringbuffer smsbody = new stringbuffer(); smsbody.append("http://maps.google.com?q="); smsbody.append(currentlocation.getlatitude()); smsbody.append(","); smsbody.append(currentlocation.getlongitude()); smsmanager.sendtextmessage(phonenumber, null, smsbody.tostring(), null, null); } i use map overlay instead of default maps. i have developed app uses location feature , shows in map. see on google play. "wherez u" https://play.google.com/store/apps/details?id=com.kabhos.android...