Wednesday, 15 July 2015

Using cookies to filter data in Google Analytics -



Using cookies to filter data in Google Analytics -

i trying filter google analytics info company site based on cookie. don't want track internal traffic, can't filter based on ip address range because there internal users want still track. have pretty simple code adding cookie, not sure add together code. new cookies, , couldn't find online clear on how add together or utilize cookie.

<html> <head> <title>remove internal traffic google analytics</title> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-xxxxx-yy']); _gaq.push(['_setvar','employee']); _gaq.push(['_trackpageview']); (function() { var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : http://www') + '.google-analytics.com/ga.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(ga, s); })();

so question is, code go? helping out novice skills cookies.

do not utilize setvar (this deprecated), utilize _setcustomvar:

_setcustomvar(index, name, value, opt_scope)

the phone call goes before _trackpageview call.

there 5 custom vars in standard ga (50 in premium), that's "index". 'name' , 'value' should clear.

customvars either valid current page, session or visitor (in lastly case valid until visitors clears cookies in browsers unless waits 6 months before visits site again).

like every instruction asynonchronous ga code "pushed" on gaq-array, right phone call be:

_gaq.push(['_setcustomvar', 1, // custom var set slot #1. required parameter. 'items removed', // name acts kind of category user activity. required parameter. 'yes', // value of custom variable. required parameter. 2 // sets scope session-level. optional parameter. ]);

which taken google documentation here: https://developers.google.com/analytics/devguides/collection/gajs/gatrackingcustomvariables#setup.

i still maintain utilize case opt-out plugin improve solution.

update: thinking don't think need setcustomvar or custom cookies @ all. have employees go website via link like:

mywebsite.com?utm_source=allyourbasearebelongtous

then go profile settings , create custom filter, set exclude, filter field "campaign source" , filter pattern "allyourbasearebelongtous" (or whatever name gave campaign parameter).

this uses cookie (the standard google cookie) not need custom code @ all. campaign source parameter valid until visit campaign geared towards site, if wants test ga code need delete cookies or utilize incognito mode (but that't not different setting custom cookie or setcustomvar-methods).

cookies google-analytics

java - Loading objects defined by numbers in an int[][], isTopLeft() not working -



java - Loading objects defined by numbers in an int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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1; 1,1,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1; 1,1,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1; 1,1,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1; 1,1,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1; 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0; 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0;

the 1s platforms, 2s player. loading them in checking if @ top left of defined objects (platforms 20x20 2x2 square). counting backwards row , column , modding number expected width (in tens of pixels).

here code istopleft:

private boolean istopleft(int item, int r, int c, string[][] map){ //width , height measured in # of map "steps" (10px ea) int width = 0; int height = 0; if(item == 0){ }else if(item == 1){ width = platformwidth/10; height = platformheight/10; }else if(item == 2){ width = playerwidth/10; height = playerheight/10; }else if(item == 3){ }else if(item == 4){ }else if(item == 5){ }else if(item == 6){ }else if(item == 7){ }else if(item == 8){ }else if(item == 9){ } //counts backwards , upwards see how many blocks of same type preceed it. int curr = r - 1; int prevwidthcount = 0; int prevheightcount = 0; while(curr >= 0 && map[curr][c] == "" + item){ curr -= 1; prevwidthcount += 1; } int curc = c - 1; while(curc >= 0 && map[r][curc] == "" + item){ curc -= 1; prevheightcount += 1; } if(prevwidthcount % width == 0 && prevheightcount % height == 0){ homecoming true; } homecoming false; }

the 1 thing jumps out @ me in lines:

while(curr >= 0 && map[curr][c] == "" + item) while(curc >= 0 && map[r][curc] == "" + item)

you comparing strings using ==. that's relatively mutual error hurts - have utilize string.equals() compare 2 strings in java.

java arrays

microphone - Mute mic in android -



microphone - Mute mic in android -

i'm making app recording app in android.

i want record sound happened near. (of course, know "only" much want. need much high quality.)

according hear, in ios, there function mute mic outside sound couldn't record.

and there setmicrophonemute in android couldn't work sleekly.

are there way solve problem? sound amplifying or noise canceling(reduction) okay don't have thought most. (because mother language isn't english language googling bounded)

android microphone mute noise-reduction

actionscript 3 - Shared back button in a menu AS3 flash -



actionscript 3 - Shared back button in a menu AS3 flash -

hi i'm making main menu , problem i've run regarding button. i'm using same button navigate throughout submenus of main menu.

i need know how determine submenu of menu @ given time, can alter playhead appropriate label instead of going original main menu label time.

var submenu:displayobject = this.getchildbyname("mc_submultiplayer"); if (boolean(this.contains(submenu))){ this.gotoandplay(49); } else{ movieclip(parent).gotoandplay("goback"); }

i've tried variations of no avail :c

i think need manually maintain track of menu user on , react accordingly. few ways, such hard coding every single sub menu parent menu go (not recommended) or keeping list or stack of menu buttons user has pressed create 'trail' can backtrack, or maybe maintain track of menu ids (same idea, keeping track of menus instead of button presses, may more cleaner , intuitive).

actionscript-3 flash-cs5

java - How come this doesn't work [trying to print out a new sentence with all the constants] -



java - How come this doesn't work [trying to print out a new sentence with all the constants] -

import javax.swing.joptionpane; public class indexof { public static void main(string[] args) { string newsentance = ""; string sentance = joptionpane.showinputdialog("enter sentance"); string vowels = "aeiou"; int len = sentance.length(); (int = 0; >=len; i++) { if(vowels.indexof(sentance.touppercase().charat(i))>0) { newsentance+=sentance.charat(i); } } system.out.println(newsentance); } }

i getting no errors in netbeans yet still returns nil when printing newsentance .length working returns number correctly if printed

what else be?

modifying code

int = 0; < len; i++

and

vowels.indexof(sentance.touppercase().charat(i)) < 0

results in constants getting printed.

java string indexof

user interface - python matplotlib blit to axes or sides of the figure? -



user interface - python matplotlib blit to axes or sides of the figure? -

i'm trying refresh plots have within gui everytime go 1 time through fitting procedure. also, these plots within framw can resized, axes , labels etc need redrawn after resizing. wondering if knew how update sides of figure using plot.figure.canvas.copy_from_bbox , blit. appears re-create , blit background of graphing area (where lines beingness drawn) , not sides of graph or figure (where labels , ticks are). have been trying graphs update trial , error , reading mpl documentation, far code has jst become horrendously complex things self.this_plot.canvas_of_plot..etc.etc.. .plot.figure.canvas.copy_from_bbox... far convoluted. know language might little off i've been trying read through matplotlb documentation , differences between figure, canvas, graph, plot, figure.figure, etc. starting evade me. first , foremost question be:

1 - how update ticks , labels around matplotlib plot.

and secondly, since have improve grasp on reply question,

2 - difference between plot, figure, canvas, etc. in regards area cover in gui.

thank much help.

all can rather confusing @ first!

to begin with, if you're chaining ticks, etc, there isn't much point in using blitting. blitting way avoid re-drawing if things changing. if changing, there's no point in using blitting. re-draw plot.

basically, want fig.canvas.draw() or plt.draw()

at rate, reply first question, in cases won't need update them manually. if alter axis limits, they'll update themselves. you're running problems because you're blitting within of axes instead of redrawing plot.

as sec question, good, detailed overview artist tutorial of matplotlib user's guide.

in nutshell, there 2 separate layers. 1 deals grouping things parts you'll worry when plotting (e.g. figure, axes, axis, lines, etc) , deals rendering , drawing in general (the canvas , renderer).

anything can see in matplotlib plot artist. (e.g. text, line, axes, , figure itself.) artist a) knows how draw itself, , b) can contain other artists.

for artist draw itself, uses renderer (a backend-specific module you'll never touch directly) draw on figurecanvas a.k.a. "canvas" (an abstraction around either vector-based page or pixel buffer). draw in figure, phone call canvas.draw().

because artists can groups of other artists, there's hierarchy things. basically, (obviously, varies):

figure axes (0-many) (an axes plot) axis (usually two) (x-axis , y-axis) ticks ticklabels axis label background patch title, if nowadays you've plotted, e.g. line2d's

hopefully makes things touch clearer, anyway.

if want utilize blitting update tick labels, etc, you'll need grab , restore total part including them. part bit tricky get, because isn't known until after draw-time (rendering text in matplotlib more complicated rendering other things due latex support, etc). can it, , i'll glad give illustration if it's want, it's typically not going yield speed advantage on drawing everything. (the exception if you're updating 1 subplot in figure lots of subplots.)

python user-interface matplotlib

java - ant run app , the command dosnt get forked -



java - ant run app , the command dosnt get forked -

i start app ant , when started via command cmd command line . got running in foreground , doesn't go on next target. how can execute app , test junit task via ant ?

<target name="init" depends="compile,run,test" description="init build "> </target> <target name="compile" depends="build_dirs" description="compile source " > <javac srcdir="${src}" destdir="${build}" verbose="${talk}" includeantruntime="false" > <classpath refid="class.path" /> </javac> </target> <target name="run"> <java classname="${main-class}" fork="true"> <env key="ld_library_path" value="${libs_java_library_path}:${env.ld_library_path}"/> <classpath> <pathelement location="../lib/misc/log4j.jar"/> <pathelement path="conf"/> <pathelement path="dist/lib"/> </classpath> </java> </target> <target name="test" > <junit printsummary="no" showoutput="true"> <classpath refid="test.classpath"/> <formatter type="brief" usefile="false" /> <test name="com.controller.core.workflowshouldhavevalidxml" /> </junit> </target>

the test target never executed , why ?

java ant