Posts

Showing posts from February, 2014

javascript - Create object from string in JavasScript ECMAScript 6 -

i want create object factory using es6 old-style syntax doesn't work new. i have next code: export class column {} export class sequence {} export class checkbox {} export class columnfactory { constructor() { this.speccolumn = { __default: 'column', __sequence: 'sequence', __checkbox: 'checkbox' }; } create(name) { let classname = this.speccolumn[name] ? this.speccolumn[name] : this.speccolumn['__default']; return new window[classname](name); // line throw error } } let factory = new columnfactory(); let column = factory.create('username'); what do wrong? don't put class names on object. put classes there, don't have rely on them being global , accessible (in browsers) through window . btw, there's no reason make factory class, instantiate once (singleton). make object: export class column {} export class sequence {} expo

javascript - Regular expression not supporting line skipping \n -

i'm trying find right regular expression number line skip @ end ( \n ) every time it's not working. my regular expression /^\d+(\n)$/ . edit : text area contains : 22\n 33 here's code ( i'm trying validate what's in textarea , it's numbers going there \n @ end of each lines ) : function validechamp() { var rexp1 = /^\d+(\n)$/; var achamps = document.queryselector("textarea").value; if (rexp1.test(achamps.value)==true){ alert("valide") } else { alert("invalide") return false; } } if want check line containing number on it, can use: /(^|\n)\d+(\r?\n)/ if want check there's number, , newline, , nothing else: /^\d+(\r?\n)$/ (which checking for, that's odd input pattern.) if want make sure textarea has lines numbers, might simpler check string.replace(/[0-9\r\n]/g, '') == '' . confirm if contains numbers , newlines.

javascript - Why is my tag still showing? -

this what's inside controller what's wrong way pass values? tried putting inside function still didn't fixed it. removed parts of code since i'm pointing out on how show or hide div using angularjs ng-show . followed answer in link var atag = this; atag.vaanchor = false; atag.nseanchor = false; //showanchor(); // function showanchor(){ var encodedstring = 'action=' + encodeuricomponent("checklogin") + '&user=' + encodeuricomponent(dataform.datausername) + '&pw=' + encodeuricomponent(dataform.datapassword); $scope.errormsg = ""; //reset error message .success(function(data, status, headers, config) { if ( data[0]["data"] != undefined) { $scope.errormsg = "incorrect username/password"; $("#mypass

spring - how to keep jpa session in the thread -

