Posts

Showing posts from June, 2013

php - How can I update this statement to be preg_replace -

as title states can indicate how can correctly update line of code is: $payment_number = ereg_replace(" |-", "", @$_session['ccdata']['order_payment_number']); to preg_replace correctly. there no need regular expressions! can solve using simple str_replace : $payment_number = str_replace(array(" ", "-"), "", @$_session['ccdata']['order_payment_number']); in case want use regular expressions anyway, have add delimiters make preg compatible: $payment_number = preg_replace("/ |-/", "", @$_session['ccdata']['order_payment_number']);

sql server - Microsoft SQL Calculating Backlog -

i calculate backlog every week in past month. date format in (mm/dd/yy) | mutation | issued_date | queryno_i | status | ----------------------------------------------- 01/05/14 12/31/13 321 open 01/02/14 08/01/13 323 closed 01/01/14 06/06/13 123 open 01/01/14 01/01/14 1240 closed 01/02/14 01/01/14 1233 open 01/03/14 01/03/14 200 closed 01/05/14 01/04/14 300 open 01/06/14 01/05/14 231 open 01/07/14 01/06/14 232 closed 01/09/14 01/10/14 332 open 01/11/14 01/11/14 224 closed 01/15/14 01/14/14 225 closed 01/16/14 01/15/14 223 open i want result set this: weeknum | opened | closed | total open -------------------------------------- 1 4 3 4 <= (2-4)+ data in week 2 (2-4)+(1-2)+7 2 4 2 6 <= (1-

validation - Show previous valid value of h:selectOneListbox when invalid selection is made -

i have problem validation of selectonelistbox. works fine , message displayed, when input false. dropdown keeps selected value dropdown value. want display old value if validation fails. how can that? i tried this: <h:selectonelistbox id="intfrom" value="#{searchbean.intfrom}" size="1" immediate="true" class="intselectbox1"> <f:ajax render=":menuform :searchform:searchbutton" listener="#{menubean.focus(menubean.mysearch)}" /> <f:ajax listener="#{searchbean.count()}" render="int1" /> <f:ajax execute="intfrom" render="intfrom" /> <f:selectitems value="#{searchbean.intrangefrom}" /> <f:validator validatorid="project.intfromvalidator" /> </h:selectonelistbox> <h:message id="int1" for="

Is there a way using javascript/jquery to fire an event on an elements deletion? -

so example, have jsp page consists of singular div button inside div, jquery creating event handler buttons click. jsp page inserted jsp page inside of separate div using ajax. see code below example: <div id="parent"> <div id="child"> <input id="rand" type="button" value="random" /> <script type="text/javascript"> jquery("#rand").on("click",function(){ console.log("i clicked on random!"); }); </script> </div> <input id="changebtn" type="button" value="change" /> <script type="text/javascript"> jquery("#changebtn").on("click",function(){ jquery("#child").html("hello world!!"); }); </script> </div> what whenever elements/html/text within &quo

java - DRY: a case with AsyncTasks -

i'm developing android app has lot of different requests web services. every request done in subclass of asynctask in manner: (new asynctask<string, void, object1>() { @override protected object1 doinbackground(string... params) { // network request , parsing object1 object1 obj = new object1(); obj1 = parser.parseobject1(httpclient.execute(...)); return obj1; } @override protected object1 onpostexecute(object1... ret) { return ret[0]; } }).execute(); object1 placeholder different objects ( car , bicycle , truck ...), each 1 in different asynctask . what alternatives other returning output of httpclient in string , parsing in main thread (ui thread)? avoid parsing in ui thread sounds reasonable if it's going parse lot of data, right? -= update =- let me rephrase question: i'm asking more intelligent way develop application avoiding being repetitive ( asynctask has lot of boilerplate cod

javascript - Highchart doesnt load when button is clicked -

my second highchart doesnt seem load. cant figure out did wrong. http://jsfiddle.net/2k9k9/ $(document).ready(function() { $("#b").click(function () { $.get('dataset/verkeer.csv', function (data) { var series = preprocessdata(data); var = chart.series.length; while (i--) { chart.series[0].remove(false); //remove prevbious series } console.log('hoi'); = series.length; while(i--){ chart.addseries(series[i], true); } }); }); }); i used following example: http://jsfiddle.net/vdac6/

c++ - with links to lib in vs 2013 with opencv -

i have asked question issue day ago , answered solution. lnk errors fixed except 1 can not figure out. here lnk error: error 1 error lnk2019: unresolved external symbol "class cv::ptr<class cv::facerecognizer> __cdecl cv::createlbphfacerecognizer(int,int,int,int,double)" (?createlbphfacerecognizer@cv@@ya?av?$ptr@vfacerecognizer@cv@@@1@hhhhn@z) referenced in function __catch$?getface@@yaxxz$0 c:\users\parker\documents\visual studio 2013\projects\pad_visualengine\pad_visualengine\source.obj pad_visualengine i have added include directory , additional library directory in project properties. have added build directory in path , separated debug libraries release libraries. here lines of codes added fix previous link problems: #pragma comment (lib, "opencv_core248d.lib") #pragma comment (lib, "opencv_highgui248d.lib") #pragma comment (lib, "opencv_imgproc248d.lib") #pragma comment (lib, "opencv_video248d.

Creating a for-loop where i identifies data by column in R -

i trying use for-loop create series of summaries of gam models of variation in capture rate of invertebrate species using smoothed term day of year (doy), , linear predictor incorporating weather (there many of these). have made function run , output model summary: gamlin <- function(x) { m <- gam(log10e ~ s(doy) + x, data=eggseasongam) return(summary(m)) } i think want utilize above in for-loop sequentially take x weather predictors in columns 4 through 173, struggling this. suggestions appreciated. thanks, mike 2 approaches off top of head be: t<-data.frame(c1=rnorm(10),c2=rnorm(10), c3=rnorm(10)) 1- use formula , allows provide character string formula > f<-function(d,x) lm(formula(paste("c1",x,sep="~")), data=d) > f(t,"c2") call: lm(formula = formula(paste("c1", x, sep = "~")), data = d) coefficients: (intercept) c2 -0.1567 -0.4654 2- alternatively feed in column

java - Get exponent of a BigDecimal -

i want exponent of bigdecimal. `1m` (`1e0m`) -> `0` `10m` (`1e1m`) -> `1` `11m` (`1.1e1m`) -> `1` `1e2m` -> `2` `1.0e2m` -> `2` `100m` (`1.00e2m`) -> `2` scale , @ least itself, not need. rather not have use .toplainstring , hack around that. i'm little surprised exponent want isn't part of internal representation of bigdecimal. i'm using bigdecimal clojure, logic works java welcome too. (defn exp<-bigdec "returns exponent, b, bigdecimal in form * 10 ^ b." [x] (- (.precision x) (.scale x) 1))

javascript - Function to append an array of classes, then split those classes in jQuery? -

i have table generated: <table> <tr> <td><input /></td> <td><span>30</span></td> <td><input /><td> </tr> </table> this basic structure. there many <tr> elements virtually same. each tr, need append class a1, b1, c1 on elements. after function should like: <table> <tr> <td><input class="a1" /></td> <td><span class="a2">30</span></td> <td><input class="a3" /><td> </tr> <tr> <td><input class="b1" /></td> <td><span class="b2">30</span></td> <td><input class="b3" /><td> </tr> </table> and on until last group this, each 1 letter increase on last group. after i'm going need calculations have split these classes. like: $(&qu

html - auto change font size when hitting width limit in css -

is @ possible make font change size automaticly when wider <div> ? i have tried few methods cant seem find on-line regarding this i have box on site width of 250px , , again there title longer on flows div after or before it and clues on great

android - DB communication suggestion for web/mobile apps -

i have lot of nice ideas develop web , mobile applications, of them need online db communication. however, don't know nothing how configure fresh db server scratch , start queries , requesting it. db basis acquired during graduation. what don't know use. if need dbms or build own server scratch (which avoid save time). so, don't want develop db server (back-end, such php, java, etc...). need ready-to-use back-end send queries , request it. any suggestion, or tutorial how configure it? deploying on aws... many thanks, in advance!!! i've developed card game apps use databases leaderboards , multiplayer data. found using http access php scripts in turn access mysql databases , json encode result works , reliable. need write bit of php , set databases other it's quite straightforward. if keep http access in seperate thread in app can visual , input processing whilst waiting result.

javascript - Storing data in node.js -

i got assessment project company involves html,css , javascript. sent me zip file , i'm supposed implement app (which address book) using node.js sent. the problem don't know node.js. i've been reading bunch of stuff online still couldn't figure out how store data. instructions said data managed server , can interacted using api: api: get - api/contacts/ params: none returns list of contacts - api/contacts/:id params: { id: int } returns contact given id or null if contact not exist post - api/contacts/ data: { firstname: string, lastname: string, email: string } returns saved contact put - api/contacts/ data: { id: int, contact: { firstname: string, lastname: string, email: string } } return updated contact delete - api/contacts/:id params: { id: int } returns true or false depending on if contact deleted i don't know how approach problem. front-end internship position. thought using

javascript - Using setTimeout to print a string char by char -

i'm trying simple, it's not working , can't figure out why not. trying write text div such text appears 1 character @ time; sort of scene in matrix. var message = document.getelementbyid("message"); function writemessage(string) { message.innerhtml = string.charat(0); (var = 1; < string.length; i++) { window.settimeout(function() {message.innerhtml+=string.charat(i);},1000); } } writemessage("hello world"); to see code's inaction in action, see jsfiddle . can tell, displays first character, if settimeout not executing function @ all. the function pass settimeout executed after loop completes i variable equal string.length when executes. try solve storing i temporary variable, or using iife . however, function instances you've registered settimeout end executing @ approximately same time, won't see animation. perhaps try using setinterval , this: function writemessage(string) { var = 0,

java - Locating data in a complex table in Selenium Webdriver -

i trying drill down on user in table full of users using selenium webdriver, have worked out how iterate through table i'm having trouble selecting person want. here html (modified x's due not being data) <table id="xxxxxxxxx_list" cellspacing="0" cellpadding="0" style=" border:0px black solid;width:100%;"> <tbody> <tr cellspacing="0" style="height: 16px;"> <tr> <tr onclick="widgetlistview_onclick('xxxx_list',1,this,event)"> <tr onclick="widgetlistview_onclick('xxxx_list',2,this,event)"> <tr onclick="widgetlistview_onclick('xxxx_list',3,this,event)"> <tr onclick="widgetlistview_onclick('xxxx_list',4,this,event)"> <tr onclick="widgetlistview_onclick('xxxx_list',5,this,event)"> <tr onclick="widgetlistview_onclick('xxxx_list',6,this,event)"> <tr

R bnlearn Grow-Shrink structure learning returns undirected graph -

the nagarajan et al. book ( bayesian networks in r , o'reilly 2013, p. 35) says when take marks dataset of r bnlearn package , ask learn structure using grow-shrink implementation writing library(bnlearn) data(marks) bn.gs = gs(marks) then should obtain directed graph: model: [stat][anl|stat][alg|anl:stat][vect|alg] [mech|vect:alg] nodes: 5 arcs: 6 undirected arcs: 0 directed arcs: 6 instead of undirected graph: model: [undirected graph] nodes: 5 arcs: 6 undirected arcs: 6 directed arcs: 0 even when add option undirected=false gs method, still same result. doing wrong? or there bug in r implementation? have tried both on mac , on debian machine, result same... the answer provided authors on web site (which discovered): http://www.bnlearn.com/book-user/ “page 35: bnlearn 3.2 , later versions more picky setting arc directions; result bn.gs undirected graph , must extended dag cextend() conclude example.” in other words, replace last line of code by

html - Bootstrap - 3 columns - what width do I create the images? -

i'm using bootstrap (12 cols) , 3 columns each image. have no idea image widths should be. have tried this: 70(col width) * 3colums + 60(30px gutter) = 270px. however if page not full width on large monitor, columns wrap. what width should create each image? <div class="container"> <div class="row"> <div class="col-md-4"> <img src="images/our-work.png" class="img-responsive" /> </div> <div class="col-md-4"> <img src="images/galleries.png" class="img-responsive"/> </div> <div class="col-md-4"> <img src="images/news.png" class="img-responsive" /> </div> </div> </div> if using col-md-4 columns means viewport below 992 pixels going change full 12 column width. means max-width need make images based on container size of next smaller col

css - Extremely weird behaviour with disabled elements in IE (localhost vs web server) -

Image
i have disabled elements on page. when run app in vs2012, disabled elements looking want in ie (8-10) (not chrome i'll @ later): notice burgundy text. now, deploy web server. css present , text gray: here's css: input[disabled] { border: 1px solid #999; color:#933 !important; background-color:#c1c1c1; } here's how i'm setting input disabled $('#btnremovepacks').prop('disabled', true); why css work when i'm running in localhost , not when deploy web server?

Adding class to existing html id using purely javascript -

so have div id no class so... <div id="leftgrapharea" style="float:left; width:100%;height:90%;border:0px solid blue;"> left graphing area </div> what add classes id using javascript. know can add classes div id in html typing in can't because have code creates graphs , there no real limit how many graphs can made. basically, codes in javascript result in same html code below. <div class="graph" draggable="true"><header>a</header></div> <div class="graph" draggable="true"><header>b</header></div> <div class="graph" draggable="true"><header>c</header></div> i'd appreciate if me this. in advance. you can use classlist document.getelementbyid('leftgrapharea').classlist.add('graph'); or classname document.getelementbyid('leftgrapharea').classname += &

theory - What computer science theorem is this? -

i've got study note ten years ago i've written: all power of programming available in language supports 3 things: step step execution (statements) altering flow of execution based on conditions (branch selection) performing execution repeatedly in loop. i have 3 questions: 1) first postulated this? 2) first proved it? (i remember proof relatively recent.) 3) popular book or text source this? googling hasn't given me answers. :-( you thinking of structured program theorem , demonstrates language features can compute computable function . as wikipedia states, stated in form corrado böhm , giuseppe jacopini in 1966, can traced further regular languages.

symfony - Many conditions if true in twig -

i have many attributes boolean type , if true show yes else show no . shall condition "if" each attribute or there other short method ? you can use ternary operator achieve shorter if -syntax in twig. example : # i'm creating example array here {% set user = { 'active' : true } %} # now, instead of ... user {% if user.active %}active{% else %}inactive{% endif %}. # ... can write: user {{ user.active ? 'active' : 'inactive' }}. output : user active .

objective c - iOS 7 UIBarButtonItem font changes when tapped -

i'm attempting change uibarbuttonitem font. looks when viewcontrollers load. if tap on bar button, or swipe right if move previous viewcontroller (but pull current one), font changes system font. here's i'm setting in appdelegate: nsdictionary* barbuttonitemattributes = @{nsfontattributename: [uifont fontwithname:@"sourcesanspro-light" size:20.0f]}; [[uibarbuttonitem appearance] settitletextattributes: barbuttonitemattributes forstate:uicontrolstatenormal]; [[uibarbuttonitem appearance] settitletextattributes: barbuttonitemattributes forstate:uicontrolstatehighlighted]; [[uibarbuttonitem appearance] settitletextattributes: barbuttonitemattributes forstate:uicontrolstateselected]; [[uibarbuttonitem appearance] settitletextattributes: barbuttonitemattributes forstate:uicontrolstatedisabled]; and here's example of viewwillappear: - (void) viewwillappear:(bool)animated { self.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle

ruby on rails - Affecting resulting params set from form_for -

relative newbie here ruby on rails. using standard form_for method in view someobjcontroller#new action = form_for @someobj |f| . . . %p.submits = f.submit "submit", :class => "submit" a submission param[] array produced contains hash of @someobj fields set in form, such param[someobj] => { "field1" => "val1", "field2" => "val2", ... } i prefer put different value, result of someobj.to_s param[someobj] someobjcontroller#create work with, such that param[someobj] => "strvalfromtos" i doubt it's relative, in case, model underlying #new action not persistent in database (i.e., someobj not derived activerecord::base , though portions of activemodel included.) i haven't had luck trying adjust until after #create invoked, submission #new #create want amend. it's not clear me if should focusing more on form_for statement or doing special in controller

javascript - How do I upload a Document file(no video or picture) from iOS to my website? -

i want upload document files in iphone home page. (pdf, txt...) referring web site ( http://codepen.io/matt-west/pen/kjehg ), can upload photo(and video). if know how upload in way, please tell me. (it couldn't have web language.) first, irrelevant question, second, ios problem, no problem code on website. might wanna in app store ftp apps, ftp on go , sync web-server host website.

java - How can I tell SuperCSV NOT to map empty string to null -

i using icsvlistreader , icsvlistwriter read , write csv file. i found empty string in csv file converted null , output. how can avoid happen. i've tried create new cellprocessor: private cellprocessor[] getprocessors(int columnnumber){ cellprocessor[] processors = new cellprocessor[columnnumber]; (int i=0; i< columnnumber; i++){ processors[i] = new convertnullto(""); } return processors; } but still not working. is there way change setting? empty columns don't require escaping in csv (so default super csv won't apply quotes around empty strings), if want quotes applied can change quotemode in super csv. here's recent example on demonstrates this. update: if want quote empty strings, make sure values you're writing empty string (i.e. may need use convertnullto("") ), use following quote mode: public class quoteemptystring implements quotemode { /** * {@in

Drawing lines in GUI with arrow keys using keylistener in Java -

i working on keylistener exercise java class, have been stuck past week. appreciate helpful suggestions. exercise is: "write program draws line segments using arrow keys. line starts center of frame , draws toward east, north, west, or south when right-arrow key, up-arrow key, left-arrow key, or down-arrow key clicked." through debugging figured out keylistener works point of getting drawcomponent(graphics g), draws when press down or right , works first couple times. here code: import java.awt.*; import java.awt.event.*; import javax.swing.*; @suppresswarnings("serial") public class eventprogrammingexercise8 extends jframe { jpanel contentpane; linepanel lines; public static final int size_of_frame = 500; public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { eventprogrammingexercise8 frame = new eventprogrammingexercise8(

xml - Is SAML metadata required to comply with SAML2.0 spec? -

i wondering if saml solution (identity provider or service provider) needs support saml metadata exchange (i.e. saml-metadata specification) in order defined compliant saml 2.0. looking @ saml conformance document, not quite clear whether must, should or may per rfc 2119. any idea should for? ref: http://docs.oasis-open.org/security/saml/v2.0/saml-conformance-2.0-os.pdf http://docs.oasis-open.org/security/saml/v2.0/saml-metadata-2.0-os.pdf unfortunately, there's no such thing saml 2 compliant it's hard 1 prove - although conformance spec metadata part of standard. there interoperable saml 2.0 profile though. see @ http://saml2int.org/ it's minimum set of profiles/bindings i've used (as part of sized saml service , software providing company) in past purpose. defines metadata requirements here: http://saml2int.org/profile/current#section5

How do you use global Coffeescript variables on client startup in Meteor? -

in lib.coffee have @x = 1 . in client.coffee have meteor.subscribe('data', x) . when page loads, error in console: uncaught referenceerror: x not defined however, after page has finished loading, , type x in console, recognized global variable value 1. it has order in source files evaluated. details, have careful read of this section of docs. can play number of games file names , locations in order change load order: change file names appear in alphabetical order put files need loaded first in subdirectory put files need loaded first in lib directory in particular case, however, can delay activation of subscription, doing like: meteor.startup -> meteor.subscribe 'data', x or tracker.autorun -> if meteor.userid() meteor.subscribe 'data', x tricks these can used execute code after of source files has been evaluated.

security - Is it safe to use relative links in website? -

in building website, referencing files (assets, js, css) parent folder via relative links. safe practice? or opening site security issues/risks such directory traversal attack? absolute links safer or cause many more http requests? what's best practice? there no security risk. directory traversal happens when buggy web server implementation or buggy script incorrectly allows path characters entered in url , server directory structure traversed. example, " .. " or " / " characters (or encoded versions). an example if had url https//www.example.com/readfile.php?file=readme.txt , malicious user change https//www.example.com/readfile.php?file=/etc/passwd if worked vulnerable. a link in html page same user directly entering url in address bar in case, no risk introduced. relative links more secure in there less risk bugs introduced url parsing code generate absolute links. latest versions of popular web servers secure against attack, , if haven

ubuntu - Upgrade pyramid, SQLAlchemy, zope and rebuild Python project -

i have inherited python rest api runs on ubuntu. my main goal update these python components latest releases, e.g. zope @ 2.0. it uses python 2.7, pyramid 1.4.1, zope 0.6, transaction 1.3, sqlalchemy 0.7.9, weberror 0.10.3, , uses nginx web server. oh, , uses cx_oracle connect oracle instance. the project (and other items) in folder called rest_api, can see setup.py, , other custom setups, setup_prod.py, etc. i went /usr/local/lib/python-2.7/sites-packages , tried running "pip install --upgrade [package_name]" , command completes each package. is need do, or have rebuild project setup*.py? i found notes showed 2 commands want - rebuild_cmd = "cd %s/python/rest_api/; /usr/bin/env python setup_prod.py build" % current_dir install_cmd = "cd %s/python/rest_api/; sudo /usr/bin/env python setup_prod.py install" % current_dir ...but when try running "python setup_prod.py build" directory, or without sudo, traceback error. to summar

Android cursoradapter filter listview -

i'm trying filter listview cursoradapter. i've tried far: customadapter adapter; cursor cursor; etsearch.addtextchangedlistener(new textwatcher (){ public void aftertextchanged(editable arg0) { // todo auto-generated method stub } public void beforetextchanged(charsequence arg0, int arg1, int arg2, int arg3) { // todo auto-generated method stub } public void ontextchanged(charsequence cs, int arg1, int arg2, int arg3) { // todo auto-generated method stub adapter.getfilter().filter(cs.tostring()); } }); cursor = dbhelper.getalliteminventorylistings(); adapter = new customadapter(this, cursor); lv.setadapter(adapter); lv.settextfilterenabled(true); adapter.setfilterqueryprovider(new filterqueryprovider() { @override public cursor runquery(charsequence constraint) { string stritemcode =

ios - LocalNotification Event When App is Suspended in Background -

i have ios app uses local notification. user can leave app , check his/her email or other stuff. after while 20 minutes local notification fires , alert user message. @ time when local notification triggered can somehow handle event. didreceivelocalnotification triggered when user clicks on notification. note: not want fire event when user clicks on notification. want fire event when local notification triggered. thanks, you can not track event let know local notification fired or fire.

AngularJS Dynamic Form Validation Based from Select box -

i have straightforward directive ensure basic sanity checks on whether form field contains valid phone number or valid email depending on select box option chosen (email or text). issue arises after valid email or phone number entered corresponding selection made, , other choice selected, field being validated remains valid though should not valid entry longer. i stuck @ how have field revalidate through directive when select option changed. my directive follows: directive("rpattern", function() { return { restrict: "a", require: "ngmodel", scope: { service: '=' }, link: function(scope, el, attrs, ctrl) { var validator, patternvalidator, pattern; scope.$watch(function() { if (scope.service == 'text') { pattern = new regexp(/^\(?(\d{3})\)?[ .-]?(\d{

database.yml in Rails reconnect set to true or false -

in database.yml , default settings reconnect on rails 3 , 4 false . common setting, , in circumstances should set true ? thanks. you can set true. option introduced in rails 2.3 mysql supports reconnect flag in connections - if set true, client try reconnecting server before giving in case of lost connection. can set reconnect = true mysql connections in database.yml behavior rails application. rails team set option default 'false' because, don't want change behavior of existing applications. but side effects there if set reconnect = true . not transaction-safe.the mysql documentation in fact explicitly states auto-reconnect feature affects transactions. any active transactions rolled , autocommit mode reset. applications not written deal break. documentation lists number of other side effects caused auto-reconnect feature, of cause applications not written anticipate behavior function incorrectly or fail. check: rails 2.3 release notes mysq

android - How to disable swipe of only the right navigation drawer? -

i have 2 navigation drawers on either side in activity. don't need right navigation drawer opened swipe gesture. if use: mdrawerlayout.setdrawerlockmode(drawerlayout.lock_mode_locked_closed) to lock swipe both left , right drawers locked. want left drawer detect swipe gesture. how do this? <android.support.v4.widget.drawerlayout android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <framelayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" /> <listview android:id="@+id/left_drawer" android:layout_width="@dimen/nav_drawer_width" android:layout_height="match_parent" android:layout_gravity="left" /> <listview android:id="@+id/right_drawer"

r - googleVis Treemap drilling up -

are treemaps formed in googlevis package intended allow "drill-up" functionality? in example in ?gvistreemap , treemap forms , allows drill-down functionality in browser. however, mouseover top not appear respond mouse-clicks. can enable drill-up functionality? (i using recent versions of firefox , chrome.) ## please note default googlevis plot command ## open browser window , requires internet ## connection display visualisation. tree <- gvistreemap(regions, idvar="region", parentvar="parent", sizevar="val", colorvar="fac") plot(tree) tree2 <- gvistreemap(regions, "region", "parent", "val", "fac", options=list(width=600, height=500, fontsize=16, mincolor='#edf8fb', midcolor='#66c2a4', maxcolo

Running node.js from Maven? -

i'd run node.js application maven ( https://github.com/mdevils/node-jscs in particular), , if errors found print them console , break build. are there well-maintained maven plugins integrate node.js in way?

android - "R cannot be resolved to a variable" error goes away after building project -

i getting "r cannot resolved variable" error of sudden. read thread on issue , says update android build tools make error go away did not fix it. reason error goes away when build project. what going on here? i found happening me broken layout. no need worry. trying best giving solution: solution: make sure r. links not broken. fix errors in xml files. if in adks broken, r not regenerate. if somehow hit , created import android.r in activity, remove it. run project -> clean. delete , regenerate r , buildconfig. make sure project -> build automatically ticked. if not, build manually via menu -> project -> build project . wait few seconds errors disappear. if doesn't work: delete inside /gen/ folder if still doesn't work: try right-clicking project -> android tools -> fix project properties. check *.properties files (in root folder of app folder) , make sure links in there not broken. right-click project

PHP/PDO: How to get the current connection status -

what pdo equivalent of: mysqli_stat($dbconn); p.s. use (get message to) make sure connected i cannot credit answer. posted answer, he/she latter deleted entry. here's (saved archived) answer question: $status = $conn->getattribute(pdo::attr_connection_status);

c# - Check that a given date does lie between two existing dates inside a datatable -

i have 1 table can store employee leave start date , end date so: employeeid managerid leavestartdate leaveenddate isapproved 1 14 10/02/2014 15/02/2014 approved 4 17 10/02/2014 12/02/2014 rejected i need check when manager login employee on leave? if yes manager can assign employees work other employee.for have check wheather current system time lies between leavestartdate , leaveenddate.how can ? if wanna filter isapprved try this. select * tblemployeeleaves date(getdate()) between leavestartdate , leaveenddate , isapproved='approved'

php - Fatal error: Class ‘Thebod_Shippingrates_Helper_Data’ not found -

when install extension or module magento connect, not works correctly in live server. 1 of them, fatal error: class ‘thebod_shippingrates_helper_data’ not found in /home1/hameem/public_html/datafunnel.us/jadroo1/app/mage.php on line 547 after installing in localhost/localserver works correctly. localhost magento ver. 1.8.0.0 when install in live server, did not works correctly. live server ver: magento ver. 1.7.0.2 this module compatible with: 1.4.2, 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7 please check module link: http://www.magentocommerce.com/magento-connect/thebod-shippingrates.html please do? regards, first try run compilation process if enable solve problem or try flush cache solve problem

activerecord - Rails: Single Record, Many Polymorphic -

i'm sure there better title this, sorry that. i've got verification model. ideally, there various other model types able associate single verification record. instance. verification(id: 1, verifiable_type: 'reference') reference(id: 1, verification_id: 1) reference(id: 2, verification_id: 1) verification(id: 2, verifiable_type: 'degree') degree(id: 1, verification_id: 2) degree(id: 2, verification_id: 2) i hoping simple dynamic :class_name option on the has_many : class verification < activerecord::base has_many :verifiables, class_name: -> { dynamic_class_name } end i 99% sure reverse associations work out of box. so, using records above, following should no problem: class reference < activerecord::base belongs_to :verification end class degree < activerecord::base belongs_to :verification end any suggestions? instead of has_many :verifiables, class_name: -> { dynamic_class_name } replace w

android - Can I force Universal Image Loader to cache only internally? -

having cache saved externally(sdcard) cause not deleted during uninstall. don't want happen, can edit uil library such saves cache internally(inside app). i'm using limitedagedisccache anyway deleted in given time. if yes, should alter getowncachedirectory method storageutils.class ? you can use imageloaderconfiguration.builder(context)'s method, diskcache(), set diskcache universal image loader. , customized disk cache prefer internal cache. and can create internal storage public method universal-image-loader, storageutils. for example, // false indicator don't prefer external storage. file cachedir = storageutils.getcachedirectory(context, false); // avoid exception, still prepare default 1 universal image loader file reservecachedir = storageutils.getcachedirectory(context); long cachemaxsize = 15 * 1024 * 1024; // 15 mb diskcache diskcache; try { diskcache = new lrudisccache(cachedir, reservecachedir, defaultconfigurationfactory.create

jQuery : render only URL and <a> tag -

i have asked question didn't correct answer asking again.if have text below in textarea: this normal text www.google.com <a href='xyz.com'>this link</a> <h3>don't render h3 tag</h3> <small>don't render small tag</small> tag.<strong> don't render strong tag</strong> ..and when submit textarea , put above string inside div should render as: this normal text www.google.com this link <h3>don't render h3 tag</h3> <small>don't render small tag</small> tag. <strong> don't render strong tag</strong> i.e. just want render <a> tag , url (i.e. if write www.google.com or http://www.google.com should show link google.com), any other html tag should is . how can that? the problem if d0n't user can play html tag while posting text in website simply use .replacewith() : demo: http://jsfiddle.net/dirtyd77/pwhn3/ $(function(){ $('a

Creating a simple text editor in C++ -

i'm in cs162 class , assignment week create very, simple text editor prompts user input paragraph, type # when finished, , program make simple edits such capitalizing beginning-of-the-sentence words , changing common errors such "teh" "the." now, have trouble getting started these things; know how i'm going correct errors (have program search misspellings , replace words correct spelling/using .upper change upper case), can't started on having user input paragraph , end #. use loop allows user continue typing until type #? like? sorry if seems excessively basic; have trouble getting started programs, since beginner. thank you. use conio.h you can use functions like: getch() - reads character console without buffer or echo kbhit() determines if keyboard key pressed. to you're looking for. edit: user falcom momot, linux systems: #include <unistd.h> #include <termios.h> char getch() { char buf = 0; struct

python - Pass slug field to url -

i'm trying create detailed view of model: product. but, i'm not getting how pass slug-field url. this detailed view: def single_product(request): product = get_object_or_404(prods, slug=slug) return render_to_response('teste.html', locals(), context_instance=requestcontext(request)) this model: class product(models.model): name = models.charfield(max_length=500) #inserir slugify na url produto slug = models.slugfield(max_length=500) category = models.foreignkey(category) image = models.imagefield(upload_to='thumbs/') created = models.datetimefield(auto_now=true, auto_now_add=false) updated = models.datetimefield(auto_now=true, auto_now_add=true) and value of slug product 1:'kinect-xbox-360' when try run: [localhost]/kinect-xbox-360/ message: typeerror @ /kinect-xbox-360/ 'str' object not callable you need add slug appropriate url in urls.py . passed parameter in view: urls.py ...

android - qml How to use loader within tabview -

i can not find way use loader fill tab within tabview. loader works fine when outside of tabview (ie if remove multi line comment characters @ top of maintrial.qml , loader plus connections @ top. if move loader in line child of tab, error "cannot assign multiple values singular property. neither can address loader outside of tabview using menuloader.source or column1.menuloader.source or other variants. here main file. (the other 2 files define signals included can see signals work). doing wrong? edit: (good ole law of permutations , combinations) discovered if make connections declaration, child of loader on tab, problem goes away. have 1 "value" assigned on tab - being loader , can load qml item per tab. //maintrial import qtquick 2.2 import qtquick.controls 1.1 import qtquick.layouts 1.1 item { id: trial width: 360 height: 360 columnlayout { id: column1 spacing:150 item {layout.fillheight: true} t

JAVA memory use of extended class -

the situation: have parent class parent. several classes extends patent. so question is: in memory created copies of parent there childs. or in memory there 1 copy used childs? there 1 copy of each child method, , of each parent method etc. each child object has copy of each of class's non-static fields, , of each of parent's non-static fields, , of each of object's non-static fields.

c++ - Binary files with Struct, classes, fstream error -

i have question regarding assignment have. here have 2 of classes, employee class , gm class void gm::addemployee(fstream& afile, int noofrecords) { afile.open("employeeinfo.dat", ios::in | ios::binary); employee::einfo e; employee emp; char name[80]; cout << "\nadd employee info" << endl; cout << "---------------------" << endl; cout << "new employee username: "; cin.clear(); cin.ignore(100, '\n'); cin.getline(name, 80); //check if there entry inside file name. //if yes, add fail bool flag = true; if(noofrecords > 0) { for(int i=1; i<=noofrecords; i++) { afile.read (reinterpret_cast <char *>(&e), sizeof(e)); if(!strcmp(name, e.username)) { cout << "username used, add gm failed" << endl; f

javascript - Get UTC time given TZID and local time -

i trying parse .ics file in application. application has server side java layer , client side javascript part it. using ical4j library parse it. problem dtstart of event not in utc format sometimes. , whenever not in utc .ics file has vtimezone component parsing , getting tzid property it. java layer send json client. in above mentioned case dtstart, dtend , tzid being sent in json. client has convert dtstart , dtend utc using tzid. tried moment.js since not find other api can this. moment.tz("2014-02-06 05:30", "northamerica/eastern").format() with moment.js below error get, typeerror: cannot call method 'rule' of undefined but below code works fine, moment.tz("2014-02-06 17:30", "america/toronto").format() is not possible use tzid (i.e northamerica/eastern) .ics file? there other way or js library can give me utc timezones , considering observance? you should aware icalendar specification rfc5545 states in

How to convert json to Python List? -

i want data in form of list while using pycurl it's showing object of json :( please tell me simplest way how break , list out of it? in advance guiding :) here code: import pycurl import json io import bytesio c = pycurl.curl() data = bytesio() c.setopt(c.url,'https://api.angel.co/1/jobs') c.setopt(c.writefunction, data.write) c.perform() fetched_data= data.getvalue() print (fetched_data); decode json json module imported: result = json.loads(fetched_data.decode('utf8')) i hardcoded encoding here; json rfc states utf-8 default, see if content-type response header has charset parameter tells actual encoding. i'd not use pycurl ; really, cumbersome deal with. use requests library instead, can handle json you, out of box. handles decoding of bytestream unicode for you : import requests result = requests.get('https://api.angel.co/1/jobs').json() that specific url returns json object , resulting in python dictionary:

Why Database is Locked while inserting data in sqlite in IOS? -

why i'm getting database locked while inserting data in sqlite? open , close database code? have code: -(void)insertdatain_tbl_selectitem_data: (nsstring *)empid prodid: (nsstring *)prodid prodname: (nsstring *)prodname genname: (nsstring *)genname computetype: (nsstring *)computetype uom: (nsstring *)uom listprice: (nsstring *)listprice uomqty: (nsstring *)uomqty{ const char *query = "insert tbl_selectitem_data (femployeeid,fproductid,fname,fgeneric_name,fcompute_type,fuom,flist_price,fuomqty) values (?,?, ?, ?, ?, ?, ?, ?)"; sqlite3_stmt *stmt; if (sqlite3_open([sqlitedb utf8string], &(_database)) == sqlite_ok) { if (sqlite3_prepare_v2(_database, query, -1, &stmt, nil) == sqlite_ok) { sqlite3_bind_text(stmt, 1, [empid utf8string], -1, sqlite_transient); sqlite3_bind_text(stmt, 2, [prodid utf8string], -1, sqlite_transient); sqlite3_bind_text(stmt, 3, [prodname utf8string], -1, sqlite_transient); sqlite3_bind_text(st

python - Is there a way to rethrow Selenium error message? -

if wrap piece of selenium webdriver code "try except" in python, self.fail('some problem') in except block, don't know selenium have said @ point. if there had been no try-except, selenium gives error message, e.g visibility, or staleness of element, etc. how can webdriver program re-throw selenium error report ? several options: try: ... except seleniumexception problem: raise or try: ... except seleniumexception problem: raise problem both re-throw original exception. first keep original stack (so can see selenium itself), latter handle exception if occurred not inside selenium @ point of raise . but typically have new information @ point, might want add while keeping original stack trace , exception information. this, changing caught exception before rethrowing proposed; that's don't propose because isn't general approach. i'd rather stick following: python 3 knows exception chaining : try: ... except sele