Posts

Showing posts from June, 2012

Not getting IP Address due to firewall -

i trying implement personalization in website using ip address. because of firewall i'am no able user's original ip address. tried following lines of code httpcontext.current.request.servervariables["remote_addr"].tostring(); httpcontext.current.request.servervariables["http_x_forwarded_for"].tostring(); httpcontext.current.request.servervariables["http_client_ip"].tostring(); please try these 2 request.servervariables("remote_addr") or request.userhostaddress

syntax - Specman e: When colon equal sign ":=" should be used? -

i saw in specman e code example use of := (colon-equal sign), e.g.: var regs_type := rf_manager.get_exact_subtype_of_instance(graphics_regs); when , why should use := ? thank help. the := means declare variable of type expression on right returns , assign value. basically, in example, function get_exact_subtype_of_instance(...) returns value of type rf_struct . regs_type variable declared type. this code equivalent (but shorter than): var regs_type : rf_struct = rf_manager.get_exact_subtype_of_instance(graphics_regs); this syntax particularly helpful when casting: var foo := some_struct.as_a(foo some_struct_type);

AngularJS: nested directives & Two-Way Binding -

i've created directive pgpaginator: function paginatordirective() { return { restrict: 'e', require: 'ngmodel', templateurl: 'paginator.html', scope: { ngmodel: '=', }, }; } // ... .directive('pgpaginator', paginatordirective) paginator.html: <input pg-paginator-page /> <select pg-paginator-perpage ng-model="ngmodel.perpage" ng-options="option option in ngmodel.perpageoptions"></select> <br /> {{ngmodel}} <br /> {{ngmodel.page}} and tryed create directive pg-paginator-page use pgpaginator scope: .directive('pgpaginatorpage', function() { return { restrict: 'a', replace: true, template: '<input ng-model="ngmodel.page" type="number" />', link: function(scope, element, attrs) { console.log(scope)

operating system - Escape \n in pathname to use os python module -

i have path of form input_path=c:\users\ngv\workspace\filename1. i using dir,file = os.path.split(input_path). this prints: `dir= c:\users gv\workspace` treating \n of \ngv newline and file = filename1 . how fix this? cannot seem find way escape \n. tried input_path=input_path.replace('\n','\\n') , input_path.replace('\\n','\\\n') failed results. please note using exec() in python. , during exec() invoke file path name changes.

How does Tycho bind its goals to the Maven lifecycle -

i didn't understand how tycho bound maven lifecyle did not see pom.xml configuration binds tycho goals. my questions are: how tycho hook maven's building reactor stage, i.e. when prints below messages before reactor computed? [exec] [warning] no explicit target runtime environment configuration. build platform dependent. how tycho bind goals maven's build lifecycle? see there goals executed during build not configured in pom.xml: [exec] [info] --- target-platform-configuration:0.21.0:target-platform (default-target-platform) @ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --- [exec] [info] [exec] [info] --- tycho-packaging-plugin:0.21.0:package-feature (default-package-feature) @ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --- tycho using maven lifecycle hooks dependency resolution before actual reactor build starts. these lifecycle hooks available maven build extension , iirc tycho 1 of reasons introduced in maven 3.0. tycho's implementation of lifecycle h

button - How to change label's text font in tcltk -

i have gui label , button. when press button new window comes have choose font. part managed it. it on tcltk site code witch helped me make font window appear. there shown 4 procedures. first , second proc used font window appearance. link is: http://www.tcl.tk/man/tcl/tkcmd/fontchooser.htm my question is: how can link font choose label's text? the label widget, text widget, has -font option. you've got make things set up. way in case add following binding (assuming you've got procedures , have made label, geometry-managed it, , stored name in thelabel variable): bind $thelabel <1> {focus %w; fontchooserfocus %w} labels don't take focus, , don't have default key bindings, can forced have focus , that's useful indicate being configured. (this particularly important on osx, font dialog different in how works on other platforms).

jquery - Make a .click override .on('mouseover') -

