Posts

Showing posts from September, 2012

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...

r - Get Index of variables from stepAIC -

i regressing gene on gene subset. use stepaic reduce number of explanatory genes. how index of non-omitted variables, analyse them? gene_subset=c(y=genes[,i], genes[,other_genes]); reduced_model=stepaic(y~.,data=gene_subset,trace=false); here 1 solution got r-help mail list, other more efficient ways welcome. # create example data frame y <- rnorm(30) gene_subset <- data.frame(y, x1=rnorm(30), x2=rnorm(30), x3=100*y+rnorm(30)) # fit full linear model fit <- lm(y ~ ., df) # reduce model reduced_model <- stepaic(fit, trace=false) # non-omitted variables (excluding response) keepx <- names(reduced_model$model)[-1] index <- match(keepx, names(gene_subset))

MKDIR 3 levels above using php -

level1/level2/level3/cwd/mkdir.php name of level1 not known; user specified & can anything. name of level2 & level3 known , remain static. current working directory contains mkdir.php file required create directory in level1 user provided name. mkdir.php file below job, don't know whether it's correct way. want experts approve , advice. in advance. <?php if (isset($_post['name'])) { $newdir = $_post['name']; $dirname = "..\\$newdir"; $step1 = "..\\cwd"; $step2 = "..\\$step1"; $step3 = "..\\$step2\\$dirname"; if (mkdir($step3, 0777, true)) { echo "dir created successfully"; } else { echo "dir not created"; } } ?> if you're running mkdir.php can use dirname() consecutively until reach level1 . also, it's important sanitize input data prevent malicio...

How to build resource files in to dll while maintaining their folder structure? -

is there way build folder containing various resource files dll? folder may contain sub-folders, , want keep folder structure of these files can access files dll relative path. i'm using visual studio seems can add resource file without sub-folders. can give me suggestion on problem? thanks.

javascript - how to create custom modal overlay -

