Posts

Showing posts from May, 2014

ios - AVPlayer class & AVPlayerStatusFailed -

i'm using avplayer class playing server mp3 urls in our music streaming app. works well, avplayer status set "avplayerstatusfailed". , documentation suggest that, when happens need drop current avplayer object , instantiate new one. this recovery approach fails sometimes, , when recovery approach fails irrespective of how many times avplayer object reinitialised not playing songs. faced simular issues? , have solution ?

python - Installation pandas failed due to a deprecated API -

Image
i wanted trythe famous python's library pandas tried install command bellow: sudo pip install pandas but lead failure said python.h file missing did: sudo apt-get update sudo apt-get install python-dev -y i used pip install once again got error (i add screenshot) , can't find out how fix it. know error , how fix it? the error given gcc x86_64-linux-gnu-gcc: error trying exec 'cc1plus': execvp: no such file or directory indicated c++ compiler package not installed. in case of debian , ubuntu, can done by apt-get install g++

SELENIUM - Dropdowns in popupwindow -

my script goes - main page click button opens window search criteria contains drop down select options, when select values , search in popupwindow, nothing happening. it stalls in popupwindow selected value in dropdown search click function doesn't execute.

eclipse - Spring STS - unable to resolve properties -

this question not related spring, sts tool suite or spring eclipse ide. given following declaration of class @configuration() @import({ websharedconfig.class, springsecurityconfig.class }) @componentscan({ "com.finovera.web", "com.finovera.platformservices","com.finovera.authentication" }) @propertysources(value = { @propertysource({ "${finovera_properties}" }), @propertysource(value = { "${static_override_properties}", }, ignoreresourcenotfound = true) }) @scope("singleton") @enabletransactionmanagement public class cabinetconfig extends webmvcconfigurationsupport { } i seeing following exception in sts plugin (org.springframework.ide.eclipse.beans.core) org.springframework.beans.factory.beandefinitionstoreexception: failed parse configuration class [com.finovera.web.config.cabinetconfig]; nested exception java.lang.illegalargumentexception: not resolve placeholder 'finovera_properties' in string value "

Jquery .bind events triggered when event capture or event bubble -

all, know in dom level 2 event model, there exists event capture , event bubble. can't figure out how jquery deal them. did experiment .bind method. here code .please review . <script> $(function() { $('*').each(function(){ var current = this; $(this).bind("dblclick",function(event){console.log('capture ' + current.tagname + '#'+ current.id + ' target ' + event.target.id);}); }); }); </script> <body id="greatgrandpa"> <div id="grandpa"> <div id="pops"> <img id="example" src="designer/templates/thumbnails/2colstemplate.png" /> </div> </div> </body> the output looks below capture img#example target example capture div#pops target example capture div#grandpa target example capture body#greatgrandpa target example capture html#

Crash on application - iOS -

i did not know why application crash. crash happen when live production. not happen when testing xcode , testing device. can help? exception type: exc_crash (sigabrt) exception codes: 0x0000000000000000, 0x0000000000000000 exception note: exc_corpse_notify triggered thread: 5 filtered syslog: none found global trace buffer (reverse chronological seconds): 2.263960 cfnetwork 0x0000000182bd184c tcp conn 0x14edc1a00 ssl handshake done 7.705489 applejpeg 0x0000000183c5eb54 [0x1500b3400] releasing session 7.705489 applejpeg 0x0000000183c5eb54 [0x14f0b8000] releasing session 7.732061 applejpeg 0x0000000183c5e338 [0x14f0b8000] created session 7.778372 applejpeg 0x0000000183c5e338 [0x1500b3400] created session 8.108716 cfnetwork 0x0000000182c73104 tcp conn 0x14ef91720 complete. fd: 8, err: 0 8.109137 cfnetwork

hiveql - What is the best way to count the missing/default value rows of a column in Hive? -

select count(column_a null or column_a '0*') num_miss_rows, count(*) num_total_rows tablex; is not working. because count(expr) function increments on expr returns non-null value 0. i want compute num_miss_rows/num_total_rows, many columns. what best way counting? you want use case inside sum (also should like 0% not like 0* ): select sum(case when column_a null or column_a '0%' 1 end) num_miss_rows, count(*) num_total_rows tablex;

.htaccess - Redirecting Wordpress site to Ember, except dashboard and API -

