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

menu - drupal 7: display book module navigation horizontally -



menu - drupal 7: display book module navigation horizontally -

i using book module navigation block display links book pages. wondering if possible alter rather children links appearing below parent, appear side. because want horizontal navigation:

thanks

you can customize navigation block book-navigation.tpl.php template. have total command on html within block template. allows links next, previous , parent elements display of list of links children. if want create more complicated form of navigation (for instance: javascript-powered slideshow slides every page @ current level of book hierarchy) you'll have resort custom view , find way embed it in navigation template.

drupal menu drupal-7

Statistics : binomial distribution and simple graph in R -



Statistics : binomial distribution and simple graph in R -

i'm trying create simple graph binomial distribution in r.

so question "there 20 patients, , probability of operating on 4 patients successfully, (given probability = 0.8)."

what did is

x <- rbinom(4, size= 20, prob = 0.8) y <- pbinom(x, size = 20, prob = 0.8) plot(y, type="l")

but i'm not sure if right way of graphing it..

in general, question visualisation comes when question like:

what's probability of having "at least" 16 successes out of 20 operations given probability of success 0.8?

this can done using binomial formula is:

p(x=k) = choose(n, k) * .8^k * .2^(n-k) # equivalent dbinom(k, n, prob=0.8)

we need same k = 16..20 , sum these values probability of sucess in @ to the lowest degree 16 out of 20. done using dbinom as:

sum(dbinom(16:20, 20, prob=0.8)) # 0.6296483

note probability of @ to the lowest degree 4 successes @ success rate(0.8) 1. is, have @ to the lowest degree 4 successes. that's why chose relatively high amount of successes.

to plot (using ggplot2):

df <- data.frame(x=1:20, prob=dbinom(1:20, 20, prob=0.8)) require(ggplot2) ggplot(data=dd, aes(x=x,y=prob)) + geom_line() + geom_ribbon(data=subset(dd,x>=16 & x<=20),aes(ymax=prob),ymin=0, fill="red", colour = na, alpha = 0.5)

this gives like:

hope helps.

r

php - json_encode returning null -



php - json_encode returning null -

echo json_encode(array(utf8_encode("success")));

that code returning null, trying debug project , homecoming post variable, won't work string

heres total code:http://www.bludevelopment.com/php/getdata.txt

the problem in uploadinstalldata function. app calls separately each function.

any help much appreciated!

