Posts

Showing posts from September, 2012

dataset - How to Plot a Pre-Binned Histogram In R -

i have pre-binned frequency table rather large dataset. is, single column vector of bins , single column vector of counts associated bins. i'd r plot histogram of data doing further binning , summing existing counts. example, if in pre-binned data have [(0.01, 5000), (0.02, 231), (0.03, 948)], first number bin , second count, , choose 0.04 new bin width, i'd expect [(0.04, 6179)]. what's fastest , or easiest way in r? looks ggplot2 has answer. library(ggplot2) qplot(bin, data=cbind(bins,counts), weight=counts, geom="histogram")

java - PHP retrieval from database on single string -

i'm retrieving data sql database these lines of code $username = $_post['username']; $selector = "select * client_table salesmanid ='" . $username . "';"; $result = mysqli_query($con,$selector); while($row = mysqli_fetch_array($result)) { echo $row['id'] . "/" . $row['name'] . "/" . $row['address'] . "/" . $row['zip code'] . "/" . $row['salesmanid']; echo "\\r\\n"; } ?> on java side do while ((bufferedstrchunk = bufferedreader.readline()) != null) { stringbuilder.append(bufferedstrchunk); } string queryresult = stringbuilder.tostring(); and problem when do string[] results=queryresult.split("\n"); the string not split. please help? you not adding line separator stringbuilder when retrieving data bufferedreader like stringbuilder.append(bufferedstrchunk).append(system.lineseparator()) anyway if wan...

android - when I pressed create button application shuts down but at same time data gets stored in sql database 4 times -