i've built ember front-end wordpress site. 2 hosted on separate domains when user clicks "view page" in wordpress dashboard sent page on api site rather front-end of site. i have created routes match wordpress site, want redirect api ember site, exception of dashboard , api endpoints. useful if, whatever reason, navigates directly api in browser. so want following: example-api.com/abc ~> example.com/abc example-api.com/abc/def ~> example.com/abc/def example-api.com/wp-admin ~> work normal example-api.com/wp-json ~> work normal i've tried following far: rewriteengine on rewritebase / rewriterule ^!(wp-json|wp-admin)($|/) http://example.com/$1 [r=301,l] # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress but seems redirect everything. next: rewr

javascript - Jquery how to select elements below an id/class without being the parent? -

i trying make button toggles every <p> below it. here html: <p>show</p> <p>show</p> <p>show</p> <a id="hc-more-info">more info</a> <p>hide</p> <p>hide</p> <p>hide</p> <ul> ... <ul> jquery (this got far) how start them hiden? jquery('#hc-more-info').click(function(){ jquery(this).parent().nextall('p, ul').toggle(); }); any appreciated! thanks! jquery('#hc-more-info').click(function(){ jquery(this).parent().nextall('p').toggle(); });

python - How do I add different amounts to one inputted variable? -

i have nested list names, longest , shortest distances sun, , time frame (in weeks) @ planets away 01/01/16. variable number of weeks user inputs, because planets start on '-x' axis default, have +/- necessary amount of time users time in order position them correctly. week=int(input("how many weeks see solar system's future? ")) timeformat=365.25*60*60*24 planetdata = [ ['mercury', 69.8, 46.0, (week+1.5)/52 * timeformat], ['venus', 108.9, 107.5, (week-9)/52 * timeformat], ['earth', 152.1, 147.1, (week-1.5)/52 * timeformat], ['mars', 249.2, 206.7, (week-21)/52 * timeformat], ["halley's comet",5250, 87.7, (week+1.54e3)/52 * timeformat], ] this works fine @ moment, trying create main function variables (which include user's "week" input) , keep constants separate. brings me problem of defining planets shown above without variable in them. don't understand how have '+1.

python - BeautifulSoup 'href' list that is giving ambiguous TypeErrors? -

i'm using beautifulsoup scrape urls webpage. going good, until of urls have non-ascii characters in them. requests.get('http://www.reddit.com') soup = beautifulsoup(req.content) urls = [i.get('href') in soup.findall('a') if 'keyword' in str(i.get('href'))] the list comprehension return unicodeerror . thought separate list comprehension 2 parts instead: urls = [i.get('href') in soup.findall('a')] urls = [i.encode('utf-8') in urls] this when got attributeerror , saying items nonetype . i checked type: print [type(i) in urls] which showed unicode types. seems none , unicode @ same time. you must have missed none value. checked www.reddit.com and, sure enough, there's: <a name="content"></a> its href none . instead of printing values , search none manually, do: urls = [(i, i.get('href')) in soup.findall('a')] print [u u in urls if u

javascript - Removing specific classes from all div elements of certain format -

i remove classes starting nf- console image jsfiddle https://jsfiddle.net/zapjelly/fda3lm84/11/ i have following html/js: var nfclasses = document.queryselectorall('.custom-nf [class*="nf-"]'); array.prototype.map.call(nfclasses, function(elem) { array.prototype.map.call(elem.classlist, function(classstr) { if (classstr.match(/^nf\-/)) elem.classlist.remove(classstr); }); }); <p>remember inspect element on input below</p> <div class="custom-nf"> <div class="input nf-input-outer nf-validation"> <div class="nf-container"> <div class="nf-outer nf-outer-input nf-outer-validation"> <div class="nf-middle"> <div class="nf-inner"> <label for="dummy" class="nf-label"></label> <input id="dummy" type="text" class="nf-inp

angularjs - How to iterate through an array within the object in angular -

this how array in data: $scope.persons = [{ cc:["abqwqe12c", "iu63enwzy", "dj101oqaq"] }, { cc:["erie1wka", "irt2naszsd", "riger1oq"] }] in html displays array when called {{person.cc}} . below doesn't give anything. <div ng-repeat = "person in persons"> <div ng-repeat = "ccs in person"> {{ccs.cc}} </div> </div> you want inner repeat loop on person.cc property array <div ng-repeat = "person in persons"> <div ng-repeat = "ccs in person.cc"> {{ccs}} </div> </div>

bash shell script for 100 iteration and log time taken -

how run 100 iterations using bash shell script? want know how long take execute 1 command (start , end time). want keep track iteration running. want log each iteration. have 1 automated script need run , log it. for in 1 2 3 command1 done but want know how long takes complete 1 iteration - , write information log file too! you may use seq in interation well: for in `seq 1 100`; ... done

How to display related post in rails application -

i'm beginner rails application, have troubled issue display related post, show post separately according id have not idea how show related post. below code show post separately according id: def postdetails @details= post.find(params[:post_id]) end now how can rich solution? this not answer, i'll delete if required. -- your question highly ambiguous, meaning it's open interpretation in many different ways. whilst not problem, when comes application functionality, need specific possible. contrary new buzzwords of "full stack engineer", "devops" etc - core of computing design functions & algorithms "compute" data. case scenario professional developer outline spec , , work towards implementing it. to answer question broadly asked it, have define how wish "relate" posts. there several options (all involve data sampling ) -- define each post "tags" or similar categorization create

javascript - Resizing images to fit in a container perfectly -

Image
i searched question on over here , found couple of examples , tried 1 in particular, not working @ wanting to. i have set container's height 600px , not coming close. sure due image width being 33%, there way these taller @ or stuck height being tall? i don't why far right image isn't going top of container. @ least want that. is there anyway adjust height these images or pull out of proportion? $(window).load(function(){ $('.home-img-block').find('img').each(function(){ var imgclass = (this.width/this.height > 1) ? 'wide' : 'tall'; $(this).addclass(imgclass); }) }) #home-img-blocks { width: 100%; height: 600px; } /*#home-img-blocks-container { border: 1px solid black; }*/ .home-img-block { width: 33%; height: 100%; border: 1px solid black; display: inline-block; } .home-img-block img.wide { max-width: 100%; max-height: 100%; max-width: 100%; height: auto; } .home-img-block im

angularjs - change angular datatables filter's look -

we using angular datatable , in backend webapi. using light-column-filter http://l-lin.github.io/angular-datatables/#/withlightcolumnfilter serverside processing , works showed in website. want change table filter's more filter options (like contains, less than, greater than, equal) , user friendly. should below image. we want these type of filter in angular datatables serverside processing image taken www.ag-grid.com website want in angular-datatables serverside processing. spend lot of time didn't solution. please , in advance.

autohotkey - How to send enter key when ever dialogue box is appears -

i new in autohotkey, how send enter key when ever dialogue box appears title of dialogue box "conversion" times dialog box may appears more once. possible ? use au3_spy.exe autohotkey folder find correct title window. use this: settimer, closedialogue closedialogue: winwait, title winclose, title return and replace title correct title of window. winclose winwait

converting json branched array to php object -

in below code, want display get_data using echo not able decode/display branched array. so, question how convert branched array php object. json response : {"status":1,"msg":"fetched succesfully","user_data":{"d91c2d21af80002a3dd6ffc76f62bb9f89b6e0ba":{"name":"pratyush","user_year":"2013","get_data":"d91c2d21af80002a3dd6ffc76f62bb9f89b6e0ba","is_active":1,"data_no":"ghjgjj2xxxxxxoioo7","user_bin":"77","is_exp":"n"}}} php code : (after using curl) $response = json_decode($o,true); $status=$response["status"]; $msg=$response["msg"]; $user_data=$response["user_data"][0]["get_data"]; result: echo $status;//(working) echo "<br>"; echo $msg;//(working) echo "<br>"; echo $user_data;//(not working) echo user_data not worki

strsplit by spaces greater than one in R -

given string, mystr = "average student score 88" i wish split if there more 1 space. wish obtain following: "average student score" "88" i searched "\s+" split number of spaces. strsplit(mystr, "\\s+") but not want. there option within strsplit can split strings based on number of spaces (say space = k) or rule on spaces (say space > 1)? you may specify through repetition quantifier. strsplit(mystr, "\\s{2,}") \\s{2,} regex should match 2 or more spaces.

Asp.Net MVC relatives paths for two application pointing to same code base -

hi have confusion publishing application on 2 server. path both like:- http://www.myapp.com/ , http://www.myapp2.com/myapp/ so including script, css or images, have given 2 path like:- <img src="~/images/ajax-loader.gif" alt="loading" /> , <img src="~/myapp/images/ajax-loader.gif" alt="loading" /> is there way not need put scripts twice. have tried:- <img src="./images/ajax-loader.gif" alt="loading" /> this works how , why not sure. please explain or give other suggestion. thanks the ideal solution relative path problems in asp.net mvc applications use of t4mvc packages. t4mvc package becoming standard handle relative path , magic strings in mvc applications. install t4mvc nuget in mvc application install-package t4mvc once installed, able see t4mvc.tt file in solution. right-click, , "run custom tool" this should create constants static resources i

filezilla - ftp multiple users accessing single file -

Image
currently using filezilla. curious know if there feature in filezilla can access single file multiple locations(users) edit , save both locations code server. or if there other ftp client job. want access(open) same file different locations(users) , not loosing changes made of user. thanks! only if every user saves copy of file. can't open file on ftp. ftp transfering files, don't have "live" access, can't "live" i/o. ftp not filesystem, maybe remote server using filesystem/os, doesn't allow concurrent access? to save copy of file, users must set "rename" "file exists action" in filezilla:

What is a `Node` in typescript (using TypeChecker) -

using answer this question reference. node , how instance of node program . the answer question above used example type information @ location (which do) let typechecker = program.gettypechecker(); let type = typechecker.gettypeatlocation(node); now i'm missing 1 last piece of puzzle. node of object pass gettypeatlocation , how instance of node . you can top-level node source file you're interested in processing so: const root = program.getsourcefile(filename); or if want process whole lot: const roots = program.getsourcefiles(); then can recursively traverse tree: processnode(root); function processnode(node: ts.node) { // process node // .... // go further down tree ts.foreachchild(node, child => processnode(child)); } with should able use likes of typechecker.getsymbolatlocation() , typechecker.gettypeatlocation() devise solution other question. if don't need modify source files plan process may easier write custom

c# 4.0 - how to Call Javascript file in dotnetnuke -

i new in dot net nuke when adding java script file on user control not loading while other java script loading have tried on both ascx , code behind.so have code load java script fie given below code protected void page_init(object sender, eventargs e) { try { page.clientscript.registerclientscriptinclude("news", resolveurl("~/script/news.js")); // clientresourcemanager.registerscript(this.page, "~/script/" + "news.js", 101, "dnnpageheaderprovider"); // clientresourcemanager.registerscript(this.page, "~/script/" + "newsscript.js", 101, "dnnpageheaderprovider");//105, page label js after global js } catch (exception ex) { this.logexception("error_pageload", ex); } } if usercontrol view in custom module , script in local folder in module, best practice use dnn's client resource management api register javascript on page.

r - ggplot2 stacked area line charts producing odd lines and holes -

Image
i have data set that's structured follows: year color toyota honda ford 2011 blue 66 75 13 2011 red 75 91 62 2011 green 65 26 57 2012 blue 64 23 10 2012 red 84 8 62 2012 green 67 21 62 2013 blue 31 74 49 2013 red 48 43 35 2013 green 57 62 74 2014 blue 59 100 32 2014 red 72 47 67 2014 green 97 24 70 2015 blue 31 0 79 2015 red 60 35 74 2015 green 51 2 28 (my actual data, presented in chart images below, larger , has 100s of "colors" i'm simplifying here can merely understand structure.) i trying make stacked area line chart shows how many cars of each color produced on time specific company. (i.e. each company has own chart in x axis = years, y axis = cars produced). i run code: qplot(year, toyota, data = datan

jsp - LDAP Tomcat implementation -

i need implement ladp + tomcat plan described here , have given index.jsp . i believe user needs give username , password , these compared ldap username , password. me, if login successful, has go mainpage.jsp . normally, have action="\loginaction" , in struts-config.xml , mention success on page mainpage.jsp . here action different. how find mainpage.jsp ? also, i'm confused this: j_username, j_password, action='<%= response.encodeurl("j_security_check") %>'

java - Why is the Facebook API returning a missing post? -

i'm using facebook4j obtain feed of public pages. tested out on public page , noticed received null value message field of 1 of posts. i checked created time of post , went compare actual facebook page. turns out post doesn't exist on page, leads me wonder if has been deleted. if so, why still being returned api? you right, graphapi return deleted posts empty data set.

Can this Scala code snippet be made more concise? -

i've seen scala code snippet somewhere: def tosentiment(sentiment: int): sentiment = sentiment match { case x if x == 0 || x == 1 => sentiment.negative case 2 => sentiment.neutral case x if x == 3 || x == 4 => sentiment.positive } is there way rewrite case statement more concisely? suspect there must simpler (shorter) way express x if x == 0 || x == 1 condition. by way, form: def tosentiment(sentiment: int): sentiment = sentiment match { case 0 => sentiment.negative case 1 => sentiment.negative case 2 => sentiment.neutral case 3 => sentiment.positive case 4 => sentiment.positive } is not i'm looking for. i'm hoping this: def tosentiment(sentiment: int): sentiment = sentiment match { case x in {0, 1} => sentiment.negative case 2 => sentiment.neutral case x in {3, 4} => sentiment.positive } or even: def tosentiment(sentiment: int): sentiment = sentiment match { case 0, 1 =&g

javascript - Troubleshoot Chrome Search Extension -

i've been trying make basic chrome extension search wayback machine based off link. i'm trying set when right-click link, context menu has 'go wayback machine' option. have: manifest.json: { "name" : "archive right click", "manifest_version" : 2, "version" : "1.0", "description" : "adds go archive right-click context menu.", "icons" : { "16" : "icon-16.png", "48" : "icon-48.png" }, "browser_action" : { "default_icon": "icon-16.png", "default_title" : "go archive" }, "permissions" : [ "tabs", "contextmenus" ], "background" : { "scripts" : ["script.js"] } } script.js: function searcharchive(info,tab) { var url = info.linkurl; var archiveurl = "https://web.archive.org/web

css - Any Alternative fix for printing a webpage when designed with vmin/vmax/vw/vh-font-sized texts -

so working on fluid responsive design , text size on website works based on %. realized if try print(cmd+p) website design breaks on chrome. looks pretty old , known issue , not able find hack online make work? can please suggest on this? issue mentioned here: https://code.google.com/p/chromium/issues/detail?id=382313 here html can try putting on local html page , try printing on chrome: <!doctype html> <html> <head> <title></title> <style> .vmin { font-size: 10vmin; } .px { font-size: 20px; } .vw { font-size: 10vw; } .vh { font-size: 10vh; } .box { width: 10vw; height: 10vh; border: 1px solid #000; } </style> </head> <body> <div class="vmin"> using vmin - font-size: 10vmin; </div> <div class="px"> using px - font-size: 20px; </div> <div class="vw"> using vw - font-size: 10vw; </div> <div cl

building failure in jenkins as build.sh: not found -

i building free style project in jenkins. configure setting execute shell script as build.sh -label $job_name -$build_number -java_home $java_home when try build project, have console output build failure. building in workspace /var/lib/jenkins/workspace/jmxweb [jmxweb] $ /bin/sh -xe /tmp/hudson4723307331600368596.sh + build.sh -label jmxweb -8 -java_home /usr/lib/jvm/java-7-oracle /tmp/hudson4723307331600368596.sh: 2: /tmp/hudson4723307331600368596.sh: build.sh: not found build step 'execute shell' marked build failure finished: failure according documentation builds non-source control projects there need build project demonstration purposes or access svn/cvs repository unavailable. choosing configure project "none" under "source code management" have to: 1 build project @ least once, (it fail), jenkins create structure jenkins/workspace/projectname/ 2 copy project files jenkins/workspace/projectname/ 3 build again , configure appr

ios4 - dyld: lazy symbol binding failed: Symbol not found: -

when try run project in ios 4.3 simulator, throws me following exception: dyld: lazy symbol binding failed: symbol not found: _cgpathcreatewithellipseinrect referenced from: /users/macintosh/library/application support/iphone simulator/4.3.2/applications/fcbb8196-9f46-4f4e-bfb3-c28d0aaec74f/tick.app/tick expected in: /users/macintosh/desktop/xcode/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator4.3.sdk/system/library/frameworks/coregraphics.framework/coregraphics dyld: symbol not found: _cgpathcreatewithellipseinrect referenced from: /users/macintosh/library/application support/iphone simulator/4.3.2/applications/fcbb8196-9f46-4f4e-bfb3-c28d0aaec74f/tick.app/tick expected in: /users/macintosh/desktop/xcode/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator4.3.sdk/system/library/frameworks/coregraphics.framework/coregraphics i have set target ios 4.3. project runs fine on ios 5 , 6

android - Rotate your finger ImageView limited -

i have imageview, rotate finger @ both sides. how can limit rotation 0 270 degrees? sorry bad english.. public boolean ontouch(view v, motionevent event) { centerx = volbt.getwidth() / 2; centery = volbt.getheight() / 2; if (event.getaction() == motionevent.action_down) { savedmatrix.set(matrix); startangle = math.atan2(event.gety() - centery, event.getx() - centerx); } if (event.getaction() == motionevent.action_move) { double = math.atan2(event.gety() - centery, event.getx() - centerx); angle = (float) math.todegrees(a-startangle); matrix.set(savedmatrix); matrix.postrotate(angle, centerx, centery); } if (event.getaction() == motionevent.action_up) { } volbt.setimagematrix(matrix); return true; }

kettle - How to get the reorder the column with csv input fixed column in pentaho -

Image
scenario: i have created transformation load data table csv file , have following columns in csv file: customer_id company_id employee_name but user may give input file column ordering (random order) employee_name company_id customer_id so, if try load file has random column ordering, kettle load correct column values per column names ... ? using etl metadata injection can use transformation this, either normalize data, or store database: then need send correct data transformation. can read header line csv, , use row normaliser convert format used etl metadata injection . i have included quick example here: csv_inject on dropbox , if make , run runs per csv file should work.

iphone - why date gets changed when i try to change formate? -

this question exact duplicate of: nsdateformatter not giving me correct 1 answer this code using changing date formate nslog(@"newbirthdates%@",_newwbirthdates); nsdateformatter *form = [[nsdateformatter alloc] init]; [form setdateformat:@"mm/dd"]; nsdate *date1 =[nsdate date]; nsstring *string =[form stringfromdate:date1]; nslog(@"string%@",string); nsdate *todaydate =[form datefromstring:string]; nslog(@"todaydate%@",todaydate); this output newbirthdates( "05/22", "07/11", "10/07", "02/20" ) newbirthdates( "05/22", "07/11", "10/07", "02/20" ) string03/18 todaydate1970-03-17 18:30:00 +0000 now question why 3/18 become 03/17?? why 1 day decreases the answer

java - Difference between Math.IEEEremainder() and StrictMath.IEEEremainder() -

i found ieeeremainder() @ 2 places in lang package. java.lang.math.ieeeremainder() java.lang.strictmath.ieeeremainder() my question both methods same or different? as spelled out in documentation: unlike of numeric methods of class strictmath , implementations of equivalent functions of class math not defined return bit-for-bit same results. relaxation permits better-performing implementations strict reproducibility not required. since x86(-64) architecture uses ieee 754 floating-point, on x86 openjdk implementation, math tends delegate strictmath , , in case, not required specification.

session - PHP's $_SESSION overwritten - only in Firefox (Mozilla) -

within site, use variable $location keeps track of page user viewing. @ end of index.php, variable copied $_session array, upon next request know user last time (i use generating "back" links). index.php goes this: $location = getlocation(); // gets user location processing $_post , $_get if(!isset($_session['last_location'])) $_session['last_location'] = somemeaningfullocation(); . . outputpage(); // renders page based on $location . . $_session['last_location'] = $location; so in outputpage(), $_session['last_location'] variable can used generating "back" links. problem is: this code works msie, chrome , safari . doesn't, however, work firefox nor seamonkey (which use web development). in these browsers, "back" links point frontpage . other facts might useful: session data stored in files, server date , time set right i've tried playing cache settings ( header('cache-co

ruby on rails - HAML: tr[@user] translates to class and ID, but how? -

as know, haml translates tr[@user] <tr class="user" id="user_123">... . how achieve this? through internal magic? or using functionality of @user object? what want achieve following. have contact model company , person subclass. when using tr[@company] , i'd haml following: <tr class="contact company" id="company_123"> ...instead of only: <tr class="company" id="company_123"> is there easy way achieve this? thank you. you can implement haml_object_ref method in model override haml uses value of class attribute. if use direct subclasses of contact simple should work in contact model: def haml_object_ref "#{self.class.superclass.to_s.underscore} #{self.class.to_s.underscore}" end (this uses activesupport underscore method.) if want use contact instances directly, or subclasses of person or company , this: def haml_object_ref classes = [] klass =

c# - Obtaining method signatures types and names -

i'm writing 'quick' c# application allow me see methods avaliable under assembly dll, far , can output class, access modifier , name : private void btnlistmethodname() { string sassemblyfilename = assemblylocation.text; if (sassemblyfilename.length != 0) { assembly assem = assembly.loadfrom(sassemblyfilename); type[] types = assem.gettypes(); arraylist arrl = new arraylist(); foreach (type cls in types) { try { //add class name arrl.add(cls.fullname); if (cls.isabstract) arrl.add("abstract class:" + cls.name.tostring()); else if (cls.ispublic) arrl.add("public class:" + cls.name.tostring()); else if (cls.issealed) arrl.add("sea

javascript - how to remove <textarea> whitespace -

i want <textarea> , 1 i'm writing in right actually. how make textarea behave one? want start @ beginning , not give me whitespace erase when clicking in middle of it. html <p> <textarea class="notetoadd"> </textarea> </p> any ideas? that between start tag <textarea> , end tag </textarea> it's value. whitespace seen 'value'. have this: (note whitespace) <textarea> </textarea> so, remove that, remove whitespace , place start , ending tag directly after each other. <textarea></textarea>

android - Fix location marker jumps while not moving -

i'm working androids fusedlocationapi receive periodically location updates , display current location on googlemaps. know accuracy can inaccurate time time , make big sidesteps on way down street. locationrequest locationrequest = new locationrequest(); locationrequest.setinterval(5 * 1000); locationrequest.setfastestinterval(2 * 1000); locationrequest.setpriority(locationrequest.priority_high_accuracy); locationrequest.setsmallestdisplacement(5); locationservices.fusedlocationapi.requestlocationupdates(this.mgoogleapiclient, locationrequest, this); when standing still still locations high accuracy value , wrong location (yeah, normal i'm aware of that). googlemaps does not change location marker, updates accuracy radius around point. so how know when should move marker next location instead of moving on every update (what produces lot of jumps in building)? not every location has speed value use. anyone fought problem , fixed it?

Regex: match feet and/or inches -

i'm trying match feet , inches can't manage , "and/or" if first half correct validates: code: (in javascript) var pattern = "^(([0-9]{1,}\')?([0-9]{1,}\x22)?)+$"; function testing(input, pattern) { var regex = new regexp(pattern, "g"); console.log('validate '+input+' against ' + pattern); console.log(regex.test(input)); } acceptable answers should be: 1' , 1'2" , 2" or 2 (assumes inches) not acceptable: else including empty but regex accepts 1'1' remove + @ end (which allows more 1 instance of feet/inches right now) , check empty string or illegal entries 1'2 using separate negative lookahead assertion . i've changed regex group 1 contains feet , group 2 contains inches (if matched): ^(?!$|.*\'[^\x22]+$)(?:([0-9]+)\')?(?:([0-9]+)\x22?)?$ test live on regex101.com . explanation: ^ # start of string (?! # assert

xperf - ETW provider for "Window in Focus" graph in Windows Performance Analyser -

windows performance analyser has graph called "window in focus". provider/trace flag should specify in xperf command line such graph? "window in focus" information provided microsoft-windows-win32k provider. example: xperf -start uisession -on microsoft-windows-win32k

java - Base64 Encoding takes too long time in Android -

i'm capturing image camera. save file in public photo directory , save uri file. i want save image in base64 string , put on hashmap put in xml file later. protected void doinbackground(void...voids) { options.injustdecodebounds = false; //bitmap bmp = bitmapfactory.decodefile(imagefilepath,options); inputstream in = null; try { in = getcontentresolver().openinputstream(uri.parse(mcurrentphotopath)); } catch (filenotfoundexception e) { e.printstacktrace(); } options.insamplesize = 2; bitmap image = bitmapfactory.decodestream(in,null,options); int imgheight = image.getheight(); int imgwidth = image.getwidth(); while(imgheight>2000){ imgheight = imgheight / 2; } while(imgwidth>2000){ imgwidth = imgwidth / 2; } bitmap test = bitmap.createscaledbitmap(image,imgwidth,imgheight,false); string st

ios - Swift inflated [UInt8] fails to deflate with miniz lib -

i have ios app use deflateswift deflate byte array ( [uint8] ). when try inflate data using miniz library not working. executed in platform. deflateswift simple wrapper around zlib library have been around ages. i have tried set different value on windowsbits compressionlevel when doing inflate in app. has not solved problem. miniz use windowsbits = 15 default default setting deflateswift well. according documentation miniz should 100% compatible zlib, not seems case. has else encountered similar problems? there more settings windowsbits & compressionlevel fiddle with? as turns out did not deflateswift classes work miniz library. nsdata+compression found in cocoagit works this.

vim - How to check multiple files at once? -

currently, if run :syntasticcheck , :errors displays errors current buffer only. want check python ( *.py ) files in current working directory, , locations aggregated in single locationlist. i know possible because syntastic documentation implies it, e.g. there syntastic_ignore_files setting ignoring patterns of filenames. my failed attempt: set let g:syntastic_aggregate_errors = 1 open *.py files :n *.py :bufdo syntasticcheck it cycles through each buffer , runs check. however, when finished :errors shows errors last buffer checked. currently, if run :syntasticcheck , :errors displays errors current buffer only. want check python ( *.py ) files in current working directory, , locations aggregated in single locationlist. this not possible, , there no plan implement it. i know possible because syntastic documentation implies it, e.g. there syntastic_ignore_files setting ignoring patterns of filenames. some checkers check include files , like

json decode error on some requests but not others with Algolia php library -

Image
i'm seeing following error: my params are array (size=4) 'facets' => string 'instock.1' (length=9) 'facetfilters' => string 'instock.1:1' (length=11) 'numericfilters' => string 'itemid!=511283' (length=14) 'getrankinginfo' => int 1 if remove either getrankinginfo or numericfilters, works requests. according logs in algolia it's returning results, don't far on end requests. one response causes error appear is: request { "params": "facets=instock.1&facetfilters=instock.1%3a1&numericfilters=itemid%21%3d511283&getrankinginfo=1&query=warburton+orange+wrapper+800g" } response { "hits": [ { "itemid": 506241, "name": "warburton blue wrapper 800g", "slug": "506241-warburton-blue-wrapper", "brand": "warburton", "supplier_nam

logstash - Filebeat service hangs on restart -

i have weird problem filebeat i using cloud formation run stack, , part of installing , running filebeat log aggregation, i inject /etc/filebeat/filebeat.yml machine , need restart filebeat . the problem filebeat hangs. , entire provisioning stuck (note if ssh machine , issue " sudo service filebeat restart myself, entire provisioning becomes unstuck , continues). tried restarting both via services section , commands section of cloudformation::init , both hang. i havent tried via userdata thats worst possible solution it. any ideas why? snippets template. both these hang mentioned. "commands" : { "01" : { "command" : "sudo service filebeat restart", "cwd" : "~", "ignoreerrors" : "false" } } "services" : { "sysvinit" : { "filebeat" : { "enabled"

html - How to make Javascript write price based on input? -

here fiddle , can see i'm talking about. basically price checker, , need use javascript in order display values. so can see have div .offer have offer call action. when user loads page, div display “please select country” after pressing “check prices” paragraph displayed price , yellow button under it. so, question is, how do this? how can create script checks both values ,“to” , “from” in order display appropriate price? example, if chooses germany united states, should display $0.02/minute. if choose spain italy, should display $0.05/minute etc. hope idea. thanks in advance :) <div class="offer"> <p>our special offer is:</p> <p id="big-offer">only $0.01/min</p> <button type="submit" class="btn btn-default btn-lg" id="big-cta">strong call action!</button> </div> i built similar while client, it's ugly hell , lot more dry, works. quote generator takes 3

javascript - Angular Schema Form - Array validation -

i trying make array of unique values using schema form seems impossible task. to keep things simple lets consider simple unique validator: $scope.validateunique = function(value) { console.log('running validation'); var samename = $scope.model.noduplicate.filter(function(item) { return item.key === value; }); return samename.length < 2; } open console , visit fiddle . step 1: add new item called 1. step 2: add new item called 12. step 3: add new item called 123. step 4: add new item called 1234. so far good. step 5: change first item (1) 1234 error message appears. step 6: delete last item first 1 unique again. nothing happens. array not validated again once item removed , if click on submit button should trigger valdiation of form nothing happens. is issue mistake? there mistake in example code? or sort of schema-form bug? how achieve revalidation of array either on removing of item or submitting form? thanks! solve