Posts

Showing posts from August, 2010

javascript - jQuery css "click" doesn't work after change in selected month in calendar -

this question has answer here: event binding on dynamically created elements? 19 answers i'm working on dynamic calendar allows user click on individual days change whether they're available or unavailable. works it's supposed until select month or year. once happens "click" event on individual cells/days doesn't work. // changes cell background of calendar var changecolor = function(temp) { // if cell background white -> change green if(temp.css('background-color') == "rgba(0, 0, 0, 0)") { temp.css('background-color', 'green'); // if cell background green -> change red } else if (temp.css('background-color') == "rgb(0, 128, 0)") { temp.css('background-color', 'red'); } else { // else change white temp.css('background-color', '');

ios - Is Firebase + Batch a good alternative to Parse in terms of push notifications? -

parse best end push notifications since that'll no more i'm looking free alternative ios app. after research seems using batch api firebase one. want send pictures/video , text user. if not possible or free have other recommendations? should know? thanks help! batch alternative parse push (disclosure: i'm co-founder) product not free obvious reasons. i'll give one: don't want migrate push notifications every year because free service using closing. you can build whole push notifications stack using google cloud messaging can painful , guess want focus on core business. closest analogy email, want setup own smtp server? not. if looking database parse core, firebase candidate and can plugged batch if needed . know, don't provide static file upload method had parse. might have use amazon s3 or (and store files urls in firebase).

sockets - How to read() from clients and a FIFO using select() in C -

i read() clients connected server, , @ same time, let select() aware of data coming fifo. right now, when data written fifo, selects writes data clients keeps returning if "ready-to-read". next read set -1 , errno == eagain . until reaches fdmax. works okay though. but, why keep getting eagain ? , there better way handle this? or proper way? note: i'm passing o_rdwr|o_nonblock can keep read() ing data sent clients , not fifo. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <fcntl.h> #include <errno.h> #define port "9034" int main(void) { fd_set master, read_fds; int fdmax, listener, newfd, sbytes, yes=1, i, j, rv; struct sockaddr_storage remoteaddr; // client address socklen_t addrlen; char buf[256] = {0}, remot

Ruby on rails error with log in -

i changed things in files , when user being created instead of going user/1 going user.1. idea why happening? below print of log extract. thanks, started "/user.113" 95.45.98.59 @ 2016-04-18 23:39:53 +0000 actioncontroller::routingerror (uninitialized constant usercontroller): activesupport (4.2.2) lib/active_support/inflector/methods.rb:261:in const_get' activesupport (4.2.2) lib/active_support/inflector/methods.rb:261:inblock in constantize' activesupport (4.2.2) lib/active_support/inflector/methods.rb:259:in each' activesupport (4.2.2) lib/active_support/inflector/methods.rb:259:ininject' activesupport (4.2.2) if you're using route helper method, , want route url specific resource, make sure call resource_path(resource) , not resources_path(resource) . note singular/plural distinction in route method. if understand question correctly, controller should this; class userscontroller < applicationconroller # ... def create

How to Code Quality on EXCEL VBA Code in SonarQube or Alternatives? -

we've have codebase vba/excel. sonarqube plugin can analyze vba inside excel or outside text file. can copy vba .vba text file if possible. if not there other tool can perform code quality on these languages. sonarsource provides commercial plugin visual basic 6 . may work vba if syntax same.

loops - Advanced (maybe) selection rule for lists in Python -

given list list_ = [a,a,b,b,b,a,b,a,b,b,...,b] and 2 other lists l_a = [v1,v2,...,vn] l_b = [w1,w2,...,wn]. the first element of list_ " a ". remaining elements can mixed between being " a " , " b " in random way. now, starting first element in list_ (which "a"): take elements l_a until hit " b " (in case: [v1, v2]). form " v1+v2 " key dictionary (the corresponding value in step 2. below). our current key. take elements l_b until hit "a" (in case [w1,w2,w3]). store " w1 + w2 + w3 " value under current key. repeat . of course, there lot of loop stuff going on tried, gets difficult bookkeep , makes me think there better way nesting loops. question: so, put, how do in efficient way? thank you maybe give ideas. what want group repeated items (itertools.groupby great that) remove items head of list (you leave lists alone , maintain index of current position , slicing). im

Squid Proxy with Authentication Not Returning A Response -

i trying set proxy server using squid interfaces outside server authentication. have configured , set squid , program carry out authentication, when attempt test no response - not error or ok response or @ all. we haven't tested proper authentication outside server, have list of usernames on file testing should return response. have tested authentication program servers on commandline on server, , returns correct response, suspect problem squid.conf file, we're sure correct configuration. here relevant squid.conf; auth_param basic program /path/to/authclient/dist/build/authclient/authclient auth_param basic realm proxy acl ip1 src address1 #ommitting actual ip addresses these correct ones. acl ip2 src address2 acl authdetails proxy_auth required acl safe_ports port 1-65535 http_access !safe_ports http_access allow authdetails ip2 http_access deny http_port proxy.ip.address.here:3128 # code below enable inserting banners users websites - not relevant i'm

angularjs - Connection refused on heroku using generator-sql-fullstack -

you last chance here. i've build project generator-sql-fullstack package , trying deploy heroku. unfortunately, can't connect heroku database error r10. i've tried different ways connect postgres through sequelize - none of them worked. main thing make ssl compatible, still doesn't connect (or maybe using wrong) project runs great locally, app build without errors also. please, take heroku logs , main files connection. hopefully, able me here. thank you. $ heroku logs 2016-04-18t21:27:36.994697+00:00 app[web.1]: > node server/app.js 2016-04-18t21:27:36.994705+00:00 app[web.1]: 2016-04-18t21:27:37.784886+00:00 app[web.1]: express server listening on 55648, in production mode 2016-04-18t21:28:34.891786+00:00 heroku[web.1]: error r10 (boot timeout) -> web process failed bind $port within 60 seconds of launch 2016-04-18t21:28:34.891786+00:00 heroku[web.1]: stopping process sigkill 2016-04-18t21:28:35.750471+00:00 heroku[web.1]: process exited status 137

asterisk - Which options are there for ip phone provisioning servers? -

i'm new voip phone provisioning , configuration please bare me. i want know options exist provision (configure) multiple voip phones multiple vendors use asterisk server. i'd kind of interface manage extensions, configuration templates , on. here's found far: freepbx has commercial module called endpoint manager seems want. however, don't idea of having run web server on same machine (or container) runs asterisk. seems bad idea increases attack surface of asterisk server. rather have endpoint manager on separate server (or container) can't find information running or buying endpoint manager outside of freepbx. phonism advertises "cloud based ip phone provisioning , management system. service looks promising, number of supported phones lower , i'm not sold on requiring internet connection configure phone extensions in office. all other solutions found tied complete proprietary voip solution ( 3cx , kerio , etc.) or particular voip phone vendor

python - Get AWS Account ID from Boto -

i have aws_access_key_id , aws_secret_key. these active credentials, belong active user, belongs aws account. how, using boto3, find id of aws account? the accountid can grabbed get-caller-identity sts function. returns "account" field: client = boto3.client("sts", aws_access_key_id=access_key, aws_secret_access_key=secret_key) account_id = client.get_caller_identity()["account"]

html - jQuery Horizontal Scroll to DIV on Click -

i have parallax setup user can scroll down when on landing of site. once scroll down, can scroll across different pages. i have tried using jquery code: $("#scrollto").click(function() { $('html, body').animate({ scrolltop: $("#page2").offset().top }, 2000); }); i want make when user clicks button scrolls across or horizontally second page "view2". system not seem work. here fiddle: https://jsfiddle.net/qm7s60ud/1/ the animate should on .wrapper class since element has overflow. .wrapper { height: 100%; background-color: gray; overflow: auto; //overflow causes div have scroll bar } and instead of scrolltop , .offset().top , ( because vertical ) it should be scrollleft , .offset().left .. ( this horizontal ) working demo

Upload images gallery to wordpress with python-wordpress-xmlrpc -

okay have created script in python using "python-wordpress-xmlrpc" package able except uploading multiple images wordpress , adding them gallery. here code upload single image file , set feature image: fileimg = urlopen('image_url') imagename = fileimg.url.split('/')[-1] imagetype = mimetypes.guess_type(str(fileimg.url))[0] data = { 'name': imagename, 'type': imagetype, } data['bits'] = xmlrpc_client.binary(fileimg.read()) response = client.call(media.uploadfile(data)) attachment_id = response['id'] widget.thumbnail = attachment_id note: know how upload multiple files don't understand how add images in product gallery.

python - Slicing and arranging dataframe in pandas -

i want arrange data data frame multiple dataframes or groups. input data id channel path 15 direct a1 15 direct a2 15 direct a3 15 direct a4 213 paid b2 213 paid b1 2222 direct as25 2222 direct dw46 2222 direct 32q 3111 paid d32a 3111 paid 23ff 3111 paid www32 3111 paid 2d2 the desired output should like id channel p1 p2 213 paid b2 b2 id channel p1 p2 p3 2222 direct as25 dw46 dw46 id channel p1 p2 p3 p4 15 direct a1 a2 a3 a4 3111 paid d32a 23ff www32 2d2 please tell way can achieve it. thanks i think can first create helper column cols cumcount , pivot_table . need find length of notnull columns (substract first 2) , groupby length . last dropna columns in each group: df['cols'] = 'p' + (df.groupby('id')['id'].cumcount() + 1).astype(str) df1 = df.pivot_table(index=['id', 'channel'],

c# - Which is better checking of null types or using Any() in LINQ? -

i have 2 codes , have know better use. i'm thinking same. if i'm not mistaken, first has 1 call database, however, don't know if checking of repo != null right. (1) var repo = repository .query() .where(ur => ur.customerid == customerid) .singleordefault(); if (repo != null) { // update repo repo.name = "name here"; } else { // code } (2) var repo = repository .query() .any(ur => ur.customerid == customerid); if (repo) { var result = repository .query() .where(ur => ur.customerid == customerid) .single(); result.name = "name here"; } else { // code } the second option finds 1 element 2 times. here repository .query() .any(ur => ur.customerid == customerid) and here repository .query() .where(ur => ur.customerid == customerid) .single() and first option finds 1 time. reason choosing first option. , also, can make code better: var repo = reposito

mysql - link to specific user profile php -

i'm creating search bar feature on website user can search users using name.the search result may come multiple users similar names (ex. if search "jenna", database may have multiple users name "jenna" multiple results show).i want user able click on 1 of profiles , see specific "jenna's" user profile. kind of twitter, can search accounts , view different profiles. right have code returns search , makes search result clickable link. however, when try save user id, saves latest user id. home.php (where search bar users is0 <form method="get" action="search.php" id="searchform"> search users: <input type="text" name="search_user" placeholder="enter username"> <input type="submit" name="submit" value="search"> </form> search.php (prints out users name user searching for) session_start(); $user = ''; $pas

sql - Hive Script, DISTINCT with SUM -

Image
i trying distinct , find count of teams player played in single season , number of teams played for. tripping me , ofcourse have sample down below(2nd) one. first ones failed attempt select o.id,o.year,count(distinct(o.team)) b join (select id, year, team batting group id,year,team order id desc limit 25) o 0.id =b.id; select id, year, team batting group id,year,team order id desc limit 25; produces ignore ^a, think represent either space or comma, column seperatpr get count of teams each player each year , order count desc,get 1 row select id, year, count(distinct(team)) batting group id,year order count(distinct(team)) desc limit 1;

ios - Text selected without showing the pins -

Image
is there way programmatically select text without showing pins @ beginning , @ end of selected text? example: although should more precise, presume want highlight parts of text background color. therefore can use nsattributedstring . you can how create attributed string here , how use background color on here .

java - There was an unexpected error (type=Not Acceptable, status=406) for Spring @RestController, spring-boot -

i'm trying return xml @restcontroller method - @restcontroller public class mcscontroller { . . @requestmapping(value = "/encoders", method = { requestmethod.get }, produces = { mediatype.application_json, mediatype.application_xml }) public list<encodervo> getencoders() { list<encodervo> encoders = null; try { encoders = infoservice.listencoders(); } catch (mcsexception e) { logger.error("error in listing encoders : " + e.getmessage()); } return encoders; } here encodervo.java - @xmlrootelement public class encodervo { @xmlelement private long id; @xmlelement private string name; @xmlelement private boolean flagactive; public encodervo() { } public encodervo(long id, string name, boolean flagactive) { super(); this.id = id; this.name = name; this.flagactive = flagactive; } public long getid() { return id; } public void setid(long id) { this.id = id; } public strin

dictionary - to check if a file belongs to a class in python -

i have 5 classes, namely: earn acq money fx crude i have list of 20000 files, , have document "topics.txt", of form: earn~6~7~4 grain~9~1~2~12 money~4~29 and on.. numbers correspond filename, , words correspond classes. i need print files falling under classes have mentioned,i.e; "earn","acq","money","fx" , "crude" ex output: (earn-6.txt,7.txt,4.txt) (acq-5.txt) and on.. i able print available classes in "topics.txt", want print 5 particular ones. import collections import sys sys.stdout=open('dicti1.txt','w') open('topics.txt') f: d = collections.defaultdict(list) line in f: value, *keys = line.strip().split('~') key in filter(none, keys): d[key].append(value+".txt") in d.items(): print(i) unless i've misunderstood problem, working hard. suggest not overwriting sys.stdout . try this

ruby on rails - Adding class to link_to causes error -

i have sign facebook text link in app. tried add class text link turn button. in rails it's written display text. = link_to_session so, rule added following = link_to_session 'sign up', class: 'button button-primary' but gave me error... wrong number of arguments (2 0) how fix this...? thank time! update sorry.. i'm not quite sure at... i looked @ session controller , in controller following written... class sessionscontroller < applicationcontroller def create auth = request.env["omniauth.auth"] user = user.find_by_auth(auth) if user.blank? if session[:user_id].present? # via token user = user.find(session[:user_id]) user.definitive_by(auth) else # new user user = user.find_or_create_by_auth(auth) end else user.token = auth.credentials.token user.save! end session[:user_id] = user.id redirect_to root_url end def create_v

javascript - Populate the dropdownlist from a specfic year to current year -

i'm creating dropdownlist of year. how can automatically populate dropdownlist? for example, adding dropdown value 1980, can use jquery populate current year, not need type year? it's simple using loop , adding string like: var nowy = new date().getfullyear(), options = ""; for(var y=nowy; y>=1980; y--) { options += "<option>"+ y +"</option>"; } $("#years").append( options ); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <select id="years"></select> https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/date/getfullyear http://api.jquery.com/append/

java - using map in pojo object not mapping the request -

i creating restful apis. doing @post call , request body below: { "user": "test1", "animals": { "cat": "3", "dog": "5", "cow": "10" } } service : @path("/saveownerdata") @post @produces({ "text/html", "application/json", "application/text" }) public response saveownerdata(ownerdata ownerdata) { //save db } entity object: @xmlrootelement @entity(value = "ownerdata", noclassnamestored = true) public class ownerdata { @id private string _id; private string user; private map<string, string> animals; public string get_id() { return _id; } public void set_id(string _id) { this._id = _id; } public string getuser() { return user; } public void setuser(string user) { this.user = user; } public map<string, string> getanimals() { return animals; } public

r - Auto update my dateRangeInput at shinyR UI -

my shinyr app using daterangeinput selector default values of date range between yesterday , 15 days ago , when app running more on day , wish default date range update accordingly , know @ server side invoke invalidatelater , have no idea can done @ ui side of app , daterangeinput @ ui side looks : daterangeinput('daterange',label = 'date',start = sys.date() - 15, end = sys.date()-1) okay, not sure why want on client side, there way. can add javascript on client construction invalidatelater do. gets more confusing server side version. code below: library(shiny) ui <- shinyui(fluidpage( daterangeinput('daterange',label = 'date',start = sys.date() - 15, end = sys.date() - 1), tags$script(html(" $(document).ready(function() { var initdate = new date(); setinterval(function() { var currentdate = new date(); if(currentdate.getdate() != initdate.getdate()) { initdate = currentdate

Smooth scroll recyclerview android -

i have recyclerview contains ratingbar in list_items.xml on completion of rating of 1 item in recyclerview scroll item of recyclerview automatically the scrolling fast , user couldn't know scrolled. i implemented smooth scroll , not working properly, first scroll of 2nd item smooth (1st displayed ), other items scroll fast linearlayoutsmoothscroll.java public class linearlayoutsmoothscroll extends linearlayoutmanager { private static final float milliseconds_per_inch = 100f; private context mcontext; public linearlayoutsmoothscroll(context context) { super(context); mcontext=context; } public linearlayoutsmoothscroll(context context, int orientation, boolean reverselayout) { super(context, orientation, reverselayout); mcontext=context; } public linearlayoutsmoothscroll(context context, attributeset attrs, int defstyleattr, int defstyleres) {

javascript - jquery scrolling function not working properly -

i'm using code change position when scroll. problem when scrolled top of page css top:'0px' not working. here code. window.onload = function() { var stickysidebar = $('.bk-form-wrap').offset().top; var $div = $('div.bk-form-wrap'); $(window).scroll(function() { if ($(window).scrolltop() > stickysidebar) { $div.css({ position:'fixed', height: '70px' }); $div.animate({ top: '95px', //top:'100%', // margintop: - $div.height() }); } else { } if ($(this).scrolltop() == 0) { //call event here $div.css({ position:'relative', }); $div.animate({ top:'0px', }); } }); }; and link page . plese help. thanks.

spring - Wrapping Oauth2 response -

how modify oauth2 response: existing: { "access_token": "25313d2c-3d24-429c-ab42-39f712aa7d8f", "token_type": "bearer", "refresh_token": "da9d14c5-32aa-44c1-8c64-83244b85e150", "expires_in": 27843637 } requirement : { "success":true, "access_token": "25313d2c-3d24-429c-ab42-39f712aa7d8f", "token_type": "bearer", "refresh_token": "da9d14c5-32aa-44c1-8c64-83244b85e150", "expires_in": 27843637 } same while authentication problem comes: existing: { "error": "invalid_grant", "error_description": "bad user credentials." } requirement: { "success":false, "error": "invalid_grant", "error_description": "bad user credentials." } or may cust

php - How would you implement private images? -

i'm developping app in android somehow has avatars whatsapp do. know, in whatsapp can create group, , set group picture it. i don't have problems on taking image, saving, etc. problem have i'm developing webservice in symfony2 (php) , want receive image , save somewhere on server. however, images not public , should viewed users permissions. i've thought traditional method: saving image on folder , giving link or not, totally easy hack. so guys, how this? maybe saving binary data mysql directly? there clean way achieve this? any tips appreciated. thanks. another answer set mime type of php call image. call url http://xxx/images.php?id=8989031289130 return image instead of html file. you have access php security context , can validate whether user has permissions view file. there more details at: setting mime type in php

javascript - How do I change color of a text after clicking on it using jquery? -

i trying hard change text color after clicking on not getting success. there 7 labels :- 1 question, 4 answer options, 1 correct answer , last 1 explanation. when click on 1 option should match correct answer , change color of text i.e. if answer wrong color of text should turn red , if answer right turn green. but when click on option changing red color , when click on option correct according correct answer turn red instead of green. can't figure out why ? have @ code. show me making mistake , solution. the jquery changing color between line number 48 , 82 <%@ page language="c#" autoeventwireup="true" codefile="test.aspx.cs" inherits="student_test" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.8.3/themes/base/jquery-ui.css

c# - Lambda .Where limitation to string -

i have method: public list<object> getthings(list<guid> listofguids) { var query = servicecontext.xrm.crmentity; bool anytypeofsearch = false; // use know if have applied search criteria. if(listofguids != null && listofguids.count > 0) { query = query.where(x => listofguids.contains(x.lgc_muncipalityid.id)); anytypeofsearch = true; } var result = new list<object>(); if(anytypeofsearch) // instead of variable here, can check if there whereconditions applied query? result = query .select(x => new suppliersearchresultmodel() { id = x.id, name = x.lgc_name, }) .tolist(); logmessage("getthings.query", <insert code query.where condition tostring()>); return result; } in real code there several different if structures .where conditions in them , call can reach code without parameters. in cas

dns - Using MX Records to Forward Email to Another Domain -

i have domain hosted @ dreamhost -- foobar.com. has google apps associated it: 50 free email accounts no longer available new domain. got domain -- foobar.edu. want foobar.edu become main domain, still want use free google apps associated foobar.com handle incoming mail. my question: can adjust mx records of foobar.edu incoming messages anyone@foobar.edu redirected anyone@foobar.com , handled google apps? i can adjust dns both foobar domains, don't think can ask google's foobar.com account handle foobar.edu emails directly. thank you! if need catch email on domain , forward other mailbox, can use http://improvmx.com/ bu adding mx records domain

indexing - Excel: Index Match using criteria, show unique values? -

i trying create calendar in excel. have sheet 1 contains calendar template so: april 8 april 9 april 10 april 11 april 12 subjecta subjectd subjectg subjectj subjectk descriptiona decriptiond descriptiong descriptionj desc k subjectb subjecte subjecth descriptionb descriptione descriptionh subjectc subjectf subjecti descriptionc descriptionf descriptioni i have rows of data in sheet 2 so: id date subject description 1 08/04/2016 subjecta descrptiona 2 08/04/2016 subjectb descriptionb 3 08/04/2016 subjectc descriptionc 4 09/04/2016 subjectd descriptiond 5 09/04/2016 subjecte descriptione 6 09/04/2016 subjectf descriptionf 7 10/04/2016 subjectg descriptiong 8 10/04/2016 subjecth

how to echo posted JSON data in php -

i trying display data in php echo not why displays nothing when it. $data = json_decode(file_get_contents("php://input")); $code = mysql_real_escape_string($data->code); $name = mysql_real_escape_string($data->name); mysql_connect("localhost", "root", "thanh03021986") or die(mysql_error()); mysql_select_db("erp") or die(mysql_error()); echo $name; mysql_query("insert element(`code`, `name` ) values('".$code."','".$name."')"); it obvious $name has value when posted echo display nothing. also, how can convert php data use?

c# - Bouncy Castle's X509V3CertificateGenerator.SetSignatureAlgorithm marked obsolete. What do I do? -

i trying create self-signed trusted certificate. using bouncy castle nuget, , answer on this question . code on page: public static x509certificate2 generateselfsignedcertificate(string subjectname, string issuername, asymmetrickeyparameter issuerprivkey, int keystrength = 2048) { // generating random numbers var randomgenerator = new cryptoapirandomgenerator(); var random = new securerandom(randomgenerator); // certificate generator var certificategenerator = new x509v3certificategenerator(); // serial number var serialnumber = bigintegers.createrandominrange(biginteger.one, biginteger.valueof(int64.maxvalue), random); certificategenerator.setserialnumber(serialnumber); // signature algorithm const string signaturealgorithm = "sha256withrsa"; certificategenerator.setsignaturealgorithm(signaturealgorithm); // issuer , subject name var subjectdn = new x509name(subjectname); var issuerdn = issuername; certificategenerator.setissuerdn(issuerdn); certificategenerator.s

Android view background color in runtime -

i set background color of views in run-time (i'm getting color server request). these views have default color, , if color server change @ once. there way happen automatically setting parameter, or way can calling setbackground each of views. thanks create every view type class extends corresponding class( bkgedittext extends edittext or bkgview extends view ) , change background color custom 1 in constructor. way, view have desired color when added xml or code.

c# - A timeout was reached (30000 milliseconds) while waiting for the service to connect -

can 1 please check doing onstart correct or not please. getting error service started , stopped automatically. want run service every 10 minutes. please been 4 hours struggling protected override void onstart(string[] args) { try { _atimer.start(); _atimer.enabled = true; _atimer = new system.timers.timer(10 * 60 * 1000);//10 minutes _atimer.autoreset = true; _atimer.elapsed += new system.timers.elapsedeventhandler(_atimer_elapsed); } catch(exception ex) { rmlogger.rmexception("servicemanager", this.gettype().name.tostring(), ex.tostring()); } } i think have things little confused here. i want run service every 10 minutes. but timer starting run every 10 minutes while service continually running. either mean way , want start service every 10 minutes, in case use task schedule

Haxe: Null object pattern for iterables -

i'd implement null object design pattern iterable class. example if internal array isn't initialized, wrapper class anyway returns empty iterator doesn't break main logic: public function iterator():iterator<t> { // ...of cause doesn't work, because iterator typedef not class return mlist != null ? mlist.iterator() : new iterator<t>(); } var mlist:array<t>; should instantiate static empty dummy array desired type of items or else implements iterator interface contains nothing? or may there more straight solution? you check @ forehand in object class itself, adding kind of isempty function: public function isempty():bool { return mlist == null || mlist.length == 0; } then use this: if(!iter.isempty()) { for(i in iter) { trace(i); } } example: http://try.haxe.org/#8719e or you use dummy iterator this: class nulliterator { public inline function hasnext() return false; public inline function next() re

How to convert string into array of objects in javascript? -

i have data shown below of string type "[ { name: "robert baratheon", birthday: "12/02/1965" }, { name: "daario naharis", birthday: "12/02/1985" }, { name: "viserys targaryen", birthday: "12/06/1984" } ]" i want convert array of objects, when use json.parse or eval giving me this [object, object, object] but don't want this, want remove double quotes can access array. [ { name: "robert baratheon", birthday: "12/02/1965" }, { name: "daario naharis", birthday: "12/02/1985" }, { name: "viserys targaryen", birthday: "12/06/1984" } ] when use json.parse(string) in fact parse string of json object. in case, array of objects. you can access object via var mylist = json.parse(string) mylist[0] //this give first item in l

html - Get <tr> value from id with jquery -

<table cellpadding="0" cellspacing="0" border="0" class="display" id="example" > <thead> <tr> <th>project code</th> <th>project name</th> <th>project ref id</th> <th>effective date</th> <th>close date</th> <th>last update date</th> <th>creation date</th> <th>created by</th> <th>last update by</th> <th>action</th> </tr> </thead> <tbody> <?php //error_log(print_r($project,false)); for($i=0;$i<count($project);$i++) { ?> <tr class="project_id" value="<?php echo $project[$i] ['project_id']; ?>"> <td><?php echo

javascript - Using $state.go() with onResume() -

i trying redirect login page each time application comes background foreground error : uncaught typeerror: $state.go not function so did wrong, can't what. here parts of code in app.js : // ionic starter app angular.module('starter', ['ionic', 'starter.controllers', 'starter.services']) .config(function($stateprovider, $urlrouterprovider) { $stateprovider .state('resetlogin', { url: '/resetlogin', templateurl: 'templates/resetlogin.html', controller: 'resetloginctrl' }) .state('login', { url: '/login', templateurl: 'templates/login.html', controller: 'loginctrl' }) .state('tab', { url: '/tab', abstract: true, templateurl: 'templates/tabs.html' }) .state('tab.account', { url: '/account', views: { 'tab-account': { templateurl: 'templates/tab-account.

javascript - Babylon JS - SceneLoader from Local File -

new babylon js user, looking speed fantastic framework. have had play sandbox , online editor, worked own coded model scratch using standard components - box, sphere etc. question relates how more complex custom geometry loaded. comfortable 3d cad - stl/obj files, got exports going blender .babylon format import great babylon's online sandbox & editors. however, can't seem sceneloader going read file local c:/ drive. code extract below: // create new babylon scene var scene = new babylon.scene(engine); // change scene background color scene.clearcolor = new babylon.color3(1, 1, 1); // create , positions free camera var camera = new babylon.freecamera("camera1", new babylon.vector3(0, 10, 0), scene); // target camera scene origin camera.settarget(babylon.vector3.zero()); // attach camera canvas camera.attachcontrol(canvas, true); // define built-in 'box' shape. var box = babylon.mesh.createbox("sphere1", 1, scene); // define 'gro