Wednesday, 15 May 2013

c++ - CComBSTR memory leak and assignment -



c++ - CComBSTR memory leak and assignment -

i debugging old c++/com code without having much com experience.

is right code below leak (the empty string lost)? is right , safe assign value of ctext myccombstr in way?

code:

tchar ctext[max_path] = {0}; ccombstr myccombstr(l""); functionthatfillsdataintextbuffer(&ctext[0]); myccombstr = ctext; // empty string leaked?

when assign array ccombstr free holding, can in header see how things implemented:

ccombstr& operator=(_in_opt_z_ lpcolestr psrc) { if (psrc != m_str) { ::sysfreestring(m_str); if (psrc != null) { m_str = ::sysallocstring(psrc); if (!*this) { atlthrow(e_outofmemory); } } else { m_str = null; } } homecoming *this; }

c++ memory-leaks com

Is RDF/OWL a representation or the database? -



Is RDF/OWL a representation or the database? -

the rdf defined representing info related semantic web , info exchange on web. used database. so, rdf ?

the owl similar rdf, why rdf used in database , not owl ?

asking rdf exclusively broad of question, there a lot in regard. i'll effort briefly reply specific question.

an rdf database, graph database, stores rdf graph can utilize sparql query. rdf isn't the database, it's info model.

owl has mapping rdf, generally, used define logical constructs reasoner can utilize infer new info existing data. rdf databases include reasoner can take advantage of owl, serialized rdf, perform reasoning either @ query time, or eagerly during info updates, expose new, inferred information, users via sparql.

database rdf semantic-web owl

java - Why Spring throws exceptions when No default constructor is found -



java - Why Spring throws exceptions when No default constructor is found -

a simple test shopping application have 2 classes clothing , offers. on calling formalshirt bean, throws next exception

caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'diwalioffer' defined in class path resource [spring.xml]: instantiation of bean failed; nested exception org.springframework.beans.beaninstantiationexception: not instantiate bean class [offers]: no default constructor found; nested exception java.lang.nosuchmethodexception: offers.<init>()

now if comment offers constructor, app runs successfully. query why spring looks default constructor when there constructor?

clothing class

public class clothing { private int price; private list<offers> offer; public void setoffer(list<offers> offer) { this.offer = offer; } public void setprice(int price) { this.price = price; } }

.

offers class

public class offers { private int discount; private string promocode; public offers(int val1, string val2) { this.discount=val1; this.promocode=val2; } //public offers(){} /*default constructor added due spring exception in below */ /* caused by: org.springframework.beans.beaninstantiationexception: not instantiate bean class no default constructor found */ /* caused by: java.lang.nosuchmethodexception: com.test.shopping.offers.<init>() */ public void setdiscount(int discount) { this.discount = discount; } public void setpromocode(string promocode) { this.promocode = promocode; } }

spring.xml

<bean id="formalshirt" class="com.test.shopping.clothing"> <property name="price" value="800"></property> <property name="offer"> <list> <ref bean="diwalioffer" /> </list> </property> </bean> <bean id="diwalioffer" class="com.test.shopping.offers"> <property name="discount" value="10"></property> <property name="promocode" value="diwali"></property> </bean>

you need alter spring xml configuration of offers to:

<bean id="diwalioffer" class="com.test.shopping.offers"> <constructor-arg value="10"></constructor-arg> <constructor-arg value="diwali"></constructor-arg> </bean>

the way have configured it, spring first attempts phone call default constructor , phone call setters. of course of study there no default constructor, , there fore spring reports exception.

another alternative if using spring 3+ utilize java config, instead of xml config. have

@configuration public class appconfig { //add other beans @bean public offers diwalioffer() { homecoming new offers(10, diwali); } }

in case java config has benefit configuration not compile if didn't phone call constructor, ie. fail instead of fail late xml configuration

spring extremely flexible how creates beans, need declare how done

java spring

Get running python server IP address in Javascript -



Get running python server IP address in Javascript -

i have python flask app running on server:

if __name__ == '__main__': port = int(os.environ.get("port", 6600)) app.run(host='0.0.0.0', port=port)

and have js script getting info app, don't want alter manually th ip or domain in js script every time deploy or alter domain i'm asking there way js know ip or hostname of python app ? here's structure: index.py <= main app static **index.html **script.js

thanks

register domain name , stick it. utilize domain name in javascript and/or config.

make sure registrar provides interface updating "a record" (ip address) , point @ server. whenever alter ip address, update record domain.

javascript python flask

c# - DataTable HTML in Add Rows new object[] -



c# - DataTable HTML in Add Rows new object[] -

i created datatable , adding new rows new object[].

datatable dt = new datatable(); dt.rows.add(new object[] { "hello", "world", "<i>test</i>" });

in object[] array got values shown in datatable.

i add together html styling, possible above? have test shown italic.

thanks in advance.

the datatable stores data, it not responsible format or styling. depends on want diplay it, if it's asp.net-gridview utilize rowdatabound event. httputility.htmldecode should work prevent html encoded:

protected void gridview1_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { e.row.cells[0].text = server.htmldecode(e.row.cells[0].text); } }

c# html asp.net gridview datatable

css - twitter bootstrap align tables side by side -



css - twitter bootstrap align tables side by side -

is there anyway can lineup tables side side in twitter bootstrap, want accomplish this:

thank much in advance!

never mind googled span* class in twitter bootstrap depreciated , replaced col-md-* function , it's other counterparts.

i have solved problem wrapping 2 tables in

<div class="col-md-*">

i have used first table:

<div class="col-md-3"> <table>....</table> </div>

and sec table

<div class="col-md-9"> <table>....</table> </div>

css twitter-bootstrap asp.net-mvc-4

sql - Huge amount of updates and postgresql -



sql - Huge amount of updates and postgresql -

currently have situation, makes me scared. have 20k rows in db, isn't 1% of data, have in next 3 months. each row represents object(let's phone call object1) data. also, have table stats each object1, let's phone call object1stats, located in mongodb. have object1stats each day, get, example, total stats, should sum every object1stats object1.

the problem is: need have info precalculated. example, display user, ability sort object1 collection stats. load , sort in code, with, example, 5 millions object1, expensive.

so, came thought of precalculating stats each hour(object1stats updated twice in hour), each object1. process makes me afraid of time need perform everything... should take each object1, send query mongodb sum object1stats, create sql update object1. repeat at least 3 1000000 times.

i have 2 bottlenecks here: calculation of sum(mapreduce) in mongodb , sql update queries in postgre. can't speedup mapreduce now(i assume good), i'm thinking sql updates.

any thoughts or suggestions? take anything, suggestions utilize different db or approach.

also, can't add together new stats info object, because lastly day stats can changed often, , previous days stats can changed too.

some ideas on postgresql end:

use copy load fresh info temporary table, update objects single query. it's faster issuing every update separately. see this answer. (if driver allows it, besides re-create , multi-valued insert options there's alternative pipeline).

keep updated part of object (the stats) in separate table.

if sure all objects updated, might want load updated stats copy , switch tables (drop table stats; alter table new_stats rename stats).

if, on other hand, updating stats in well-defined batches (e.g. first update stats of objects 1..99999, update stats of objects 100000..199999, , on), might partition stats table according these batches.

another angle load stats straight mongodb, on demand, using foreign table wrapper. might want utilize stored procedure accessing stats cache stats in local table. updating stats paramount truncating cache. downside of approach postgresql issue separate mongodb request every stat fetches, if queries need touch lot of stats approach might worse hourly batch update.

yet way create mongodb "river", driver force stat changes postgresql occur in mongodb. way you'll pay use, updating postgresql objects indeed changed in mongodb. load less rough. imo preferred way, don't know how hard create "river" driver.

p.s. here's blog post using notify update es: http://evol-monkey.blogspot.ru/2014/08/postgresql-and-elasticsearch.html

sql database mongodb postgresql optimization

Advanced authorisation and API in PHP -



Advanced authorisation and API in PHP -

what want accomplish have application consume own api. more changing architecture hmvc this:

clients model model files controllers api.php -option consume api straight json clients.php - consumes info straight api - same if had called model view

with controller getting info 'api' section straight - avoiding 2 major hurdles:

a) passing json encoded info api controller controller (just save on minor over-head of encoding/decoding it)

b) more importantly not having check access token on every request ensure application allowed access information.

i have next scenarios:

a user logged scheme , wants consume api - send valid access token

a user logged scheme - navigates api page not provide access token should redirected controller section / 404 page.

a user not logged in our scheme has authorisation token can utilize api.

a user / isnt logged in provide wrong access token should receive invalid token message.

the solution have ended works fine seems 'spaghetti' code!

i have extended authorisation (ion_auth) class follows:

class authentication extends ion_auth { public $application = false; }

and in controllers have

$this->authentication->application = true;

in __construct:

finally within api controller have:

private $application = false; public function __construct() { $this->token = $this->input->get_post('token'); parent::__construct(); if($this->authentication->application == true){ $this->application = true; } //api should have token set before can happen, every request if($this->token){ //check token valid if (!$this->checktoken($this->token)){ $this->error('token did not match'); } //all clear if here - token matched }else{ //no token found //ok have no token - user logged in? if not trying utilize api haven't set token in request. if (!$this->authentication->logged_in()){ $this->error('no token sent'); }else{ //user logged in , might have gone page error if(!$this->application){ echo "you shouldn't here"; //this replaced redirect exit; } } } //all cases passed , application can go on - have flag of $this->application set allow decide whether 'return' info array / object or (if false i.e. api) json encode info consumption. }

with function:

private function sendit($data){ if($this->application){ homecoming $data; }else{ $this->output ->set_content_type('application/json'); echo json_encode($data); exit; } }

that used in lieu of 'return' ensure info used application used in right format, whereas api info json encoded.

usage:

return $this->sendit($clients);

this functions fine said not seem succinct. can offer suggestions how can i.e. fit rules above without having set variable within each controller?

for clarity folder construction follows:

clients models controllers - client - api views jobs models controllers - jobs - api views

the thought beingness navigating site/clients results in info beingness pulled api page straight without needing access token - navigating 'site/clients/api' results in either redirect (if logged in) 'no token' error (if not logged in) or 'wrong token' error if either logged in or not logged in wrong token has been passed.

i stuck here , have 600 hundred controllers don't want have more once!

final points

i cannot utilize class name nor url identify api beingness called straight don't want have set rule on each page different, current solution @ to the lowest degree offer cutting , paste solution!

edit

thanks halfer - couldn't reply in comments here edit address comments , add together clarity them

$this->authentication->application

is trigger see if request internal - should '$is_application'.

it boolean set false within authentication module (which runs before controllers)

it set false within authentication module.

then if controller within application calls api controller module (which consuming within own application) sets flag true

i utilize 'flag' 2 things:

set output type -> 'return' if application requests info or 'json' if requested straight api page. decide if access token api needs nowadays - if application requests info api internally no access token required - if accessed straight url access token required.

i have ammended construction @ top improve explain how modules layed out.

navigating site/clients automatically looks clients.php file within controller.

navigating site/clients/api navigates clients controller folder - api file.

the controller @ sites/clients consumers info , sends info site/clients/api - , api communicated database.

i going turn separate function controller not messy - magic going happen utimately - , playing!

hope adds clarity , 1 time 1 time again give thanks 1 takes time point!!!!

php api

ios - Bar chart/UIView animation conundrum -



ios - Bar chart/UIView animation conundrum -

i'm trying create simple bar chart showing relative durations of sequentially recorded activities, , can't life of me display properly. it's based on simple uiview animations, , parts of seem work, namely drop shadow under bar. however, bars never appear.

i'm doubly flummoxed, because modeled code closely on bar chart within app work. real difference driving info , orientation of bars.

here's code, followed console readout:

-(void) displaydaychart { nstimeinterval timeframe = -86400; // 24 hours test, selectable in real life nsdate *daystart = [nsdate datewithtimeintervalsincenow:timeframe]; nsdate *ratnow = [nsdate date]; int y = (self.chartview.frame.size.height) - 5; nslog(@"daystart %@",daystart); // info source // predicate retrieve activities stopped after origin of timeframe, plus running 1 actpredicate = [nspredicate predicatewithformat:@"(starttime >= %@ , stoptime <= %@) or ((starttime <= %@ , stoptime >= %@) or (starttime <= %@ , stoptime == null))",daystart,ratnow,daystart,daystart,ratnow]; // fetch activities nsfetchedresultscontroller *dayactivityfrc = [timedactivity mr_fetchallsortedby:@"starttime" ascending:no withpredicate:actpredicate groupby:nil delegate:nil]; // int tacount = [timedactivity mr_countofentities]; // nslog(@"total of timedactivities %d",tacount); int grabbedactivities = dayactivityfrc.fetchedobjects.count; nslog(@"total of grabbedactivities %d",grabbedactivities); nslog(@"number of timedactivities in dayactivityfrc %d",dayactivityfrc.fetchedobjects.count); daychartbar *thisbar; timedactivity *thisitem; for(int i=0; i<(dayactivityfrc.fetchedobjects.count); i++) { thisbar = [[daychartbar alloc] initwithframe:cgrectzero]; thisbar.tag = i+1; [self.chartview addsubview:thisbar]; thisitem = [dayactivityfrc.fetchedobjects objectatindex:i]; // increment vertical location of bar y = y - 20; // calculate top (currently timing) activity's duration if (thisitem.stoptime == nil) { nsnumber *n = ([nsnumber numberwithdouble: abs([thisitem.starttime timeintervalsincedate:[nsdate date]])]); thisitem.duration = n; } // calculate bottom activity's duration if (thisitem.starttime < daystart && thisitem.stoptime > daystart) { nsnumber *n = ([nsnumber numberwithdouble: abs([thisitem.stoptime timeintervalsincedate:daystart])]); thisitem.duration = n; // nslog(@"%@ bottom item",thisitem.name); } // calculate middle activities' duration if (thisitem.starttime > daystart && thisitem.stoptime < ratnow) { nsnumber *n = ([nsnumber numberwithdouble: abs([thisitem.stoptime timeintervalsincedate:thisitem.starttime])]); thisitem.duration = n; } nslog(@"check loop %@",thisitem.name); nslog(@"starttime %@",thisitem.starttime); nslog(@"stoptime %@",thisitem.stoptime); nslog(@"duration %@\n",thisitem.duration); // width of view = 280 // calculate width of bar (proportionate length of activity vs timeframe, relative available space in chart view) int w = ((280) * ([thisitem.duration doublevalue])) / (abs(timeframe)); nslog(@"w = %d",w); // create animated bar of appropriate color , size [uiview animatewithduration:.3 delay:.2 options: uiviewanimationcurveeaseout // deprecated, still works animations:^ { // starting state thisbar.frame = cgrectmake(20, y, 0, 15); thisbar.backgroundcolor = [uicolor blackcolor]; // end state thisbar.frame = cgrectmake(20, y, w, 15); nslog(@"thisbar.frame %@",nsstringfromcgrect (thisbar.frame)); thisbar.backgroundcolor = thisitem.color; thisbar.layer.shadowcolor = [[uicolor blackcolor] cgcolor]; thisbar.layer.shadowopacity = 0.7; thisbar.layer.shadowradius = 4.0; thisbar.layer.shadowoffset = cgsizemake(5.0f, 5.0f); thisbar.layer.shadowpath = [uibezierpath bezierpathwithrect:thisbar.bounds].cgpath; nslog(@"bar created!"); } completion:^(bool finished) { // reserved creating name label @ end of each bar nslog(@"bar completed!"); }]; } }

and console readout:

2014-06-20 11:05:17.910 wmdgx[46607:a0b] number of activities 2 2014-06-20 11:05:22.793 wmdgx[46607:a0b] daystart 2014-06-19 18:05:22 +0000 2014-06-20 11:05:22.794 wmdgx[46607:a0b] total of grabbedactivities 8 2014-06-20 11:05:22.795 wmdgx[46607:a0b] number of timedactivities in dayactivityfrc 8 2014-06-20 11:05:22.796 wmdgx[46607:a0b] check loop dusting 2014-06-20 11:05:22.796 wmdgx[46607:a0b] starttime 2014-06-20 17:29:04 +0000 2014-06-20 11:05:22.797 wmdgx[46607:a0b] stoptime (null) 2014-06-20 11:05:22.797 wmdgx[46607:a0b] duration 0 2014-06-20 11:05:22.798 wmdgx[46607:a0b] w = 0 2014-06-20 11:05:22.798 wmdgx[46607:a0b] thisbar.frame {{20, 261}, {0, 15}} 2014-06-20 11:05:22.799 wmdgx[46607:a0b] bar created! 2014-06-20 11:05:22.800 wmdgx[46607:a0b] check loop test 1 2014-06-20 11:05:22.800 wmdgx[46607:a0b] starttime 2014-06-20 17:19:22 +0000 2014-06-20 11:05:22.801 wmdgx[46607:a0b] stoptime 2014-06-20 17:29:04 +0000 2014-06-20 11:05:22.801 wmdgx[46607:a0b] duration 581 2014-06-20 11:05:22.802 wmdgx[46607:a0b] w = 1 2014-06-20 11:05:22.803 wmdgx[46607:a0b] thisbar.frame {{20, 241}, {1, 15}} 2014-06-20 11:05:22.803 wmdgx[46607:a0b] bar created! 2014-06-20 11:05:22.804 wmdgx[46607:a0b] check loop dusting 2014-06-20 11:05:22.804 wmdgx[46607:a0b] starttime 2014-06-20 16:52:10 +0000 2014-06-20 11:05:22.805 wmdgx[46607:a0b] stoptime 2014-06-20 17:19:22 +0000 2014-06-20 11:05:22.805 wmdgx[46607:a0b] duration 1632 2014-06-20 11:05:22.806 wmdgx[46607:a0b] w = 5 2014-06-20 11:05:22.808 wmdgx[46607:a0b] thisbar.frame {{20, 221}, {5, 15}} 2014-06-20 11:05:22.809 wmdgx[46607:a0b] bar created! 2014-06-20 11:05:22.810 wmdgx[46607:a0b] check loop test 1 2014-06-20 11:05:22.811 wmdgx[46607:a0b] starttime 2014-06-20 16:52:04 +0000 2014-06-20 11:05:22.811 wmdgx[46607:a0b] stoptime 2014-06-20 16:52:10 +0000 2014-06-20 11:05:22.812 wmdgx[46607:a0b] duration 6 2014-06-20 11:05:22.812 wmdgx[46607:a0b] w = 0 2014-06-20 11:05:22.813 wmdgx[46607:a0b] thisbar.frame {{20, 201}, {0, 15}} 2014-06-20 11:05:22.813 wmdgx[46607:a0b] bar created! 2014-06-20 11:05:22.814 wmdgx[46607:a0b] check loop timer sleeping 2014-06-20 11:05:22.814 wmdgx[46607:a0b] starttime 2014-06-20 16:29:06 +0000 2014-06-20 11:05:22.816 wmdgx[46607:a0b] stoptime 2014-06-20 16:52:04 +0000 2014-06-20 11:05:22.816 wmdgx[46607:a0b] duration 1378 2014-06-20 11:05:22.817 wmdgx[46607:a0b] w = 4 2014-06-20 11:05:22.818 wmdgx[46607:a0b] thisbar.frame {{20, 181}, {4, 15}} 2014-06-20 11:05:22.818 wmdgx[46607:a0b] bar created! 2014-06-20 11:05:22.820 wmdgx[46607:a0b] check loop dusting 2014-06-20 11:05:22.821 wmdgx[46607:a0b] starttime 2014-06-20 16:28:53 +0000 2014-06-20 11:05:22.821 wmdgx[46607:a0b] stoptime 2014-06-20 16:29:06 +0000 2014-06-20 11:05:22.822 wmdgx[46607:a0b] duration 12 2014-06-20 11:05:22.823 wmdgx[46607:a0b] w = 0 2014-06-20 11:05:22.824 wmdgx[46607:a0b] thisbar.frame {{20, 161}, {0, 15}} 2014-06-20 11:05:22.825 wmdgx[46607:a0b] bar created! 2014-06-20 11:05:22.826 wmdgx[46607:a0b] check loop test 1 2014-06-20 11:05:22.827 wmdgx[46607:a0b] starttime 2014-06-20 16:28:38 +0000 2014-06-20 11:05:22.827 wmdgx[46607:a0b] stoptime 2014-06-20 16:28:53 +0000 2014-06-20 11:05:22.827 wmdgx[46607:a0b] duration 14 2014-06-20 11:05:22.828 wmdgx[46607:a0b] w = 0 2014-06-20 11:05:22.828 wmdgx[46607:a0b] thisbar.frame {{20, 141}, {0, 15}} 2014-06-20 11:05:22.829 wmdgx[46607:a0b] bar created! 2014-06-20 11:05:22.829 wmdgx[46607:a0b] check loop timer sleeping 2014-06-20 11:05:22.829 wmdgx[46607:a0b] starttime 2014-06-20 16:25:35 +0000 2014-06-20 11:05:22.830 wmdgx[46607:a0b] stoptime 2014-06-20 16:28:38 +0000 2014-06-20 11:05:22.831 wmdgx[46607:a0b] duration 183 2014-06-20 11:05:22.832 wmdgx[46607:a0b] w = 0 2014-06-20 11:05:22.834 wmdgx[46607:a0b] thisbar.frame {{20, 121}, {0, 15}} 2014-06-20 11:05:22.834 wmdgx[46607:a0b] bar created! 2014-06-20 11:05:23.348 wmdgx[46607:a0b] bar completed! 2014-06-20 11:05:23.350 wmdgx[46607:a0b] bar completed! 2014-06-20 11:05:23.351 wmdgx[46607:a0b] bar completed! 2014-06-20 11:05:23.352 wmdgx[46607:a0b] bar completed! 2014-06-20 11:05:23.352 wmdgx[46607:a0b] bar completed! 2014-06-20 11:05:23.353 wmdgx[46607:a0b] bar completed! 2014-06-20 11:05:23.354 wmdgx[46607:a0b] bar completed! 2014-06-20 11:05:23.355 wmdgx[46607:a0b] bar completed!

i hope dumbass case of not seeing forest trees, i've been beating brains out 3 days before bringing so. know it's not proofreading site.

here's screenshot showing drop shadows (and absence of bars themselves). drop shadows appear in right location , right size based on data:

edit***********

following comments rdelmar , @gro below, changed line:

thisbar.backgroundcolor = thisitem.color;

to:

thisbar.backgroundcolor = [uicolor redcolor];

which produced screenshot:

so, believing problem have been identified, went , changed this:

thisbar = [[daychartbar alloc] initwithframe:cgrectzero]; thisbar.tag = i+1; [self.chartview addsubview:thisbar]; thisitem = [dayactivityfrc.fetchedobjects objectatindex:i];

to this

thisbar = [[daychartbar alloc] initwithframe:cgrectzero]; thisbar.tag = i+1; [self.chartview addsubview:thisbar]; thisitem = [dayactivityfrc.fetchedobjects objectatindex:i]; thisbar.endcolor = thisitem.color;

and (in animation block):

thisbar.backgroundcolor = thisitem.color;

to this:

thisbar.backgroundcolor = thisbar.endcolor;

and bars have disappeared 1 time again.

second edit***************

i've had quite bit of backtracking, bars displaying, albeit bit strangely. problem (the primary 1 @ least) colors assigned each item through it's associated category, passed on timedactivity, represented bars. yeah, know, kinda convoluted. need cleaning up.

in case, looks now. said, behavior little weird--for example, top bar has drop shadow , no bar, @ to the lowest degree i'm seeing some colored bars. however, drop shadows, inexplicably, beingness created before bars themselves. or appear.

i thought i'd wrap up, since no 1 has contributed 24 hours, , problem stated has been resolved.

the color of each bar intended set sort of round-about core info scheme of relationships. 1 time straightened out, colored bars appeared expected.

the other (unstated) problem there apparent randomness lengths of bars relative available space. @ point view arithmetic issue.

thanks @rdelmar , @gro, both of comments pointed me core info problem.

ios bar-chart uiviewanimation

NullPointerException when running Spring Data Neo4j in Advanced Mapping mode (Aspectj) -



NullPointerException when running Spring Data Neo4j in Advanced Mapping mode (Aspectj) -

i've been trying configure spring info neo4j utilize advanced mapping mode aspectj i've not been able work spring boot project. project compiles , starts without exception when seek phone call controller java.lang.nullpointerexception. i've compared code of illustration projects , cannot see i'm doing wrong.

i've set little illustration programme highlights issue on github: https://github.com/tjakobsen/nullpointer

below re-create of total stack trace when run above project (i'm using jdk 1.7 tomcat 7). insight on i'm doing wrong much appreciated.

java.lang.nullpointerexception org.springframework.data.neo4j.aspects.support.node.neo4jnodebacking.ajc$intermethod$org_springframework_data_neo4j_aspects_support_node_neo4jnodebacking$org_springframework_data_neo4j_aspects_core_nodebacked$persist(neo4jnodebacking.aj:133) com.example.nullpointer.domain.person.persist(person.java:1) com.example.nullpointer.domain.person.persist(person.java:1) org.springframework.data.neo4j.support.mapping.neo4jentitypersister.persist(neo4jentitypersister.java:229) org.springframework.data.neo4j.support.neo4jtemplate.save(neo4jtemplate.java:356) org.springframework.data.neo4j.support.neo4jtemplate.save(neo4jtemplate.java:350) org.springframework.data.neo4j.repository.abstractgraphrepository.save(abstractgraphrepository.java:91) sun.reflect.nativemethodaccessorimpl.invoke0(native method) sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) java.lang.reflect.method.invoke(method.java:601) org.springframework.data.repository.core.support.repositoryfactorysupport$queryexecutormethodinterceptor.executemethodon(repositoryfactorysupport.java:405) org.springframework.data.repository.core.support.repositoryfactorysupport$queryexecutormethodinterceptor.doinvoke(repositoryfactorysupport.java:390) org.springframework.data.repository.core.support.repositoryfactorysupport$queryexecutormethodinterceptor.invoke(repositoryfactorysupport.java:344) org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:179) org.springframework.transaction.interceptor.transactioninterceptor$1.proceedwithinvocation(transactioninterceptor.java:98) org.springframework.transaction.interceptor.transactionaspectsupport.invokewithintransaction(transactionaspectsupport.java:262) org.springframework.transaction.interceptor.transactioninterceptor.invoke(transactioninterceptor.java:95) org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:179) org.springframework.dao.support.persistenceexceptiontranslationinterceptor.invoke(persistenceexceptiontranslationinterceptor.java:136) org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:179) org.springframework.aop.framework.jdkdynamicaopproxy.invoke(jdkdynamicaopproxy.java:207) com.sun.proxy.$proxy69.save(unknown source) com.example.nullpointer.controllers.indexcontroller.index_aroundbody0(indexcontroller.java:29) com.example.nullpointer.controllers.indexcontroller$ajcclosure1.run(indexcontroller.java:1) org.springframework.transaction.aspectj.abstracttransactionaspect.ajc$around$org_springframework_transaction_aspectj_abstracttransactionaspect$1$2a73e96cproceed(abstracttransactionaspect.aj:59) org.springframework.transaction.aspectj.abstracttransactionaspect$abstracttransactionaspect$1.proceedwithinvocation(abstracttransactionaspect.aj:65) org.springframework.transaction.interceptor.transactionaspectsupport.invokewithintransaction(transactionaspectsupport.java:262) org.springframework.transaction.aspectj.abstracttransactionaspect.ajc$around$org_springframework_transaction_aspectj_abstracttransactionaspect$1$2a73e96c(abstracttransactionaspect.aj:63) com.example.nullpointer.controllers.indexcontroller.index(indexcontroller.java:24) sun.reflect.nativemethodaccessorimpl.invoke0(native method) sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) java.lang.reflect.method.invoke(method.java:601) org.springframework.web.method.support.invocablehandlermethod.invoke(invocablehandlermethod.java:215) org.springframework.web.method.support.invocablehandlermethod.invokeforrequest(invocablehandlermethod.java:132) org.springframework.web.servlet.mvc.method.annotation.servletinvocablehandlermethod.invokeandhandle(servletinvocablehandlermethod.java:104) org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.invokehandlemethod(requestmappinghandleradapter.java:749) org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.handleinternal(requestmappinghandleradapter.java:689) org.springframework.web.servlet.mvc.method.abstracthandlermethodadapter.handle(abstracthandlermethodadapter.java:83) org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java:938) org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java:870) org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:961) org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java:852) javax.servlet.http.httpservlet.service(httpservlet.java:620) org.springframework.web.servlet.frameworkservlet.service(frameworkservlet.java:837) javax.servlet.http.httpservlet.service(httpservlet.java:727) org.springframework.web.filter.hiddenhttpmethodfilter.dofilterinternal(hiddenhttpmethodfilter.java:77) org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter.java:108)

