Posts

Featured post

razor - Is this a bug in WebMatrix PageData? -

i think may have found bug in webmatrix's pagedata, not sure. concerns how pass data partial page calling page. in webmatrix documentation (tutorials, e.g. " 3 - creating consistent look ", , example code), pagedata recommended mechanism pass data between pages (e.g. content page layout page, or partial page). however have found not work other way, pass data partial page calling page. modifying or adding entries in pagedata in partial page, not seem calling page. cutting right down simplest possible example, in test page may have this: @{ pagedata["test"] = "initial entry"; } <p>before calling partial page, test value @pagedata["test"]</p> @renderpage("_testpartial.cshtml") <p>after returning calling page, test value @pagedata["test"]</p> and in _testpartial.cshtml page might have this: @{ pagedata["test"] = "modified entry"; } <p>in partial page

iphone - Requiring the presence of a method in an id -

the situation my custom controller class has following method: - (void)requestviewcontrollerwithidentifier:(nsstring *)identifier fromobject:(id)object; this causes object receive message: - (uiviewcontroller *)viewcontrollerwithidentifier:(nsstring *)identifier; the problem right now, object id there's no guarantee implements method, , compiler warning when send message. the solution i came 2 solutions myself: use protocol. make id nsobject , create category nsobject . they both fine solutions , don't mind choosing 1 of them, but... the question ...i noticed apple doing odd in gamekit api. gksession has following method: - (void)setdatareceivehandler:(id)handler withcontext:(void *)context handler id , apple requires implement method: - (void) receivedata:(nsdata *)data frompeer:(nsstring *)peer insession: (gksession *)session context:(void *)context; without making use of protocol or category! i'm wondering how , why thi

Bug Silverlight Intelliscence in VS 2010 does not recognize new controls on page -

silverlight intelliscence in vs 2010 not recognize new controls on page. solution needs built intelliscense recognized newly placed control (textbox label extra) is bug? edit: controls not custom, siple label , textbox , button controls. edit: button toolbox dragged designer, switched home.xml.cs types button1 error, intelliscence doesnot recognize button1 added. must build each time. what solution problem its not bug, feature. custom controls must compiled before can use it.

c++ - Template metaprogramming rules of thumb -

what rules of thumb should considered whenever might use template metaprogramming accomplish goal? , good example using template metaprogramming more efficient plain old code other libraries boost ? one helpful rule can think of have compilation error thrown close "true" problem possible. ways it's easier not deduce issue easier others use library deduce issue. here's contrived version of mean: template<typename type> struct convert{}; template<> struct convert<double>{ static const int value = d_coord; }; template<> struct convert<degree>{ static const int value = angle_coord; }; template<> struct convert<radian>{ static const int value = radian_coord; }; for you'll not salient description of compiler error attempting convert<int> when if had made first declaration forward declaration tell there no type defined "convert." as far example, i'm afraid i'll have defer else. how

xslt - Is it possible to select a node that just includes a subset of the child nodes? -

i have xpath: //tbody/tr[2]/td/div/table/tbody/tr[2]/td[position() > 1] which gives me first child node. however, gives me nodelist of td notes result. want select parent tr node, first child td node removed. is possible using xpath? xpath query language xml documents. such cannot modify structure source xml document or create new xml document. the task of creating new, modified document cannot done xpath only. this easy accomplish xslt : <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xs="http://www.w3.org/2001/xmlschema"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="tr[2]/td[1]"/> </xsl:

Suppressing sign-extension when upcasting or shifting in Java -

i have feeling rather trivial question, i'm stumped. in application i'm keying things in lookup table pair of ints. thought easier concatenate 2 ints 1 long , use single long key instead. coming c background, hoping work: int a, b; long l = (long)a << 32 | b; my attempts replicate in java have frustrated me. in particular, because there no unsigned integral types, can't seem avoid automatic sign-extension of b (a gets left-shifted irrelevant). i've tried using b & 0x00000000ffffffff surprisingly has no effect. tried rather ugly (long)b << 32 >> 32 , seemed optimized out compiler. i hoping strictly using bit manipulation primitives, i'm starting wonder if need use sort of buffer object achieve this. i use utility class with public static long compose(int hi, int lo) { return (((long) hi << 32) + unsigned(lo)); } public static long unsigned(int x) { return x & 0xffffffffl; } public static int high(long x)

Android json parsing -

how parse type of json arrary [{'name':'john', 'age': 44}, {'name':'alex','age':11}] where can't this: jsonarray datalistarray = jobject.getjsonarray("???"); you can use string initialize json array. string json = "[{'name':'john', 'age': 44}, {'name':'alex','age':11}]"; jsonarray json = new jsonarray(json);