im making timeline, , shows info when being hovered over, want clickable, , when clicked, stay visible until button clicked, or button clicked again. how do this? jsfiddle my html: <div class="timeline-pills"> <div class='timeline-element' id='year-1492'> <p>1492</p> </div> <div class='timeline-element' id='year-1607'> <p>1607</p> </div> <div class='timeline-element' id='year-1620'> <p>1620</p> </div> </div> <div class="timeline-info-panels"> <div class='timeline-info' id='1492'> <p>1492</p> </div> <div class='timeline-info' id='1607'> <p>1607</p> </div> <div class='timeline-info' i

centos - Changing hostnames in added hosts in Ambari server? -

in ambari server have added 7 slaves master, problem had changed hostnames on slaves, therefore master node cannot identify slaves now. so can me changed hostnames added? thank you. as of ambari 2.2.2 can change hostnames using ambari-server update-host-names <hostnames.json> the basic steps are: back ambari db disable kerberos stop ambari-server , ambari-agent on hosts create hostnames.json map old names new names. example: {"clustername":{"oldhost1.example.com":"newhost1.example.com","oldhost2.example.com":"newhost2.example.com"}} on ambari server: ambari-server update-host-names hostnames.json updates hostnames on nodes if hostname of ambari server changed, update ambari-agent.ini on every ambari agent node on ambari server: ambari-server start on agents: ambari-agent start re-enable kerberos if needed http://docs.hortonworks.com/hdpdocuments/ambari-2.2.2.0/bk_ambari_reference_guide/content/ch

in Excel use name from namebox ( range ? ) in VBA -

what want select range b2:b5 and give name, above cells a1 , b1 there namebox , type name: "my_test_range" here , hit enter. the word range official name range described above in excel? then want loop trough range b2:b5 using vba , make cells right of ranged cells 1. how do above? i want named range , because find name "options_for_red_car" or "options_for_blue_car" easier read b2:b5 etc., if dozen such ranges. range important object in excel object model. here 1 of thousands of references information ranges: http://msdn.microsoft.com/en-us/library/office/ff838238(v=office.15).aspx seems like named-ranges powerful , useful , if you're going start playing vba you'll find them more , more useful. to loop through cells in range can following: sub loopthroughrangecells() dim cell each cell in excel.thisworkbook.sheets("sheet1").range("a2:c6").cells msgbox cell.address next end sub al

.htaccess - how to install laravel on sub domian shared host -

i create small registration system site laravel framework. want upload on "shared host". host control panel direct admin . 1.first create sub domain this: reg.mydomain.me . after created reg folder on root directory , copy of laravel folders , files in that. /home/mydomain.me/public_html/ i moved main file of laravel (app, boostrap, vendor, composer.json, composer.lock, phpunit.xml etc) reg folder **except public folder. opened /home/username/main-laravel/bootstrap/paths.php , edit this: replace 'app' => dir .'/../app', 'app' => dir .'/../../main-laravel/app', replace 'public' => dir .'/../public', 'public' => dir .'/../../public_html/laravel', replace 'base' => dir .'/..', 'base' => dir .'/../../main-laravel', replace 'storage' => dir .'/../app/storage', 'storage' => dir .'/../../main-laravel/app/storage'

ios - Why viewdidlayoutsubviews call multiple times? -

i'm developing ios universal app on swift,using auto layout , support portrait. i found uiviewcontroller#viewdidlayoutsubviews called multiple times. instead, viewdidload call once on starting myapp's uiviewcontroller. why viewdidlayoutsubviews call multiple times? constraints on each uiview(uibuttons,uitextfields etc..) perform in order? any information appreciated. loadview called one: when view needs loaded. layoutsubviews , however, called once per run loop on view has had setneedslayout or setneedsdisplayinrect called on - includes whenever subview has been added view, scrolling, resizing, etc. see this link more information. uses objective-c, information still holds.

java - Spring validation with Javax.validation redirects to 400 -