now use jpa in web application. , have class this: class { ... @onetomany private list<b> list; ... } when in http request, can use a.getlist() successful. in schedule thread, throws exception: org.hibernate.lazyinitializationexception: failed lazily initialize collection of role: a.list, not initialize proxy - no session can keep session in schedule thread http request thread? actually, when spring handle http request, start transaction interceptor org.springframework.orm.hibernate3.support.opensessioninviewinterceptor or filter org.springframework.orm.hibernate3.support.opensessioninviewfilter . if want keep session, can start , commit transaction our self. here code: public class backendthread { @autowired private platformtransactionmanager platformtransactionmanager; @override public void onmessage(message message, byte[] pattern) { new transactiontemplate(platformtransactionmanager).execute(new transactioncallb

android - Layout pushing views down the screen -

Image
so, have imageview inside framelayout. need way. feel issue here image , it's size itself. layout image pushes further down other views on screen leaving considerable empty space that's supposed layout. i found hard coding height value let's me minimize issue. if height wrap_content image reach same point blank space supposed layout extends extreme lengths. so want know if image size (or resolution?) problem (which seems be) or else, , if there better solution hardcoding layout height. in advance. here code: <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <framelayout android:layout_width="match_parent" android:layout_height="700dp"> <imageview android:id="@+id/image_header" android:layout_width="match_parent" android:layout_height=

java - Wrong number of values when importing csv file in Weka tool -

i want open csv file (saved openoffice calc) in weka. keep getting error: " wrong number of values. 120 read, 110 expected on line 4." csv fixed quotes around labels. , count 120 values on first lines. have removed possible symbols(, ; " = + -) possible. still problem persists.

java - Am I calling the other classes correctly? I feel like the SnakeBoardDisplay should only be created once -

i have 3 separate classes in java 1 logic, 1 painting, , last window. window class, class creates board display , adds window class public snakewindow() { this.settitle("snake"); this.setdefaultcloseoperation(jframe.exit_on_close); this.setsize(win_wid, win_hei); snakeboarddisplay dpanel = new snakeboarddisplay(); this.add(dpanel); inintmenu(); this.setvisible(true); setresizable(false); } public static void main(string[] args) { new snakewindow(); } board display class, class creates new board display where proper place class called , executed? public snakeboarddisplay() { game = new snakegame(); tm.start(); addkeylistener(this); setfocusable(true); setfocustraversalkeysenabled(false); } public static void main(string[] args) { new snakeboarddisplay(); } game class public snakegame() { init(); } public void init() { for(int = 0; < tokens; i++) { int q = i;

ruby - Rails Beginner NoMethodError in PinsController#new -

having issues keep getting error undefined method `pins' nil:nilclass, can explain how fix error. been following tutorial , got stuck. pins_controller.rb class pinscontroller < applicationcontroller before_action :find_pin, only: [:show, :edit, :update, :destroy] def index @pins = pin.all.order("created_at desc") end def new @pin = current_user.pins.build end def create @pin = current_user.pins.build(pin_params) if @pin.save redirect_to @pin, notice: "successfully created new pin" else render 'new' end end def edit end def update if @pin.update(pin_params) redirect_to @pin, notice: "pin updated!" else render 'edit' end end def destroy @pin.destroy redirect_to root_path end private def pin_params params.require

java - Right way to implement encapsulation -

Image
i have following class scheme. national have arraylist of zone , zone arraylist of region , region have arraylist of person . so have next questions: 1) can "push" person trough national , zone add in region? for example: national national = new national(); .... national.addperson(person); // every level has own addperson method or national.getzone(i).getregion(i).addperson(person); what right way in oop? 2) can make method return every person in level? i mean example: zone zone = new zone(); ... zone.getpersons(); //return arraylist persons of every region in zone. this goes against encapsulation? 3) next(), hasnext(), first() methods every level, can iterate in particular level. that's all. encapsulation , oop in general, can't figure out right do, , wrong. thanks. given class diagram, person must member of region , is, national or zone cannot directly contain person objects not contained in region under it.

jdbc - java.sql.SQLException: No suitable driver found -

i trying execute simple query using below dbquery.java class uses dbconnector connection drivermanager. note : i have included "mysql-connector-java-5.1.25-bin.jar" on classpath via: export classpath=$classpath:/home/me/ocpjp/chapter-10/mysql-connector-java-5.1.25/mysql-connector-java-5.1.25-bin.jar i able connect mysql "mysql -uroot -ptcial addressbook", if matters. have tried running '-cp' argument no avail. i able #3 dbconnect.java class "database connection established". also #4 dbqueryworking.java has no issues , provides expected output . can please me understand issue here ? 1) dbconnector.java package com.me.ocpjp.chapter10; import java.sql.connection; import java.sql.drivermanager; import java.sql.sqlexception; public class dbconnector{ public static connection connecttodb() throws sqlexception{ string url = "jdbc:mysql//localhost:3306/"; string db = "addressbook"; string username = "root&quo

qt - Python 3.4.3 + Current PyQt5, DLL load failed -

when trying run simple test of database.py: import pymysql.cursor pyqt5.qtcore import pyqtsignal, qobject, qtimer this output in exceptions tab of wingware ide: file "c:\myprojects\___mechanikos\ultrasimplesarlaccpit\01_ultrasimplesarlaccpit.py", line 1, in <module> database import database  file "c:\myprojects\___mechanikos\ultrasimplesarlaccpit\database.py", line 2, in <module> pyqt5.qtcore import pyqtsignal, qobject, qtimer builtins.importerror: dll load failed: specified module not found.` there error when installing pyqt5 says built 3.5 not 3.4. why? if so, can download 3.4.3 compatible version? thanks! regards, team mechanikos try upgrading 3.5: uninstall old pyqt5 , python 3.4.3 through control panel > programs install python 3.5.1, specifying making sure specify c:\python35\ install location. install pyqt5 3.5 (current). works.

Is this possible anymore? PHP Switch call on function -

hey guys time looking @ project i'm working on! old project had semi-working 2 years ago isn't doing me whole lot. i'm hoping can save me lot of time rewriting this! anyway it's smaller project i'm looking ioncube , instead of paying per file used able use switch , call on several different functions within 1 file. anyway here's basic mockup of i'm trying do. said isn't working. when point browser index.php?action=calendar it's blank other classes. <?php include 'theme/header.php'; ?> <?php if (login_check($mysqli) == true) : ?> yes logged in <?php $action = $_get['action']; echo $action; switch($action){ case "calendar": calendar(); break; default: index(); break; } function index() { echo "hello"; } function calendar() { include 'calendar.php'

What is the lifetime of variables inside a self calling function in javascript -

i've been trying understand following code: var add = (function () { var counter = 0; return function () {return counter += 1;} })(); add(); add(); add(); here add assigned return value of anonymous self calling function -- function function() { return counter += 1 } . first time add() called returns 1 expected. second time add() called returns 2 . my question since counter defined inside function wouldn't every time function finishes execution counter should die? is, after first call add() 1 displayed. out of function shouldn't counter forget it's previous value , destroyed stack automatic variables are? what lifetime of variables inside self calling function in javascript the same variables in other kind of javascript function: exist long can referenced, means long past time function contains them returns. your counter variable continues exist after iife returns because function creates , returns ( r

perl - How do you change globally the default content type in Catalyst? -

i've tried with: myapp/lib/myapp.pm __package__->config( ..., content_type => 'application/xhtml+xml' ); and with: myapp/lib/myapp/view/html.pm __package__->config( ..., content_type => 'application/xhtml+xml', ); i'd do $c->response->headers->content_type('text/plain'); in yourapp/controller/root.pm sub auto . this should run before other controller (method) , should give reasonable default value.

ios - Enlarge CGRect around existing point -

i using cgrect cut image out of imageview. rectangle generated automatically depending on features on imageview enlarge maybe 10% around same point. to sizes of use frame this: cgrect frame = _imageview.frame; cgimageref imageref = cgimagecreatewithimageinrect([image cgimage], frame); uiimage *img = [uiimage imagewithcgimage:imageref]; then change origin.x unable frame of existing rectangle. any appreciated on expanding cgrect have @ cgrectinset, think want. depending on sign of insets, can make rectangle that's smaller or larger original same center point.

assembly - Why is ASLX required when reading values from INT array -

trying better understanding of working integer arrays , came across issue. q: when printing elements of array , don't use aslx unexpected results, when use aslx expected results. how aslx effect result? food:.word 0 .word 1 .word 1 .word 0 main:ldx 3,i ; = 3 stx i,d for: cpx 0,i ; >= 0 brlt endfor deco i,d charo ' ',i aslx ; if remove 256 instead of expected value deco food,x ; food[i] charo '\n',i ldx i,d subx 1,i stx i,d br endfor: stop .end thanks asl, or arithmetic shift left, shifts of bits of number left. 0001 becomes 0010, 0100, , on. equivalent multiplying number two. when use aslx command, double index register. when working integer array because integers take 2 bytes, , index register measured in single bytes. in other words, if increment/decr

javascript - Is this html code OK for auto submitting (if there is a separate page needs to be appeared after submission) -

this basic think 1 of few ways create auto submission using html. <meta charset=utf-8" http-equiv="refresh" content="120;url=http://localhost/quiz/grade.php"> is okay if need new page after submission.... typing large java-script codes. (i'm creating quiz page website , need show results after 2 minutes in new page)? it's 1 way redirect page. it's fine use it. side note if ever auto-include head content every page, code redirect every page (i think it's not want, keep in mind that). typo in <meta> : <meta charset=utf-8"> must <meta charset="utf-8">

c# - Read xml file just as it is -

i have xml file has following all i'm trying display text in multi line textbox in file. i've found code on microsoft site , altered work me i'm still not quite there. <employees> <employee> <name>davolio, nancy</name> <title>sales representative</title> <birthday>12/08/1948</birthday> <hiredate>05/01/1992</hiredate> </employee> <employee> <name>fuller, andrew</name> <title>vice president, sales</title> <birthday>02/19/1952</birthday> <hiredate>08/14/1992</hiredate> </employee> <employee> <name>leverling, janet</name> <title>sales representative</title> <birthday>08/30/1963</birthday> <hiredate>04/01/1992</hiredate> </employee> code: xmltextreader reader = new xmltextreader("employees.xml"); string contents

javascript - compare 2 arrays and get those variables did not match -

var array1 = ["display1"]; var array2 = ["display1", "display2", "display3"]; array.prototype.compare = function(testarr) { if (this.length != testarr.length) return false; (var = 0; < testarr.length; i++) { if (this[i].compare) { if (!this[i].compare(testarr[i])) return false; } if (this[i] !== testarr[i]) return false; } return true; } if(!array1.compare(array2)) { alert("is not match"); // un-matched variable. }else{ alert("matched"); } my intetion compare 2 array each other , , un-matched variable out , code compare see if matched or not. how un-matched variable ?? so result ["display2", "display3"]; you use temporary object count given values of array1 , array2 , filter if value has count 1. function xxx(a1, a2) { var a3 = a1.concat(a2), temp = object.create(null);

algorithm - Vector subscript out of range error in c++ and opencv -

Image
i'm trying write program uses orb algorithm detect , compute keypoints of image , matches descriptor vectors using flann matcher. issue facing is, every time run program on visual c++, getting error tells "vector subscript out of range"(i've attached image of error). the problem seems somewhere in because when start debugger stops there , error. when commented first see if rest ok, i've got same error on second for. please me find problem. #include <iostream> #include <stdio.h> #include <opencv2/opencv.hpp> #include <opencv2/features2d.hpp> #include <opencv2\core\types.hpp> #include <opencv2\highgui.hpp> #include <opencv2\core.hpp> #include <opencv2\opencv_modules.hpp> using namespace cv; using namespace std; int main() { mat img1 = imread("c:\\users\\patri\\desktop\\test.bmp"); mat img2 = imread("c:\\users\\patri\\desktop\\test3.bmp"); /* if (!img1.data || !img2.data) { printf(

sms - Using static methods in Android with getApplicationContext()? -

this question has answer here: the method getapplicationcontext() undefined 4 answers i working on app called drive mode allow user enter custom message in settings , have message auto-replied incoming text. (along other features of course) problem trying reference static string , using getapplicationcontext(); i grabbing text edittextpreference , trying access string in multiple activities. fixed: problem fixed , have edited entire post better others possibly have same problem. thank help. public class main extends activity implements onsharedpreferencechangelistener { ... public static string reply = ""; ... public void loadpreferences() { sharedpreferences settings = preferencemanager.getdefaultsharedpreferences(getapplicationcontext()); settings.registeronsharedpreferencechangelistener(main.this); if

Sending json object via http post method in android -

its not duplicate.link has been provided old one."http client" has been removed in api23 i want send json object: {"emailid":"ashish.bhatt@mobimedia.in","address":"naya bans","city":"noida","pincode":"201301","account_number":"91123546374208","bank_name":"axis bank","branch_name":"91123546374208","ifsc_code":"uti0000879"} to url: http://10digimr.mobimedia.in/api/mobile_retailer/update_profile how do it? via post method? method: post /api/mobile_retailer/update_profile mandatory key: {"emailid","address"} request json: {"emailid":"ashish.bhatt@mobimedia.in","address":"naya bans","city":"noida","pincode":"201301","account_number":"91123546374208","bank_name&quo

html5 - CSS3 one-way transition controlled by JavaScript doesn't work when add/remove class sequentially -

i want css3 transition in one-way. example, want highlight element setting it's background-color: yellow; immediately, , set background-color: white; one-way transition. i tried use javascript achieve this: const highlightbtn = document.getelementbyid("highlightbtn"); const highlighttogglebtn = document.getelementbyid("highlighttogglebtn"); const highlighttimeoutbtn = document.getelementbyid("highlighttimeoutbtn"); const bodyclasslist = document.getelementsbytagname("body")[0].classlist; highlightbtn.addeventlistener("click", () => { bodyclasslist.add("highlight"); bodyclasslist.remove("highlight"); /* doesn't work, either. bodyclasslist.toggle("highlight"); bodyclasslist.toggle("highlight"); */ }); highlighttogglebtn.addeventlistener("click", () => { bodyclasslist.toggle("highlight"); }); highlighttimeoutbtn.addeventl

html - Shrink wrap breaks as I add more text into a child DIV element -

html code: <div id="container"> <div id="first"> foo bar baz foo bar baz foo bar baz foo bar baz </div> <div id="second"> foo </div> <div id="third"> foo bar baz foo bar baz foo bar baz foo bar baz </div> </div> css code: body { text-align: center; } #container { display: inline-block; background: lightcyan; } #first { display: inline-block; background: lightgreen; } #second { background: orange; } #third { width: 30%; display: inline-block; background: lightblue; } i trying ensure entire div#container shrink-wraps around div#first. above code works expected. see demo: http://jsfiddle.net/hhre6/ however, add more text div#third, shrink-wrap breaks. see broken demo: http://jsfiddle.net/n4kn2/ why happen? how can prevent happening? in example have width of container depends o

latex - How to write footnote citation in beamer in one line? -

i using beamer latex , need give reference in footnote . reference 2 lines. when write following code writes in more lines!!! \begin{frame} \frametitle{r: literature review} \setbeamerfont{footnote}{size=\tiny} huo et al. \footfullcite{huo, et al. ``computerized ...''} \end{frame} the output this: guo, et al. ”prediction of clinical phenotypes in invasive breast carcinomas integration of radiomics , genomics data.” no. 4 (2015): 041007-041007.. do know how can in 2 lines? thanks , regards. a little trick: not use comma after 'guo' (or 'huo')! \footfullcite{huo et al. ``computerized ...''}

java - UnrecognizedPropertyException after changing structure of Firebase data -

this question has answer here: why “failed bounce type” when turn json firebase java objects? 3 answers there little problem firebase , firebase snapshot.getvalue(mmodelclass) i have android app wich contains user list(model class - user.java ) , interacts firebase, structure: -user --$user_id ---name ---surname i've published app, , want update app, add new field user structure in firebase: -user --$user_id ... --status if it, published app crash because old model - user.java doesn't has status field , can't edit pubslished version crash text: caused by: com.fasterxml.jackson.databind.exc.unrecognizedpropertyexception: unrecognized field "status" (class package.user), not marked ignorable (2 known properties: , "name", "surname"]) finally found answer: import org.codehaus.jackson.annotate.jsonignor

javascript - Issues with fullstops in word count script -

i have following code text div id para has last word , first word of next sentence joined , views 1 word instead of 2 code: var value = $('#richhtmlfield_displaycontent').text(); console.log("text", value) if (value.length == 0) { $('#show_word_count').html(0); return; } var wordcount = value.match(/\s+/ig).length $('#show_word_count').html(wordcount); }; $(document).ready(function() { $('#richhtmlfield_displaycontent').change(counter); $('#richhtmlfield_displaycontent').keydown(counter); $('#richhtmlfield_displaycontent').keypress(counter); $('#richhtmlfield_displaycontent').keyup(counter); $('#richhtmlfield_displaycontent').blur(counter); }); so want add space after full stops, question marks count total word. if replace ths "s" in regular expression "w" search words instead . see below -

android - Package has already posted 50 toasts. Not showing more -

hello working on app , in @ 1 point need take input user , store in database , fetch data , put on different textview . problem did stored data in database , when trying fetch app shows pop i.e : app not responding , logcat shows this: package has posted 50 toasts. not showing more. have used 6 database operations before pullaccstt can problem. databseadapotor public long updateaccsetttable(string loactionname, string hospitalname, string patientid, string firstname, string middlename, string lastname, string dob, string gender, string weight, string height, string mobno, string emailid, string ethinicity, string patientconcentstatus, string devicepatientid, string cosensorid, string deviceid, string videoid){ sqlitedatabase db= helper.getwritabledatabase(); contentvalues contentvaluesaccsett= new contentvalues(); contentvaluesaccsett.put(databasehelper.patientid,patientid); contentvaluesaccsett.put(d

How to check for which country a youtube video is allowed? -

for videos, youtube site say, video not available in country . possible check using youtube data apis or other way, country particular video allowed ? check link . can use contentdetails.regionrestriction property of video. example : https://www.googleapis.com/youtube/v3/videos?part=contentdetails&id=tddaa1if-u4&key={your_api_key}

phpdoc - Best way to write contributions header in php and all available tags like @author -

Image
i working on github project https://github.com/qzoke/isbn-converter want create nice contribution header. here questions : all variables or whatever @author available. few know are: @author @license @version @package @subpackage best way showcase values like few use @author www.website.com few use @author name<email> and @author name. how , should name package , sub package. subpackage confusing , no idea if should use file name in subpackage or same package name. is ok write description, keyword, contribution in there. what's best way reference license, name (like gnu gpl v3.0) or name+weblink or link local copy or copy of whole license text. and files should have such header , index.php , or header.php or every other. and include in html commenting , if any. according https://phpdoc.org/ documentation there number of tags recognised phpdocumentor listed @ https://phpdoc.org/docs/latest/index.html . example source https://ph

c# - how to put cursor focus on textbox? -

Image
i have wpf usercontrol contains controls , want put focus on textbox tried use "focusmanager.focusedelement" can't type in bacause tab set first control in usercontrol. <grid> <grid.rowdefinitions> <rowdefinition height="10"/> <rowdefinition height="45"/> <rowdefinition height="160"/> <rowdefinition height="50"/> <rowdefinition height="15"/> <rowdefinition height="272*"/> </grid.rowdefinitions> <button grid.row="1" x:name="btncreationoffre" background="transparent" width ="120" height="35" borderbrush="{x:null}" horizontalalignment="left" click="btncreationoffre_click" margin="0,2,0,8" style="{dynamicresource nv_offrebutton}"/> <button grid.

sql server - Display Sum of time in HH:MM format in SSRS 2008 -

Image
i have table last column total_service_time in hh:mm format getting correctly sql query. i getting #error while adding expression =sum(fields!total_service_time.value) in last row sum of total_service_time in hh:mm format. is there way sum of time in hh:mm format in last row my query total_service_time value: (select cast(total / 60 varchar(8)) + ':' + cast(total % 60 varchar(2)) expr1 (select cast(sum(action.[travel time] + action.[total productive time]) int) total) t) total_service_time screenshot thanks, salman your trying sum hours , minutes format not compatible sum add hours , minutes need use specific datetime functions. try out below expression - =right("0" & sum(cint(left(fields!total_service_time.value,2)), "<datasetname>") + floor(sum(cint(right(fields!total_service_time.value,2)), "<datasetname>") / 60),2) & ":" & sum(cint(right(fields!total_service_time.value,2)),

bash - Functional difference between if-then and command group -

is there functional advantage of using simple if-then statement such as if [ … ]; over using short-circuit list evaluators command groups such as [ … ] && { } of course, if-then standard way of writing it, there actual difference/advantage functional point of view? using () instead of {} spawn new subshell, creating new scope variables inside if-then block. not example, commonly seen condition && foo || bar is not same if condition foo else bar fi in former case, bar run not if condition fails, if foo fails.

Set translucent statusBar in iOS with react-native -

i'm trying nothave translucent (default) statusbar on ios react-native seems option available on android? class thapp extends component { render() { return ( <view style={styles.container}> <statusbar translucent={false} backgroundcolor="rgba(0, 0, 0, 1)" barstyle="default"/> <tabs></tabs> </view> ); } } probably solved problem in other way have same problem. , far deal problem i'm implementing platform independent margintop or paddingtop. import {platform} 'react-native'; // status bar height on ios 20 dpi const margintop = platform.os === 'ios' ? 20 : 0;

sql - LAG functions and NULLS -

Image
how can tell lag function last "not null" value? for example, see table bellow have few null values on column b , c. i'd fill nulls last non-null value. tried using lag function, so: case when b null lag (b) on (order idx) else b end b, but doesn't quite work when have 2 or more nulls in row (see null value on column c row 3 - i'd 0.50 original). any idea how can achieve that? (it doesn't have using lag function, other ideas welcome) a few assumptions: the number of rows dynamic; the first value non-null; once have null, null end - want fill latest value. thanks if null way end can take short cut declare @b varchar(20) = (select top 1 b table b not null order id desc); declare @c varchar(20) = (select top 1 c table c not null order id desc); select is, isnull(b,@b) b, insull(c,@c) c table;

python - How can I start building universal conda packages? -

now maintaining several pure python packages publishing both source , wheels onto pypi repository want start publishing them on conda too. i surprised not find clean information on how this. how can it? note, don't want have build tons of platform specific conda packages combinations of python version , operating system platforms, because these packages pure-python.

c# - Getting different innerplotposition in the same charts -

Image
i know title bit confusing i'm gonna try explain as can make guys easy understand problem. i'm working 2 solutions, 1 try things, , made chart can have multiple series , bars of same size, working fine in tries solution fails when use on other one, after 30 minuts of research ive found difference, innerplotposition getting different values. solution 1 ipp values: height: 72.94543. width: 71.73857. solution 2 ipp values: height: 97.40223. width: 100. the other sizes same(except location of chart). i don't know why because copied 1 working(code , chart) other project, after 2 hours decided ask there if knows why im getting different values apparently on same chart. example of chart(both equals):

jquery - Kendo Datasource refresh -

i facing same problem going through in previuos questions asked in stack overflow no success answer, can please guide me. kendo ui datasource refresh? i using angular js bind grid, showing column " jan2016, feb2016" these 2 cilumns shows perfectly, when go , select 1 more month "mar2016", grid doesnt refresh showing mar2016 i used k-rebind, datasource.read(), datasource.refresh()... nothign works thanks in advance ram while erick's answer work, instead of destroying in recreating kendo widget, first try doing $("#grid").data("kendogrid").setdatasource(datasource) it's less code , it's cleaner way of changing datasource

doctrine2 - Working with Entity Manager from other bundle -

i have application serves central hub multiple other applications. so vendor folder contains bundles, main bundles other applications. now central application want load page 1 of these main bundles. the problem default entity manager used in these main bundles. loaded in central app, should use non-default manager (which has been configured in config.yml) how tell these main bundles use corresponding entity manager?

android - How can I store my JSON array elements in variables? -

here json array having sub array in it. want store data of sub array in arranged manner in android. first record other,etc..how can this? { "result": [ ["", "", "2016-04-22", "", "", "problems since last 5 days", "replace piping", "0", null], ["elec4820", "", "2016-04-25", "", "", "jsjshdjdjjcncnc", "hdjdhdhfbbff", "0", null], ["elec7558", "", "2016-04-25", "", "", "jsjshdjdjjcncnc", "hdjdhdhfbbff", "0", null], ["gara8118", "11827", "2016-03-13", "completed", "nknm", "too garbage near front gate causing unbearable stink.", "garbage ", "0", null], ["nois6091", "17061", "2016-03-11", &

html5 - Input string in correct format. VB.net - New to this so help required -

i having issues page , code behind working on. please see code: protected sub page_load(sender object, e eventargs) handles me.load dim dttable datatable = nothing dim intconnectionid integer = 0 if page.ispostback ' user data session httpcontext.current intconnectionid = cint(result.value) end end if ' remove connection modconnections.delete(intconnectionid) ' clear desks attahced connection moddesktext.clearuserdesk(intconnectionid) using sqlcommand new sqlcommand sqlcommand .commandtext = "usp_connectsdetailedlist" .commandtype = commandtype.storedprocedure end execute(sqlcommand, dttable) end using rep1 .datasource = dttable.defaultview .databind() end if not isnothing(dttable) dttable.di

How to calculate the total days for reservation in MySQL -

i have table stores vehicles reservations each record have datefrom "the reservation start date" , dateto "the reservation end date" i trying write query calculate total of day each vehicles booked , total of revenue each vehicles generates. the business rule are following if datefrom , dateto in same day considered 1 days if reservation 2013-05-25 2013-06-06 then 7 days go month of may , 5 days go month of june here break down of logic 2013-05-25 - 2013-05-26 (may) 2013-05-26 - 2013-05-27 (may) 2013-05-27 - 2013-05-28 (may) 2013-05-28 - 2013-05-29 (may) 2013-05-29 - 2013-05-30 (may) 2013-05-30 - 2013-05-31 (may) 2013-05-31 - 2013-06-01 (**may**) 2013-06-01 - 2013-06-02 (june) 2013-06-02 - 2013-06-02 (june) 2013-06-03 - 2013-06-02 (june) 2013-06-04 - 2013-06-02 (june) 2013-06-05 - 2013-06-02 (june) this example on how calculation should work. for revenue suppose calculate average daily rent dividing total revenue total rented days multiply

python - sqlalchemy core autoincrement integer column which is part of the unique constraint -

requirement: composite key having auto-incremental value. how define table: doc_versions = table("doc_versions", metadata, column("id", integer, primary_key=true), column("doc_id", integer,foreignkey("docs.id")), column("version_number", integer, default=select([ func.max(1, 1)])), uniqueconstraint("doc_id","version_number", name="doc_version") ) how initialize version number composite key i.e doc_id + version_number should unique , take next sequence. want use sqlalchemy core 1.0.8 there have been lot of questions similar problems here, , answer (sorry no links, search e.g. 'sqlalchemy autoincrement composite'): sqlalchemy can handle autoincrement on integer primary keys. it's sad, tr

python - Apache Thrift Tutorial Error -

i've been trying learn use apache thrift in python following tutorial: http://www.billdimmick.com/devjournal/building-an-apache-thrift-service-in-python.html . thrift file used tutorial is: namespace py demo service mathservice { i64 add(1: i64 a, 2: i64 y) } when try compile python code thrift --gen py:new_style demo.thrift following error: [error:/home/pi/programming/python/thrift-tutorial/demo.thrift:4] (last token '{') syntax error [failure:/home/pi/programming/python/thrift-tutorial/demo.thrift:4] parser error during include pass i can't see wrong thrift file i'm still getting errors. what's wrong?

Why does my JSON not load in Angular 2 -

i trying load json data angular 2 component, getting error of 'unexpected token :' seems not understand json data is. i have tried complete 'simple' task many times yet have yet been unable so, hope can somewhere time communities help... here code: index.html <!doctype html> <html> <head> <script>document.write('<base href="' + document.location + '" />');</script> <title>angular 2 quickstart</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="style.css"> <!-- 1. load libraries --> <!-- ie required polyfills, in exact order --> <script src="node_modules/es6-shim/es6-shim.min.js"></script> <script src="node_modules/systemjs/dist/system-polyfills.js"></script> <script src="node

awk - How to count occurrences no matter its case? -

table chr10 10482 10484 0 11 + ca chr10 10486 10488 0 12 + ca chr10 10487 10489 0 13 + ca chr10 10490 10492 0 13 + ca chr10 10491 10493 0 12 + ct chr10 10494 10496 6.66667 15 + ca chr10 10495 10497 6.66667 15 + cc i count number of lines in column 7 "ca" can found regardless of of 2 letters being in upper or lower case. the desired output 5. the 2 commands (below) give empty output cat table | awk ' $7 ==/^[cc][aa]/{++count} end {print count}' awk 'begin {ignorecase = 1} $7==/"ca"/ {++count} end {print count}' table the below command returns value of 1 awk 'begin {ignorecase = 1} end {if ($7=="ca"){++count} {print count}}' table note: actual table tens of millions of lines long, not want write table intermediate in order count. (i need repeat task other files too). there little problem in syntax: either var == "string"

javascript - Save as image canvas mixed with CSS -

i know possible save content's of canvas image, on client side, using javascript . i have photo , want add text on it, style text css, , save resulting image, on client side. is possible? there awesome if there javascript library transform html elements styled css in canvas shapes. check out html-2-canvas project. it'll convert entire web page (or particular tag want) canvas object. so in case have html + canvas converted canvas. can save picture.

swift - Binding ViewModel to ViewController (ReactiveCocoa) iOS -

i implementing simple facebook/google login now. trying apply mvvm pattern reactivecocoa in project. not able bind viewmodel viewcontrollers . tried cocoaactions not able make work. view model : let name = mutableproperty<string>("") let email = mutableproperty<string>("") let phoneno = mutableproperty<string>("") let referal = mutableproperty<string>("") var fbloginaction:action<onboardingviewcontroller,bool,nserror> view controller : //mark: signup binding let logincocoaaction = cocoaaction(viewmodel.fbloginaction., input:()) signupview.fbbtn.addtarget(logincocoaaction, action: cocoaaction.selector, forcontrolevents: .touchupinside) its been while since question posted. since then, rac 5.0.0 has been released makes lot easier, ui bindings: assuming, have fbloginaction ready defined in view model, can bind action button in view controller this: signupview.fbbtn.reactive.pr