Posts

Showing posts from March, 2011

Spring Integration: how to make the SecurityContext propagation working? -

i'm trying integrate 2 simple spring web applications spring integration, , want propagate spring securitycontext between 2 applications, i've not yet found working solution. the 2 applications similar between each other, there few differences in configuration: 1 of them has "caller", other 1 has "receiver". in order getting expected result, i'm using spring security , i've configured both applications following spring security configuration: <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.1.xsd"> <http au

windows - Crash when calling getOpenFileName from QItemDelegate's custom editor -

prerequisites: i have custom qitemdelegate creates custom editor treeview items. editor consists of qlineedit , qtoolbutton. button used open file dialog selecting file , placing it's path line edit. use call qfiledialog::getopenfilename open file dialog. dialog native windows file dialog (this important). when editor created first time, works ok no matter how press button. after editor closed , reopened again first press on button results in crash. reason of crash custom editor gets deleted. here code: void ccustomeditor::on_runsetupbtn_clicked() { auto qfilename = qfiledialog::getopenfilename(this, "select application run", qstring(), "executable files (*.exe)"); if (qfilename.isempty()) return; setcommandline(qdir::tonativeseparators(qfilename), m_qparameters); } i have made digging , found out calling winapi function getopenfilename results in same way: editor gets deleted (although crash doe

SYMFONY FORM isClicked() issue (depending Browser) when mixed with JavaScript - JQuery: event.preventDefault() and event.target.submit() -

Image
the goal: i want on symfony form have two submit buttons . 1st 1 used validate form, 2nd submit button used away form . by default fields of form use required check before submitting, means prior use 2nd submit, required attributes need turned off on dom <input> . using jquery, event.preventdefault() , turn off required on each <input> , event.target.submit() . then on symfony side expect catch button had been clicked using $form->has([button name])->isclicked() function. the issue: i have noticed depending on browser, $form->has([button name])->isclicked() doesn't work if javascript event.preventdefault() , event.target.submit() had been used. on chrome (version 51.0.2704.103 m) (isclicked = 1 or true): on firefox (version 47.0) or microsoft edge 25.* (isclicked = false): the code: the full code @ following github . emphasis on code: in /src/appbundle/form/formtype.php you'll find, code manages javascript hold on submit

sql server - SSDT/ VS2015 Database deployment -- publishing is ignoring nested views -

i attempting gain knowledge , use cases on ssdt database development , deployments , strugling deployment issues. specifically when using nested views. unknown reason when attempting deploy / publish files in project local / live db seems mess references in views. in project have following views (example): view1 view2 view3 view1 references view2 , view3 referencing view1. building project works fine. hoewever when try publish database either generating dacpac snapshot , publish database or let visual studio generate update script after (or not) comparing schemas end update script tries create views in seems logical order in stored in project. in case view1 -> view2 -> view3. means publish fails because of reference issues. can't create view if referenced view not exist. i have tried several options adding dacpac reference in project in various ways (same database, same server different database w/ w/o database parameter) in many cases end sql71561 / sql

Angular 2 multiple components -

it seemed confused angular 2 concept. i'd have 3 components on page defined way in app.component.html (this should entry point): <bp-header></bp-header> <bp-home></bp-home> <bp-footer></bp-footer> and main component (app.component.ts): import { component } '@angular/core'; import { router_directives } '@angular/router'; import {headercomponent} "./header.component" import {footercomponent} "./footer.component" import {homecomponent} "./home.component" @component({ selector: 'bp-app', templateurl: 'app.component.html', styleurls: ['app/app.component.css'], directives: [headercomponent, footercomponent, homecomponent] }) export class appcomponent {} bu there nothing when open home page no errors in console. well, final solution put header , footer directives inside template way bp-header , bp-footer separate components. import { component

javascript - JSON to JSON mapping using Mustache -