/** * creating product * */ protected string doinbackground(string... args) { string name = inputname.gettext().tostring(); string price = inputprice.gettext().tostring(); string description = inputdesc.gettext().tostring(); // building parameters list<namevaluepair> params = new arraylist<namevaluepair>(); params.add(new basicnamevaluepair("name", name)); params.add(new basicnamevaluepair("price", price)); params.add(new basicnamevaluepair("description", description)); // getting json object // note create product url accepts post method jsonobject json = jsonparser.makehttprequest(url_create_product, "post", params); // check log cat response log.d("create response", json.tostring()); // check success tag...

javascript - ImageMap type repeating itself -

i have posted image map type in site image repeats if zoom in , zoom out image. platform using joomla. editor jce editor.this how looks in web http://logic.al/qtu2/index.php/maptest . missing here ??? var moontypeoptions = { gettileurl: function(coord, zoom) { var normalizedcoord = getnormalizedcoord(coord, zoom); if (!normalizedcoord) { return null; } var bound = math.pow(2, zoom); return 'http://i.imgur.com/9igczkv.png' + '/' + zoom + '/' + normalizedcoord.x + '/' + (bound - normalizedcoord.y - 1) + '.png'; }, tilesize: new google.maps.size(1130, 604), maxzoom: 3, minzoom: 0, radius: 1738000, name: 'moon' }; var moonmaptype = new google.maps.imagemaptype(moontypeoptions); function initialize() { var mylatlng = new google.maps.latlng(0, 0); var mapoptions = { center: mylatlng, zoom: 5, streetviewcontrol: false, maptypecontroloptions: { ...

jquery - MVC Ajax refresh interval text highlight changing values -

i have made mvc view partial view witch refreshing every x seconds. that's works fine, but: want highlight values changing. if 1 row changing want highlight row couple of seconds. this: http://domajax.com/documentation/data-highlight-color (successes , errors). my master view: @using moviestore.domain.entities @model ienumerable<igrouping<movie, timetable>> @{ viewbag.title = "actuele bezetting"; } <h2>bezetting voor vandaag</h2> <div id="timetabel"> @{ html.renderpartial("_timetable", model); } </div> <script type="text/javascript"> window.setinterval(function () { $("#timetabel").load('@(url.action("gettimetable","timetable",null, request.url.scheme))'); }, 5000); </script> partial view: @using moviestore.domain.entities @model ienumerable<igrouping<movie, timetable>> <table class="table"...

keytool SHA256 (android keystore) not generating -

i have been using sha1 far. need sha256 tried keystore file made android studio. until now, couldn't result. result this. engineerui:docs/b0006$ keytool -v -list -keystore ./andapprelease.keystore keystore 암호를 입력하십시오: keystore 유형: jks keystore 공급자: sun keystore에는 1 항목이 포함되어 있습니다. 별칭 이름: thealiasname 작성일: keystore.getcreationdate(alias) 항목 유형: privatekeyentry 인증서 체인 길이: 1 인증서[1]: 소유자: o=company inc., l=acity, st=astate, c=us 발급자: o=company inc., l=acity, st=astate, c=us 일련 번호: aserialnum 유효 기간 시작: fri sep 21 15:39:04 kst 2012 끝: sat sep 09 15:39:04 kst 2062 인증 지문: md5: amd5string sha1: asha1string 서명 알고리즘 이름: sha1withrsa 버전: 3 ******************************************* ******************************************* any idea or thought? thank much!

python - How can I filter instances of a model in django, with a queryset value of filter field? -

i creating application in django, , have next question: i want filet objects of modela, field att1, , have queryset of values of field att1. mean, models are: class modela(models.model): att1 = models.foreignkey(modelb) ... class modelb(models.model): ... i got queryset ot objects of modelb, , want objects of modela has value of att1, of values of queryset of modelb. how can it? thank much! nothing magic modela.objects.filter(att1=queryset of modelb)

javascript - document.getElementById not working with dynamic id generation -

<!doctype html><!-- change license header, choose license headers in project properties. change template file, choose tools | templates , open template in editor. --><html><head><title>inventory master - material inwards</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="inwards.css"/> <link rel="stylesheet" href="bootstrap-3.3.2-dist/css/bootstrap.css" type="text/css"> <link rel="stylesheet" href="bootstrap-3.3.2-dist/css/bootstrap.min.css" type="text/css"/> <script src="jquery-2.1.3.min.js"></script> <script src="inwards.js"></script> </head> <body> <div id="operation"> <div class="container-fluid"> <div id...

php - Single page WordPress site with comments box -

i creating site in wordpress consists of 1 single page (index.php). each section of page loops , brings in content post (based on id). 1 section has comment box post content, along posted comments. however, problem have once comment has been posted (send button clicked), loads single.php. idea there no permalinks on site , content of posts displayed, hence keeping user on index page only. kind go code need add posting comment not load single.php, , therefore reload index.php? thanks. edit: give example of code using: on index.php using: <?php $category = array('category_name' => 'my category'); ?> <?php query_posts($category); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class="articlewrap"> <?php the_content(); ?> </div> <?php endwhile; endif; ?> <?php wp_reset_query(); ?> and on section want comments box: <?php $other_category = array(...

video - load movie trailer in android application from imdb -

is somehow possible, can load movie trailers imdb videoview or native android player. so far, i've tried. iframe approach let me load trailer in webview, don't want. here found link direct link stream. i want play in video view or native android control. in advance. the link have above not direct link video - link web page contains embedded player, in turn has link actual trailer video itself. you can see link video if use network timeline tab in browser inspector @ network requests. example above client (the browser running html5 page have downloaded) requesting video m3u8 file following request: http://imdb-video.media-imdb.com/vi1225109529/1421100405014-mxwp62-1434643350557.m3u8 this 'index' file hls format video file - tells client request video streams. client downloads video chunk chunk can see requests ts segments - e.g. example above: http://imdb-video.media-imdb.com/vi1225109529/1421100405014-mxwp62-143464335055700002.ts if imdb s...

Can I declare only specific elements of an array as constant? (C/C++/Fortran) -

scenario: pass e.g. 2d matrix argument in function , able read , change elements, but i prevent accidental writting in let's last column . somehow tell compiler use specific elements in function constant. probably can't done useful in scenarios. an array contiguous block of objects of common type; suggesting not supported. the appropriate solution encapsulate array , access through functions can apply required semantics. in fact if used c++ encapsulate in class [] operator overloaded can apply semantics require while still using array access notation.

SQL Server query syntax with single quote -

i have in database kia car model cee'd . how write right syntax car model = cee'd now using semipart of model select make, model cars model '%cee%' but need full model name. how write right syntax in case? you can escape single quote ( ' ) single quote - 2 in total ( '' ). note not double quote character ( " ), single character, two single quote characters ( ' , ' ): select make,model cars model = 'cee''d'

ubuntu 12.04 - Removing first defined function in bashrc -

i have file containing: ... function myfunction(){ content } ... function myfunction(){ content2 } ... how can automatically remove first occurrence of myfunction every such duplica function?

qml - Jpeg image not displayed in Qt4.8.5 deployed visual sudio -

when using qt creator qt 4.8.5, jpeg image displayed properly. however, same code deployed visual studio 2008 qt 4.8.5 not display jpeg image. issue? may need add qjpegd4.dll or macro setup project dependencies? image { fillmode: image.preserveaspectfit smooth: true source: "../components/images/success.jpg" sourcesize.width: 60 sourcesize.height: 50 }

sql server - How to get Day and Month from Date Sql Query? -

date format : 20-jun-14 need query return : 20-jun current date : 20-jun-2015 so,that should compare current date , return in above case total years : 1 year you can cut of parts of date using datepart . see: select datepart(day,currentdate), datepart(month, currentdate) this way should able compare dates example in where -clause. as questioner need date not integer, use datename function: select datepart(day,currentdate), datename(month, currentdate) due fact datename doesn't support mmm format, use case structure. select datepart(day,currentdate) day, case datepart(month, currentdate) when 1 n'jan' when 2 n'feb' when 3 n'mar' when 4 n'apr' when 5 n'mai' when 6 n'jun' when 7 n'jul' when 8 n'aug' when 9 n'sep' when 10 n'oct' when 11 n'nov' ...

android - How do I make a textview fill the height of a linear layout? -

ok, i've been spending hours trying solve or find solution online , far nothing has worked. how can make textview "content_note" fill available space in linearlayout? <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:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:gravity="center" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity" android:background="#000000" android:id="@+id/screen"> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/size" androi...

Operator precedence in C for the statement z=++x||++y&&++z -

i studying operator precedence , not able understand how value of x became 2 , of y , z 1 x=y=z=1; z=++x||++y&&++z; this evaluates to x=2 y=1 z=1 ++ has higher priority || , whole rhs of assignment boils down increment of x , evaluation truth value (1). z = ++x || ++y&&++z; truthy (1) never executed this because ++x evaluates true , second branch not executed. ++x 2 which, in boolean context, evaluates true or 1 . z takes value of 1 , giving observed final state.

Add items to tab's context menu in Google Chrome -

in google chrome web browser add options such "bookmark selected tab", "close tab left" tab's context menu. is possible? if possible, api must check? no, it's not possible. the closest api exists contextmenus api . however, if @ available "contexts" (objects menu can change), there no "tab" there. so, @ least currently, can't modify tab's context menu.

c++ - How to debug a Fast Common Gateway Interface (FCGI) program? -

i encountered problem don't known how debug fcgi program written in c++ , based on fastcgi . the program managed lighttpd spawn-fcgi , called nginx fastcgi module. i wrote shell script restart spawn-cgi : #! /bin/bash cgi_default="index.cgi" process_pid="pid" param_ip="127.0.0.1" param_port="9000" if [ -f "$process_pid" ]; pid=`cat $process_pid` kill -9 $pid &> /dev/null rm $process_pid fi spawn_out=`/usr/local/bin/spawn-fcgi -a $param_ip -p $param_port $cgi_default` # spawn-fcgi: child spawned successfully: pid: 6423 pid=`echo $spawn_out | cut -d " " -f6` expr $pid + 0 &> /dev/null [ $? -eq "0" ] && echo "$pid" > $process_pid the program index.cgi built , printf strings out stream. and configuration in nginx : location / { fastcgi_pass 127.0.0.1:9000; include fastcgi_params; } now wroking on index.cgi , change code (maybe ...

ios - How to Use Constants in Swift: AVAudioSessionInterruptionNotification -

this working code in swift. issue i'm using uint intermediary type. func handleinterruption(notification: nsnotification) { let interruptiontype = notification.userinfo?[avaudiosessioninterruptiontypekey] as! uint if (interruptiontype == avaudiosessioninterruptiontype.began.rawvalue) { // started } else if (interruptiontype == avaudiosessioninterruptiontype.ended.rawvalue) { // ended let interruptionoption = notification.userinfo?[avaudiosessioninterruptionoptionkey] as! uint if interruptionoption == avaudiosessioninterruptionoptions.optionshouldresume.rawvalue { // resume! } } } is there better way? this approach similar matt's, due changes swift 3 (mainly userinfo being [anyhashable : any] ), can make our code little more "swifty" (no switching on rawvalue or casting anyobject , etc.): func handleinterruption(notification: notification) { guard let useri...

jsf - primefaces rowEdit Event to update table only if the event is a success -

i calling rowedit event , want refresh table when event performs db update successfully. below code. xhtml <p:datatable id="xobjtable" var="xobj" value="#{xlistview.xlistresponseobject}" scrollrows="20" scrollable="true" livescroll="true" scrollheight="600" rowkey="#{xobj.x}" selection="#{xlistview.selectedobject}" selectionmode="single" style="margin-top: 20px; margin-bottom:20px" editable="true"> <f:facet name="header"> search results <p:spacer width="20"/> <h:commandlink id="csv"> <p:graphicimage value="csv.png" width=...

css - Google Fonts not loading sometimes -

i using google fonts on webpage notice 5% of time google font seems timeout , display fallback font. stopped using , tried using @font-face downloaded font files on server have add 100 more lines of css versions , load correct formats (.ttf,.eot etc) right css implementation. of headache. there way can tell webpage keep trying font google until loads? or there solution? <link href='http://fonts.googleapis.com/css?family=indie+flower' rel='stylesheet' type='text/css'> <h1>text</h1> css h1 { font-family: 'indie flower', georgia, sans-serif; } try webfont loader https://github.com/typekit/webfontloader little bit more set works veery nicely , gives bit more control on loading fonts

sql server - Supply default values to all columns, tables, databases in sql-2012 express -

i working on sql 2012 server express edition . i want assign default values columns of tables in user databases. all numeric, int, smallint, tinyint etc 0 default value all date related fields '01-jan-1900' default value all character fields (varchar etc) '' default value all logical fields 0 default value i not want table designer. how command or stored procedure. this default value not set primary key fields , auto increment fields (identity columns). i new sql programming , times have take care null values , working null have no significance other thier default values. done existing tables. you can try solution each database: declare @sql nvarchar(max) = '' select @sql = @sql + 'update [' + s.name + '].[' + o.name + '] set [' + c.name + '] = ' + case when t.name in ('int', 'bigint', 'bit', 'decimal', 'money', 'numer...

getting a file name from a folder into page using php or javascript -

if it's possible, can 1 please me made youtube example. see in plnkr link http://plnkr.co/edit/44eqksjp3gl566wczkl6?p=preview for example "embed" folder , in "embed" folder have files name "p9zdcra9gce" "qrmou4gu3uu" as see them in here <div class="ytid" data-str="p9zdcra9gce">video 1</div> <div class="ytid" data-str="qrmou4gu3uu">video 2</div> if it's possible want like, when ever add file like, "p9zdcra9gce.html" or "qrmou4gu3uu.html" in folder "embed", , automatically on index page next other video buttons become this <div class="ytid" data-str="p9zdcra9gce">video 1</div> <div class="ytid" data-str="qrmou4gu3uu">video 2</div> <div class="ytid" data-str="anotherfile">video 3</div> <div class="ytid" data-str="anotherfil...

python - Compute weekly returns from daily returns using Wed-to-Wed convention in pandas -

i'm python/pandas newbie. have data set looks following: permno date gret gvwretd date 2012-01-03 10001 2012-01-03 1.001751 1.016152 2012-01-04 10001 2012-01-04 0.989510 0.999553 2012-01-05 10001 2012-01-05 1.003525 1.002928 2012-01-06 10001 2012-01-06 0.997368 0.997093 2012-01-09 10001 2012-01-09 0.999117 1.002815 2012-01-10 10001 2012-01-10 1.003534 1.010420 2012-01-11 10002 2012-01-11 0.981074 1.000951 2012-01-12 10002 2012-01-12 0.993243 1.003046 2012-01-13 10002 2012-01-13 1.003175 0.994688 2012-01-17 10002 2012-01-17 1.013562 1.003904 2012-01-18 10002 2012-01-18 1.001784 1.012296 2012-01-19 10002 2012-01-19 0.995013 1.005580 2012-01-20 10002 2012-01-20 0.984428 1.000881 2012-01-23 10002 2012-01-23 1.017273 1.001606 2012-01-24 10002 2012-01-24 0.987489 0.999196 i wednesdays of week, using df.resample('w-wed'), cannot merge them c...

php - Database permissions in MySQL Workbench inconsistent? -

Image
i trying add user, in addition root database. so, did following in mysql workbench: clicked on tab called "management" shown in picture, , clicked on "users , priveleges". then clicked "add account" in lower left hand corner, , entered user name , password, , of course shows in pane on lhs. however, go tab called "schemas", shown in piccutre above, , click on "i" circle around it, shown in picture below. then, click on tab says "grants" , see if i'm there. i'm not. how add username? i refreshed multiple times, isn't issue. the way got problem was: tried access db using python mysql package, common error: _mysql_exceptions.operationalerror: (1044, "access denied user... ...which why went , added user , tried check grants. how change permissions? thanks.

javascript - Best practice for jQuery AJAX Modals -

i have lot of jquery functions. work fine. need modal windows loaded via ajax. content loading fine too. jquery functions won't work inside modal. put javascript stuff in onloadfunction(). call on main page when loads , fire again after opening modal. jquery stuff work in modal too. every click do, jquery fires functions multiple times. $(".something").click(function() { alert("just alert"); }); this alert comes once after clicking 1 time. @ second time comes 2 times , on. ajax posts: in form validation can click 10 times on submit, after filling fields correctly , clik submit 11. time, form submited 11 times! how can write jquery stuff , use of them in every modal , main page?

fortran - Compiling .f file, "undefined reference to 'MAIN_' issue -

i trying compile .f file using g77 . tried compile .cmd batch file (as per 1 of ways described in g77 documentation ) following content (in .cmd file): g77 -o gtemp.exe gtemp.f pause but when run upper .cmd file, following error message: "undefined reference 'main_' why happening? gtemp.f file in same folder g77.exe file. thank you. here code gtemp.f file: subroutine gtemp(dif,tmin,tmax,tav,tg) gtemp 2 dimension amon(12),tg(12) gtemp 3 data amon / 15.,46.,74.,95.,135.,166.,196.,227.,258.,288., gtemp 4 1 319.,349. / gtemp 5 data p,pi,po / 8760.,3.14159265,0.6 / gtemp 6 c gtemp 7 beta = sqrt(pi/(dif*p))*10. ...

c# - How to control flow from one function to another function -

i trying call chk_condition() function find_output() problem control not moving find_output() function chk_condition() function. possible error? private void find_output(string a) { string[] separators = new string[] { "\n" }; foreach (string sent in a.split(separators) { listbox8.items.clear(); string sentence = sent.replace("\r", ""); if (sentence != "") { int s = sentence.count(); string[] separators1 = new string[] { " " }; foreach (string word in sentence.split(separators1)) { listbox8.items.add(word); } int word_count = listbox8.items.count; chk_condition(sentence); if (condition_satisfy == i) textbox6.text = textbox6.text + environment.newline + sentence; } } } private void chk_condition(string a) { } assuming code compiles - beca...

objective c - iOS - Pass Data Multiple Times From Parent View Into Container View's View -

i have uipageviewcontroller , , 1 of view controller s has container view parent view controller passes data container can display dynamic data. have parent view passing data view within container view prepareforsegue method: //in storyboard-based application, want little preparation before navigation - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { nslog(@"called prepare segue"); if ([segue.identifier isequaltostring:@"viewembed"]) { //pass data } } however, prepareforsegue method called once (note nslog debugging statement), need pass different data child view every time uipageviewcontroller swipes parent view. noticed viewdidload method fires once in parent view because uipageviewcontroller retains state of pages. is there way re-instantiate (call viewdidload again) parent view every time swiped uipageviewcontroller ? i'm thinking make prepareforsegue method fire more once, need do. or thinking wrong...

swing - Implementing JOptionPane in Java -

Image
i created popup window show in response button being clicked in gui. have 2 questions regarding this. how rid of text field below radio buttons? i need check radio button selected once ok button clicked didn't create button. how implement actionperformed function that? my code: private void jbutton2actionperformed(java.awt.event.actionevent evt) { if(evt.getsource() == jbutton2) optionpopup(); } private void optionpopup(){ jpanel panel = new jpanel(); jradiobutton undergraduatebutton = new jradiobutton(); jradiobutton graduatebutton = new jradiobutton(); buttongroup group = new buttongroup(); undergraduatebutton.settext("option a"); graduatebutton.settext("option b"); group.add(undergraduatebutton); group.add(graduatebutton); panel.add(undergraduatebutton); panel.add(graduatebutton); joptionpane.showinputdialog(panel); use joptionpane.sh...

tomcat - why is transitive dependency not included my final war? -

somewhat similar question posted here. no answers there. i have multi-module maven project when run mvn dependency:tree , see following [info] ------------------------------------------------------------------------ [info] building service 2.2.22-snapshot [info] ------------------------------------------------------------------------ [info] +- org.apache.httpcomponents:httpclient:jar:4.3.2:compile [info] | \- commons-codec:commons-codec:jar:1.6:compile [info] ------------------------------------------------------------------------ [info] building common 2.2.22-snapshot [info] ------------------------------------------------------------------------ [info] +- com.mycompany.project:jar:2.1.115:compile +- commons-httpclient:commons-httpclient:jar:3.1:compile [info] | | \- commons-codec:commons-codec:jar:1.2:compile no other configuration exclude library done in pom.xml. in final war/web-inf/lib , i see commons-codec-1.6.jar , commons-httpclient-3.1.jar , htt...

ios - Changing the tableview's content inset -

i changing content insets in swift. want change bottom inset. code changing each inset. let edgeinsets = uiedgeinsetsmake(0, 0, 0, 0) self.tableview.contentinset = edgeinsets self.tableview.scrollindicatorinsets = edgeinsets i want change bottom inset , other insets should default insets. how can this? the third parameter in uiedgeinsetsmake function parameter sets bottom inset. in case want let edgeinsets = uiedgeinsetsmake(0, 0, bottomvalue, 0) . however, because using swift, it's more "swifty" use uiedgeinsets(top: 0, left: 0, bottom: valueyouwant, right: 0)

amazon web services - AWS IAM Policy to Allow User Access to A Single Elastic Transcoder Pipeline -

i have user policy allows users access specific s3 bucket assigned. functions perfectly. however, need append instructions policy grant user access elastic transcoder pipeline has been created them. i've tried following instructions here , policy keeps failing. i'm new iam policy syntax, , use hand. see examples below: functional policy in place: { "statement": [ { "effect": "allow", "notaction": [ "s3:createbucket", "s3:deletebucket" ], "resource": "arn:aws:s3:::org-b-bucket", "condition": {} }, { "effect": "allow", "action": "s3:*", "resource": "arn:aws:s3:::org-b-bucket/*", "condition": {} }, { "effect": ...

ember.js - Can I use 'ember generate' to generate tests for existing 'objects'? -

i have ember eak project migrated ember cli, tests coded mocha/chai test runner don't run correctly in migrated project, though i've installed ember-cli-mocha. can use 'ember generate', mocha blueprints, generate new test stubs can go in , more or less re-implement had tests in eak? so want use 'ember generate' generate tests existing routes, controllers & views, rather generating new stub objects , tests together. yes, can indeed this, using ember generate blueprints of controller-test , route-test , etc. ember generate controller-test my-resource this documented @ http://www.ember-cli.com/#appendix . ember-cli feature, not ember feature, covered in documentation former. additional information can obtained ember generate help .

javascript - Comparing the InnerHTML of an object in jQuery -

i able .html() of sharepoint textbox, in dom appears <div> . when textbox empty, innerhtml of <div> appears <p></p> . because particular textbox not appear (i control appearance based on selected value of previous checkbox on form), can't make required, i'm doing dynamically checking if filled in or not on-save. means seeing if innerhtml <p></p> or <p>asdf<span id="ms-rterangecursor-start" rtenodeid="1"></span><span id="ms-rterangecursor-end"></span></p> , asdf text entered (sharepoint puts in gobbly-gook in-between). what thought check this, explainfield representing <div> jquery variable, similar done @ http://makandracards.com/makandra/13445-compare-two-jquery-objects-for-equality : var $divnode = $('div'); var $pnode = $('p'); var $testnode = $divnode.html($pnode); if (explainfield.is($(testnode))) { // got <p></p> ...

javascript - Nested jQuery each statement runs after the first has completed -

i want dynamically create combo box reading json variable. the problem first $.each() statement finishes before second $.each() statement. this makes 2 options fall outside of <select> element. what doing wrong? var ofields = { "fields": [ {"name": "idtipopratica", "label": "id tipo prat.", "type": "hidden", "visible": "true", "disabled": "false"}, {"name": "tipologia", "label": "tipologia", "type": "select", "selectparams": { "source": "list", "values": {"cc":"conto corrente","fi":"conto finanziario"} },"visible": "true", "disabled": "false"} ] }; var html = '<form id="editform" method="pos...

javascript - How to combine these 2 ng-class statements? -

<ul> <li ng-repeat="(k, v) in charttags track k" class="blue-tag"> <div class="tag" ng-class="{blue1: k == 0 , blue2: k == 1 , blue3: k == 2 }" ng-class="{'positive': v.direction == 'positive', 'negative': v.direction == 'negative', '' : v.direction == 'stagnant'}">{{v.term}}</div> </li> </ul> currently first ng-class overrides 2nd ng-class have. how combine both of these, blue class of sort, direction type? chain them did first one. <div class="tag" ng-class="{blue1: k == 0 , blue2: k == 1 , blue3: k == 2, 'positive': v.direction == 'positive', 'negative': v.direction == 'negative', '' : v.direction == 'stagnant'}"> </div...

c++ - Calculating the next higher number which has same number of set bits? -

a solution given question on geeksforgeeks website. i wish know there exist better , simpler solution? bit complicated understand. algorithm fine. i pretty sure algorithm efficient , easier understand linked algorithm. the strategy here understand way make number bigger without increasing number of 1's carry 1, if carry multiple 1's must add them in. given number 1001 1100 right shift until value odd, 0010 0111 . remember number of shifts: shifts = 2; right shift until value even, 0000 0100 . remember number of shifts performed , bits consumed. shifts += 3; bits = 3; so far, have taken 5 shifts , 3 bits algorithm carry lowest digit possible. pay back. make rightmost bit 1. 0000 0101 . owe 2 bits. bits -= 1 shift left 3 times add 0's. 0010 1000 . 3 times because shifts - bits == 3 shifts -= 3 now owe number 2 bits , 2 shifts. shift left twice, setting leftmost bit 1 each time. 1010 0011 . we've paid bits , shifts. bits -= 2; shifts -= ...

Heroku Toolbelt Installation on Centos 6.5 -

i'm trying heroku toolbelt installed on our centos server, , can't seem figure out. have ruby , rubygems installed , functioning, , ran stand-alone download heroku getting started tutorial wget -qo- https://toolbelt.heroku.com/install.sh | sh running 'whereis heroku', get heroku: /usr/local/heroku and 'which heroku' outputs /usr/local/heroku/bin/heroku however, when try , run 'heroku login', get /usr/local/heroku/bin/heroku /usr/local/heroku/lib/heroku/helpers.rb:13:in `home_directory': undefined method `home' dir:class (nomethoderror) /usr/local/heroku/lib/heroku/updater.rb:22:in `updated_client_path' /usr/local/heroku/lib/heroku/updater.rb:170:in `inject_libpath' /usr/local/heroku/bin/heroku:19 i'm unable find same error heroku on google, , i'm not sure error means. thank help! update 6/22/15 adding software versions centos: 6.5 ruby: 1.9.3 gems: 2.4.8 after upgrading ruby 1.9.3, differen...

php - How to show product attribute name in cart page -

Image
one of favorite members helgatheviking , gave me solution of previous question remove quantity field cart page specific product attribute . below function given her. add_filter( 'woocommerce_cart_item_quantity', 'remove_cart_item_quantity', 10, 2 ); function remove_cart_item_quantity( $product_quantity, $cart_item_key ){ $cart_item = wc()->cart->cart_contents[ $cart_item_key ]; if( $cart_item['data']->is_type( 'variation' ) ){ $attributes = $cart_item['data']->get_attributes(); // var_dump( $attributes ); if( array_key_exists( 'color', $attributes ) ){ $product_quantity = ''; } } return $product_quantity; } now $product_quantity; return blank string. is possible show name instead of blank. $product_quantity = ''; should replace ? if selected product has color green $product_quantity; should return green. example: $product_quantity = ...

visual studio 2013 - C# visible doesn't works -

i'm making universal application windows phone 8.1 , have problem code. after textblock value become greater or equal 22, images should become visible. if value less 22 images should invisible. my question: how can visible images after textblock value >="22" this code hide images: private void points_loaded(object sender, routedeventargs e) { int n = 0; bool b = int.tryparse(points.text, out n); datacontext = this; imagevis = (b && n >= 22) ? visibility.visible : isibility.collapsed; } private visibility imagevis; public visibility imagevis { { return imagevis; } set { imagevis = value; raisepropertychanged("imagevis"); } } public event propertychangedeventhandler propertychanged = delegate { }; protected void raisepropertychanged(string propertyname) { propertychanged(this, new propertychangedeventargs(propertyname)); } this code part xaml: <image x:name="hole17img" horizontalalignmen...

How to load same plugins from 2 different assemblies, and serializing and deserializing types between the two? C# .net -

so have 2 .net assemblies, 1 wpf other windows service. talk using wcf protobuf.net serializing types. everything working smooth made primitive plugin system loads plugins, both assemblies in project load same plugins intention of sending classes within them on wire. so... 1. wpf app loads, loads plugins (.net dlls) assembly.loadfrom 2. wcf app loads plugins (same .net dlls) assembly.loadfrom 3. both assemblies share dll (object library) explicitly referenced in source code. all types in object library can serialize on 1 end, go on wire , deserialize no problem. types in plugins can serialized on either end, other end throws type not resolved exception when attempting deserialize, though same type. found out problem, shotgun willingness help, have been lot of code show. basically protobuf couldn't load type because didn't exist in load context of application domain. read stuff on msdn had handle appdomain.currentdomain.assemblyresolve event , return corre...

regex - I want specific word to be stored in a CSV file -

i need specific word in file name should pulled out file names among directory !/usr/bin/perl -w $directory = "/home/grds/datafiles"; opendir(dir, $directory) or die "couldn't open $directory: $!\n"; @files = grep("exp", readdir(dir)); closedir(dir); foreach $file (@files) { # print "$file\n"; open ($file } example file name : expresult_3d0r0000002345_test345_cache1_ind0000asd123_2014_04_12_18_56_1 i need 3d0r0000002345, test345, cache1, ind0000asd123, 2014_04_12 should stored in excel file separate columns. this straightforward if want csv output this program checks each directory item file (not directory) , name contains exp , , splits on underscores _ maximum of 6 fields. leaves trailing date-time intact single field then first field removed, time stripped last field, , remaining fields printed, joined commas , i have used autodie removes need check success of opendir use strict; use warnin...