Tuesday, 15 April 2014

html - Is an image within a noscript tag only downloaded if Javascript is disabled? -



html - Is an image within a noscript tag only downloaded if Javascript is disabled? -

consider next example:

<noscript> <img class="photo" src="example.png"> </noscript>

does client download image file if have javascript disabled? (i'm aware client can see image if javascript disabled in example)

the reason i'm asking because i've been using base64 info uris several background-image properties in external css (avoiding http requests). utilize base64 info uris src value of img tags updating values via external javascript (to retain benefits of caching).

essentially, whole point of avoid/limit http requests , wondering if can degrade gracefully , fetch image files if javascript disabled? or image downloaded regardless?

the html 4.01 specification says content of noscript not rendered in situations. however, suggests browsers should not perform operations on basis of content in such situations, since such operations pointless , cut down efficiency.

the html5 draft more explicit , reflects actual browser behavior. says noscript element, in emphatic note: “it works ‘turning off’ parser when scripts enabled, contents of element treated pure text , not real elements”. (the note relates why noscript not work when using xhtml syntax, reveals principle works, when works.)

so can expect when scripting enabled, content of noscript won’t parsed (except recognize end tag). blender’s reply seems confirm this, , little experiment firefox:

<img src=foo style="foo: 1"> <noscript> <img src=bar style="bla: 1"> </noscript>

firefox makes failing request foo no request bar, when scripting enabled. in addition, shows warning erroneous css code foo: 1, in error console, no warning bla: 1. apparently img tag not parsed.

however, don’t see how question relates scenario presented reason asking it. think utilize img element outside noscript , set there, using data: url, desired initial content (which remain, fallback, final content when scripting disabled).

html http background-image image noscript

database - How much slow are the cursors in Sybase -



database - How much slow are the cursors in Sybase -

i have heard cursors slow in sybase, said should avoid cursors. can tell how slow cursors in sybase. read cursors fine, or slow, , acceptable utilize cursors altogether

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc20020_1251/html/databases/databases537.htm

here reply example.... sample execution times against 5000-row table

procedure | access method | time --------------------------------------------------------------------- increase_price | uses 3 table scans | 28 seconds increase_price_cursor | uses cursor, single table scan |125 seconds

database stored-procedures cursor sybase

python - How do I call a model method in django ModelAdmin fieldsets? -



python - How do I call a model method in django ModelAdmin fieldsets? -

i want display embedded map on admin form when info exists in db. have next code:

models.py

class address(models.model): address = models.charfield() def address_2_html(self): if self.address: # homecoming html embedded map using entered address. homecoming embedded_map_html else: homecoming '' address_2_html.allow_tags = true

admin.py

class addressadmin(admin.modeladmin): fieldsets = [(label, {'fields': ['address','address_2_html']}),]

this doesn't work. error:

'addressadmin.fieldsets[1][1]['fields']' refers field 'address_2_html' missing form.

another thing tried using 'description' alternative 'fieldsets', however, 'address_2_html' not accessible within scope of addressadmin. did succeed @ embedding static map using 'description' cool not cool enough.

like (from memory):

class addressadmin(admin.modeladmin): fieldsets = [(label, {'fields': ['address','address_2_html']}),] readonly_fields = ['address_2_html'] def address_2_html(self, obj): homecoming obj.address_2_html() address_2_html.allow_tags = true address_2_html.short_description = 'address display'

python django django-models django-admin

python - IO error for saunter.ini while setting up py.Saunter -



python - IO error for saunter.ini while setting up py.Saunter -

while setting py.saunter on system, getting io error saunter.ini file.

directory construction shown in illustration - https://github.com/element-34/py.saunter-examples

below error message -

ioerror: [errno 2] no such file or directory: '/src/conf/saunter.ini' error: module: tests not imported (file:/users/.../pythonworkspace/pysaunter/src/scripts/tests.py)

i know there lot of import related questions. of them suggest add together init.py if not there. have added init.py in every folder.

the code snippet reads saunter.ini below -

def configure(self, config = "saunter.ini"): self.config = configparser.safeconfigparser() self.config.readfp(open(os.path.join("conf", config)))

any help appreciated...

there isn't plenty here diagnose problem. but, in examples directory there 2 different projects (ebay , sauce) -- have in 1 of them, not top.

also, py.saunter won't create saunter.ini you. need create (most renaming saunter.ini.default).

oh, , don't seek , run checkout github -- need egg. if there bits missing http://element34.ca/products/saunter/pysaunter prevent getting started, allow me know , i'll modify page.

(now if remembered credentials...)

python selenium webdriver

subdomain - app.facebook.com/mygame didn't work -



subdomain - app.facebook.com/mygame didn't work -

i have app on facebook, i'm hosting app on subdomain (mygame.mydomain.com). when click game on app center or direct link (www.facebook.com/appcenter/mygame) there no problem, if want redirect on link "app.facebook.com/mygame" didn't work.

i couldn't understand what's problem, please help

isn't "apps.facebook.com"?

and also, think "apps.facebook.com doesn't work anymore. because whenever tried opening app using url, redirected me "facebook.com/appcenter/"

subdomain facebook-apps

xml - How to use or in Xquery -



xml - How to use or in Xquery -

how can utilize use or in query?

i want homecoming if name ="michael" or age =21. have

$d[contains((name,"michael") or (age,"21"))]

if want check if = :

$d[name = "michael" or age = "21"]

or if want utilize contains:

$d[contains(name,"michael") or contains(age,"21")]

when write contains((,) or (,) ) seemingly using or on syntactical level, giving 2 different xquery parser. not possible in xquery, or programming languages, since functions , operands operate on values of expressions, not on syntax. (name,"michael") has no value (well, has value of 2 element sequence, not value interested in), contains(name,"michael") has actual value, of test, if name contains "michael". or has between 2 calls contains.

xml xquery

c# - Serializing and Deserializing with Polymorphism and Protobuf-net -



c# - Serializing and Deserializing with Polymorphism and Protobuf-net -

i'm trying utilize protobuf-net serialize objects. i'm not sure if i'm trying inheritance supported, thought i'd check , see if or if i'm doing wrong.

essentially, i'm trying serialize kid class , deserialize back, doing base of operations class reference. demonstrate:

using unityengine; using system.collections; using protobuf; public class main : monobehaviour { // if don't set "skipconstructor = true" // protoexception: no parameterless constructor found parent // ideally, wouldn't have set "skipconstructor = true" can if necessary [protocontract(skipconstructor = true)] [protoinclude(1, typeof(child))] abstract class parent { [protomember(2)] public float floatvalue { get; set; } public virtual void print() { unityengine.debug.log("parent: " + floatvalue); } } [protocontract] class kid : parent { public child() { floatvalue = 2.5f; intvalue = 13; } [protomember(3)] public int intvalue { get; set; } public override void print() { unityengine.debug.log("child: " + floatvalue + ", " + intvalue); } } void start() { kid child = new child(); child.floatvalue = 3.14f; child.intvalue = 42; system.io.memorystream ms = new system.io.memorystream(); // don't *have* this, can, if needed, utilize kid directly. // cool if abstract reference parent abstractreference = child; protobuf.serializer.serialize(ms, abstractreference); protobuf.serializer.deserialize<parent>(ms).print(); } }

this outputs:

parent: 0

what i'd output is:

child: 3.14 42

is possible? , if so, doing wrong? i've read various questions on inheritance , protobuf-net, , they're bit different illustration (as far i've understood them).

you'll kick yourself. code fine except 1 thing - forgot rewind stream:

protobuf.serializer.serialize(ms, abstractreference); ms.position = 0; // <========= add together protobuf.serializer.deserialize<parent>(ms).print();

as was, deserialize reading 0 bytes (because @ end), trying create parent type. empty stream valid in terms of protobuf specification - means object without interesting values.

c# unity3d protocol-buffers protobuf-net