i think you're missing neo4j aspect configuration. check out https://github.com/inserpio/nullpointer , allow me know if correctly works you.

cheers, lorenzo

neo4j spring-data spring-data-neo4j

xml - How do i check a remote soap service from bash and check it has a specific string -



xml - How do i check a remote soap service from bash and check it has a specific string -

i want check remote soap server, sending xml , greping string? if it's successful want output xml file can utilize pingdom check uptime of service.

here script used this. add together cron, run every 60 seconds, output result web root , utilize http custom check in pingdom or other monitoring tool:

#!/bin/bash # result file file="/var/www/vhostwebroot/out.xml" # remove file if exists (from previous runs) if [ -e $file ];then rm $file fi # set start time start=$(date +%s%3n) # soap_text.xml soap phone call want post remote server test=$(curl --silent -d @soap_test.xml -h "content-type: application/soap+xml" -h 'soapaction: ""' https://www.soap-server-to-check/service-endpoint | grep -o 'string want check for') # set end time end=$(date +%s%3n) # calculate elapsed time el=$(($end-$start)) # if string exists, output xml file if [ "$test" = 'string want check for' ] # output appropriately formatted file pingdom check echo "<pingdom_http_custom_check> <status>ok</status> <response_time>$el</response_time> </pingdom_http_custom_check>" > $file else # if check fails, output failure doc echo "<pingdom_http_custom_check> <status>down</status> <response_time>$el</response_time> </pingdom_http_custom_check>" > $file fi