function uploadinstalldata(){ if (isset($_post["timestamp"]) && isset($_post["pmino"]) && isset($_post["gps"])){ //$result = array(utf8_encode('value', 'success')); if ($_post['cmd'] == "uploaddata"){ $con = mysql_connect("localhost","bludevel_pmi","password1"); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db("bludevel_pmiform", $con); $sql="insert jobdata (starttime, pmino, address, beforephoto, extraphoto1, extraphoto2, extraphoto3, abletoinstall, installproblem, bboxstatus, newlocation, bboxphoto, occupied, basementfinished, buildingtype, servicesize, servicetype, housepipesize, housepipetype, sscontrolvalve, newmeter, newmetersize, newtransmitter, miulocation, meterinstalltype, mtrlocated, mtrdirection1, mtrsideof1, mtrdistance, mtrdirection2, mtrsideof2, accessnotes, bldgwidth, bldgdepth, review, streetvalve, housevalve, authorizedwork, inspectorsname, newstreetvalve, addpiping, installedby, afterphoto, afterphoto2, customerincentive, confirmsignal, installnotes, endtime, gps) values ('".$_post[timestamp]."', '".$_post[pmino]."', '".$_post[address]."', '".$_post[beforephoto]."', '".$_post[extraphoto1]."', '".$_post[extraphoto2]."', '".$_post[extraphoto3]."', '".$_post[abletoinstall]."', '".$_post[installproblem]."', '".$_post[bboxstatus]."', '".$_post[newlocation]."', '".$_post[bboxphoto]."', '".$_post[occupied]."', '".$_post[basementfinished]."', '".$_post[buildingtype]."', '".$_post[servicesize]."', '".$_post[servicetype]."', '".$_post[housepipesize]."', '".$_post[housepipetype]."', '".$_post[sscontrolvalve]."', '".$_post[newmeter]."', '".$_post[newmetersize]."', '".$_post[newtransmitter]."', '".$_post[miulocation]."', '".$_post[meterinstalltype]."', '".$_post[mtrlocated]."', '".$_post[mtrdirection1]."', '".$_post[mtrsideof1]."', '".$_post[mtrdistance]."', '".$_post[mtrdirection2]."', '".$_post[mtrsideof2]."', '".$_post[accessnotes]."', '".$_post[bldgwidth]."', '".$_post[bldgdepth]."', '".$_post[review]."', '".$_post[streetvalve]."', '".$_post[housevalve]."', '".$_post[authorizedwork]."', '".$_post[inspectorsname]."', '".$_post[newstreetvalve]."', '".$_post[addpiping]."', '".$_post[installedby]."', '".$_post[afterphoto]."', '".$_post[afterphoto2]."', '".$_post[customerincentive]."', '".$_post[confirmsignal]."', '".$_post[installnotes]."', '".$_post[endtime]."', '".$_post[gps]."')"; echo json_encode(array(utf8_encode("success"))); homecoming true; $res = mysql_query($sql); if (!res) { die('error: ' . mysql_error()); } if (!$mysql->error) { } mysql_close($con); } }}

as mentioned, should not using ext/mysql extension new code. until purged ancient php tutorials on internet, wont see end of people going "why doesn't code work more", because using throws e_deprecated in php 5.5, , removed in later versions.

this uses mysqli extension, prepared queries (you can utilize pdo).

$db = new mysqli($dbip, $dbuser, $dbpass, $dbname); if ($query = $db->prepare("insert table_name (x, y) values (?, ?)")) { $query->bind_param("ss", $_post["x"], $_post["y"]); // s = string, = int $query->execute(); } else { echo json_encode(array("error" => "malformed query")); homecoming false; // in php, false or null both signify error in non-boolean context } echo json_encode(array("success" => "query attempted")); homecoming true;

of course, don't want blindly assume query successful here (hence "attempted").

your json doesn't seem failing, best give values in array associative key. also, utf8_encodeing array gives null. see this:

json_encode(array("query attempted")); // ["success"] json_encode(array("success" => "more info")); // {"success":"more info"} json_encode(utf8_encode(array("success" => "more info"))); // null

doing improve practice , can help debug complex json when can homecoming many different things. "null" part answers question pretty much this.

also, iso-8859-1 (aka latin1) subset of unicode (as ascii); encode cleanly json. should utf8_encode stick in json explicitly, though (such user input).

another vital thing missed when first answered (i can't believe missed this):

. $_post[newlocation] .

this isn't proper php. might work depending on how strictly php configured, keys in arrays quoted strings, not unquoted constants. can , throw error in error log (undefined t_constant newlocation; 'newlocation' assumed).

use $_post["newlocation"] (single or double quotes work, remember have different meanings in php)

php mysql json

oracle11g - Continuing the loop from exception block -



oracle11g - Continuing the loop from exception block -

i understand question had been answered , have referred question . when trying compile next code whereby trying go through loop contains insert statement ,if insert statement not successful need check if error thrown dml-insert failure unique constraint or not ,if unique constraint error (-1) need perform update statement , go on loop.

oracle version : 11g

create or replace procedure "testsample" type array_test table of number; test_arr array_test := array_test(1, 2, 3); v_key number; dup_chk number; v_excp_error_code varchar2(25); begin in test_arr.first .. test_arr.last loop dbms_output.put_line(i || ' = ' || test_arr(i)); dup_chk := test_arr(i); insert trig_test values('test324', test_arr(i), 'y', 'y') returning key v_key; if v_key not null dbms_output.put_line(' commiting insert ' || v_key || ' ' || dup_chk); commit; end if; exception when others v_excp_error_code := sqlcode; dbms_output.put_line('error code = ' || v_excp_error_code); if v_excp_error_code = '-1' dbms_output.put_line('entered unique constraint exception ' || v_key); if v_key = dup_chk or v_key null update trig_test set status = 'tstsample' key = v_key; dbms_output.put_line('updated '); commit; end if; else raise; end if; end; end loop; end testsample;

the above stored procedure throwing next compilation error ,

error(33,3): pls-00103: encountered symbol "exception" when expecting 1 of following: ( begin case declare end exit goto if loop mod null pragma raise homecoming select update while << go on close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge

error(56,7): pls-00103: encountered symbol "loop" when expecting 1 of following: ;

error(59): pls-00103: encountered symbol "end-of-file" when expecting 1 of following: end not pragma final instantiable order overriding static fellow member constructor map

highly appreciate help

thanks

you're missing begin after loop. ie:

loop begin -- add together dbms_output.put_line(i || ' = ' || test_arr(i)); dup_chk := test_arr(i); insert trig_test values ('test324', test_arr(i), 'y', 'y') returning key v_key; if v_key not null dbms_output.put_line(' commiting insert ' || v_key || ' ' || dup_chk); commit; end if; exception

instead of trapping others though, interested in ora-00001 can trap when dup_val_on_index instead , not check sqlcode.

oracle11g

model - Composite foreign key symfony2 yml -



model - Composite foreign key symfony2 yml -

i'm seek have right solution generate entities yml in symfony2.

here part of code in yml:

onetomany: actions: targetentity: action mappedby: testcaseid lifecyclecallbacks: { }

and i'm searching way set composite key in maybe

mappedby:testcaseid,revision

but doesn't work , dont' have right syntaxe , can't find on web

in fact found reply myself.

composite pk generated on manytoone side.

another issue might have doctrine generation of crud composite keys...

symfony2 model doctrine foreign-keys

android - Why does SKIA not use a custom FilterInputStream? -



android - Why does SKIA not use a custom FilterInputStream? -

i'm trying decode bitmap extended filterinputstream. have perform on-the-fly byte manipulation image info provide decodable image skia, seems skia ignores custom inputstream , initializes 1 of own...

when run test application, attempting load in 2mb big jpeg results in obfuscatedinputstream.read([]) beingness called 1 time bitmapfactory.decodestream()

it seems 1 time type of file determined first 16kb of info retrieved obfuscatedinputstream initializes own native stream , reads that, rendering changes create how input stream should work useless...

here buffered read function in extended filterinputstream class. log.d @ top of function executed once.

@override public int read(byte b[], int off, int len) throws ioexception { log.d(tag, "called read[] aval + " + super.available() + " len " + len); int numbytesread = -1; if (pos == 0) { numbytesread = fill(b); if (numbytesread < len) { int j; numbytesread += ((j = super.read(b, numbytesread, len - numbytesread)) == -1) ? 0 : j ; } } else numbytesread = super.read(b, 0, len); if (numbytesread > -1) pos += numbytesread; log.d(tag, "actually read " + numbytesread); homecoming numbytesread; }

has ever encountered issue? seems way desired behavior rewrite portions of skia library... know point of inputstream parameter if native implementation initializes stream of own...

turns out wasnt able observe actual image first 1024 bytes takes in. if doesnt observe file actual image, not bother decoding rest, hence having read[] called once.

android bitmap inputstream skia

mobile - ld: library not found for -lgcc_s.1 when creating AIR iOS package with native extension -



mobile - ld: library not found for -lgcc_s.1 when creating AIR iOS package with native extension -

i'm trying create air native extension ios, when seek create bundle deploy device, i'm getting next error:

ld: library not found -lgcc_s.1 compilation failed while executing : ld64

its working when seek create app simulator. i've tried many combinations of adding libgcc_s.1 platform.xml file, creating bundle ios, creating fat binary both simulator , phone, etc.

i'm not sure why needs libgcc_s.1 bundle since i'm not referencing in extension. tried adding manually "link binary libraries" list in xcode, , @ point won't build, telling me libgcc_s.1.dylib doesn't exist on system.

do other people have lib on system? know why it's beingness added if didn't inquire it?

i solved after days of searching , testing. remove -platformsdk alternative when packaging device.

ios mobile air air-native-extension libgcc

python - django - static files in base template -



python - django - static files in base template -

how create base of operations template utilize static files , create other templates inherits base of operations template utilize same static files?

as read in django documentation writes how utilize static files used specific app. can't seem find way create utilize static files outside app.

given app inherits everything, static files.

my settings.py:

static_url = '/static/' # additional locations of static files staticfiles_dirs = ( # set strings here, "/home/html/static" or "c:/www/django/static". # utilize forwards slashes, on windows. # don't forget utilize absolute paths, not relative paths. ) # list of finder classes know how find static files in # various locations. staticfiles_finders = ( 'django.contrib.staticfiles.finders.filesystemfinder', 'django.contrib.staticfiles.finders.appdirectoriesfinder', # 'django.contrib.staticfiles.finders.defaultstoragefinder', ) installed_apps = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'south', 'myproject.apps.finance', 'myproject.apps.base', 'django.contrib.admin', ) template_context_processors = ( 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.media', 'django.core.context_processors.static', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', )

this current homepage settings:

url homepage:

from django.conf.urls import patterns, include, url myproject.views import hello urlpatterns = patterns('', ('', hello), )

view of homepage:

from django.shortcuts import render_to_response django.http import http404, httpresponse import datetime def hello(request): hello = "hello world" homecoming render_to_response('home/home.html', {'hello': hello})

homepage template:

{% extends "base/base.html" %} {% block title %} homepage {% endblock %} {% block content %} <p>i {{ hello }}</p> {% endblock %}

base template:

<!doctype html public "-//w3c//dtd html 4.01//en"> <html lang="en"> <head> <link rel="stylesheet" href="{{ static_url }}/css/style.css"> <title>{% block title %}{% endblock %}</title> </head> <body> <h1>my personal finance site</h1> {% block content %}{% endblock %} {% block footer %} <section class="divider1"> <p>thanks visiting site.</p> <p>all rights reserved</p> </section> {% endblock %} </body> </html>

my css file located in empty project called base. think there improve way utilize static files outside given app.

so best way link base of operations template css file create other templates intherits base, same css file configuration?

base.html

<!doctype html public "-//w3c//dtd html 4.01//en"> <html lang="en"> <head> {% block css %} <link rel="stylesheet" href="{{ static_url }}/css/style.css"> {% endblock %} <title>{% block title %}{% endblock %}</title> </head> <body> <h1>my personal finance site</h1> {% block content %}{% endblock %} {% block footer %} <section class="divider1"> <p>thanks visiting site.</p> <p>all rights reserved</p> </section> {% endblock %} </body> </html>

page.html

{% extends "base/base.html" %} {% block title %} homepage {% endblock %} {% block css %}{{block.super}} //put css here {% endblock %} {% block content %} <p>i {{ hello }}</p> {% endblock %}

urls.py

from django.conf.urls import patterns, include, url django.conf.urls.static import static django.contrib import admin django.contrib.staticfiles.urls import staticfiles_urlpatterns project_name import settings admin.autodiscover() urlpatterns = patterns('', ....... ) + static(settings.media_url, document_root=settings.media_root) urlpatterns += staticfiles_urlpatterns()

settings.py

import os import sys .......................... site_root = os.path.dirname(__file__) sys.path.insert(0, os.path.join(site_root, 'app_name')) media_root = os.path.join(site_root, 'media') media_url = '/media/' static_root = os.path.join(site_root, 'static') static_url = '/static/' staticfiles_dirs = ( # set strings here, "/home/html/static" or "c:/www/django/static". # utilize forwards slashes, on windows. # don't forget utilize absolute paths, not relative paths. os.path.join(site_root, 'staticfiles'), ) template_dirs = ( # set strings here, "/home/html/django_templates" or "c:/www/django/templates". # utilize forwards slashes, on windows. # don't forget utilize absolute paths, not relative paths. os.path.join(site_root, 'templates'), ) ....................

python html css django

how to detach sidekiq process once started in terminal -



how to detach sidekiq process once started in terminal -

i want run sidekiq on production server, using command start process

bundle exec sidekiq -q mailer,5 -q default -e production

how detach process without stopping it, can close connection server.

the right reply lower case -d:

bundle exec sidekiq -d -q mailer,5 -q default -e production

sidekiq --help list options:

-d, --daemon daemonize process

when running -d option, sidekiq inquire log file, finish command is:

bundle exec sidekiq -d -l sidekiq.log -q mailer,5 -q default -e production

sidekiq

objective c - Network activity indicator and asynchronous sockets -



objective c - Network activity indicator and asynchronous sockets -

i have app continuously reads status updates server connection.

all working stream delegate handle reading , writing asynchronously.

there's no part of app "waiting" specific response server, continuously handling status updates sporadically arrive socket. there no requests on client side waiting responses.

i'm wondering best practice network activity indicator in case.

i turn on in stream event handler, , off before leave handler, short time (just plenty non-blocking read or write occur). trying this, see faintest flicker of indicator; needs on longer during event handler.

what turning on in stream delegate, , setting timer turn off short time later? (this ensure it's on long plenty seen, rather short time spent in stream delegate.)

note: i've tried lastly idea: turning on network activity indicator whenever there's stream activity, , note nsdate; in timer (that have fired every 1 second), if time passsed >.5 second, turn off indicator. seems give reasonable indication of network activity.

any improve recommendations?

if network activity continuous sounds might annoying user, if it's turning on , off time.

perhaps improve test lack-of-response timeout value , display alert view user if aren't getting response server. optional if can provide feedback (like "last update: 5 mins ago") user instead.

objective-c sockets networking nonblocking

ios - Need assistance regarding few concepts of objective-c protocols -



ios - Need assistance regarding few concepts of objective-c protocols -

1> there other way use/avail/consume protocol without doing @interface myclass : nsobject <someprotocol>.

2> can class become delegate of delegating class without doing @interface myclass : nsobject <someprotocol>.

3> right regarding these

id<aprotocol> *myvar1; means myvar1 hold object of class class must implement <aprotocol>?

aclass<bprotocol> *myvar2; means myvar2 hold object of aclass , must implement <bprotocol>?

4> doing (myclass <someprotocol> *)[[myclass alloc] init]; , myclass in interface not inheriting <someprotocol>.

yes, long object implements required interface of protocol object can stand in object explicitly conforms protocol. if loose compiler helping out confirming implement required methods. it's best explicit , declare class conforms protocol.

when as long object implements required interface of protocol mean object informally conforms in sense implements methods required not create explicit trying conform. e.g. object valid uitableviewdatasource implements @required methods, not declare such.

@interface myobject : nsobject - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section; - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath; @end

again should create these relationships clear , conform @interface myobject : nsobject <uitableviewdatasource>

a)id<aprotocol> *myvar1; should written without asterisk id<aprotocol> myvar1; , saying have variable called myvar1 should conform aprotocol - lie (see reply 3) b) right except it must implement <bprotocol> strong, saying have variable called myvar2 , should conforms bprotocol - 1 time again lie (see reply 3)

here performing cast homecoming type of method myclass myclass<someprotocol>. saying compiler "i know object returns object of type myclass telling myclass<someprotocol>". if myclass not defined @interface myclass : nsobject <someprotocol> lying compiler , there chance introduce bugs compiler cannot tell about.

you should careful casting things quiet compiler (the compiler clever) illustration compile code without issues crash @ runtime

uiview *view = (id)@"hey i'm not view"; view.frame = cgrectzero;

ios objective-c protocols

objective c - How to play transparent video in MPMediaPlayer? -



objective c - How to play transparent video in MPMediaPlayer? -

can 1 please tell if there way play transparent alpha channel videos in mpmediaplayer. had tried setting image behind player , colouring background view not work.

it plays sound heard , no video. can not understand problem. please help me.

thank you

objective-c ios4 ios6 media-player

[Rails]jQuery: Syntax error, unrecognized expression -



[Rails]jQuery: Syntax error, unrecognized expression -

i've problem rails 3 app: i've script in view display progress bar upload (the upload process works):

<h1>ajouter des images:</h1> <%= form_for [:admin, :gallery, @painting], html: { multipart: true} |f| %> <%= f.hidden_field :gallery_id %> <%= f.label :image, "upload paintings:" %> <%= f.file_field :image, multiple: true, name: "painting[image]" %> <% end %> <script id="template-upload" type="text/x-tmpl"> <div class="upload"> {%=o.name%} <div class="progress"><div class="bar" style="width: 0%"></div></div> </div> </script>

but when seek upload file, got error:

uncaught error: syntax error, unrecognized expression: <div class="upload"> argentina.gif <div class="progress"><div class="bar" style="width: 0%"></div></div> </div>

coming form jquery.js file:

sizzle.error = function( msg ) { throw new error( "syntax error, unrecognized expression: " + msg );

i don't know how prepare it, i've sought lot ! help !

this happening because of identation within template tag. check out: jquery-htmlstring-versus-jquery-selectorstring

you can avoid using $.parsehtml():

data.context = $($.parsehtml(tmpl("template-upload", file))[1])

jquery ruby-on-rails syntax-error sizzle

How can I make a JIRA sub-task read-only? -



How can I make a JIRA sub-task read-only? -

i want create sub-task read-only when parent closed. sub-task not have typical workflow associated - single step says "not applicable".

my thinking i'd extend closed action (whatever is) , set jira.issue.editable property false. possible, , if so, parts of api??

many thanks!

one easy way attack post function close transition of parent issue move sub-task locked transition.

to create post function can utilize script runner or jira scripting suite. add together locked transition subtask, add together new state it's workflow , on workflow screen create read only, see this answer more details.

if want restore sub-task status 1 time issue re-opened, on post-script leads close state of parent issue, save subtask custom field it's current state before making transition locked. attach post function parent issue re-open transition move subtask it's original state, according what's saved in custom field.

jira jira-plugin

settings - Eclipse: do not close missing (because of network resource unavailable) files -



settings - Eclipse: do not close missing (because of network resource unavailable) files -

introduction:

i work laptop in 2 different places , utilize eclipse in 1 of them. i'm using network resource (samba) maintain sources , i'm fine setup except for

the problem:

i not close eclipse when work place don't have access sources. other point, whenever accidentally open eclipse window starts refreshing project, considers open files deleted (as there no access network resource) , closes editors. how can prevent except disabling auto-refresh completely?

update

i'm looking setting in either eclipse settings or config files or whatever, i'll take argumentative "it's not possible" reply well.

update2

updated title more detailed in effort bring more attending question.

i suggest utilize sort of version control. :)

that way files on disk, meaning have access them, no matter what, won't have utilize samba either , made alot harder lose changes made code/versions had.

if worry things not beingness automatically updated, can run cronjob automatically commit changes repo on server. (into autosave branch example).

eclipse settings

android - gson or jackson for google drive api -



android - gson or jackson for google drive api -

google drive api comes several versions of google-http-client-...

one using gson, using jackson.

currently, app haven't decide go json parser. may know, gson or jackson beingness recommended officially? personally, prefer gson due little size.

i'm huge fan of jackson.

i've used gson, jackson, , org.json parser. good, way jackson's api works best.

android google-drive-sdk

Import repository from git to gerrit -



Import repository from git to gerrit -

i have 2 questions gerrit:

how convert or import existing git repository gerrit's format? there lot of commits without gerrit control, want force commits gerrit project.

i see 2 ways it:

copy existing bare git directory gerrit , add together database. safe method?

push commits local repository gerrit repository.

how revert repository gerrit original git format? required remove gerrit's special */for/* branches that?

first of all: there no special "gerrit format". gerrit works regular git repositories.

create new project in gerrit (without initial commit). add together created repository remote existing repository , push. can configure gerrit allow direct pushing repository (bypassing review), allowing import entire repository.

alternatively, if have direct access gerrit's repository location (e.g. via ssh or on local filesystem), can force straight repository (whereever gerrit created it), bypassing gerrit entirely. you'll need flush gerrit caches afterwards, however, gerrit notice repository heads have updated.

as said, there no "gerrit format". clone repository gerrit, , well. don't need worry special branches.

git gerrit

PHP More elegant way to handle mysqli errors -



PHP More elegant way to handle mysqli errors -

with pure php code (and not frameworks) there more elegant way handle mysqli errors shown below:

if (!mysqli_query($con, $sql)) { # throw error can handle them echo mysqli_error($con); # handle duplicate email if (strpos(mysqli_error($con), "email_unique") !== false ) { $_session["errors_found"] = true; array_push($_session["error_messages"], "email given registered."); } # handle duplicate username else if (strpos(mysqli_error($con), "username_unique") !== false ) { $_session["errors_found"] = true; array_push($_session["error_messages"], "username taken."); } # handle other sql query error... else { die("database query error: " . mysqli_error($con)); } }

first of all, wouldn't phone call such process "handling mysqli errors", rather "user input validation". , secondly, wouldn't perform such validation way @ all.

i've been under impression validating user input against database performed using select queries, not insert ones. not create application error-free, create more flexible, allowing separate verifications ajax-based registration example.

as real mysqli errors - have handle them, instead of dying. convenient yet easy way throwing exception:

if (!mysqli_query($con, $sql)) { throw new exception(mysqli_error($con)); }

which handled according site-wide error handling settings , provide priceless trace log.

php error-handling mysqli

Unix commands using grep to specify a pattern -



Unix commands using grep to specify a pattern -

i have file named lastnames.txt lists 100 lastly names percentage of popularity 0 100. question how utilize grep create new file contains lastly names 0.000 percent popularity only. note: utilize unix commands , code used:

grep '0.000' lastnames.tab > unpopularnames.tab

when utilize command lastly names greater percentage 0.000.

try doing :

grep '\b0\.000\b' lastnames the dot . mean any character in regex \. mean literal . \b means word boundaries

unix grep command

jquery - Not only wait for page to load but for a content of it to be updated via an ajax call -



jquery - Not only wait for page to load but for a content of it to be updated via an ajax call -

i using jquery , ajax remote webpage. if load webpage browser, loads fine, after ~100ms element beingness shown represents counter. counter inserted @ specific place , has specific class. html of place:

<span class="unreadcount">1</span>

i trying create plugin chrome , needs value. thing value not available after page loaded, have wait request page server (for unreadcount number) finish, before processing page's html getting value want.

is there way can jquery? using next code html page:

$.ajax({ async: false, cache: false, type: 'get', datatype: 'html', url: 'https://somesite.com/index.php', success: function(data1) { var descnode = document.createelement("div"); descnode.innerhtml = data1; var unreadcount = descnode.getelementsbyclassname("unreadcount"); /*process unreadcount etc*/ }, error: function () { // went wrong request error_occurred(); return; } });

unfortunately, each time, unreadcount.length 0 , noticed counter wasn't loading along page, shortly after.

how can wait counter load before processing page?

you can't.

you getting webpage string. hence, no javascript executed.

your best bet seek replicate request fetchs unread mail service count. is, if sure done via ajax.

although, using <iframe> may of help. and, in favor, need <iframe> solution works in chrome, not cross-browser <iframe> solution prone fail.

jquery ajax get load

Set the returned value from php using AJAX -



Set the returned value from php using AJAX -

i confused think on right now.... index.html contains simple html form, using post sending values php file, db operations , homecoming message... simple that. problem unable print message in index.html file. help.

make index.html index.php , move php code top of index file, create form submit itself. allows live user feedback using echo or similar - without need ajax :)

php ajax

shell - Execute git command in hook post-commit -



shell - Execute git command in hook post-commit -

i have post-commit hook. count commit number every time commit on repo. wrote :

#!/bin/sh commit_number=$(git shortlog | grep -e '^[ ]+\w+' | wc -l) echo "$commit_number"

every new commit, terminal printing 0 ... don't why. if launch command after commit within terminal have right count.

try :

cd .. commit_number=$(env -i git shortlog | grep -e '^[ ]+\w+' | wc -l) echo "$commit_number"

git shell command hook post-commit

ios - UIPageViewController change duration -



ios - UIPageViewController change duration -

how set faster page turns in uipageviewcontroller (when tap on border current page)?

i don't think there easy way standard uipageviewcontroller, trick set uiview animation of frame shorter, have implement behavior in custom pageview controller.

ios uipageviewcontroller

jquery - Coloring CSS syntax for textarea -



jquery - Coloring CSS syntax for textarea -

i'm having page edit css in textarea. have sort of plugin colors code edit.

is there editor ckeditor lets accomplish that?

you can find more number of suggestions syntax coloring here

jquery css jquery-plugins

asp.net mvc - display validation errors using @html.validationmessagefor -



asp.net mvc - display validation errors using @html.validationmessagefor -

i'm trying utilize @html.validationmessagefor() displaying errors in mvc, , i'm trying like: @html.validationmessagefor(@viewbag.price) syntax errors. want validation input:

input type="number" value="@viewbag.price" name="currentprice"

you're getting syntax errors because validationmessagefor takes in func. can't utilize @viewbag.price in , assume work. msdn definition of method is right here.

what need have method mapped specific field in model class (i.e. not viewbag) mvc knows exactly set validation message should 1 come after submission.

you instead utilize validationmessage, take field instead of func. illustration of using can found here.

asp.net-mvc model-view-controller asp.net-mvc-4 validation

php - JavaScript doesn't update Internet Explorer if same query sent before -



php - JavaScript doesn't update Internet Explorer if same query sent before -

i'm working on checklist users can set 4 diffent alternative on while cliking on it. when click once, greenish , display "ok", 1 time more, gray , "n/a", white , empty. after starts 1 time again greenish , "ok" each time update database value 1,2,3 or 0 each possibilities. javascript works great, color , text updated correctly in browsers everytime click on update of database, works well, until go white or 0 in database. click, updates 1, 2, 3, 0, when should 1 doesn't update anymore. don't have issue chrome.

here javascript code :

function checklog(tdcheck,id){ var url; var color; var status; var text; xmlhttp=getxmlhttpobject(); if (xmlhttp==null) { alert ("browser not back upwards http request"); return; } var td = document.getelementbyid("tdcheck"+tdcheck); if(td.style.backgroundcolor == "white"){ color = "green"; status = "1"; text = "ok"; } else if(td.style.backgroundcolor == "green"){ color = "grey"; status = "2"; text = "n/a"; } else if(td.style.backgroundcolor == "grey"){ color = "red"; status = "3"; text = "ko"; } else if(td.style.backgroundcolor == "red"){ color = "white"; status = "0"; text = ""; } url="checklist/checklog.php"; url=url+"?id="+id+"&tdcheck="+tdcheck+"&status="+status; xmlhttp.onreadystatechange=statechanged; xmlhttp.open("get",url,false); xmlhttp.onreadystatechange = function() { if(xmlhttp.readystate == 4 && xmlhttp.status == 200){ alert(xmlhttp.responsetext); } } xmlhttp.send(null); document.getelementbyid("tdcheck"+tdcheck).style.backgroundcolor=color; document.getelementbyid("tdcheck"+tdcheck).innerhtml=text; }

checklog.php :

<?php seek { $pdo_options[pdo::attr_errmode] = pdo::errmode_exception; $bdd = new pdo('mysql:host=localhost;dbname=dbname', 'database', 'password'); } catch(exception $e) { die('erreur : '.$e->getmessage()); } if(isset($_get["tdcheck"])) { $bdd->exec("update checklistnew set ".$_get["tdcheck"]." = '".$_get["status"]."' id = '".$_get["id"]."'"); } ?>

i have removed pdo in case issue , utilize mysql_connect, still same. using response text, monitor sql request , can see 1 thing :

i click first, query looks :

update checklistnew set a2 = '1' id = '4' update checklistnew set a2 = '2' id = '4'

then if update php file "update checklistnew set td = number id = 'idnum'" (i added quotes arround id)

update checklistnew set a2 = '4' `id` = '4' update checklistnew set a2 = '0' `id` = '4' update checklistnew set a2 = '1' id = '4' update checklistnew set a2 = '2' id = '4'

notice kept previous query. :)... think there there.

i'll appreciate help!

ie caches xmlhttprequests utilize method, it's that.

you can 1 of many things, simplest being:

don't utilize updating; switching post prepare problem; utilize send("post", ...) instead of send("get", ...), not need alter on php side (because post requests $_get gets populated query parameters); add random url. simple unused parameter random number. like: url=url+"?id="+id+"&tdcheck="+tdcheck+"&status="+status + "&random=" + math.random()

warning: php script extremely unsafe, has multiple sql injection vulnerabilities. prepare now. (see how prevent sql injection in php?)

php javascript mysql internet-explorer

android - Retrieve string from AudioRecord buffer -



android - Retrieve string from AudioRecord buffer -

i'm using basic4android , audiorecord library based on this

i want know how retrieve string buffer

in short, if register audiorecord word (eg, "hello"), can retrieve buffer in order have string value "hello"?

thanks alberto

with audiorecord library don't think can speech recognition, far know raw sound wave there, seek speechrecognizer, demo application tutorial here

android buffer basic4android audiorecord

iphone - How to write to a server/URL in iOS? -



iphone - How to write to a server/URL in iOS? -

basically, how can store info in url can accessed other devices?

this similar how instagram works, people can see pictures others post, though files not stored locally on user's device.

this way create high score leaderboards in game without using gamecenter.

thanks in advance.

nsurlrequest class improve utilize perform request url. so, if have restful backend url take post info able force binaries. can find code ios illustration request similar yours next url - send image server binary data

for server side suggest take node.js direction (http://nodejs.org)

iphone ios xcode url serialization

mysql - Sql Query LIKE not working -



mysql - Sql Query LIKE not working -

hi have trying query, receives value on querystring, not working think query self no good. help me?

so receive query on

<%string detalhe = request.getparameter("value");%>

i wont set connections , stuff, because work other querys, problem not connections.

// sql query retrieve values specified table. string querystring = "select * ebooko.dadoslivros autor '%"+detalhe+"%' or ano '%"+detalhe+"%'";; rs = statement.executequery(querystring);

it cannot retrive value, i'm querying.

adicional info: table: dadoslivros columns need compare value: autor, ano.

for illustration when run href value passed is: jules%verne (i gess changes spaces '%'.

use urldecoder#decode() decode parameters in query string.

you should consider using preparedstatement prevent sql injection attacks.

mysql jsp jsp-tags

github - Delete all Git Commit History -



github - Delete all Git Commit History -

i trying fetch repo github, revert tag in past, force remote deleting history. can below except deleting commit logs. missing?

git clone https://github.com/user/user-repo.git cd user-repo git reset --hard tags/v2.0 git remote add together stash ssh://git@myserver:7999/myproject/user-repo.git git force --force stash master

i thought want repo new one, deleting .git/ directory , re-initing more simple.

git clone https://github.com/user/user-repo.git cd user-repo git reset --hard tags/v2.0 rm -rf .git/ git init git add together . git commit -m 'first commit' git remote add together stash ssh://git@myserver:7999/myproject/user-repo.git git force --force stash master

git github git-stash

python - Is it OK to create two objects with a single command? -



python - Is it OK to create two objects with a single command? -

i'd create 2 empty list objects. tried use

vlist,slist = [],[]

and seems work. never saw in manual (but python still basic). non empty lists i'd doing harms readability ok identical, empty ones? considered bad practice or are there bad side effects?

does same hold (empty) strings?

there no bad side effects, unless use

vlist = slist = []

which references both variables same list.

i don't think pep8 says this, splitting assignments on 2 lines read much better.

however, @gorlum0 mentioned, if objects related , relatively simple, might improve utilize tuple unpacking. if they're unrelated, reader quite confused trying see why you've set them on 1 line.

python

add text field values to localstore from field set in sencha touch 2 -



add text field values to localstore from field set in sencha touch 2 -

i new sencha touch , error in below code tab alter function error:uncaught typeerror: object [object object] has no method 'getvalues'

var uswrfeild = ext.getcmp('user_details'); //var fieldset = ext.create('fieldset_personalsettings'); //var fieldset= this.tab; var values = uswrfeild.getvalues(); cart = ext.create('items'); //alert(values); //cart.add({field1:'value1',field2:'value2'}); cart.add(values); cart.sync();

below code feild set code

{ xtype: 'container', title: 'user', id: 'user_details', itemid: 'mycontainer3', scrollable: 'vertical', items: [ { xtype: 'fieldset', id: 'fieldset_personalsettings', itemid: 'myfieldset12', margin: '2%', title: 'user', items: [ { xtype: 'textfield', label: 'name', name: 'name', maxlength: 31, placeholder: 'given-name family-name' }, { xtype: 'emailfield', label: 'email', name: 'email', required: true, maxlength: 63, placeholder: 'name@example.com' }, { xtype: 'textfield', label: 'street', name: 'street', required: true, placeholder: 'streetname' }, { xtype: 'textfield', label: 'house number', required: true, placeholder: '123' }, { xtype: 'textfield', label: 'zipcode', required: true, autocapitalize: true, maxlength: 10, placeholder: '1234aa' }, { xtype: 'textfield', label: 'country', required: true, placeholder: 'nl' } ] }, { xtype: 'fieldset', margin: '2%', title: 'sharing information', items: [ { xtype: 'checkboxfield', label: 'receive email', labelwidth: '75%', checked: true }, { xtype: 'checkboxfield', height: 49, label: 'upload statistics (anonymously)', labelwidth: '75%', checked: true } ] }

belo code model

ext.define('ifp.model.item', { extend: 'ext.data.model', config: { fields: [ { name: 'name', type: 'string' }, { name: 'email', type: 'string' }, { name: 'street', type: 'string' }, { name: 'hno', type: 'auto' }, { name: 'zipcode', type: 'int' }, { name: 'country', type: 'string' } ] } });

below code store

ext.define('ifp.store.userlocalsettings', { extend: 'ext.data.store', requires: [ 'ifp.model.item' ], config: { autosync: false, model: 'ifp.model.item', storeid: 'usersettingslocalstore', proxy: { type: 'localstorage' } } });

my aim text feid values stored in browser localstore. please help me buddy. in advance.

you should first set id each field, example

{ xtype: 'textfield', label: 'name', name: 'name', maxlength: 31, placeholder: 'given-name family-name', itemid: 'tfname' },

then can value of field after event in function

var namefield = this.down('#tfname'); var namevalue = namefield.getvalue();

...

and can add together value store

var store = ext.getstore('userlocalsettings'); store.add({name: namevalue}); store.sync();

hope help.

sencha-touch touch sencha-touch-2 local-storage

CSS classes under a class -



CSS classes under a class -

this question may foolish, though want know experts in css. there way write css classes under 1 class.

suppose have few divs under div

<div class="parent"> <div class="c1"></div> <div class="c2"></div> <div class="c3"></div> </div>

normally, write css classes below-

.parent { width: 100%; } .parent .c1 { //somecode } .parent .c2 { //somecode } .parent .c3 { //somecode }

but, want know. can write below-

.parent { width: 100%; .c1 { //somecode } .c2 { //somecode } .c3 { //somecode } }

please allow me know reply on curiosity. you.

you can't using normal css.

maybe looking less? nested rules section farther downwards page.

this allows asking, along many other useful functions, variables , mixins.

alternatively there alternative of sass. similar less.

css

mongodb background task -



mongodb background task -

if possible, i'd run find & remove query on non-indexed columns in "background", without disturbing other tasks or exhausting memory detriment of others.

for indexing, there background flag. can same appended find/remove tasks?

thanks tip

this not can utilize "background:true" for. perchance best way handle write script in background. script should run operation in little batches delay in between. in pseudo code do:

find 10 docs need update update 10 docs sleep goto first step.

you have experiment value sleep works. need realize documents updating need pulled memory, have @ to the lowest degree impact.

mongodb background

sql - How to perform "Select Count" with complicated "Where" statement to compute co-occurrences? -



sql - How to perform "Select Count" with complicated "Where" statement to compute co-occurrences? -

let's have illustration declare concern: suppose have table (tags) has 2 columns this

userid -------------------------------- tag 1 -------------------------------------- sql 1 -------------------------------------- select 1 -------------------------------------- db 2 -------------------------------------- sql 2 -------------------------------------- programming 2 -------------------------------------- code 2 -------------------------------------- software 3 -------------------------------------- code 4 -------------------------------------- sql 4 -------------------------------------- code

i need count distinct co-occurrences each tag based on userid

so, output should (with order co-occurrences desc):

tag -------------------------------- co-occurrences --------------------------------------------- sql --------------------------------------- 5 programming ------------------------------- 3 code -------------------------------------- 3 software ---------------------------------- 3 select ------------------------------------ 2 db ---------------------------------------- 2

this example..

how can create select statement can this?

i came 1 way 1 specific tag:

select count (distinct (tag)) - 1 co_occurrences tags tag not null , userid in ( select userid tags tag = 'sql')

is possible alter above statement create general tags in table?

select t2.tag, count (distinct (t1.tag)) - 1 co_occurrences tags t1 inner bring together tags t2 on t1.userid = t2.userid grouping t2.tag order count (distinct (t1.tag)) desc

sql select count

Highcharts - line chart dataLabels on every other point? -



Highcharts - line chart dataLabels on every other point? -

i have highcharts line graph has datalabels configured in plotoptions. working , have nice label displayed on each point.

plotoptions: { line: { datalabels: { enabled: true, formatter: function() { homecoming '$' + highcharts.numberformat(math.round(this.y),0,0,","); } } } }

however, there way set interval determines how datalabels appear on points? want show every point in graph, due space constraints, show datalabel every 2 or 3 points.

edit:

difficulty level: graph has multiple y-axes, uses datetime x-axis, , has irregular data. http://jsfiddle.net/sqkmw/68/

yes, homecoming blank string if point x mod 2 0, every 2nd show up, illustration (http://jsfiddle.net/hzytv/):

formatter: function() { if(this.point.x % 2 == 0) homecoming ''; homecoming this.y +'mm'; }

for datetime axis have create variable , increment manually http://jsfiddle.net/sqkmw/69/

highcharts

Rewrite rule behaving differently on new server -



Rewrite rule behaving differently on new server -

i on shared host , business relationship migrated new server. unfortunately, means not have specifics on configuration changes made @ root level. however, major alter has occurred in how our mod_rewrite rule beingness handled.

options +execcgi +followsymlinks -multiviews modpagespeed off rewriteengine on rewriterule ^static - [l,e=no-gzip:1] rewriterule ^sixteencolors-app/script/dispatch\.fcgi/.*$ - [l,e=no-gzip:1] rewriterule ^v0/(.*)$ sixteencolors-app/script/dispatch.fcgi/$1 [pt,l]

the intended result request /v0/year/ should rewritten /sixteencolors-app/script/dispatch.fcgi/year, instead going /sixteencolors-app/script/dispatch.fcgi/v0/year/

it worked before migration, , no changes have been made on our end since then.

mod-rewrite

php - File upload not working using codeignitor. Have no idea why -



php - File upload not working using codeignitor. Have no idea why -

i trying add together an, upload image directory in root. when nail submit button add together image shows error in if statement if false. have no thought doing wrong. help great, thanks.

to see have live visit here: http://travismichael.net/seniorproject

i have uploads folder in root , made writable.

here controller

function do_upload() { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '32'; $config['max_width'] = '200'; $config['max_height'] = '200'; $this->load->library('upload', $config); if ( !$this->upload->do_upload('userfile')) { echo '<p>image not working</p>'; } else { $data = array('upload_data' => $this->upload->data()); $this->load->view('partials/upload_success', $data); }

here view

<!doctype html> <?php $this->load->view('partials/page_head'); ?> <body> <body class="home"> <div id="container"> <div id="top"> <div class="topcenter"> <h2><a class="addbtn">add folder</a></h2> <h2><a class="deletebtn" href="<?php echo base_url();?>index.php/home/delete">deletefolders</a></h2> </div> <div class="navdescription"><span>home</span></div> </div> <div class="projectfolders"> <?php foreach($foldername $row) { ?> <div class="folder <?php echo $row->foldername; ?>"> <button class="<?php echo $row->foldername; ?>"><?php echo $row->foldername; ?> </button> </div> <script> $(function () { $('button.<?php echo $row->foldername; ?>').bind('click', function() { $('.open.<?php echo $row->foldername;?>').show() }); $('.gohome').bind('click', function() { $('.open.<?php echo $row->foldername;?>').hide() }); }); </script> <?php } ?> <?php foreach($foldername $row) { ?> <div class="open <?php echo $row->foldername; ?>"> <h1><?php echo $row->foldername;?></h1> <a class="gohome">home</a><a class="addimagebtn">add image</a> <div class="edititable" contenteditable="true" focus="true"> content goes here </div> </div> <?php } ?> <div class="uploadimage"> <?php echo form_open_multipart('home/do_upload');?> <input type="file" name="userfile" size="20" /> <br /><br /> <input type="submit" value="add image" /> </form> </div> </div> <div id="bottom"> <div class="formwrapper"> <form accept-charset="utf-8" method="post" action="<?php echo base_url(); ?>index.php/home/create" id="cf_form"> <input type="text" name="foldername" placeholder="enter new folder" class="required" required/> <?php echo form_submit('createfolder', 'create folder'); ?> <?php echo form_close(); ?> <?php echo validation_errors('<p class="error">'); ?> </div> </div> </div><!-- end of container div --> </body> </html>

some reason codeignitor forgot update documentation.

you need add together line right above phone call upload library

$this->upload->initialize($config);

php

asp.net mvc - Combine data annotation attributes -



asp.net mvc - Combine data annotation attributes -

i have collection of several attributes should used ui , validation. illustration currency field, have add together ui hint, validation logic, , display formatting. result, class looks crowded.

public class model { [uihint("currency")] [displayformat(applyformatineditmode = true, dataformatstring = "{0:c}")] [customregularexpression(currency.validationpattern, onlyonclientside = true)] [setmetadataforcustommodelbinder("currency")] public double? cost { get; set; } [uihint("currency")] [displayformat(applyformatineditmode = true, dataformatstring = "{0:c}")] [customregularexpression(currency.validationpattern, onlyonclientside = true)] [setmetadataforcustommodelbinder("currency")] public double? turn a profit { get; set; } }

is there way create [currency] attribute combines functionality of these attributes 1 simple attribute? goal create following:

public class model { [currency] public double? cost { get; set; } [currency] public double? turn a profit { get; set; } }

edit: clarify, have tried creating custom attribute, there no interfaces exposed allow me implement functionality of different attributes. can subclass validationattribute, cannot subclass uihintattribute. other potential solutions i'm missing?

according post , reference post phil haack's article can create custom associatedmetadataprovider adds attributes need. have this:

public class mycustommetadataprovider : dataannotationsmodelmetadataprovider { protected override modelmetadata createmetadata(ienumerable<attribute> attributes, type containertype, func<object> modelaccessor, type modeltype, string propertyname) { var attributelist = attributes.tolist(); if (attributelist.oftype<currencyattribute>().any()) { attributelist.add(new uihintattribute("currency")); attributelist.add(new displayformatattribute { applyformatineditmode = true, dataformatstring = "{0:c}" }); } homecoming base.createmetadata(attributelist, containertype, modelaccessor, modeltype, propertyname); } }

and in application start event:

modelmetadataproviders.current = new mycustommetadataprovider();

asp.net-mvc validation

wordpress - Adding new line in wp-config.php using perl -



wordpress - Adding new line in wp-config.php using perl -

i migrating of wordpress installation 1 place another. have database table, each row wordpress installation, queue of wordpress installation. making perl script migration , work cron job. source , destination location migration database. 1 time migration of each wordpress completed need add together new line within wp-config.php:

i want add together line define(‘wp360_is_ghost’, true);. please allow me know idea.

for help in advance!!!

wordpress perl content-management-system

android - Push notification using GCM with Asp.net server -



android - Push notification using GCM with Asp.net server -

if device offline or switched off @ time server sending force message, when getting online(active) should receive pending notifications. not receiving force notification of app. might reason???? please help me solve issue.

string posting server side(asp.net server) gcm server:

string postdata= "collapse_key=score_update"+i+"&time_to_live=2419200&delay_while_idle=1&data.message=‌​"+ message + "&data.time=" + system.datetime.now.tostring() + "&registration_id=" + devicetoken + "";

also tried delay_while_idle=0, facing same issue. "i" incremental value have appended collapse key.

android google-cloud-messaging

java - how to find out running tomcat version -



java - how to find out running tomcat version -

i'm trying appfuse + tomcat + jrebel working.

appfuse default uses cargo download tomcat (ver. 7.0.33) , deploy application it. wish utilize installed tomcat (ver. 7.0.27) instead of downloaded one. made alter next appfuse faq.

after deploying mvn cargo:run, how can know actual running tomcat indeed 7.0.27?

i used type wrong url (ex. localhost:8080/dfsfsdf) see in error page, shows nothing.

my $catalina_home points own tomcat 7.0.27. sorry forgot mention, it's windows

update:

since question had become somehow popular, explain why accepted answer. simple, first 1 solved problem.

looking @ title of question, tech junkie , cpu 100 have best answer, not scenario encountered. (i wanting know if mvn cargo:run runs installed tomcat or "project embeded" tomcat) :)

if can upload jsp file may print out info in example: bestdesigns.co.in/blog/check-jsp-tomcat-version

save code file called tomcat_version.jsp:

tomcat version : <%= application.getserverinfo() %><br> servlet specification version : <%= application.getmajorversion() %>.<%= application.getminorversion() %> <br> jsp version : <%=jspfactory.getdefaultfactory().getengineinfo().getspecificationversion() %><br>

when access, http://example.com/tomcat_version.jsp, output should similar to:

tomcat version : apache tomcat/5.5.25 servlet specification version : 2.4 jsp version: 2.0

thanks! :)

java tomcat appfuse

Can't get Gmail Contextual Gadget to Load -



Can't get Gmail Contextual Gadget to Load -

help! have looked @ on , on , wont load. should see show on every email nothing. did miss?

<?xml version="1.0" encoding="utf-8" ?> <applicationmanifest xmlns="http://schemas.google.com/applicationmanifest/2009"> <!-- back upwards info show in marketplace & command panel --> <support> <!-- url explaining how customers support. --> <link rel="support" href="http://example.com" /> </support> <edition id="slidersextractor"></edition> <!-- name , description pulled message bundles --> <name>sliders 2</name> <description>sliders</description> <!-- extractor --> <extension id="slidersextractor" type="contextextractor"> <name>sliders</name> <url>google.com:subjectextractor</url> <triggers ref="sliders"/> <scope ref="emailsubject"/> <container name="mail"/> </extension> <!-- gadget --> <extension id="sliders" type="gadget"> <name>sliders gmail contextual gadget</name> <url>http://hosting.gmodules.com/ig/gadgets/file/117105461644591440890/sliders.xml</url> <container name="mail"/> </extension> <!-- scope --> <scope id="emailsubject"> <url>tag:google.com,2010:auth/contextual/extractor/subject</url> <reason>this application searches subject:"</reason> </scope> </applicationmanifest>

and gadget:

<?xml version="1.0" encoding="utf-8"?> <module> <moduleprefs title="sliders gadget" description="matches emails" height="20" author="me" author_email="james@example.com" author_location="everywhere"> <!-- declare feature dependencies. --> <!-- 1 not specific gmail contextual gadgets. --> <require feature="dynamic-height"/> <require feature="google.contentmatch"> <param name="extractors"> google.com:subjectextractor </param> </require> </moduleprefs> <!-- define content type , display location. settings "html" , "card" required gmail contextual gadgets. --> <content type="html" view="card"> <![cdata[ hello sliders 2/18 ]]> </content> </module>

i have not tested xml, may perchance due "caching". have tried logging out , logging again, or changing browser?

please have @ answer!

http://stackoverflow.com/a/8011614/2071317

gmail-contextual-gadgets

android - How to access animated content locally from Swiffy converted flash? -



android - How to access animated content locally from Swiffy converted flash? -

i have flash animation file converted html5 file using swiffy. these files beingness played in webview, play fine.

there few animations in html5, command these little animations in android locally on touch event. want know how expose these animations android layer, there else required javascript or jquery?

i add, totally new html5, css, javascript , jquery.

any help appreciated.

if understand problem, can't because animations defined within swiffyobject become parts of 1 larger svg, swiffy runtime manages. runtime exposes little api, bit constraining. i've found no way "my swiffy.someanimationwithin.dosomething()"

what can utilize stage.setflashvars pass "messages" actionscript, of course of study translated , beingness played runtime. in actionscript, utilize onenterframe check variables/messages alter states actionscript. animation can talk javascript via actionscript's geturl("javascript: mynamespaceobj.dosomethingscripty()") or, believe, as3's urlrequest(...)

android html5 android-webview google-swiffy

asp.net mvc - MVC controller vs. out-of-box Sitecore Controller -



asp.net mvc - MVC controller vs. out-of-box Sitecore Controller -

i've been reading lots of blogs on mvc provided here: http://www.sitecore.net/community/technical-blogs/john-west-sitecore-blog.aspx

however, not beingness able explain/convience myself/team:

when utilize custom command vs. out of box site core controller? when out of box controller gets invoked? benifit of custom command vs. out of box controllers? if go out of box, should include business logic on views. testable?

i looked @ below , still not certain: https://bitbucket.org/demoniusrex/launch-sitecore-mvc-demo

any help appreciated.

whilst broadly agree kevin obee's statement think it's worth reminding ourselves controllers beingness used in 2 distinct roles in sitecore:

page level controller (invoked item route) component level controller (invoked redering mechanism)

when use: custom controller / default sitecore controller

page level controller

any route matches item path default utilize index action on sitecore.mvc.controllers.sitecorecontroller. action homecoming viewresult based on layout configuration of item.

if have need changing behaviour (e.g. impacts entire page) can specify custom controller , action on item (or standard values item). custom controller can either roll own or subclass default controller.

component level controller

for viewrendering sitecore renders razor views without need specific controller (well guess it's page level controller in play - imagine sitecore provides default controller gets model using mvc.getmodel pipeline , feeds razor view).

for controllerrendering provide custom controller can execute logic (see kevin's answer) , provide model view. there no benefit subclassing sitecore.mvc.controllers.sitecorecontroller.

when controllers invoked

page level controller

the action on page level controller invoked routing engine.

component level controller

the action on controllerrendering invoked page view renders.

benefit of using: custom controller / default sitecore controller

the benefit of custom controller on default sitecore controller in command of logic. benefit of using default sitecore controller sitecore provides logic you.

should include business logic on views

no. (see kevin's answer)

asp.net-mvc sitecore sitecore6

How to hookup jQuery autocomplete with POST query to remote data source? -



How to hookup jQuery autocomplete with POST query to remote data source? -

i'm trying hook text field jquery ui's autocomplete remote info source using post query. far have this:

$( "#booking_student" ).autocomplete({ source: function( request, respond ) { $.post( "/path/to/my/api.php", { student: request.term }, function( response ) { //do } ); } });

using firebug can see api returning results i'd expect, autocomplete dropdown doesn't appear. need plug results autocomplete dropdown? need populate variable in //do section json results or?

you need supply results respond callback widget giving you:

$( "#booking_student" ).autocomplete({ source: function( request, respond ) { $.post( "/path/to/my/api.php", { student: request.term }, function( response ) { respond(response); }); } });

this of course of study assumes info array items containing either label property, value property, or both. outlined in documentation source option.

jquery jquery-ui autocomplete jquery-autocomplete jquery-ui-autocomplete

Boolean Algebra And DeMorgan Laws -



Boolean Algebra And DeMorgan Laws -

i trying find complement of function: x(y+z!w+!vs) utilizing demorgan's laws.

i need express result sum of products.

i think complement should be: !x + (y!(z+!w)(v!s)) i'm not sure...

and if i'm uncertain how sum of product form.

thoughts?

![x(y+z!w+!vs)] = ![xy + xz!w + x!vs] distributive law = !(xy)!(xz!w)!(x!vs) de morgan's law = (!x+!y)(!x+!z+w)(!x+v+!s) de morgan's law = (!x!x+!x!z+!x!w+!y!x+!y!z+!yw)(!x+v+!s) distributive law = (!x+!y!z+!yw)(!x+v+!s) x or (x , y) = x = !x!x+!xv+!x!s+!y!z!x+!y!zv+!y!z!s+!yw!x+!ywv+!yw!s distributive law = !x+!y!zv+!y!z!s+!ywv+!yw!s x or (x , y) = x

this in sum-of-products form. taking bit further...

= !x+!y(!z+w)(v+!s) distributive law

boolean boolean-logic

javascript - TD height expands on dynamic content in Internet Explorer -



javascript - TD height expands on dynamic content in Internet Explorer -

first; i've searched here , on net, couldn't find working solution. i'm working on problem literally 2 days now, have ask.

i've next problem :

<table width="650px" border="1" > <tr> <td style="height :5px">stay are</td> <td rowspan="3" id="content"> empty </td> </tr> <tr> <td style="height :5px">please dont expand</td> </tr> <tr> <td style="background: red;height : 100%;">&nbsp;</td> </tr> </table> <input type="button" value="do" onclick="dontexpand()"> <script language="javascript"> function dontexpand() { var html = ""; (var = 0; < 100; ++i) html += "lorem ipsum<br>"; document.getelementbyid("content").innerhtml = html; } </script>

jsfiddle illustration of problem, works in chrome

the upper left , left cell in middle expanding after content dynamically gets modified javascript.

i guess have doctypes, i'm no expert.

is there way of making net explorer , firefox expand lower left cell; other 2 cells above should remain are.

need help please.

look here same problem: ie setting row height not working when using rowspan

i guess 1 solution alter teh height of lastly table col after update content based on total height after adding content - 10 px ?

javascript html table height html-table

php - How to display content in random order? -



php - How to display content in random order? -

with code below displaying questions retrieved database:

$qandaquery = "select q.questionid, q.questionno, q.questioncontent question q sessionid = ? grouping q.questionid order q.questionid"; $qandaqrystmt=$mysqli->prepare($qandaquery); // need phone call bind_param 1 time $qandaqrystmt->bind_param("i",$session); // result , assign variables (prefix db) $qandaqrystmt->execute(); $qandaqrystmt->bind_result($qandaquestionid,$qandaquestionno,$qandaquestioncontent); $arrquestionid = array(); $arrquestionno = array(); $arrquestioncontent = array(); while ($qandaqrystmt->fetch()) { $arrquestionid[ $qandaquestionid ] = $qandaquestionid; $arrquestionno[ $qandaquestionid ] = $qandaquestionno; $arrquestioncontent[ $qandaquestionid ] = $qandaquestioncontent; } $qandaqrystmt->close(); foreach ($arrquestionid $key=>$question) { ?> <div class='lt-container'> <p><strong>question <span id="quesnum"></span>:</strong></p> <p><?php echo htmlspecialchars($arrquestionno[$key]) . ": " . htmlspecialchars($arrquestioncontent[$key]); ?></p> </div> <?php } ?>

now says question:

<p><strong>question # <?php echo $q; ?> :</strong></p> <?php $q++; ?>

i want remain same place

but displays question details:

<p><?php echo htmlspecialchars($arrquestionno[$key]) . ": " . htmlspecialchars($arrquestioncontent[$key]); ?></p>

i want display questions in random order. illustration if have 3 questions below:

question 1: 1. 2+2? question 2: 2. 3+3? question 3: 3. 4+4?

it displayed in order example:

question 1: 2. 3+3? question 2: 3. 4+4? question 3: 1. 2+2?

instead of order q.questionid utilize order rand()

php mysqli

cordova - Authentication in HTML5 + phonegap application -



cordova - Authentication in HTML5 + phonegap application -

i'm building application on html5 + jquery , rest services @ back-end . application meant desktop users , mobile users. building mobile version using phonegap. application secure application , needs login screen. in prepare how can accomplish this. 1. if move application asp.net mvc can't create build using phonegap. 2. phonegap found http://www.raymondcamden.com/index.cfm/2011/11/10/example-of-serverbased-login-with-phonegap think not suitable solution desktop users

you can secure server side using authentication technology of selection , create ajax calls rest services pass along credentials.

for example, if wanted write service using asp.net mvc, protect using simple http basic auth , pass along user/pass string in request.

to accomplish login screen, can write dummy controller method login screen can phone call check if authentication working.

if want sample asp.net mvc backend phonegap front-end using jquery, have sample code on github , blog describing building application

html5 cordova

create a different index.php for post in wordpress -



create a different index.php for post in wordpress -

i'm working on wordpress has, among other things, front end page , post page showing news.

from understand, template post page uses, index.php, index.php used other pages.

the thing want create special page post, header says news, etc., don't want other pages utilize template. there way create alternative index.php (index_news.php) used show posts?

that way can utilize index_news.php post , index.php else.

thanks

edit //////////

my first alternative create new page-template (news.php) loop inside, , then, in the wordpress options, targeted post new page (news.php).

but when that, loads index.php not news.php template. maybe wrong loop. here loop i'm using:

<!-- start loop. --> <div class="post"> <!-- display title link post's permalink. --> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="permanent link <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <!-- display date (november 16th, 2009 format) , link other posts posts author. --> <small><?php the_time('f js, y') ?> <?php the_author_posts_link() ?></small> <!-- display post's content in div box. --> <div class="entry"> <?php the_content(); ?> </div> <!-- display comma separated list of post's categories. --> <p class="postmetadata">posted in <?php the_category(', '); ?></p> </div> <!-- closes first div box --> <!-- stop loop (but note "else:" - see next line). --> <?php endwhile; else: ?> <!-- first "if" tested see if there posts --> <!-- display. "else" part tells if there weren't any. --> <p>sorry, no posts matched criteria.</p> <!-- stop loop. -->

single.php - 1 post view, if wolud modify blog index, create custom template (page-news.php) header allows separated page template:

<?php /* * template name: news page * @package wordpress */ ?>

and utilize loop within of it. case think better, can modify header.php , utilize wordpress conditional tags such as: is_front_page(), is_page() or work you: http://codex.wordpress.org/conditional_tags

there many ways same ;).

wordpress