i working on spring-mvc application, , want validate data. able validate data no problems. thing if data invalid, go jsp page, not happening right now. instead apache 400 error, request sent syntactically incorrect. can tell me remaining implement in validation. controller : @requestmapping(value = "/", method = requestmethod.get) public string listpersons(model model) { person person = personservice.getcurrentlyauthenticateduser(); if(!(person==null)){ return "redirect:/canvas/list"; } else { model.addattribute("person", new person()); // model.addattribute("listpersons", this.personservice.listpersons()); model.addattribute("notices",new notes()); model.addattribute("canvases",new canvas()); return "person"; } } @requestmapping(value= "/person/add", method = requestmethod.post) p

Removing background and measuring features of an image in MATLAB -

Image
i'm trying measure areas of each particle shown in image: i managed general shape of each particle using mser shown here: but i'm having trouble removing background. tried using matlab's imfill, doesn't fill particles because cut off @ edges. tips on how rid of background or find areas of particles other way? cheers. edit: imfill looks like: edit 2: here code used outline. used this mser. %compute region seeds , elliptial frames. %mindiversity = how similar parent mser region %maxvariation = stability of region %brightondark used void dark. prevents dark %patches in void being detected. [r,f] = vl_mser(i,'mindiversity',0.7,... 'maxvariation',0.2,... 'delta',10,... 'brightondark',1,'darkonbright',0) ; %plot region frames, not used right %f = vl_ertr(f) ; %vl_plotframe(f) ; %plot msers m = zeros(size(i)) ; %m = no of overlapping extremal regions x=r' s =

Custom cook book to deploy java app on tomcat using AWS CLoudFormation template -

i trying deploy java webapp/tomcat using aws opsworks, not finding cookbooks configures tomcat on ec2 , deploy java app. can please provide me custom cookbook that. need both link application , custom cookbook. trying cloud formation template. my cloud formation template "mystack": { "type": "aws::opsworks::stack", "properties": { "customcookbookssource": { "type": "git", **"url": "xxx (url cookbook)"** } } } -- "myapp": { "type": "aws::opsworks::app", "properties": { "stackid": { "ref": "mystack" }, "type": "java&

ruby - Command line gem install error - sqlite3 - Rails New Command -

i tried creating new rails application in command line , had following error. what's problem? i have tried working out myself, i'm new coding , reading through i'm lost! /users/johnsway/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb checking sqlite3.h... *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/users/johnsway/.rvm/rubies/ruby-2.1.2/bin/ruby --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include --without-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sqlite3-lib=${sqlite3-dir}/lib /users/johnsway

java - Applying OGNL expression to a context variable -

i'm working struts2 (unexperienced developer) , i've been searching couldn't find how apply ognl expression variable stored in context. the thing need retrieve parameter context , uppercase it. now, i've tried way sadly no luck: <s:property value="#myvar.touppercase()" /> as works variables stored in valuestack (notation without #), don't understand why won't work stored in context.. i'm able print #myvar content fine if dont append .touppercase() it. also tried workaround didn't help: <s:property value="<s:property value="#myvar"/>.touppercase()"/> so what's thing i'm missing? how can apply ognl expression variable stored in context? many thanks your variable isn't string there isn't touppercase() method in it. solution call tostring() before calling touppercase() . <s:property value="#myvar.tostring().touppercase()" /> update actually p

Highcharts: how display tooltip, when point = null? -

when hover on may in example , don't see tooltip month, because data null. can set settings see tooltip when data null? well far know there no generic option since highcharts ignores null values showing. on other hand, can replace null points "fake" ones, have average value between 2 closest points (this cause chart flow remain same), , custom property isnull can used flag later. after doing that, can use formatter function tooltip, , manipulate tooltip way want, example displaying series name when point isnull . $(function () { $('#container').highcharts({ title: { text: 'the line connected april juni, despite null value in may' }, xaxis: { categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] }, plotoptions: { serie

r - Non standard evaluation (NSE) for dplyr do() -

i implement like mtcars %>% group_by(cyl) %>% do(mod = lm(mpg ~ disp, data = .)) inside function this myfun <- function(d, groupvar, x, y) { d %>% group_by(groupvar) %>% do(mod = lm(y ~ x, data = .)) } myfun(mtcars, cyl, disp, mpg) but cannot understand enough nse it. know, example, dplyr nse functions group_by or summarize have associated se functions group_by_ , summarize_ seems do has not associated do_ . try library(dplyr) library(lazyeval) f <- function(d, groupvar, x , y) { groupvar <- lazy(groupvar) x <- lazy(x) y <- lazy(y) d %>% group_by_(groupvar) %>% do(mod = lm(interp(quote(y ~ x), y = y, x = x), data = .)) } f(mtcars, cyl, disp, mpg) # source: local data frame [3 x 2] # groups: <by row> # # cyl mod # 1 4 <s3:lm> # 2 6 <s3:lm> # 3 8 <s3:lm>

c++ - Comparing numbers in strings to numbers in int? -

i'm trying make program open txt file containing list of names in format (ignore bullets): 3 mark 4 ralph 1 ed 2 kevin and create file w/ organized names based on number in front of them: 1 ed 2 kevin 3 mark 4 ralph i think i'm experiencing trouble in line 40, try compare numbers stored in strings number stored in int. i can't think of other way tackle this, advice wonderful! #include <iostream> #include <fstream> #include <vector> #include <cstdlib> using namespace std; int main() { ifstream in; ofstream out; string line; string collection[5]; vector <string> lines; vector <string> newlines; in.open("infile.txt"); if (in.fail()) { cout << "input file opening failed. \n"; exit(1); } out.open("outfile.txt"); if (out.fail()) { cout << "output file opening failed. \

javascript - Backbone: abort previous router callback execution -

suppose have 2 links on page: <a href="#a">link a</a> <a href="#b">link b</a> and use backbone router handle in-app page navigation. on routing link '#a', have registered listenera , listenerb '#b' both listenera , listenerb heavy task in background. now, let's user clicks 'link a' , gap of few milliseconds, clicks 'link b'. so, happens when listenera done execution, listenerb starts executing due single ui thread. is there way, can block/abort/preempt execution of listenera if listenerb requested? it's expected user see response latest action. previous actions should not honored if 2 actions similar. to understand how backbone handles routes lets review chunk of code backbone.history : if (this._haspushstate) { backbone.$(window).on('popstate', this.checkurl); } else if (this._wantshashchange && ('onhashchange' in window) && !o

html - Open same popup dialog on multiple pages Jquery Mobile 1.4.5 -

in app have popup come on page within app log user out if stay inactive long. had working in jqm 1.4.2 have upgraded 1.4.5 popup not appear on page has not had page refresh. i calling popups using #id thought changing use class solve problem didn't. code: (simplified show basic popup on each page) popup page included in files: <div data-role='popup' class='class_popcountdown' data-theme='a' data-overlay-theme='a' data-dismissible='false' style='min-width: 300px;'> <div data-role='header' data-theme='a'> <h1>time out</h1> </div> <div data-role='main' class='ui-content'> <p> popup test </p> <a href="#" class="ui-btn" data-rel="back">cancel</a> </div> <script> function displaypopuptest() { $(".class_popcountdown").popup("open"); }; &l

osx - NSWindowController/NSDocument lifecycle (closing) -

i have 'standard' os x document based app using nswindowcontroller, nsdocument etc. has nstextview part of ui. question have (and it's driving me nuts) how best trap 'close document' , tell nstexview finish edit. finishing edit may result in model being updated (and possibly change count of document) need before other nsdocument logic decides whether save necessary. thanks your textview doesn't allow undo. -(void)setallowsundo:(bool)value; you either disabled calling former method or unchecked in interface builder (for textview). without undo support in textview document isn't made dirty automatically (no updatechangecount made document doesn't know edited). cleaner solution (without allowing undo): to fix have register delegate , implement textdidchange: (nstextviewdelegate method) or register nstextdidchangenotification. within methods can update model and/or make document dirty/edited. alternatively: when there attempt

mysql - I want to alter table in php , but my code is not working -

i want add column table using php code not working $sql="alter table user_preference_table add column '$tag_id' varchar(60) "; $result = $conn->query($sql); i think problem way of declaring variable query ? is query right? '$tag_id' it variable contains id 501 replace single quote backtick. $sql="alter table user_preference_table add column `$tag_id` varchar(60) "; signle quotes inserting values database tables. backticks used db fields. they prevent errors of using reserved keywords in mysql. e.g. as ...etc

r - prcomp and ggbiplot: invalid 'rot' value -

i'm trying pca analysis of data using r, , found this nice guide , using prcomp , ggbiplot . data 2 sample types 3 biological replicates each (i.e. 6 rows) , around 20000 genes (i.e. variables). first, getting pca model code described in guide doesn't work: >pca=prcomp(data,center=t,scale.=t) error in prcomp.default(data, center = t, scale. = t) : cannot rescale constant/zero column unit variance however, if remove scale. = t part, works fine , model. why this, , cause of error below? > summary(pca) importance of components: pc1 pc2 pc3 pc4 pc5 standard deviation 4662.8657 3570.7164 2717.8351 1419.3137 819.15844 proportion of variance 0.4879 0.2861 0.1658 0.0452 0.01506 cumulative proportion 0.4879 0.7740 0.9397 0.9849 1.00000 secondly, plotting pca. using basic code, error , empty plot image: > ggbiplot(pca) error: invalid 'rot' value what mean, , how can f

Connect telerik appbuilder to Azure documentdb -

Image
we're using appbuilder extension in visual studio. we're trying find ways connect our azure document database. want know how can connect database , add, name or number (for now). thanks in advance! telerik appbuilder doesn't have integration w/ azure documentdb yet . if you're looking to simple connect documentdb database simple crud operations (e.g. add name or number field) - i'd recommend checking out 1 of following: the document explorer inside azure portal : or mingaliu's documentdb studio :

android - How to do something when screen is turning off? -

this question has answer here: android notification of screen off/on 2 answers how can invoke arbitrary code in android when screen of device turned off? there callback of sort? the system broadcast message when screen turns on , off. here detailed answer https://stackoverflow.com/a/4208538/1581921

c# - Entity Framework one context many databases -

in app, have 1 context user can select 1 of many databases during login. these databases based on same context , connection strings configured in web.config. i have class caches user details: public class userdetais { public string token { get; set; } public string connectionstring { get; set; } } once user logs in, new userdetails object added cache later requests. on receiving further requests, controller gets user's details cache , passes them on service, example: public class customertypecontroller : apicontroller { private readonly icustomertypeservice customertypeservice; public customertypecontroller(icustomertypeservice customertypeservice) : base(logservice) { this.customertypeservice = customertypeservice; } protected override void initialize(httpcontrollercontext controllercontext) { base.initialize(controllercontext); var token = controllercontext.request.properties["token"] strin

Gemfile.lock equivalent in Maven and gradle -

as maven (client) , ivyresolver (used gradle) bundler solves libraries dependencies declared on configuration file (gemfile bundler). however, after bundler saves dependency resolution on gemfile.lock. allows other developers use same libraries. for instance, maven use determinist not clear way resolve conflict in dependency resolution. example, specifying version ... <version>1.0.1</version> is not guarantee version used. , specifying version ... <version>[1.0.0,2.0.0)</version> give no guarantee. yes, write manually versions listed by mvn dependency:resolve but, there automatic way that? to clear: is there equivalent gemfile.lock in maven or gradle? java developers, if not familiar gemfile.lock, bundler, please check: http://bundler.io/v1.3/rationale.html the important part copy below: checking code version control after developing application while, check in application gemfile , gemfile.lock snapshot. now, reposi

unix - Reason for disparate results with mdfind using Python subprocess -

i'm trying write python wrapper unix mdfind utility. in simplest form, works well; however, cannot figure out 1 instance of odd behavior. things bit odd when running more complex queries (two or more fields). take following example: import subprocess import itertools def test1(): cmd = "mdfind 'kmditemfsname=pandoc&&kmditemcontenttype=public.unix-executable'" shell_res = subprocess.check_output(cmd, shell=true) find_res = mdfind(content_type='public.unix-executable', name='pandoc') if shell_res == find_res: print('passed!') def mdfind(**kwargs): cmd = ['mdfind'] key, arg in kwargs.iteritems(): if key in mdattributes().keys(): md_name = mdattributes()[key]['id'] query = '='.join([md_name, arg]) cmd.append(query) if 'only_in' in kwargs: cmd.append('-onlyin') cmd.append(k

cordova - Unable to Create or Open JavaScript file in Android-Studio -

i'm using cordova, phone-gap, android studio, have created project it's working fine i'm unable create or open existing java script file in android studio, existing javascript files showing folder or directory when click on them nothing happens, looking quick response thanks. http://i.stack.imgur.com/93fbh.png i have reset android studio well. anyway :p.

xml - XSL Transform for Multiple Child Elements -

team i absolute newbie xslt. trying hand @ automation. want able create following output using below xml code of text: my xslt <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="3.0"> <xsl:output method="html" version="5.0" encoding="utf-8" indent="yes"/> <xsl:template match="/"> <html> <head> <title>kt/definitions list</title> </head> <body> <h2>kt/definitions list</h2> <table border="1"> <thead> <tr> <th>kt</th> <th>definition</th> </tr> </thead> <tbody> <xsl:apply-templates select="cl:doc//cl:key-term-entry"/&

java - How to insert transaction into table in mysql keeping it unique for every user -

hey newbie in web development , having problem in cashbook web application using servlets have 2 tables in db users(primary-key p_id) , transactions(primary-key t_id) whenever user-a adds transaction transaction table visible user-b when logs in web application. there way whatever transaction user-a added transaction table db visible user-a , not other user? when user-b logs in can see user-b transactions not of user-a. thanks.your appreciated simplest solution (without multitenancy or other things) have foreign key in transactions table user table, can filter on user , vice-versa or use jpa like: user.gettransactions()

c# - Unable to read the full output redirected from Console application - SVN Update automation -

i trying automate update procedure svn update using console application. use following code below. processstartinfo svnupdate = new processstartinfo(); svnupdate.arguments = string.format("update \"{0}\" -r {1}", destination, revisionno); svnupdate.filename = "svn.exe"; svnupdate.createnowindow = true; svnupdate.useshellexecute = false; svnupdate.windowstyle = processwindowstyle.hidden; svnupdate.redirectstandardoutput = true; svnupdate.redirectstandarderror = true; process p = new process(); p.startinfo = svnupdate; p.enableraisingevents = true; p.start(); svnoutput = p.standardoutput.readtoend(); p.waitforexit(); if (p.hasexited) { console.writeline("received output test : " + svnoutput); } p.close(); p.dispose(); the above code works fine if there no errors returned update command. if there errors able first line of outpput returned when set code below console gives me full error text. svnupdate.redirectstandardoutput = false; sv

ios - Setting "Build Active Architectures Only" To "YES" Pros vs Cons? -

i understand setting value yes speeds building time. far know setting option "yes" build connected device's architecture. so if had connected older device such iphone 3gs (armv7) release build should work on armv7, armv7s , arm64. but happens if release iphone 5 (armv7s) connected while "build active architectures only" set "yes" ? can assume build work on armv7s , arm64, work on older devices has armv7? yes, don't think apple let submit app way, if distribute in other ways, won't work on older devices... that's why it's set yes debug , no release

sql - Postgresql: select MAX value from two joined tables -

i have 2 tables: tbl_status: id status_code month_digest_id project_id tbl_project id name tbl_month_digest: id month_ts i have project. each project has status 0 or more months (stored in tbl_month_digest). given list of project ids need latest status object. i having trouble doing this. in mysql able select join of tbl_month_digest , tbl_status , adding having tbl_month_digest.month_ts = max(tbl_month_digest.month_ts) . postgres insists add tbl_month_digest.month_ts group by, not have desired effect. is possible recent status list of projects in single sql query in postgresql? example data , expected result: tbl_month_digest: id month_ts 1 2014-05-01 2 2014-06-01 3 2014-07-01 tbl_project: id name 90 'foundation' 91 'testing' 92 'examination' tbl_status: id project_id month_digest_id status_code 1 90 1 'on_track' 2 90 2 'on_track'

Facebook Ads API - Actions by conversions returns total actions -

i'm trying info specific user's ad campaigns using async request /reportstats . when add fields request, fine. when remove both total_actions , total_unique_actions , fields actions_28d_click_by_convs , unique_actions_28d_click_by_convs return totals instead of object breakdown of totals per action. add either total_actions or total_unique_actions list, 2 by_convs fields return expected object. with 'total_actions': { campaign_name: '...', campaign_group_name: '...', clicks: 337, reach: 80564, [...] total_actions: 335, actions_28d_click_by_convs: [object], unique_actions_28d_click_by_convs: [object] } without 'total_actions': { campaign_name: '...', campaign_group_name: '...', clicks: 337, reach: 80564, [...] actions_28d_click_by_convs: 335, unique_actions_28d_click_by_convs: 335 } another weird thing: summary of response show object totals (of campaigns combined) per ac

atg droplet - SQL Statement Failed in ATG -

i working in atg application. today, got below sql exception in /atg/userprofiling/profileadapterrepository , because of violation of unique constraint. atg.repository.repositoryexception; source:java.sql.sqlintegrityconstraintviolationexception: ora-00001: unique constraint (dcs_usr_actvprom_p) violated exception occurs when insert query user promotion table dcs_usr_actvpromo of atg executed. searched when , query executed, values passed not find till now. handlelogin method of atg.scenario.userprofiling.scenarioprofileformhandler have been called custom formhandler. not find flow after method call. after method call, exception occurs. could let me know happens inside method , sql queries executed in atg above table please? you did not add actual sql trying run, error message pretty says all. breaching unique constraint. let's suppose have table called foo , have unique column, called bar . if intend insert record foo , having bar value of 'loremip

html - 3 colums with list item -

can that? don't know i'm doing wrong. want list items make 3 column layout. here code css3: <section class="intro clearself"> <ul class="three-col-row"> <li> <h2>wat?..</h2> <p>praktische en juiste informatie een belangrijke deelsleutel tot de oplossing van rugproblemen.</p> <a class="button" href="advice.html">meer info!</a> </li> <li> <h2>hoe...</h2> <p>ga zo ver mogelijk in de beweging en herhaal dit regelmatig gedurende u capaciteit.</p> <a class="button" href="work-out.html">kies je sport!</a> </li> <li> <h2>doel...</h2> <p>het belangrijkste aspect echter dat u ontdekt dat u zelf veel kan doen om uiteindelijk uw rugklacht te vermijden, m

c# - How to ensure injected property updates its reference in IoC in order to have all depended ViewModels have same property instanceup to date -

it possible inject interface via constructor: private readonly idataservice _dataservice; public mainviewmodel(idataservice dataservice) { _dataservice = dataservice; } above injection proper if service created in ioc container , never changes. another way inject via property (property injection) public idialogservice dialogservice { { return simpleioc.default.getinstance<idialogservice>(); } } such solution useful if instance of idialogservice may changed during application lifetime. then change data: dialogservice.somedata = updateddata the first way injection done easy test. i can mock interface , inject via constructor. i know practise ensure above second way testable. i ensure depended viewmodels using same idialogservice (being changed here in mainviewmodel) has date same instance. your example doesn't show property injection. example shows container being use

java - Time efficient recursion for Magical Number -

i solving magical number problem number @ nth position sum of previous 3 numbers, minus 1. example: 0 1 1 1 2 3 5 9 16.... , on. i solved in 2 ways. code 1) using recursion int magicnumber(int n){ int f = 0; if (n == 1) return 0; else if (n > 1 && n <= 4) return 1; else f = (magicnumber(n-1) + magicnumber(n-2) + magicnumber(n-3)) - 1; return f; } code 2) using array void magicnumber(int n){ long arr[] = new long[100]; int i=1; for(i = 1; <= n; i++) { if(i==1) arr[i] = 0; else if(i>1&&i<=4) arr[i] = 1; else arr[i] = (arr[i-1] + arr[i-2] + arr[i-3]) - 1; } system.out.println("result : "+arr[n]); } code 1 works fine when provide small integer number program, hangs input of bigger integer numbers , code 2 runs fine without problem. so need suggestions, how can improve performance of recursion program

c# - Clone a WPF element with a Setter -

in wpf application, have tabcontrol tabitems : <tabitem.header> <stackpanel orientation="horizontal"> <textblock name ="tabheader"/> <image margin="7,0,0,0"> <image.style> <style> <setter property="image.source" value="pictures/croixrouge.png"/> // no error without line </style> </image.style> </image> </stackpanel> </tabitem.header> and clone tabitem add 1 in tabcontrol following function : tabitem ti = (tabitem)_tabcontrollist.items.getitemat(_tabcontrollist.items.count - 1); tabitem ticloned= trycloneelement<tabitem>(ti); private static t trycloneelement<t>(t orig) { try { string s = system.windows.markup.xamlwriter.save(orig); // error : impossible serialize non-public type 'system.windows.media.imaging.b

javascript - Show gaps (diff) between a bar and a line -

Image
is possible draw gaps between different chart types? in example (picture below) have bars , line in same chart. gap difference of line-value , bar-value below. furthermore, if bar above line, should green gap, else red one. it's possible draw "normal" gap-bar bottom line behind actual bar, work red gaps , not green ones? here's example image: http://i.imgur.com/ruvjxa2.png what showing 4 different data series. blue bar series, black line series, green bar "below" series , red bar "above" series. given have line , bar series this: var databar = [[0,23],[1,34],[2,45],[3,21]]; var dataline = [[0,13],[1,53],[2,23],[3,90]]; you can create other 2 series like: var diffabove = []; var diffbelow = []; (var j = 0; j < 10; j++) { if (dataline[j][1] > databar[j][2]) { diffabove.push([j, dataline[j][3], databar[j][4]]); } else { diffbelow.push([j, databar[j][5], dataline[j][6]]); } } and put usi

Reading file seperated by white spaces into dynamic array C++ -

hi read file , put numbers seperated white space int different array. example file read 15 10 2 20 1 30 1 this did while(!file.eof()){ file>>first[count++]; } by doing taking line line want read until white space , put number after whitespace different array. result array (assume first , second dynamic integer arrays) first={15,10,20,30} second ={0,2,1,1} you should use string streams . #include <sstream> ... string line; while(getline(file, line)) { istringstream iss(line); int firstnumonline, secondnumonline. iss >> firstnumonline; first.push_back(firstnumonline); if(iss >> secondnumonline) { //... second.push_back(secondnumonline) } else { //... there no second number on line. second.push_back(0); } } here, first , second assumed vectors

c# - Is it possible to inherit from a class which is recursively generated? -

i have class makes nested grouping. simplified form follows. public class group { public readonly object key; public readonly ienumerable<group> groups; public readonly ienumerable<datarow> drs; public group(object key, ienumerable<datarow> source, list<string> columnlist) { key = key; if (columnlist.count == 0) drs = source; else { string firstcolumn = columnlist.first(); list<string> restofcolumns = columnlist.skip(1).tolist(); groups = source.groupby(dr => dr[firstcolumn]) .select(g => new group(g.key, g, restofcolumns)); } } } this fine point. need more properties(and methods) class. @ same time don't want add properties class, break simplicity , of usages not interested these properties. reason try inherit class. public class specialgroup:group { public specialgroup(object key, ienume