xml bash curl soap

Django queryset - filter/exclude by sum over column -



Django queryset - filter/exclude by sum over column -

for little caching application have next problem/question:

part of model:

class cachedresource(models.model): ... filesize = models.positiveintegerfield() created = models.datetimefield(auto_now_add=true, editable=false) ...

the cache should e.g. limited 200mb - , maintain newest files.

how can create queryset like:

cachedresource.objects.order_by('-created').exclude(" summary of filesize < x ")

any input appreciated!

example:

created filesize keep/delete? 2014-06-22 15:00 50 maintain (sum: 50) 2014-06-22 14:50 100 maintain (sum: 150) 2014-06-22 14:40 30 maintain (sum: 180) 2014-06-22 14:30 20 maintain (sum: 200) 2014-06-22 14:20 50 delete (sum: 250 > 200) 2014-06-22 14:10 10 delete ... 2014-06-22 14:00 200 delete ... 2014-06-22 13:50 10 delete ... 2014-06-22 13:40 2 delete ... ... ... ... ...

each object in next queryset have 'filesize_sum' attribute holding summary of filesizes of cache resources created since object's creation time.

qs = cachedresource.objects.order_by('-created').extra(select={ 'filesize_sum': """ select sum(filesize) cachedresource_table_name cr cr.created >= cachedresource_table_name.created """})

then can create loop want. example, create loop breaks on first object filesize_sum > 200mb , run delete query on queryset objects smaller or equal creation date object:

for obj in qs: if obj.filesize_sum > 200: qs.filter(created__lte=obj.created).delete() break

keep in mind though want take action before inserting new cache resource, filesize of new resource not exceed limit. example, run above procedure with:

limit = configured_limit - filesize_of_cache_resource_to_insert

django django-models django-queryset

javascript - angular http post adds extra params to the request -



javascript - angular http post adds extra params to the request -

i have next in directive:

scope.progresscourse = -> req_data = course_id: scope.course.id success: true $http.post( "<%= rails.application.routes.url_helpers.progress_course_path %>", req_data ).then (succesful_resp) -> scope.course = succesful_resp.data.data scope.init_from_course_object() , (error_resp) -> show_error(error_resp)

and, server side, i'd expect receive course_id , success params. however, receive extra:

parameters: {"course_id"=>1, "success"=>true, "training"=>{"course_id"=>1, "success"=>true}}

the request addressed controller called trainingcontroller. i'm running rails 3.2.13, angular 1.2.10. explain why hash appears {"training"=>{"course_id"=>1, "success"=>true}}

update: if add together this:

$httpprovider.defaults.transformrequest = (data) -> if data? homecoming $.param(data) homecoming info

and alter post to:

$http( method: "post" url: "<%= rails.application.routes.url_helpers.progress_course_path %>", data: req_data, headers: { 'content-type': 'application/x-www-form-urlencoded; charset=utf-8'} ).then (succesful_resp) ->

then 2 params need. can explain why behaviour?

rails has lot of inbuilt functionality create dealing external apis easier. in case has params_wrapper manipulate parameters passed in in request, nesting them in hash assumes want.

for example, if submitting {name: 'foo', age: 12} userscontroller, assume should wrapped in nested user key , transparently.

documentation wrapper here:

http://api.rubyonrails.org/v3.2.13/classes/actioncontroller/paramswrapper.html

and code here:

https://github.com/rails/rails/blob/v3.2.13/actionpack/lib/action_controller/metal/params_wrapper.rb

if don't want functionality, can disable commenting out wrap_parameters format: [:json] line in /config/initializers/wrap_parameters.rb.

javascript jquery ruby-on-rails angularjs

Netsuite - Get the current form ID from a script -



Netsuite - Get the current form ID from a script -

i have couple of customized sales order forms, , able determine, within script, form user using.

for example, let's have form called "regular sales order" (internal id 100) , form called "special sales order" (internal id 101). they're identical, little differences. special order form zero-charge orders, such pocs or test licenses. other orders utilize regular form.

our sales orders have "custom price" option, prices can overridden. want add together validation ensure no line item in sales order has 0.00 charge, if form in utilize regular sales order form. conversely, if special form in use, line items should have 0.00 charge.

how can observe current form id script, can tell whether user using regular or special form? in advance.

try customform field

nlapigetfieldvalue('customform'); obj.getfieldvalue('customform');

netsuite

php - Mysqli - Bind results to an Array -



php - Mysqli - Bind results to an Array -

i switched mysqli mysql , started using prepared statements. in mysql do

$result = mysql_query("select * table id = ?");

so array of whole table in 1 variable.

but in mysqli do

mysqli_stmt_bind_result($stmt, $result);

so here 1 variable gets bind variable result. how can same variable(array) got mysql? ps - hope ques clear enough. know not many methods possible luking best one. pss - more comfortable procedural way.

use this

$con=mysqli_connect( "$host", "$mysql_u", "$mysql_p","$mysql_db");/*these variables ur host,username, password , db name*/ $val="select * table"; $ex=mysqli_query($con,$val); while ($row = mysqli_fetch_assoc($ex)) { $ans=$row['col1']; .... }

php mysql arrays mysqli bind

java - I'm getting an error with <= saying that it's an invalid AssignmentOperator + my code looks wack I think -



java - I'm getting an error with <= saying that it's an invalid AssignmentOperator + my code looks wack I think -

so got stuck whole lot of this:

package test; import javax.swing.*; import java.util.random; import java.util.scanner; public class guessgame { public static void main(string[] args) { scanner keys = new scanner(system.in); system.out.println("hello! play?"); string selection = keys.next(); (choice.equals("y"); choice.equals("yes");) { system.out.println("awesome!"); selection = ""; random bill = new random(); int j; j = bill.nextint(50); system.out.println("guess number i'm thinking "); int number; number = keys.nextint(); (number <= (j + 10); number >= (j - 10);) { system.out.println("warm!"); number = 0; number = keys.nextint(); } (number = (j + 5); number == (j - 10);) { system.out.println("hot!!!"); number = 0; number = keys.nextint(); } } (choice.equals("n"); choice.equals("no");) { system.out.println("okay"); keys.close(); system.exit(0); } } }

on line " (number <= (j + 10); number >= (j - 10);)", i'm getting error on "<=", , i've got no thought how create amends on it. well, i'm not sure if should using statement this. please help me understand mistake, , if there improve alternate for.

thank you!

that because first parameter of for statement used initialization of variable, giving error.

documentation:

for (initialization; termination;increment) { statement(s) }

problem:

for (number <= (j + 10); number >= (j - 10);)

solution:

use if statement if going check both variable

if(number <= (j + 10) && number >= (j - 10))

java eclipse assignment-operator

php regex expression to get img srcs with exceptions -



php regex expression to get img srcs with exceptions -

how write regex look gets img tags, , within them, gets "src" value, ignoring imgs tags has given class? let's srcs of img tags don't have "dontgetme" assigned classes (but may still have other classes)

i.e.

<img src="teste1.jpg" class="blueclass brightclass dontgetme" /> <img src="teste2.jpg" class="blueclass" /> <img src="teste3.jpg" class="dontgetme" /> <img src="teste4.jpg" />

on example, regex should teste2.jpg , teste4.jpg.

the regex got far next (which gets imgs src values regardless of presence of "dontgetme" class):

((?:\<img).*)(src)

! regex used on php script, has run succesfully on "http://www.phpliveregex.com".

edit: regex used in next php function: totally agree regex doesn't seems clear , guaranteed way it, still, lack of php knowledge ties me technology.

function advanced_lazyload($buffer) { (...) $pattern = '(regex look goes here)'; $buffer = preg_replace($pattern, "$1 src='temp.gif' imageholder", $buffer); homecoming $buffer; }

dont utilize regex parsing html. task xml parser.

the recommended way utilize xpath this.

$doc = new domdocument(); $doc->loadhtml($html); $dox = new domxpath($doc); $elements = $dox->query('//img[not(contains(@class, "dontgetme"))]/@src'); foreach($elements $el){ echo $el->nodevalue, "\n"; }

php regex html-parsing

ruby on rails - How to do many to many in active model serializer? -



ruby on rails - How to do many to many in active model serializer? -

i'm looking solution utilize many many association in active model serializer.

let's have user many user types through many many table, how can homecoming user types specific user?

do need create serializer many many model?

the reply pretty stupid. had set serializer "has_one user_type", simple alter "has_many user_types" worked.

ruby-on-rails active-model-serializers

localization - PHP setlocale, UTF-8 or not? -



localization - PHP setlocale, UTF-8 or not? -

i've installed zh_tw locale via

sudo locale-gen --purge en_us.utf-8 zh_tw

and codeset big5

locale: zh_tw directory: /usr/lib/locale/zh_tw ------------------------------------------------------------------------------- title | chinese locale taiwan r.o.c. email | bug-glibc-locales@gnu.org language | chinese territory | taiwan r.o.c. revision | 0.2 date | 2000-08-02 codeset | big5

and i've simple php script

<?php putenv('lc_all=zh_tw'); setlocale(lc_all, 'zh_tw'); bindtextdomain("myphpapp", "./locale"); textdomain("myphpapp"); echo gettext("hello");

i have prepared mo file (which in utf8) , set under

./locale/zh_tw/lc_messages/myphpapp.mo

and echo did work, so, point of installing locale such zh_tw.utf-8

what point of installing locale such zh_tw.utf-8?

the point of .[codeset] suffix in locale specification specify codeset. if, particular language, utf-8 default codeset, don't have specify explicitly - specifying zh_tw (but specify zh_tw.utf-8). if have console available, can list available locale locale -a.

but please note can scheme specific! while on linux zh_tw utf-8 default, on ibm big5 , on windows cp950!

php localization internationalization locale setlocale

jsf 2.2 - JSF 2.2 conditional text based on EL tests not working -



jsf 2.2 - JSF 2.2 conditional text based on EL tests not working -

i have been searching solution , though seem have lot of options none of them seem working me. other solution have tried below, have tried various panelgrid/group combos el expressions in rendered attribute , c:if/otherwise no luck well. i'm running on wildfly 8.0 jee7

question: should in theory below code work? have absolute confidence email returning null if not logged in.

symptoms: displaying logged in html never not logged in html. regardless if userbean.email null or has value.

<ul class="loginbar pull-right"> <li class="topbar-devider"></li> <li><a href="page_faq.html">help</a></li> <c:if test="#{empty userbean.email}"> <li class="topbar-devider"></li> <li><a href="login">login</a></li> </c:if> <c:if test="#{not empty userbean.email}"> <li class="topbar-devider"></li> <li><a href="page_faq.html">hello: #{userbean.email}</a></li> <li class="topbar-devider"></li> <li><a href="logout">logout</a></li> </c:if> </ul>

jsf jsf-2.2

c# - SetupDiGetDeviceRegistryProperty fails with ERROR_INVALID_DATA -



c# - SetupDiGetDeviceRegistryProperty fails with ERROR_INVALID_DATA -

i'm trying display names appear in "screen resolution" window (win8.1 x64).

first tried enumdisplaydevices

var deviceinfo = new display_devicew(); uint = 0; while (true) { if (!nativemethods.enumdisplaydevices(null, i++, deviceinfo, 0)) { break; } printdeviceinfo(deviceinfo); nativemethods.enumdisplaydevices(deviceinfo.devicename, 0, deviceinfo, edd_get_device_interface_name); printdeviceinfo(deviceinfo); }

the sec phone call enumdisplaydevices (with edd_get_device_interface_name) indeed yielded display name appears main display (in display_devicew.devicestring). hdmi-connected tv field contains generic pnp monitor, instead of samsung appears in "screen resolution" window. perhaps fact it's connected hdmi somehow related?

i tried setup api

var hdevinfo = nativemethods.setupdigetclassdevs(ref guid_devinterface_monitor, null, intptr.zero, digcf_deviceinterface | digcf_present); if (hdevinfo == invalid_handle_value) return; var spdeviceinterfacedata = new sp_device_interface_data(); uint memberindex = 0; while (true) { bool success = nativemethods.setupdienumdeviceinterfaces(hdevinfo, null, ref guid_devinterface_monitor, memberindex++, spdeviceinterfacedata); if (!success) { break; } printinterfacedata(spdeviceinterfacedata); uint requiredsize; var devinfodata = new sp_devinfo_data(); nativemethods.setupdigetdeviceinterfacedetail(hdevinfo, spdeviceinterfacedata, intptr.zero, 0, out requiredsize, devinfodata); printdevinfodata(devinfodata); var interfacedetail = marshal.allochglobal((int)requiredsize); var cbsize = (marshal.sizeof(typeof(uint)) + marshal.systemdefaultcharsize); marshal.writeint32(interfacedetail, 0, cbsize); nativemethods.setupdigetdeviceinterfacedetail(hdevinfo, spdeviceinterfacedata, interfacedetail, requiredsize, intptr.zero, null); var dynamictype = getdeviceinterfacedetaildatatype(requiredsize); var interfacedetailstruct = marshal.ptrtostructure(interfacedetail, dynamictype); marshal.freehglobal(interfacedetail); printinterfacedetail(interfacedetailstruct); uint propertyregdatatype; nativemethods.setupdigetdeviceregistryproperty(hdevinfo, devinfodata, spdrp_friendlyname, out propertyregdatatype, null, 0, out requiredsize); console.writeline(marshal.getlastwin32error()); }

looking @ returned values different methods, seems work, lastly phone call setupdigetdeviceregistryproperty fails error_invalid_data (that is, method returns false , getlastwin32error yields 13). according docs, means the requested property not exist device or if property info not valid.