updated : jsfiddle link here i have hidden div .i shows on event , using jquery flippy plugin rotate div when open (as popup). want make modal overlay background when popup shows. means no 1 can click in background untill popup disappear. cant use jquery dialog. background should blur , no event happen on background.but when popup div disappear should work normal. ask clearification if u need.thanks! **update : **button 'click me' , other elements should not clicked when div open. <> add div class="modalcover" element last element in document, create css class below: .modalcover { position: fixed; top: 0px; bottom: 0px; left: 0px; right: 0px; opacity: 0.0; z-index = 10000; background-color: #000000; display: none; } you may need fit z-index other zindexes in page. when need cover, set display: block .

javascript - Cannot hold div when select email from autocomplete list -

Image
below script create effect fade in , fade out when user hover mouse login box <script> $("#login").hover(function() { $("#loginform").slidetoggle('500').css('display', 'block'); }, function() { $("#loginform").slidetoggle('500') }); </script> but when want select email <input type="name" name="email_address" /> this div #loginform automatically closed : so how keep box show when user select email address autocomplete list ? this issue happen in browser mozilla firefox. fyi : change <input type="name" name="email" /> .. list gmail email address jsfiddle as drop-down created browser, jquery thinks mouse leaves #login , slide again. prevent happening, add delay slideup animation. created fiddle show mean. $("#login").hover(function () { $("#loginform").clearqueue().slidedown(500); }, function () ...

postgresql - Retrieve dynamicaly the columns of a records -

my sql statement built dynamicaly. have like strsql := 'select name, tel, adress, activity_id filtre_1, country_id filtre_2, ... ... ...' i can have 1 n filter, , filter_1 can activity_id country_id, order in not important. how can retrieve values of filter_1, filter_2 don't know how many request send back? normaly retrieve values, : for rowresult in execute strsql loop name := rowresult.name tel := rowresult.tel adress := rowresult.adress filtre_1 := rowresult.filtre_1 filtre_2 := rowresult.filtre_2 end loop; as cannot done, like for rowresult in execute strsql loop name := rowresult.name tel := rowresult.tel adress := rowresult.adress filtre_1 := rowresult("filtre_1") filtre_2 := rowresult("filtre_2") end loop; but rowresult(stringfield) not exist. is have idea? thanks may there're more efficient ways, can access fields anonymous record...

extension methods - free Facebook comments module on product page of magento -

i have tried facebook comment magestore . , configured on backendv valid facebook app id.but not showing fb comment option on frontend. wrong going on? module not working well??? if suggest me module facebook comment integration on product page. maybe can move layout\fbcomment.xml , template\fbcomment\fbcomment.phtml on template directory \app\design\frontend\[your template dir]\default\

c - Find longest suffix of string in given array -

given string , array of strings find longest suffix of string in array. for example string = google.com.tr array = tr, nic.tr, gov.nic.tr, org.tr, com.tr returns com.tr i have tried use binary search specific comparator, failed. c-code welcome. edit: i should have said im looking solution can work can in preparation step (when have array of suffixes, , can sort in every way possible, build data-structure around etc..), , given string find suffix in array fast possible. know can build trie out of array, , give me best performance possible, im lazy , keeping trie in raw c in huge peace of tangled enterprise code no fun @ all. binsearch-like approach welcome. assuming constant time addressing of characters within strings problem isomorphic finding largest prefix. let i = 0 . let s = null let c = prefix[i] remove strings a a if a[i] != c , if a . replace s a if a.length == + 1 . increment i . go step 3. is you're looking for? example: ...

postgresql - what does openerp-server do after I restart server with the para--update? -

what openerp-server after restart server para--update? thank in advance! you tend use in development along database parameter -d. means openerp connect database , update module. note update only, won't install. if other modules depend on module being upgraded upgraded. can pass in comma separated list of modules.

php - how do I save a ftp password but get the plain password later -

okay so, i have problem need save password on server hash php's crypt hashing function, need plain password test users password can connect own ftp server (with password entered)... , i'm stumped ideas on how this... i going create function adds random set of characters password , remove them later when try plain password... (which bad know) ideas? question : anyway save plain password , secure hashing password... said above need use plain password connect ftp server, can't compare hashed passwords... thanks in advanced... if using mysql data storage use des_encrypt [...] set password = des_encrypt($password) [...] alternatively try encrypt to reverse use des_decrypt or decrypt this way have passwords stored in secure way can decrypt use in plaintext @ will.

javascript - Uncaught TypeError: Object [object Object] has no method 'dropotron' in config.js:30 -

hope can me. assume have conflict between dropotron , slidesjs. after setting slidesjs ( http://www.slidesjs.com/ ) dropdown isn't working anymore. console giving me following error message: uncaught typeerror: object [object object] has no method 'dropotron' in config.js:30 in config.js:30 says: jquery('#nav > ul').dropotron({ offsety: -20, offsetx: -1, mode: 'fade', noopenerfade: true, alignment: 'center', detach: false }); i started jquery stuff... still kind of try-and-error-guy. ;) deactivate slidejs dropdown works again. thanks lot, let me know if need else. alex

java - The particular URL created date and updated date -

how publication date of url or link web page ? example https://stackoverflow.com/questions/ask/submit ( question link posted today should show today date after if 1 answered question should show answered date , time). thank q i don't think there way find out publish date & time url/link only, until keeping record of current/publish date & time post on database. should maintain database should keep publish date & time each post.

javascript - Android opening Instagram intent with image causes crash -

i developing app android should have functionality take picture, , share instagram app. app opens camera, takes picture , instagram app opened "crop photo" window active. seems loading picture, after couple of seconds app crashes, can't see image ever gets loaded. i developing app on top of appcelerators titanium platform, not think problem related titanium, rather how pass image. since emulator doesn't have instagram app, developing on galaxy s4. have tried running logcat through adb sort of error message me, thing see notices instagram exited. here code, wrong? have checked image saved filesystem. ti.media.showcamera({ success: function(event) { var file = ti.filesystem.getfile(ti.filesystem.tempdirectory,"ggs-instagram.jpg"); file.write(event.media); var instaintent = ti.android.createintent({ action: ti.android.action_send, packagename: "com.instagram.android", type: 'image/jpeg' }); ...

azure - create image from blob storage -

i need create image html file stored in blob azure storage. cloudstorageaccount account = new cloudstorageaccount(credentials, true); cloudblobclient client = new cloudblobclient(account.blobendpoint.absoluteuri, account.credentials); cloudblobcontainer container2 = client.getcontainerreference(absolutepath); cloudblob blob = container.getblobreference(filename); if (absolutepath != null) { bmp = (bitmap)system.drawing.image.fromfile(blob.name) , true); } but got error of file not found exception. plz help. i need convert html page image , store blob storage. regards, brijesh vaidya thanks gaurav, applied authentication , azure library blob file, when path https://abc.core.windows.net/ds/file.html " , if generate image file html file path supplied in following line: bmp = (bitmap)system.drawing.image.fromfile(blob.name) , true); i got error.

Jquery autocomplete change source -

i have fiddle here and need availabletags1 source if it's choice1 radio button chosen , availabletags2 if choice2 radio button chosen. , need change dynamically actual user choice. code: var availabletags1 = [ "actionscript", "applescript", "asp" ]; var availabletags2 = [ "python", "ruby", "scala", "scheme" ]; $( "#autocomplete" ).autocomplete({ source: availabletags1 }); $('input[name="choice"]').click(function(){ if(this.checked){ if(this.value == "1"){ $( "#autocomplete" ).autocomplete('option', 'source', availabletags1) } else { $( "#autocomplete" ).autocomplete('option', 'source', availabletags2) } try $('input[name="choice"]').click(function(){ if(this.checked){ if(this.value == "1"){ $( "#autocomplete" )...

selenium - java.lang.NoClassDefFoundError + ant - running a jar -

tagging- selenium in case faced similar issue while creating selenium tests using ant. i have seen lot of questions/answers on topic, tried options suggested on various forums still issue not getting resolved. compile code(includes test scripts), create jar , run same jar. reason not seem identify libraries during run time. same code(with tests) works fine when main() method run eclipse. here build.xml, <project default="run"> <target name="clean"> <delete dir="build" /> </target> <target name="init-classpath"> <path id="lib.classpath"> <fileset dir="./lib/"> <include name="**.jar" /> </fileset> </path> <pathconvert property="mf.classpath" pathsep=" "> <path refid="lib.classpath" /> <flattenmapper /> </pathconvert> </target> ...

javascript - JQuery: Event handlers stop working when window is resized -

jsfiddle link: http://jsfiddle.net/4qldc/6 this js code: var togglecontent = function (event) { $(event.target).siblings().toggle(); }; var showorhidepanels = function () { var windowheight = $(window).height(); var windowwidth = $(window).width(); if (windowwidth < 980) { $(".headbar1").siblings().hide(); $(".headbar1").parent().css("min-height", 0); $(".headbar1").css("cursor", "pointer"); $(".headbar1").on("click", togglecontent); } else { $(".headbar1").siblings().show(); $(".headbar1").parent().removeattr("style"); $(".headbar1").css("cursor", "auto"); $(".headbar1").off("click", togglecontent); } }; $(function () { showorhidepanels(); }); $(window).resize(function () { showorhidepanels(); }); this trying achieve...

cocoa touch - How to put escape sequence in Objective C? -

i have small code: nsstring *size = [labelnewcontent stringbyevaluatingjavascriptfromstring:@"return math.max( document.body.scrollheight, document.documentelement.scrollheight, document.body.offsetheight, document.documentelement.offsetheight, document.body.clientheight, document.documentelement.clientheight );"]; the problem xcode doesnt recognize parentheses , commas whole string. replace code nsstring *size = [labelnewcontent stringbyevaluatingjavascriptfromstring:@"return %f",math.max( document.body.scrollheight, document.documentelement.scrollheight, document.body.offsetheight, document.documentelement.offsetheight, document.body.clientheight, document.documentelement.clientheight )]; hope you.

android - Gridview image to give sqlite data -

i have been trying find can me retrieve sqlite database row when click on gridview image ! when click first image on new activity shows me data related image saved in database. @override public void onclick(view v) { // todo auto-generated method stub intent intent = new intent(mcontext,herodata.class); intent.putextra("imageid", mthumbids[position]); mcontext.startactivity(intent); } this how i'm starting new activity , putting image click, need know how sql database row has data related image. public cursor gettestdata() { try { string sql ="select * heroes"; cursor mcur = mdb.rawquery(sql, null); if (mcur!=null) { mcur.movetonext(); } return mcur; } catch (sqlexception msqlexception) { log.e(tag, "gettestdata >>"+ msqlexception.tostring()); throw msqlexception; } } the above cursor data, wan...

android - AndroidStudio gradle proxy -

i've tried run androidstudio it's failing on boot gradle error: failed import gradle project: connection timed out: connect i found solution here but can't find how set properties in android studio . setting them in graddle-wrapper.properties doesn't help. in android studio -> preferences -> gradle, pass proxy details vm options. gradle vm options -dhttp.proxyhost=www.somehost.org -dhttp.proxyport=8080 etc. *in 0.8.6 beta gradle under file->settings (ctrl+alt+s, on windows)

androidstudio set java version 1.7 -

i'm trying use java version 1.7 android studio unfortunately not working properly... if set version in file->other settings -> default project structure to project sdk: java version 1.7.0_06 project language level: 7.0 diamonds, arm, multi-catch but when use switch-statement string error should possible in java 1.7, need set other settings? no... there no settings change. android sdk don't support full java 7 syntax, can't use it. note java.nio.* (new in java 7 api) supported latest android version.

Import data quickbook to openerp for version 7 -

openerp version 7 module available import data quickbooks openerp ?... , depends module "import_base". currenltly old version "import_quickbooks", "import_base" available not working in version 7. there module called base_import in openerp 7. can try it.

python - How to extract values with BeautifulSoup with no class -

html code : <td class="_480u"> <div class="clearfix"> <div> female </div> </div> </td> i wanted value "female" output. i tried bs.findall('div',{'class':'clearfix'}) ; bs.findall('tag',{'class':'_480u'}) these classes on html code , output big list. wanted incorporate {td --> class = ".." , div --> class = ".."} in search, output female. how can this? thanks use stripped_strings property: >>> bs4 import beautifulsoup >>> >>> html = '''<td class="_480u"> ... <div class="clearfix"> ... <div> ... female ... </div> ... </div> ... </td>''' >>> soup = beautifulsoup(html) >>> print ' '.join(soup.find('div', {'class...

php - My sites INSERT and UPDATE script has ceased working -

i complete newb php malarkey concerned, have picked few basics , many more bad habits. the problem have insert script , update scripts have ceased working on friday, last time know insert worked thursday items added pretty daily without problems. have done added 2 fields in database 'salesperson' , 'live_date' , amended scripts accordingly, when realized had stopped working re-uploaded original files , still wasn't working, don't know if coincidence or i've broken something. i can't life of me see errors in script know, (actually wish re-phrase that, can't see errors cause problem, i'm sure there plenty of errors in ;-) i appreciate if 1 of experts take peek me before yank out grey hair have remaining. many in advance. ian. insert script: <?php //connect mysql database include"../scripts/connect_to_mysql.php"; if (!get_magic_quotes_gpc()) { $meta_desc=addslashes($_post['meta_desc']); $sku=$_post['sku...

uiviewcontroller - IBM Worklight: Using native page in iOS -

i have followed this tutorial (06_02_ios_-_using_native_pages_in_hybrid_applications) in order display native viewcontroller through worklight api - wl.nativepage.show . , able go hybrid page through [nativepage showwebview:] . there 2 screens in application: screen a: hybrid page (with button go screen b) screen b: native page (in there textbox input values , button go screen a) here step: go screen b (native) screen (hybrid) input values in native page click button go screen a go screen b again screen --> in step, values previoulsy typed still here. is possible freshly go screen b everytime? in android, can use finish() on clicking button. thanks. finally got work setting self.view = nil . // implement function when button pressed - (ibaction)pressonbackbutton:(uibutton *)sender { nslog(@"pressonbackbutton"); nsdictionary *dic = [[nsdictionary alloc] init]; [nativepage showwebview:dic]; self.view = nil; }

c# - How to work in MVVM -

hi using wpf , devexpress! new c# world , have no experience in mvvm. have watched different videos learn mvvm. related basics of mvvm (why efficient, etc) wrote code in wpf. there 3 buttons in code : add new data, edit data , refresh grid. each button has it's click event defining it's functionality. want convert simple basic wpf code mvvm framework. can guide me it's conversion mvvm. edition void editrow(int focrowhand, entities a) { name nametext = grid.getrow(focrowhand) name; try { if (nametext.name1 != string.empty) { update_id = nametext.id; txtname2.text = update_text = nametext.name; if (panel3.visibility == system.windows.visibility.visible) { panel1.visibility = system.windows.visibility.visible; panel3.visibility = system.windows.visibility.collapsed; } ...

r - Creating a new column filled with random numbers -

sorry simple question, haven't found fitting solution in search. i'd create new column in data frame , fill random numbers between 1 100 (can repeat). below code i'm using, data$newrow <- rep(1:100,replace=t, nrow(data)) i receive error: error in `$<-.data.frame`(`*tmp*`, "newrow", value = c(1l, 2l, : replacement has 2088800 rows, data has 20888` can me fix code? data$newrow <- sample(100, size = nrow(data), replace = true)

xmlhttprequest - MooTools CORS request vs native Javascript -

i have mootools code: new request.json({ method: 'post', url: url, /*url domain*/ onsuccess: function(r){ callback(r); } }).post(data); and code doesn't send post requests (options only)... @ code below (it works great): var http = null, params = object.toquerystring(data); try { http = new xmlhttprequest(); } catch (e) { try { http = new activexobject("msxml2.xmlhttp"); } catch (e) { try { http = new activexobject("microsoft.xmlhttp"); } catch (e) { http = null; alert("your browser not support ajax!"); } } } var url = url; http.onreadystatechange = function () { if (http.readystate == 4 && http.status == 200) { var jsondata = json.parse(http.responsetext); /*or eval*/ callback(jsondata); } }; http.open("post", url); http.setrequestheader("content-type", "application/x-www-form-urlencoded"); http.send(params); edit : tried: .s...

c# - Visual Studio 2010 Property Search -

in visual studio 2010 there extension search controls in tool box? there way filter properties of control? there lots of properties control e.g. (name, acceptsreturn, acceptstab, acciblename, text, visible, top, left etc.). want go directly "visible" property of control. there short cut or extension? no there nothing .. if have many control in form , trying set specific property of controls "visible" property can select controls holding shift or ctrl key , change property value in property panel. or if want change 1 1 select first control select property property panel type applicable property value on next control selection need not select property name again property panel type applicable property value change respective control, dot net ide remember property earlier had selected.

java - Which version of Quartz is compatible with Spring 2.5.6 -

currently application using spring 2.5.6 , opensymphony.quartz-1.6.1 , deployed on jboss6. i have been given task upgrade quartz version if possible. when try stable version 1.8.6 or 2.0.2 or 2.2.0 - following error : org.quartz.schedulerexception: threadpool class 'org.quartz.simpl.simplethreadpool' not instantiated. [see nested exception: java.lang.classcastexception: org.quartz.simpl.simplethreadpool cannot cast org.quartz.spi.threadpool] there no direct reference given threadpool in code. due class clashes ? i oberved thing - on upgrading version - groupid changes 'org.quartz-scheduler' 'opensymphony.quartz'. because 2.5.6 doesn't supports greater quartz versions ? thanks dhananjay

java - Advantages of library -

i have 1 java file numbers of functions around 30-40 use commonly, thinking make external library of it. but want know what advantages of making library except not need import java file , there performance advantage of making library? libraries , frameworks have these advantages: reduce size of class files (code can extracted , moved elsewhere don't disturb anyone). cleaner api since can't leak internal fields you can test library independent of application. if library good, bug must in app. reduces test , debug time. you can reuse library in several projects.

Deserialize a class within a class from a JSON query in PHP -

i have 2 classes (as in c#) public class inside { public string name {get;set;} public int id {get;set;} public string value {get;set;} } public class outside { public inside[] items {get;set;} } i query server , deserialize json values come outside class. i've been asked if can port on php , i've come with class inside { public $name; public $id; public $value; } class outside { public array $item -> inside; with pretty else coming deserializing json php, casting? for outside class deserialization. no real surprise in doesn't work me (i stopped doing php years ago annoyed hell out of me php or nothing language - if don't see something, wrong) the stumbler think how link inside class outside class in same way in c#? i suggest pass in instance of inside class constructor of outside class , set instance property of class: <?php class inside { public $name; public $id; public $value; } clas...

osx - Is /usr/local/opt/php54/bin/php alright compared to /usr/local/bin/php? -

i'm starter these things, want know if having php in first directory fine. got installed there using homebrew, think should installed in second directory. /usr/local/opt/php54/bin/php shows when type type in "which php." i use mac os x 10.8. whenever type in "php" in terminal, goes php ends there. blank thing. when executing php commandline without arguments it's waiting input stdin. the installation location not matter (depending on doing of course). if can execute php entering php everything's fine.

Rails Polymorphic Association - Join elements with similar relationships -

i have system displays training resources skills , (basically) groups of skills on site. user can express interest in either skill or skill grouping stored in polymorphic table interests . i'd display training each skill or skill group interest on user home page, in view, want iterate through interests have training (not skills or skill groups have training). both skill.rb , skill_group.rb models define training resources relationship. _interests.html.erb # iterate through interests <% @user.interests.each |interest| %> <% interest_element = interest.interest_element %> <% if interest_element.training_resources.size > 0 %> # more rendering code here... <% end %> <% end %> interest.rb class interest < activerecord::base belongs_to :user belongs_to :interest_element, :polymorphic => true end ideally, i'd iterate through limited set of interests this: @user.interests.joins(:interest_element => :trainin...

jquery - Datatable doesnt work in chrome -

i'm having problem datatables , don't have clue on how fix it. i use datatables in custom cms , works should on mac (safari, chrome, firefox). colleagues works fine (windows). but have customer (and more one) datatables doesn't show anything. received screenshot customer titles visible. datatables isn't showing anything, not "no records found". customer having problem in google chrome version 28.0.1500.95 on windows machine. when customer opens internet explorer works fine. i can't reproduce problem, i'm hoping guys can me out. maybe more common problem? or possible client has on pc, causes datatables not work properly? client has not disabled javascript, cause cms shows message , message not visible in screenshot. this js have table: $(document).ready( function() { $('#applicationstable').datatable( { "aasorting": [[4,"desc"]], "bpaginate": true, "idisplaylength...

Datapower authentication -

i confused how have authentication using ltpa login re-use in datapower. and authentication of user presenting spnego ap-req (kerberos) via keytab file what steps performed , main conept behind authentication? thanks aaa authentication pretty simple , works in following way: 1. extract identity of user message 2. extract resource message 3. authenticate 4. map resource 5. authorize 6. post processing unique thing behind aaa doesn't stop processing if authentication fails. owing fact if user un-authenticated may want 'something' him/her. can more information in following link. now let me answer second question in shortest way. need following things achieve [tell me if face issue because configured , works me]. 1. create aaa policy in following way 2. in extract identity phase choose 'ltpa token' 3. in authenticate phase choose 'accept ltpa token' , provide ltpa token version. need give ltpa key file , relevant password. key file must...

c# - force TextBox to refresh -

i have normal wpf textbox control bound string property. need displayed text updated after binding or .text property updated. have tried ((textbox)sender).getbindingexpression(textbox.textproperty).updatesource(); ((textbox)sender).getbindingexpression(textbox.textproperty).updatetarget(); in textchanged event handler. i've tried updatesourcetrigger=explicit on binding. i've tried application.current.dispatcher.begininvoke( dispatcherpriority.input, new action(() => { statustextbox.text = "newvalue"; })); and many different combinations of these. text displayed changes once method update textbox exits. xaml: <textbox x:name="txbox" height="150" margin="0,0,0,0" verticalalignment="top" textwrapping="wrap" verticalscrollbarvisibility="auto" acceptsreturn="true" verticalcontentalignment="top" text="{binding textproperty}"width=...

CSS 'background-size' property - Cross-Browser Solution? -

i have element uses css: .my-box { padding-left:50px; background-image:url('images/img01.png'); background-size:20px; height:20px; } my problem: in browsers internet explorer, 'background-size' property doesn't work. there solution either through javascript, jquery or css make work without having put physical <img> tag in markup? you can use polyfill. maybe fill issue. ie behavior adding support background-size: cover; , background-size: contain; ie8. how use it? everywhere use background-size: cover; or background-size: contain; in css, add reference file. backgroundsize.min.htc .selector { background-size: cover; /* url relative document, not css file! */ /* prefer absolute urls avoid confusion. */ -ms-behavior: url(/backgroundsize.min.htc); } see here: background-size polyfill github repo , further information

java - OnTouchListener is not getting fired -

please have @ following code xml code <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".paragraphreader" > <scrollview android:id="@+id/paragraph_reader_scroll_view" android:layout_width="match_parent" android:layout_height="wrap_content" > <textview android:id="@+id/paragraph_reader_txt" android:layout_width="match_parent" android:layout_...

html - Image behind text -

Image
i want display image behind h1 tag, want image width stretch same width text. my code : <div style="display: inline;"> <img src="http://img585.imageshack.us/img585/3989/m744.png" width="100%" height="68" /> <h1 style="position: absolute; top: 0px;">variable length text</h1> </div> jsfiddle: http://jsfiddle.net/aykng/ current appearance : desired appearance : the image width should either stretch or shrink fill div, how can achieve this? i want compatible ie 7+, otherwise use background-image , background-size . this done basic positioning added demo jsfiddle div { position: relative; } h1 { display: inline; } img { position:absolute; width:100%; max-width: 100%; }

Does Python need to know the definition of passed, but unused object? -

a, b, c , x classes in different modules. want pass object of class x following way: a->b->c is necessary inculde class x in b, or can pass class x object without knowing definition? (i don't need use methods or anything, return object) no, not. about time have from some_module import some_object when going create instances of some_object , or want catch exceptions some_module . if have instances of some_object being passed in use (read, write, or call various attributes, etc.).

How can I press an Excel Addin's Ribbon Button using C#? (Reuters Excel Addin) -

i writing c# application data excel data comes excel reuters addin. the reuters addin creates 2 excel ribbons (menu tabs next "home", "insert", etc.) "thomson reuters datastream" , "thomson reuters". in order use retuers addin functions in excel, first need press "logon" button in "thomson reuters datastream" ribbon (so green , says "online" instead of red , "offline") because needs "online" or else reuters addin functions won't work. how can push button (access ribbon , make sure logon button "online", if not press button) c#? i comfortable creating excel application object in c# , manipulating cells etc don't know how press addin's ribbon button. any help/guidance appreciated! thank you! i dont think possible custom addins, if built in tab can use application.commandbars.executemso() for automating controls in custom ribbon tabs might you auto...

How to organize a Python GIS-project with multiple analysis steps? -

i started use arcpy analyse geo-data arcgis. analysis has different steps, executed 1 after other. here pseudo-code: import arcpy # create masking variable mask1 = "mask.shp" # create list of raster files files_to_process = ["raster1.tif", "raster2.tif", "raster3.tif"] # step 1 (e.g. clipping of each raster study extent) index, item in enumerate(files_to_process): raster_i = "temp/ras_tem_" + str(index) + ".tif" arcpy.clip_management(item, '#', raster_i, mask1) # step 2 (e.g. change projection of raster files) ... # step 3 (e.g. calculate statistics each raster) ... etc. this code works amazingly far. however, raster files big , steps take quite long execute (5-60 minutes). therefore, execute steps if input raster data changes. gis-workflow point of view, shouldn't problem, because each step saves physical result on hard disk used input next step. i guess if want temporarily di...

javascript - Move around dynamic divs in blog post listings -

i working blog , want move category above title on each post listing. when use following code 50 clones of first category. think need using index parameter of .each() i'm not sure. here's code: jquery(document).ready(function(){ jquery(".blog-category").each(function(){ jquery(this).insertbefore( jquery(".blog-head") ) ; }); }); essentially i'm trying insert .blog-category before .blog-head on each post. html <div id="entry-2839"> <div class="blog-post-in"> <div class="blog-head">content</div> <div class="blog-side"> <div class="blog-category">more content</div> </div> </div> </div> this should trick: var e = jquery(this); e.closest(".blog-post-in").prepend(e);

ruby - Passenger can't load Sinatra app in production? -

Image
in development , in previous production environments, sinatra app worked fine. on recent new server deployment, can't app load @ under passenger , nginx. response says: an error occurred while starting web application: did not write startup response in time. [ 2013-08-26 16:05:23.8219 30156/7f379e621700 eventedbufferedinput.h:381 ]: [eventedbufferedinput 0x7f3784000980 fd=19, state=live, buffer(0)="", paused=1, socketpaused=1, nexttickinstalled=0, generation=2, error=0] start() [ 2013-08-26 16:05:23.8219 30156/7f379e621700 agents/helperagent/requesthandler.h:1300 ]: [client 19] new client accepted; new client count = 1 [ 2013-08-26 16:05:23.8219 30156/7f379e621700 eventedbufferedinput.h:146 ]: [eventedbufferedinput 0x7f3784000980 fd=19, state=live, buffer(0)="", paused=0, socketpaused=0, nexttickinstalled=0, generation=2, error=0] onreadable [ 2013-08-26 16:05:23.8220 30156/7f379e621700 eventedbufferedinput.h:187 ]: [eventedbufferedinput 0x7f378400...