i want map input json json using mustache . my input json like: { "data": [ { "catalogid": "1850", "productid": "elec004a"}, { "catalogid": "1851", "productid": "png679"} ] } i want template in combine mustache tags output json. var template = json.stringify( { product: [ {{#data}} { productid:'{{productid}}', parentproductid:'{{catalogid}}' } {{/data}} ] } ); i tried using mustache tag json giving me errors. tried defining template without using json.stringify no luck! have use mustache requirement, actual input json quite large , can't map using traditional way. my desired output json mentioned in template mustache tags replaced relevant data input json you don't need moustache here. var input = { "data": [ { "catalogid": "1850", &qu

Nested CSS counter does not show increment -

this question has answer here: how stop <div> tags interfering counters? 2 answers i trying use css counters applied series of elements , miserably fail right. the html code simple: <html> <head> <style> body { counter-reset: objgen; } span.general:before { content: counter(objgen) ; counter-increment: objgen; } span.general { counter-reset: objesp; font-weight: bold; } span.esp:before { content: counter(objgen) "." counter(objesp); counter-increment: objesp; } span.esp { font-weight: bold; } </style> </head> <body> <p>inputs:

How to get authenticated Json object in angularjs -

i want object using request in angularjs. server asks authentication details: how pass authentication details? $http({ method: 'get', url: 'http://192.168.1.133:8080/xyz-api/api/customer/token/xyzname', headers: { 'content-type': 'application/json' } }).success(function (data) { $scope.customerdetails = data; $scope.customer_id = $scope.customerdetails.id; $scope.companyname = $scope.customerdetails.name; }).error(function () { alert('error'); });

r - error in installing Rsubread package -

i trying install 'rsubread' package error new r not sure how should solve it. using rstudio on windows 8.1 source(" http://bioconductor.org/bioclite.r ") bioconductor version 3.2 (biocinstaller 1.20.1), ?bioclite bioclite("rsubread") bioc_mirror: https://bioconductor.org using bioconductor 3.2 (biocinstaller 1.20.1), r 3.2.3 (2015-12-10). installing package(s) ‘rsubread’ package available in source form, , may need compilation of c/c++/fortran: ‘rsubread’ these not installed seems rsubread not available windows. needs mac or linux. https://support.bioconductor.org/p/77755/

c# - Column data missing when i import data from .csv excel to grid view in Asp.net -

Image
i trying export excel sheet data grid view in asp.net site. grid view populating data missing excel sheet column data emp_code . excel data : rendered gridview : ` code populating asp:gridview : protected void btnsave_click(object sender, eventargs e) { if (fileupload1.filename != "") { try { fileupload1.saveas(server.mappath("~/appraisal/" + fileupload1.filename)); cvspath = null; string constr = null; //constr = system.configuration.configurationmanager.connectionstrings("connstr").tostring; constr = configurationmanager.connectionstrings["connectionstring"].connectionstring; sqlconnection dwconn = new sqlconnection(constr); //con.open() cvspath = server.mappath("~/appraisal/" + fileupload1.filename); //response.write(cvspath) fileupload1.dispose(); // dim constr st

swift - NSCollectionView dataSource not working properly -

i'm experimenting new nscollectionview  api, introduced in el capitan. following wwdc video, create subclass of nscollectionviewflowlayout determine layout of collection view. class layout : nscollectionviewflowlayout { override func preparelayout() { super.preparelayout() self.minimuminteritemspacing = 0 self.minimumlinespacing = 0 let cheight = self.collectionview!.bounds.height let cwidth = self.collectionview!.bounds.width self.itemsize = cgsizemake(cwidth / 2.0, cheight / 6.0) } } after that, i've created nsobject subclass serve data source. class datasource : nsobject, nscollectionviewdatasource { func collectionview(collectionview: nscollectionview, numberofitemsinsection section: int) -> int { return 5 } func collectionview(collectionview: nscollectionview, itemforrepresentedobjectatindexpath indexpath: nsindexpath) -> nscollectionviewitem { /* doesn't called! */ let item = collectionview.m

pdo - Array to String Conversion PHP -

so title says i'm having issue when trying display 5 results sql query don't know how convert them array, # collection of sql try { $sql = $conn->query("select channel_location channels order rand() limit 5"); } catch(pdoexception $e) { echo $sql . "<br>" . $e->getmessage(); } foreach($sql->fetchall(pdo::fetch_assoc) $c) { echo $c . "<br>"; } $conn = null; i can't work out how display results, displays 1 result if change foreach($sql->fetchall(pdo::fetch_assoc) $c) { foreach($sql->fetch(pdo::fetch_assoc) $c) { need display each result $sql = "select channel_location channels order rand() limit 5"; $channels = $conn->query($sql)->fetchall(pdo::fetch_column); foreach($channels $c) { echo $c . "<br>"; } your main problem trying use variable knowing nothing of type. goes both $sql (which misnamed) , fetchall result. supposed know variable

ruby on rails - Is there a Gem that checks that all DB records are valid? -

when adding validations, it's easy make data in db invalid. is there gem validates data in db? it should easy load records , see if they're valid, if exists don't want reinvent it. not sure if there gem it's not common case have invalid records. can understand may want if imported lot of data without validation or created validations after records created. i rake task. depending on size of db can expensive. namespace :validate desc "validates records" task :check_all_records # records module.constants.select { |c| (eval c).is_a? class }.each |class| # load 1000 memory @ time , check if they're valid class.find_each{ |record| fix_the_record_method unless record.valid? } end end end

html - Divs not moving down within parent section -

here website current code: http://www.actuatecontent.com i building first website , trying move down 2 divs within container div , won't budge down. ( .copy , .btn_section ) what doing wrong, , how can correct it? thanks help! source code: .second_section .container { position: relative; top: 300px; background-image: url(http://1.bp.blogspot.com/-i0jocwyqw94/udfz9u8si0i/aaaaaaaacrw/2hhb0xy7yzy/s1600/84.jpg); height: 900px; width: 100%; } .copy { top: 300px; width: 100%; text-align: center; color: white; font-family: 'josefin sans', sans-serif; letter-spacing: 2px } .btn_section { position: relative; top: 300px; text-align: center; } .btn { margin-top: 100px color: white; border: solid 2px fixed; } .btn_section { border: 1px solid white; padding: 20px 40px; text-decoration: none; background-color: #191919; color: white; font-family: 'open sans', sans-serif; font-size: 1.33em; l

loops - how progressive calculation in php -

Image
good morning, have problem progressive points tally on sales. when sales person can sell cars in 1 month. many 6 cars on sale 4 pointnya increase. in picture below how make program in php?

C++ Diamond of Doom with external SDK -

i have annoying multiple-inheritance diamond of doom complicated twist (we're talking ms com objects, detail relevant later) - assume abstract class (interface) has pure virtual methods. another abstract class (another interface) b derived , expands more pure virtual methods. class c derived class , implements of abstract methods. class d derived class b, implementing abstract methods both , b. right have 2 classes c, d lot of copy-pasted code (since of required interface resides in class a). i'd avoid having d inherit c, d inherits b, creates classic diamond of doom issue. i know can solved virtual inheritance, here's twist in plot: classes , b com interfaces, defined in sdk cannot modify (i.e. "a.h" , "b.h" read only). inheritance b not virtual , cannot modified. can modify classes c , d, must adhere defined interfaces. i'd appreciate creative ideas on how overcome this. i'm assuming details of question, problem have f

android - Fragment still displayed on screen when back key while refreshing with SwipeRefreshLayout -

i have activity 2 fragments: , b. added on activity. after click button: ft.replace(containerid, b, tag); ft.addtobackstack("a"); ft.commit(); b displayed , removed normally. pull refresh , press while progress loading: // implementation in onbackpressed() .... int backstackentrycount = fm.getbackstackentrycount(); if (backstackentrycount > 0) { fm.popbackstackimmediate(); } .... the problem fragment b still displayed on screen (blank) , overlap fragment a, if again app exit . information b: i implemented swiperefreshlayout on b here b source code: public class b extends myfragment { protected view view; protected listview listview; protected imageview progress; protected textview notiftext; protected layoutinflater inflater; protected ptrbaseadapter adapter; protected swiperefreshlayout mswiperefreshlayout; protected string emptytext; protected boolean fromrest; protected int loads = 0; protected float mpreviousx = 0; protected float mpreviousy =

mysql - get distinct record from table using rowid, rownum from Table -

i've faced 1 question distinct records table without using function rownum, rowid etc. i answered can union putting inner join in inner query , uion outer query. think gave wrong answer. 1 can tell approach can distinct record table or * gave 100% wrong answer.

python - Load objects from text files into datastore/ndb using djangoappengine -

i'm trying port existing webapp2 django. i'm using djangoappengine uses django 1.5 previously while using webapp2, used url handler load objects ndb #webapp2 class migratedata(webapp2.requesthandler): def get(self): listofentities=[] self.loadtagtrend("tagtrend_refine.txt",listofentities) ndb.put_multi(listofentities) def loadtagtrend(self, filename, listofdata): f = open(filename) lines = f.readlines() f.close() line in lines: temp = line.strip().split("\t") data = models.tagtrend_refine( tag = temp[0], trenddata = temp[1] ) listofdata.append(data) return application = webapp2.wsgiapplication([("/migratedata", migratedata),],debug=true) how perform same thing on django? possible run remote shell instead of using url handler? to keep simple, wish find method run .py script readi

loops - How Do I Print Out The Sum Of A Palindrome in Java? -

Image
i having trouble printing out sum of palindrome without using ant string methods , using mathematical methods. have figured out how calculate sum , when try print out sum gives me list of of numbers. example, number 11, output 1 3 6 10 15 21 28 36 45 55 66 i want figure out how print out last number, 66, sum of numbers 1 11 , how make program print out "1 11" since numbers user inputted using scanner method. below code have included output should like. thank much! import java.util.scanner; public class palindrome { public static void main (string args []) { system.out.println("please enter integer > 0:"); scanner keyboard=new scanner(system.in); int palindrome=keyboard.nextint(); int palindrome1=palindrome; int num; int sum; int rev=0; if (palindrome<=0) { system.out.println("sorry, must enter integer greater zero."); } while (palindrome!=0) {

Multicast not being sent to all Docker containers -

i have 3 services defined in docker-compose. 1 of them sends multicast should received other 2 services, 1 of them receives it. 2 receivers in different networks, , sender part of both networks. docker-compose.yml: services: sender: networks: - network_a - network_b receiver1: networks: - network_a depends_on: - sender receiver2: networks: - network_b depends_on: - sender networks: network_a: ipam: driver: default config: - subnet: 172.20.1.0/24 gateway: 172.20.1.1 network_b: ipam: driver: default config: - subnet: 172.20.2.0/24 gateway: 172.20.2.1 receiver1 gets multicast receiver2 doesn't. if remove network_a sender networks field, receiver2 receives message. somehow multicast doesn't work on multiple networks. does know why happens? i'm going answer myself found out problem. the problem isn't docker or related dock

mysql - How to store input given by user in html form in sql using php -

this php code. <html><head> <title>login.php</title> <link rel = "stylesheet" href="login-style.css"> </head> <body> <div class = "container"> <div class = "message"> <?php define('db_name','mydb'); define('db_user','root'); define('db_password',''); define('db_host','127.0.0.1'); $link = mysql_connect(db_host,db_user,db_password); if($link){ die('could not connect:'. mysql_error()); } $db_selected = mysql_select_db(db_name,$link); if(!$db_selected){ die('can\'t use'.db_name . ': ' . mysql_error()); } $value1 = $_post['name']; $value2 = $_post['password']; $sql = "insert account (username,password) values ('$value1','$value2')"; if(!mysql_query($sql)) {die('error'.mysql_error()); } mysql_close(); ?> <h1>thank logging in <

java - Running many thread and Stop thread on Exception -

i have thread (implements runnable) many branch officer call thread branch code. set name of thread branch code. problems are... when exception occurred in running thread - can't stop that. , when try make thread name "exceptionininitializererror" or "outofmemoryerror: java heap space" comes "outofmemoryerror: java heap space" exception comes when 2 or more thread running @ time. public myrunnerclass { //this method called many branch branch code public void executebranchprocess(string branchcode){ thread t = new thread(new exporter(branchcode); t.setname(branchcode); t.start(); } } thread class here public class exporter implements runnable{ private string branchcode; public exporter(string branchcode){ this.branchcode = branchcode; } @override public void run() { try { exportcorner(); } catch (interruptedexception e) { e.prints

java - File not found exception? (Voice recog) -

Image
sorry long question, have been stuck on month, , want provide detail possible...its file not found exception in simple library... :) i getting file not found exception on variances file: i do, however, have variances file: i trying implement voice recognition in background service, can detect when user says word hello (using pocketsphinx). the problem happens in method: createsphinxdir(); here service: @override public void oncreate() { super.oncreate(); setuprecog(); } private void setuprecog() { string sphinxdir = createsphinxdir(); log.v(tag, "about create setup"); if (sphinxdir != null) { try { log.v(tag, "setting up! :)"); mspeechrecognizer = defaultsetup() .setacousticmodel(new file(sphinxdir, "en-us-ptm")) .setdictionary(new file(sphinxdir, "hello.dict")) .setboolean("-allphone

How can a iPad app be used to fill Sharepoint forms -

i have develop ipad (native)app can display sharepoint(2013 or online) forms (aspx forms) , allow app user fill forms when app offline. based on searches, there does not seem way retrieve aspx forms ipad app. there few apps (such filamente, formotus, harmon.ie etc.) seem allow that, although have not tried. i looked @ web services here not find webservice provides forms (although there forms & list web wervice) can let me know how can achieve this? thanks. you on way ! actualy there no api retreive sharepoint forms (except use iframe it's ugly ...) for (in ios) there rest/odata api of sharepoint. you must build own form based on list structure (where want add data). retreive fields of list or content type, can query fieldcollection of list ( getting fields collection ). give structure of list (fields name, type, ....), after can build own form custom logic. you must use rest/odata add/edit/delete items. here tuto microsoft : working lists , list

Control Firefox Download Prompt Using Selenium and Python -

here code : from selenium import webdriver selenium.webdriver.support.ui import webdriverwait profile = webdriver.firefoxprofile() profile.set_preference("browser.download.folderlist", 2); profile.set_preference("browser.download.manager.showwhenstarting", false) profile.set_preference("browser.download.dir", "/home/ripundeep/desktop/python challenges /") profile.set_preference("browser.helperapps.alwaysask.force", false) profile.set_preference("browser.download.manager.alertonexeopen", false) profile.set_preference("browser.download.manager.focuswhenstarting", false) profile.set_preference("browser.download.manager.usewindow", false) profile.set_preference("browser.download.manager.showalertoncomplete", false) profile.set_preference("browser.download.manager.closewhendone", false) profile.set_preference("browser.helperapps.neverask.openfile","text/csv") pr

In a local repo where does git save the files? -

i'm using local git repo, main repo folder stored in network path i can push changes without problems , can see files in repo, when access main folder don't see files i've pushed the files aren't store in main repo? locally? edit: there no .git folder in main repo, that's why i'm questioning files are i think call "main repo" git remote push to. in case guess remote configured "bare", meaning git-internal files stored. missing checked out version of each file. typical git server not need, there no human directly working on files, or other program (besides git) using them. to clarify, internal files stored in .git directory. storage contains previous versions (or differences between versions). based on this, see regular files. bare repository has internal files.

android - How can I show popup window below RecyclerView item? -

Image
how can show popup window below recyclerview item? i should use popupwindow, because menu customized layout see image: showpopupmenu(view); pass view want attach popup? void showpopupmenu(view anchor) { popupmenu popup = new popupmenu(mainactivity.this, anchor); //inflating popup using xml file popup.getmenuinflater().inflate(r.menu.popup_menu, popup.getmenu()); //registering popup onmenuitemclicklistener popup.setonmenuitemclicklistener(new popupmenu.onmenuitemclicklistener() { public boolean onmenuitemclick(menuitem item) { toast.maketext(mainactivity.this, "you clicked : " + item.gettitle(), toast.length_short).show(); return true; } }); popup.show();//showing popup menu } full demo

Opening youTube in iOS not work -

Image
i'm trying create youtube app in app mt source code load webview is: viewcontroller header file: @interface viewcontroller : uiviewcontroller @property (nonatomic, strong) uiwebview *webview; @end viewcontroller implementation file - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. self.webview = [[uiwebview alloc] initwithframe:cgrectmake(0, 0, 300, 200)]; self.webview.layer.borderwidth = 1.0; self.webview.layer.bordercolor = [uicolor redcolor].cgcolor; self.webview.backgroundcolor = [uicolor blackcolor]; self.webview.center = self.view.center; [self.view addsubview:self.webview]; nsstring* embedhtml = @"\ <html><head>\ <style type=\"text/css\">\ body {\ background-color: transparent;\ color: white;\ }\ </style>\ </head><body style=\"margin:0\">\ <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\&

Debayer video with ffmpeg -

looking debayer video ffmpeg. can't find way without piping raw video between 2 instances of ffmpeg, because can't change pixel format of input video "in place" gray bayer_gbrg8. so, command works: ffmpeg -i fr_losslessmovie_png_codec.avi -f image2pipe -pix_fmt gray \ -vcodec rawvideo - | ffmpeg -r 25 -f rawvideo -s 2048x700 \ -pix_fmt bayer_gbrg8 -i pipe:0 -y -pix_fmt yuv420p -b:v 25000k \ fr_debayer_compressed.mp4 i have given source movie pixel format, didn't realize ffmpeg suported bayered pixel formatting. didn't see exact question online, , have not found way change pixel format video filters etc. without ffmpeg thinking i'm trying convert data. want change pixel format existing gray data has been assigned. thanks in advance! andrew i think bayer support added in ffmpeg use mlv demuxer. automatically debayers magic lantern files bayer_rggb16le desired colorspace. way know of debayer video in ffmpeg. support currenly basic. if vid

common lisp - Lexical versus dynamic scope, let form, declare form -

dynamic versus lexical scope. ; 1 expects lexical scope. (let (( '(a))) (defun func1 (x) (setq (cons x (cons (func2 x) a)))) (defun func2 (y) (setq (cons y a)))) (func1 'b) => (b (b a) b a) doing lexically, 1 expect following. substitute (a) a in func2 . func2 called x , i.e. value b . func2 attaches value of a (a) . so (cons y a) evaluates (b a) . (setq (cons y a))) (b a) . so func1 cons (b a) (a) . x consed (b (b a) a)) . end result (b (b a) a) ? contradiction? let try dynamical version. ; dynamic scope (defparameter '(a)) (defun func1 (x) (setq (cons x (cons (func2 x) a)))) (defun func2 (y) (setq (cons y a))) (func1 'b) =>(b (b a) b a) this works expected same in lexical scope? but following not accepted @ all. ; won't work. (let (( '(a))) (defun func1 (x) (declare (special a)) (setq (cons x (cons (func2 x) a)))) (defun func2 (y) (declare (special a)) (setq

html - How to do auto slide for divs -

Image
i have 3 main div movie poster. want 3 div auto slide , want left , right navigation button. how can done? html code <div class="movie-review"> <div class="single-movie"> <img src="style.jpg" width="250" > <div class="description"> <span class="movie_title">movie title</span><hr> <span class="rating">rating:</span> </div> </div> <div class="single-movie"> <img src="rasputin.jpg" width="250" > <div class="description"> <span class="movie_title">movie title</span><hr> <span class="rating">rating:</span> </div> </div> <div class="single-movie"> <img src="spirit.jpg" width="250" > <div class="description"> <span class="movie_title">movie title</span&g

Python - when one integer variable is changed, make the second variable the same -

i have 2 integers x , y equal each other. whenever change x want change reflected in y . how can python? i think can achieved somehow pointing both variables 'memory location' value stored. lists , dictionaries act pointers in python hacky version of you're attempting might this: in [16]: x = y = [0] in [17]: x out[17]: [0] in [18]: y out[18]: [0] in [19]: x[0] = 10 in [20]: y out[20]: [10] in [21]: x out[21]: [10]

asp.net mvc - Passing collection as model without ordered index -

Image
i have list of objects , i'm passing view , rendered properly. when submit form, i'm getting getting same model. works fine. unfortunately, when decide delete dynamically record using jquery, looks after submitting form, i'm getting list 2 first items. it's probably, because indexes arent in natural order (0,1,3 instead of 0,1,2). there fix (not using jquery change inputs, smth server sided)? i've tried change array list or ienumerable still nothing. know pack , send json or read formcollection, i'd ask here first , see if there other solution. you need include input index property allows post non consecutive indexers. value of index must match collection indexer. example for(int = 0; < model.taglist.count; i++) { @html.textboxfor(m => m.taglist[i].name); <input type="hidden" name="taglist.index" value="@i" /> }

javascript - Annotation Google Chart error -

Image
who knows, what's going wrong google annotation charts? doesn't work right now. get uncaught typeerror: cannot read property 'prototype' of null in console. error in google library, not in code. i think google updating annotation chart api testcode: https://jsfiddle.net/lecaoquochung/dsmgl9wj/15/ or google document page https://developers.google.com/chart/interactive/docs/gallery/annotationchart p.s. met same error today (20160229) testcode above (it's runnning yesterday , haven't fixed code. keep updating) uncaught typeerror: cannot read property 'prototype' of null o (anonymous function) e google.a.c.xc google.a.c.oa google.a.oa (anonymous function) update 20160301: google has updated chart package ver 44 google.charts.load('44', {'packages':['annotationchart'], 'language': 'ja'}); testcode: https://jsfiddle.net/dsmgl9wj/17/ (annotation chart version 44)

javascript - Quickblox JS SDK notifyOccupants on dialog creation -

i use code retrieve http://quickblox.com/developers/javascript . my sdk info: /* quickblox javascript sdk - v2.1.4 - 2016-07-19 */ function notifyoccupants(dialogoccupants, newdialogid) { dialogoccupants.foreach(function(itemoccupanid, i, arr) { if (itemoccupanid != currentuser.id) { var msg = { type: 'chat', extension: { notification_type: 1, _id: newdialogid, }, }; qb.chat.send(itemoccupanid, msg); } }); } when execute function returning always: "quickblox.min.js:7 uncaught typeerror: cannot read property 'send' of undefined". someone can help? as said in tutorial , have initialize qb object before can use it. ensure have lines in code: qb.createsession({login: user.login, password: user.pass}, function(err, res) { if (res) { qb.chat.connect({userid: user.id, password: user.pass}, function(err, roster) { and check code inside connect function ca

java - Handling possibility of empty parseInt -

i have string, , extract text between 2 special characters. (my text numbers, example -- hi%773%what -- 773) i use praseint change substring of numbers integer(which successful). where program crashes , burns ( praseint numformat exception) , when string contains no numbers between special characters. my_string = "heyhow$ 98765 $you" works, 98765 , can parseint . my_string = "heyhow$$areyou" runtime error . string str = "heyhow$$areyou"; int startindex = str.indexof('$'); int lastindex = str.indexof('$', i+1); string nums = str.substring(startindex + 1, lastindex); int stringnumber = integer.parseint(nums); <--runtime error cause of no# parse thank in advance help. if have idea not involve using loop or conditional statement best! use instead: int stringnumber = nums.length() > 0 ? integer.parseint(nums) : 0; this parse number if length not zero, otherwise set stringnumber value