i looped on possible spdrp values (0-24) , result in same failure. clarify, expected method fail, error_insufficient_buffer , having requiredsize set (the latter retains previous value, unmanaged code doesn't alter it).

here's signature setupdigetdeviceregistryproperty (all other methods work expected):

[structlayout(layoutkind.sequential)] public class sp_devinfo_data { public uint cbsize = (uint) marshal.sizeof(typeof (sp_devinfo_data)); public guid classguid; public uint devinst; public intptr reserved; } [dllimport("setupapi.dll", charset = charset.auto, setlasterror = true)] public static extern bool setupdigetdeviceregistryproperty( intptr deviceinfoset, sp_devinfo_data deviceinfodata, uint property, out uint propertyregdatatype, byte[] propertybuffer, uint propertybuffersize, out uint requiredsize);

looks i'm looking impossible:

there not supported way figour out ids referred programmatically. never design goal provide way applications label monitors same ids screen resolution command panel uses

c# winapi interop

sql - MySQL select unique record from a joint table that have duplicated referencing entry -



sql - MySQL select unique record from a joint table that have duplicated referencing entry -

how display table not match result in sec table.

eg: want display each name in (table a) not have record type 1. note 'ken' have 2 log entry. 1 each type 1 , type 2. result should display john , genius

table a - name

+-----+--------+ | nid | name | +-----+--------+ | 1 | ken | | 2 | john | | 3 | genius | +-----+--------+

table b - log (each name may have multiple entry)

+------+-----+ | type | nid | +------+-----+ | 1 | 1 | | 2 | 1 | | 2 | 2 | +------+-----+

expected result

| nid | name | +-----+--------+ | 2 | john | | 3 | genius |

all have sort of records type='1' in subquery

select name tablea nid not in (select nid tableb type='1')

mysql sql database-design relational-database

file - Python similar type of string to search -



file - Python similar type of string to search -

i have started learning python , have question. have text file opened. file has random questions. question how can search question similar type of question "what .... " , "how ...." , homecoming whole question . using python 3.x. please help

i highly suggest spend time reading regex. trick search string includes first words want (the "what your" statement) , ends question mark. next docs should give quite bit of clarity.

https://docs.python.org/3.4/library/re.html https://docs.python.org/3.4/howto/regex.html#regex-howto

string file search python-3.x

php - How to enforce the user to click a checkbox in profile section in Buddypress -



php - How to enforce the user to click a checkbox in profile section in Buddypress -

i'm developping website using wordpress & buddypress. aim display checkbox in profile page consist in accepting "term of use". point ok. enforce user thick checkbox, otherwise can leave page (or validate changes). alternative "obligatory" of "required filed" in wp-admin section (users > profile configuration) not efficient.

do have suggestion, or advice give ?

thank

how want enforce this? if fellow member must agree terms no matter what, simple redirect profile page if terms yet agreed

function redirect_to_terms() { if ( is_user_logged_in() && $terms_not_agreed ) { bp_core_add_message( 'you must agree our terms', 'error' ); wp_redirect( '/members/' . bp_core_get_username( bp_loggedin_user_id() ) ); exit(); } } add_action( 'template_redirect', 'redirect_to_terms' );

note: you'll need assign either true or false $terms_not_agreed before in code.

php wordpress checkbox buddypress

Swift - not able to compile with instance checking -



Swift - not able to compile with instance checking -

i want inspect if object optional string type @ runtime. why next not compile in command line project?

var p:string? if p string { println("p string") } else { println("p not string") }

build error:

bitcast requires both operands pointer or neither %81 = bitcast i8* %80 %ss, !dbg !131 invalid operand types icmp instruction %82 = icmp ne %ss %81, null, !dbg !131 phi nodes must have @ to the lowest degree 1 entry. if block dead, phi should removed! %85 = phi i64 phi node operands not same type result! %84 = phi i8* [ %81, %73 ] llvm error: broken function found, compilation aborted! command /applications/xcode6-beta2.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/swift failed exit code 1

you first have assign value it. this:

var p : any? p = "string" if p string { println("p string") } else { println("p else") }

swift

python - TypeError : object does not support indexing -



python - TypeError : object does not support indexing -

i learned python. can't grab error in code. wrong?

class bankaccount: def __init__(self, initial_balance): """creates business relationship given balance.""" self = [initial_balance, 0] def deposit(self, amount): """deposits amount account.""" self += amount def withdraw(self, amount): """ withdraws amount account. each withdrawal resulting in negative balance deducts penalty fee of 5 dollars balance. """ self[0] -= amount if self[0] < 0: self[0] -= 5 self[1] += 1 def get_balance(self): """returns current balance in account.""" homecoming self[0] def get_fees(self): """returns total fees ever deducted account.""" homecoming 5*self[1] my_account = bankaccount(10) my_account.withdraw(15) my_account.deposit(20) my_account.get_balance(), my_account.get_fees()

the error is:

traceback (most recent phone call last): file "c:\python34\bank.py", line 28, in <module> my_account.withdraw(15) file "c:\python34\bank.py", line 15, in withdraw self[0] -= amount + 5 typeerror: 'bankaccount' object not back upwards indexing

self value contains initial_balance , count of how many withdrawals have happened.

it should this:

class bankaccount: overdraw_penalty = 5 def __init__(self, opening_balance=0): self.balance = opening_balance self.withdrawals = 0 def withdraw(self, amount): self.withdrawals += 1 self.balance -= amount if self.balance < 0: self.balance -= self.overdraw_penalty homecoming amount

note using self access instance , class attributes, not trying assign straight it. also, have factored out "magic number" 5, clearer happening.

also, implementation of get_fees wrong - number of withdrawals incremented whether or not fee applied. should either store self.overdrawn_withdrawals count separately or maintain running total self.fees attribute.

finally, have added return amount end of withdraw - allows things like:

account2.deposit(account1.withdraw(100))

to transfer money between bankaccounts.

python python-3.x

bash - How can I include return codes and the command number in my eshell prompt? -



bash - How can I include return codes and the command number in my eshell prompt? -

i have need of shell while using emacs. recently, have been trying switch on shell eshell, able utilize same commands regardless of platform.

one of first things customize prompt match bash prompt. this, customizing eshell-prompt-function. thing still missing current command count , lastly homecoming code. can in bash setting ps1 e.g. \! , $? respectively. have tried (eshell/echo "$?") latter, doesn't work (though works if execute command manually in eshell).

edit: illustration of part of current bash prompt looks [~][501:0], 501 current command number (so if type command , nail enter show 502), , 0 homecoming code.

this puts homecoming code eshell prompt:

class="lang-lisp prettyprint-override">(setq eshell-prompt-function (lambda () (format "[%s][%s] " (abbreviate-file-name (eshell/pwd)) eshell-last-command-status)))

i couldn't find simple way set latest command number prompt—and might less useful, since eshell seems utilize ring command history, @ point counter stuck @ 128, , previous prompts inaccurate.

note should update eshell-prompt-regexp match eshell-prompt-function come with.

bash emacs eshell

javascript - Debugging exceptions in DOM Promises -



javascript - Debugging exceptions in DOM Promises -

not long ago chrome devtools started supporting async stack traces (http://www.html5rocks.com/en/tutorials/developertools/async-call-stack/) can avoid pain of debugging asynchronous code.

but dom promises (http://www.html5rocks.com/en/tutorials/es6/promises/) released, bringing pain right back.

if exception thrown somewhere within promised code swallowed promises scheme , not allow debugger stop if "pause on exceptions" on.

alright, can turn on "pause on caught exceptions" lead pause on every promise rejection redundant. want grab kinds of real javascript or libraries errors showing code written incorrectly. promises may rejected without logic error though:

function showlargeimage (user) { homecoming promise(function (resolve, reject) { if (!user.image.large) { // expected behavior. no exception pause needed. reject('no larger image.'); } else { // if element doesn't exist? want grab exception here. $('#user-' + user.id + '-large-image')[0].style.display = 'block'; resolve(); } }); }

has faced same issue? how debug code?

update: code illustration wrong. exceptions swallowed in "then" handler (not in promise body). should like:

function showlargeimage (user) { homecoming loadlargeimage(user).then(function (largeimage) { if (!largeimage) { // expected behavior. no exception pause needed. homecoming promise.reject('no larger image.'); } else { // if element doesn't exist? want grab dom exception here. $('#user-' + user.id + '-large-image')[0].src = largeimage; homecoming true; } }); }

simple workaround - avoid dom promises. not production ready yet.

this known issue. dom promises @ moment rather experimental:

they much slower fast promise implementations bluebird. they provide no .done method or unhandled rejection detection in chrome. exceptions swallowed silently. they provide limited subset of functionality.

if have utilize dom promises, utilize firefox, version 27+ features unhandled rejection detection based on gc. stack traces still lot worse bluebird's @ to the lowest degree it'll not swallow exceptions silently.

the upside there plans build improve unhandled rejection detection chrome dom promises.

you can utilize bluebird , swap out native promises in production (although outperforms them , really want debuggability in production).

but do current code?

most promise libraries, bluebird can deed drop-in replacement.

javascript asynchronous exception-handling error-handling promise

python - How can i implement spherical hankel function of the first kind by scipy/numpy or sympy? -



python - How can i implement spherical hankel function of the first kind by scipy/numpy or sympy? -

i knew there no builtin sph_hankel1 in scipy want know how implement in right way?

additional: show me 1 right implementation of sph_hankel1 either using of scipy or sympy.

regarding implementing in sympy, there guide on how implement special functions here. love pull requests well-known special functions.

for numerical routines, implemented in mpmath. looks like uses definition directly.

python numpy scipy sympy

What is !+[]+!+[] in javascript? -



What is !+[]+!+[] in javascript? -

hi reading article , found pretty unusual results below code in javascript homecoming 2.

!+[]+!+[]

can please explain.

breaking downwards look right order of operations, have:

(!(+[])) + (!(+[]))

first things first, [] cast number +, results in 0. don't inquire me why, :p buried in specification somewhere.

!0 true

so end true + true, 1 time again casts numbers, resulting in 1 + 1 = 2

to nine, you'd need 9 repetitions:

!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[] == 9

javascript

Python Flask Intentional Empty Response -



Python Flask Intentional Empty Response -

is there way homecoming response (from make_response() object or similar) properties doesn't render page 1 time again , doesn't else either. trying run code on server without generating output

a simple 'return none' produces:

valueerror: view function did not homecoming response

this should possible because next downloads file , doesn't render template:

mystring = "first line of document" response = make_response(mystring) response.headers["content-disposition"] = "attachment; filename=myfile.txt" homecoming response

any help appreciated!

you responding request, http server must homecoming something. http 'empty response' response 204 no content:

return ('', 204)

note returning file browser not empty response, different html response.

python flask response

I can't manage positioning of divs in css and html -



I can't manage positioning of divs in css and html -

i'm creating website , adding divs. problem main div, container, not next number of divs within of it. divs within keeps on overlapping on , not follow container. help me find problem. thanks. below code:

for css:

.container{ position: relative; height: 100%; margin: 0 auto; width: 100%; max-width: 1100px; background-color: #fff; -moz-box-shadow: 0px 0px 6px 7px #ccc; -webkit-box-shadow: 0px 0px 6px 7px #ccc; box-shadow: 0px 0px 6px 7px #ccc; } .cities{ position: relative; top: 110px; } .top{ position: relative; top: 120px; left: 25px; max-width: 500px; }

for html:

<div class="container" > <div class="cities"> <p style="font-weight: bold; font-size: 18px;">kwiktable makati <a href="#" style="color: black; float: right; margin-right: 5px; ">mandaluyong </a> <a href="#"style="color: black;float: right;margin-right: 5px; ">pasig </a> <a href="#"style="color: black;float: right;margin-right: 5px; ">quezon city </a> <a href="#"style="color: black;float: right;margin-right: 5px; ">taguig </a></p> </div> <hr style="position: relative; top: 120px; width: 1060px; margin-right: auto; margin-left: auto;"> <div class="top"> <?php include'content1.html';?> </div> <hr class="middle" style="position: relative; top: -300px;"/> <div class="best"> <h1 style="position: relative; width: 350px; left: 50px; height: 80px; color: #fff; text-shadow: 0px 0px 3px #000;"><span style="position: absolute; top: 20px; left: 40px"> kwiktable's best!</span></h1> <?php include'best.php';?> </div>

here whats happening: http://tinypic.com/r/o69qqe/8

try positioning div's margin , padding instead of top , left. is, occupy much space if there no (positional) styling on them. it's not .container isn't containing, can't tell. if instead of using top:125px utilize padding-top:125px container expand. because container see element taking space. (execpt in case of floats, need clear them.)

html css

c# - camera in Windows Mobile 5.0 Pocket PC -



c# - camera in Windows Mobile 5.0 Pocket PC -

i'm developing c#, windows mobile app , need launch device camera:

this code:

cameracapturedialog ccd = new cameracapturedialog(); ccd.showdialog();//<--- picturebox1.image = new bitmap(ccd.filename);

in ccd.showdialog();//<--- line shows me next exception: system.invalidoperationexception: unknown error occurred.

i dont know if exception because of windows mobile 5.0 pocket pc doesn't have photographic camera built in. or i'm trying never works..

so... tell me something?

in fact, windows mobile 5.0 pocket pc emulator doesn't have built-in camera, that's why tries unsuccessful..

when built app, , installed on device, ran app and... surprise!!! worked!!

so... conclussion is:

the code lines work! on device, wont work on wmppc emulator...

if has different answer.. allow me know it.

c# exception camera pocketpc

visual studio 2010 - How to add global warning rule suppression in StyleCop.Settings file? -



visual studio 2010 - How to add global warning rule suppression in StyleCop.Settings file? -

i getting 5k+ stylecop warnings of different flavours. using visual studio 2010 express edition, there no menu alternative go stylecop settings or suppressions warnings within visual studio. alternative left edit stylecop.settings file attempting atm, stylecop version using 4.7.

my stylecop.settings file looks this:

<stylecopsettings version="4.3"> <globalsettings> <collectionproperty name="deprecatedwords"> <value>preprocessor,pre-processor</value> <value>shortlived,short-lived</value> </collectionproperty> </globalsettings> <parsers> <parser parserid="stylecop.csharp.csparser"> <parsersettings> <collectionproperty name="generatedfilefilters"> <value>\.g\.cs$</value> <value>\.generated\.cs$</value> <value>\.g\.i\.cs$</value> </collectionproperty> </parsersettings> </parser> </parsers> <analyzers> <analyzer analyzerid="stylecop.csharp.namingrules"> <analyzersettings> <collectionproperty name="hungarian"> <value>as</value> <value>do</value> <value>id</value> <value>if</value> <value>in</value> <value>is</value> <value>my</value> <value>no</value> <value>on</value> <value>to</value> <value>ui</value> </collectionproperty> </analyzersettings> </analyzer> </analyzers> </stylecopsettings>

how need edit settings file suppress warnings within csharp.ordering , csharp.documentation, or code code (sa1202, sa1600)? don't mind solution.

sa1202 : csharp.ordering : private methods must placed after public methods. sa1600 : csharp.documentation : method must have documentation header.

solved myself, in stylecop installation folder, same folder stylecop.settings file (in case c:\program files\stylecop 4.7). there should file named stylecopsettingseditor.exe. drag , drop stylecop.settings onto stylecopsettingseditor.exe should launch application , open window shown in screenshot below.

you can edit settings grouping or specific code.

for not have ability utilize editor whatever reason, xml below shows how stylecop.settings file looks after editing.

<stylecopsettings version="105"> <globalsettings> <collectionproperty name="deprecatedwords"> <value>preprocessor,pre-processor</value> <value>shortlived,short-lived</value> </collectionproperty> </globalsettings> <parsers> <parser parserid="stylecop.csharp.csparser"> <parsersettings> <collectionproperty name="generatedfilefilters"> <value>\.g\.cs$</value> <value>\.generated\.cs$</value> <value>\.g\.i\.cs$</value> </collectionproperty> </parsersettings> </parser> </parsers> <analyzers> <analyzer analyzerid="stylecop.csharp.namingrules"> <analyzersettings> <collectionproperty name="hungarian"> <value>as</value> <value>do</value> <value>id</value> <value>if</value> <value>in</value> <value>is</value> <value>my</value> <value>no</value> <value>on</value> <value>to</value> <value>ui</value> </collectionproperty> </analyzersettings> </analyzer> <analyzer analyzerid="stylecop.csharp.documentationrules"> <rules> <rule name="elementsmustbedocumented"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="partialelementsmustbedocumented"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="enumerationitemsmustbedocumented"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="documentationmustcontainvalidxml"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementdocumentationmusthavesummary"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="partialelementdocumentationmusthavesummary"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementdocumentationmusthavesummarytext"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="partialelementdocumentationmusthavesummarytext"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementdocumentationmustnothavedefaultsummary"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementparametersmustbedocumented"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementparameterdocumentationmustmatchelementparameters"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementparameterdocumentationmustdeclareparametername"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementparameterdocumentationmusthavetext"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementreturnvaluemustbedocumented"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementreturnvaluedocumentationmusthavetext"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="voidreturnvaluemustnotbedocumented"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="generictypeparametersmustbedocumented"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="generictypeparametersmustbedocumentedpartialclass"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="generictypeparameterdocumentationmustmatchtypeparameters"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="generictypeparameterdocumentationmustdeclareparametername"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="generictypeparameterdocumentationmusthavetext"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="propertysummarydocumentationmustmatchaccessors"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="propertysummarydocumentationmustomitsetaccessorwithrestrictedaccess"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementdocumentationmustnotbecopiedandpasted"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="singlelinecommentsmustnotusedocumentationstyleslashes"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="documentationtextmustnotbeempty"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="documentationtextmustcontainwhitespace"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="documentationmustmeetcharacterpercentage"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="constructorsummarydocumentationmustbeginwithstandardtext"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="destructorsummarydocumentationmustbeginwithstandardtext"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="documentationheadersmustnotcontainblanklines"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="includeddocumentationxpathdoesnotexist"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="includenodedoesnotcontainvalidfileandpath"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="inheritdocmustbeusedwithinheritingclass"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementdocumentationmustbespelledcorrectly"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="filemusthaveheader"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="fileheadermustshowcopyright"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="fileheadermusthavecopyrighttext"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="fileheadermustcontainfilename"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="fileheaderfilenamedocumentationmustmatchfilename"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="fileheadermusthavevalidcompanytext"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="fileheaderfilenamedocumentationmustmatchtypename"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> </rules> <analyzersettings /> </analyzer> <analyzer analyzerid="stylecop.csharp.orderingrules"> <rules> <rule name="usingdirectivesmustbeplacedwithinnamespace"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementsmustappearinthecorrectorder"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="elementsmustbeorderedbyaccess"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="constantsmustappearbeforefields"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="staticelementsmustappearbeforeinstanceelements"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="declarationkeywordsmustfolloworder"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="protectedmustcomebeforeinternal"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="propertyaccessorsmustfolloworder"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="eventaccessorsmustfolloworder"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="staticreadonlyelementsmustappearbeforestaticnonreadonlyelements"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> <rule name="instancereadonlyelementsmustappearbeforeinstancenonreadonlyelements"> <rulesettings> <booleanproperty name="enabled">false</booleanproperty> </rulesettings> </rule> </rules> <analyzersettings /> </analyzer> </analyzers> </stylecopsettings>

visual-studio-2010 configuration warnings stylecop suppress-warnings

c - Stop string array -



c - Stop string array -

how stop sting array. if set maximum 40 char can put, dont want fill whole string 40 char. here code write char @ string array.

int main(void) { char data[1][40]; int i1 = 0; int i2 = 0; serial_init(); while (1) { (i1=0;i1<1;i1++) { (i2=0;i2<40;i2++) { data[i1][i2] = usart_receive(); } } (i1=0;i1<1;i1++) { (i2=0;i2<40;i2++) { usart_transmit(data[i1][i2]); } } } homecoming 0; }

example if force if (usart_receive() == '.'). function stop string fill until 40 char. how that, hope can help me out here.

(i1=0;i1<1;i1++) { (i2=0;i2<40;i2++) { data[i1][i2] = usart_receive(); if (data[i1][i2] == '.') { if (i2 < 39) data[i1][i2+1] = '\0'; // null terminate string break } } }

this stop receive on '.', null terminate string (if needed), , break out of loop.

c arrays string avr uart

sql server - Where to find the 'views' settings from crm 2013 sql -



sql server - Where to find the 'views' settings from crm 2013 sql -

having troubles finding views settings section using sql server. filtered views query find these settings. told briefly seek looking in filtereduserquery did not find of columns looking for. have attached screenshot more clarification on settings looking for. interested in these columns while using sql server. please allow me know if have questions or confusions questions. here link of different filtered views have access http://msdn.microsoft.com/en-us/library/dn531182.aspx

thanks assitance!

you need filteredsavedquery, entity savedquery holds scheme views.

sql sql-server dynamics-crm-2011 crm dynamics-crm-2013

Find commit where file has been deleted in GitHub (without cloning repo) -



Find commit where file has been deleted in GitHub (without cloning repo) -

is there way find , display in commit file has been deleted in github, without cloning locally? example, using website's online search form?

no, there no way without cloning repo.

github

extjs - Updating Rowediting editor after a user Input -



extjs - Updating Rowediting editor after a user Input -

we have rowediting plugin on grid button of 1 trigger field changes other values of record (we loading remote info applied record). values changed in background commonly not editable, rendered. remote loading of info works fine, meaning record changed , info save have next problems:

1.the rowediting plugin not show changes applied record fields

2.setting changes via record.set() cause store sync , not on clicking "save" button of editor.

so how can create editor show changes applied in background , how can apply these changes in way saved along other edited fields.

thanks in advance help!

this should not complicated, need reference active editor instance. can either

reload record form calling loadrecord() again. note may overwrite changes made within editor

or (for sec way expecting values same in record in manner of key:value definition - short: no special mapping required)

apply new info record calling either set (note trigger sync if have autosync turned on) or using ext.apply(recinstance.data,newvalues) , editorinstance.getform().setvalues(newvalues)

extjs extjs4 extjs4.2

ruby on rails - How do I get the currently authenticated user with Ember simple auth? -



ruby on rails - How do I get the currently authenticated user with Ember simple auth? -

if user starts out in app unauthenticated , logs in, can have rails back-end homecoming user data, , create user model in ember app.

however, if user starts out in app authenticated? how can utilize session fetch user's details rails?

i'm using ember-simple-auth-devise authenticator.

i able use

this.get('session.user_email')

in application route find authenticated user.

the improve way reopen session object , add together property references authenticated user. see this illustration guides.

ruby-on-rails ember.js ember-simple-auth

php - Linux / Ubuntu cannot find JVM -



php - Linux / Ubuntu cannot find JVM -

i'm trying install netbeans larn php.

i chose alternative here

https://netbeans.org/downloads/index.html>

and when tried installing on terminal, said needed jdk 7. after downloading , installing jdk 7 from

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

i tried install netbeans 1 time again , gave me same message; jdk not installed , need install it.

what should netbeans isntall?

did seek using bundle manager? should have jre installed default, should able use:

sudo apt-get install openjdk-7-jdk

to verify installed java on scheme can try:

java -version

once have should able run netbeans using netbeans.sh script in bin/ of netbeans download. if remember correctly doesn't install anything, runs there.

php linux netbeans ide java-7

node.js - Node-Webkit Iframe Not Displaying Internet Browser -



node.js - Node-Webkit Iframe Not Displaying Internet Browser -

maybe installed incorrectly or something, no matter try, can't browser window display in iframe. copy-pasted code illustration found main page:

<!doctype html> <html> <head> <meta charset="utf-8"> <title>test</title> </head> <body> <b>you should able see google in iframe below:</b> <iframe src="https://www.google.com" style="width: 80%;" nwdisable nwfaketop> </iframe> </body> </html>

i copy-pasted json file:

{ "name": "test", "main": "main.html", "window": { "width": 600, "height": 400, "position": "center", "title": "test", "resizable": true } }

when run code "c:\node-webkit\nw.exe ." command line, "you should able see google in iframe below:" empty box below it.

also, i'm on windows. help appreciated.

edit: i'm able run of sample apps here

the problem was trying load https site within http window.

node.js iframe node-webkit

Map with ArrayList as the value in Java - Why use a third party library for this? -



Map with ArrayList as the value in Java - Why use a third party library for this? -

i've found need utilize map long key , arraylist of objects value, this:

map<long, arraylist<object>>

but read here using third-party library google guava recommended this. in particular, multimap recommended instead of above.

what main benefits of using library simple?

what guava details reasoning , benefits.

for me biggest reason reliability , testing. mentioned has been battle-tested @ google, used elsewhere , has extensive unit testing.

arraylist map guava java

Is there an equivalent of ping for checking connectivity to SQL Server? -



Is there an equivalent of ping for checking connectivity to SQL Server? -

is there equivalent of ping checking connectivity sql server?

i'm finding our biztalk admin console during long operations, e.g. importing big bindings file, "connection" beingness lost, i.e. reddish box appears on console. connectivity comes back. sql server on different machine biztalk.

also saw issue connection sso db lost min or ... worse, production environment!

sql dba has checked , sql fine, showing no network issues ...

i can ping -t see if happens connection between 2 machines, there equivalent function check ongoing connectivity sql server itself?

and if there such function, there someway automate checking can have flag occurance of disconnect ... sending email ops first step

you can utilize powershell

add-pssnapin sqlservercmdletsnapin100 add-pssnapin sqlserverprovidersnapin100 $query = "select top 1* bts_application" invoke-sqlcmd -query $query -serverinstance '.' -database 'biztalkmgmtdb'

sql-server sql-server-2008-r2 biztalk biztalk-2010

How to Display Custom KML Placemark Icon using Image from Local Disk or Network Drive -



How to Display Custom KML Placemark Icon using Image from Local Disk or Network Drive -

does know how display custom kml placemark icon using image local disk or network drive.

i tried , not working:

<?xml version="1.0" encoding="utf-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <style id="icon"> <iconstyle> <icon> <href>c:\etnasss.jpg</href> </icon> </iconstyle> </style> <placemark> <name>simple placemark</name> <description>attached ground. intelligently places @ height of underlying terrain.</description> <styleurl>#icon</styleurl> <point> <coordinates>-122.0822035425683,37.42228990140251,0</coordinates> </point> </placemark> </kml>

thanks

the <href> element in kml takes url not windows file path. url can absolute or relative location.

to working suggest first move kml file , image same folder refer image filename.

<style id="icon"> <iconstyle> <icon> <href>etnasss.jpg</href> </icon> </iconstyle> </style>

source: https://developers.google.com/kml/documentation/kmlreference#href

next refer image absolute location (e.g. file:///c:/etnasss.jpg) google earth has security policy regarding access local files on file scheme outside context of kml file. you'd have allow access local files not recommended.

alternatively create kmz file (aka zip file) , include image within kmz archive file , reference in kml file.

icons kml google-earth

android - Hint not visible in Editbox while i run my app -



android - Hint not visible in Editbox while i run my app -

when alter ,it not reflected in app when test it

<edittext android:id="@+id/edittext1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_centervertical="true" android:background="#eeeeee" android:ellipsize="end" android:ems="10" android:focusableintouchmode="true" android:hint="entername" android:imeoptions="actiondone" android:padding="5dp" android:paddingbottom="40dp" android:paddingleft="30dp" android:paddingtop="40dp" android:textcolorhint="#aaaaaa" android:textsize="16sp" android:textstyle="italic" />

not able see hint have alter it.

you have forgot "=" sign hint attribute.

<edittext android:id="@+id/edittext1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_centervertical="true" android:background="#eeeeee" android:ellipsize="end" android:ems="10" android:focusableintouchmode="true" android:hint="entername" android:imeoptions="actiondone" android:padding="5dp" android:paddingbottom="40dp" android:paddingleft="30dp" android:paddingtop="40dp" android:textcolorhint="#aaaaaa" android:textsize="16sp" android:textstyle="italic" />

android hint editbox