Posts

Showing posts from May, 2014

google app engine - On GoogleEngine (Java), in JDO, how do I query a list of child objects based on the id of the parent? -

i have 2 value objects, calendar , event, persistent. calendar has property consists in list of events, 1 many relationship. calendar parent of events shown below. @persistent @element(dependent = "true") private list<event> events; now, able retrieve via jdo query, events corresponding calendar, based on calendar object key. using encodedkey both classes. i want run query on event entity , not retrieve whole calendar object, because want able retrieve set of events, pagination purposes. i tried in possible way, not figure out how query parent key. any appreciated. a few notes: list properties in entities (like list<event> events ) stored serialized protocolbuffer. problem is: if property indexed, limited 5000 elements. every time query list, whole list needs deserialized. answer question if can selectively retrieve list elements: can't. if have multiple indexed list properties in entity can lead exploding indexes . if want un...

c# - What is the use of Enumerable.Zip extension method in Linq? -

what use of enumerable.zip extension method in linq? the zip operator merges corresponding elements of 2 sequences using specified selector function. var letters= new string[] { "a", "b", "c", "d", "e" }; var numbers= new int[] { 1, 2, 3 }; var q = letters.zip(numbers, (l, n) => l + n.tostring()); foreach (var s in q) console.writeline(s); ouput a1 b2 c3

html - How do I position a left scrollbar on a tbody element of a table for Google Chrome? -

i have looked issue , can not find solution. web site rtl site scrollbars on left. have seen hacks can done except need it. the tbody element of table needs scroll down without header row disappearing. can scrollbar on right hand side of tbody have no idea how move left. any ideas how tbody's scrollbar on left hand side appreciated. i lucky has work on google chrome. it can't changed css. example, there browsers (iphone, android) don't have scroll bars. scroll bar position depends entirely on user's system, not web page. you can use javascript imitate want. make draggable scroll bar replacement, place on left, , adjust hidden overflow according while user drags "scrollbar". try googling "jquery scrollbar" or "javascript scrollbar". here's interesting alternative scrolling... dragging (similar how drag maps in google maps): http://plugins.jquery.com/project/mapscroller and yet alternative, here's script cal...

android - Multiple icon images in Honeycomb -

i'm trying change app icon make match blue of honeycomb maintain green icons previous android versions. i've come across problem if put blue 72x72 icon in drawable-xlarge, uses correctly in launcher uses actionbar. 72x72 large, extends beyond actionbar top & bottom. my res directory follows: drawable - images ldpi & mdpi screens (48x48) drawable-hdpi - hdpi screens (72x72) drawable-xlarge - images tablets how can correctly organise blue icons 72x72 used launcher , 48x48 used actionbar? honeycomb's launcher use available hdpi drawables higher-res mipmaps on mdpi devices. mdpi icons should still 48x48. if want provide resources specific xlarge screens should provide versions in drawable-xlarge-mdpi, drawable-xlarge-hdpi, etc. however, if goal provide icons match styling in android 3.0 might want use v11 (api level 11) qualifier instead of xlarge. (e.g. drawable-mdpi-v11, drawable-hdpi-v11) api level version qualifiers in resource organizati...

python - Tags with : in name in lxml -

i'm trying use lxml.etree parse wordpress export document (it's xml, rss like). i'm interested in published posts, i'm using following loop through published posts: for item in data.findall("item"): if item.find("wp:post_type").text != "post": continue if item.find("wp:status").text != "publish": continue write_post(item) where data tag item tags found in. item tags contain posts, pages, , drafts. problem lxml can't find tags have : in name (e.g. wp:post_type ). when try item.find("wp:post_type") error: traceback (most recent call last): file "<input>", line 1, in <module> file "lxml.etree.pyx", line 1279, in lxml.etree._element.find (src/lxml/lxml.e tree.c:38124) file "/usr/lib64/python2.7/site-packages/lxml/_elementpath.py", line 210, in f ind = iterfind(elem, path) file "/usr/lib64/python2.7/site-package...

big o - Example of an impractical algorithm known to be in P? -

it's accepted problems can solved in polynomial time "tractable" while algorithms requiring more time intractable. of course, being solvable in polynomial time says nothing of absolute efficiency; example, runs in time n 1000 impractical in practice. although i've seen fair number of polynomial-time algorithms, i've never seen 1 practical problem ran in more o(n 4 ), original version of edmonds' matching algorithm. my question is: is there well-known problem best polynomial-time algorithm impractical real inputs? can construct simple contrived problems utterly useless, i'm curious if there's famous problem best known solution both polynomial-time , entirely infeasible. edit: clarify, should i'm looking algorithm enormous exponent on problem size, rather hard-to-implement algorithm or 1 huge constant factor. moron pointed out, there many famous impractical algorithms great asymptotic behavior. primes in p: aks primality test ...

image - send request using json in android -

possible duplicate: send requst json java server in android now working in gallery project. images on server database.using json want send request , response server, in server side using java.when images changed in database,gallery images must changed dynamically.how use json purpose,please me package com.devstream.http; import org.json.jsonexception; import org.json.jsonobject; import android.app.activity; import android.os.bundle; import android.util.log; public class mainactivity extends activity { private static final string tag = "mainactivity"; private static final string url = "http://www.yourdomain.com:80"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // json object hold information, sent server jsonobject jsonobjsend = new jsonobject(); try { // add key/value pairs ...

android - texture mapping -

i'm trying apply texture sprite using opengl follows: int[] textures=new int[1]; gl.glenableclientstate(gl10.gl_texture_2d); gl.glgentextures(1, textures, 0); gl.glbindtexture(gl10.gl_texture_2d, textures[0]); gl.gltexparameterf(gl10.gl_texture_2d, gl10.gl_texture_min_filter, gl10.gl_nearest); gl.gltexparameterf(gl10.gl_texture_2d, gl10.gl_texture_mag_filter, gl10.gl_linear); bitmap bitmap=null; try { bitmap= bitmapfactory.decodestream(contxt.getassets().open("gfx/garf.png")); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } glutils.teximage2d(gl10.gl_vertex_array, 0, bitmap, 0); bitmap.recycle(); ..... i'm using andengine framework in android , using onmanageddraw method of sprite this. can in direction? i think need teximage2d( gl10.gl_texture_2d , 0, bitmap, 0);

html - komodo - correct identation, simple question -

how can apply simple correct identation of code? eclipse example... there possible, right? thanks you can use external code formatter via macro

jquery droppable only one child -

i new jquery , working droppable api. i want have group of divs can hold 1 , 1 droppable item. i've set class of droppable divs inv. can drop items divs can find way reject drop once in drop function. i want able detect div has child , if revert dopped element. my code looks this $( "div.inv" ).droppable( { drop: function( event, ui ) { childcount = $(this).children().length; if (childcount !=0) { //revert droppable initial position return; } //if there child revert , return $( ) .addclass( "ui-state-highlight" ) .append($(ui.draggable)) } }); what disabling droppable area after receiving item ? you can : $( "div.inv" ).droppable( { drop: function( event, ui ) { $(this).droppable('disable'); } });

script/rails vs rails -

i'm writing tutorial demo rails commands. on machine rails , script/rails both work equally well. there "preferred" form? of 2 works more universally? when run rails executable within rails 3 application, looks script/rails file and, if it's present, executes file arguments passed rails . the reason why you'd use rails on script/rails falls down fact it's shorter. one more thing note, there's rails c command which, in rails 2 application, generate application folder called c inside current directory. using script/rails , wouldn't happen; instead complain script/rails doesn't exist.

javascript - Model.find() returning null json object in mongoose (mongodb) on node -

here's relevant code: app.get('/all', function(req,res) { party.find({},[],function(p) { console.log(p); }); res.redirect('/'); }); should return collections database - returns null in console. var mongoose = require('mongoose'); var db = mongoose.connect('mongodb://localhost/impromptu'); var schema = mongoose.schema, objectid = schema.objectid; general stuff initialization var partyschema = new schema({ : string, when : string, : string }); mongoose.model('party',partyschema); // models var party = db.model('party'); schema i have else setup properly, can save collections fine, can't retrieve reason... checked /var/log/mongodb.log , indeed connecting. any ideas? assuming you're using mongoose after v1.0 null err argument callback (there 2 ... first error results) ... try this: party.find({},[],function(err,p) { console.log(p); });

Why are my fonts blurry in Visual Studio 2010? -

Image
i switched visual studio 2010. have used old pixelized fonts find easier read (one pixel black, other white... perfect). in visual studio 2005 using bitmap fonts. in vs 2010 seems must use ttf fonts, switched proggy fonts ttf format . but text blurry. here screenshot: how can disable useless feature? don't want code "pretty" want work :) i try tool great solution remove clear type on code (text view). http://vlasovstudio.com/text-sharp/index.html want have in windows 8 high dpi options linux versions (for instance cinnamon, excelent , flexible controls high dpi screens). working vstudio 2013 , lenovo yoga 2 pro.

workitem - TFS Lock Work Items in State -

once work items in particular workflow reach "tested/resolved" end state, don't want them editable. enter field restrictions on end state every field exists, that's pain , doesn't support addition of future fields. there easier way? thanks! alas, don't think there "out of box" way except using "when" clause on each of fields or adding state transitions "tested/resolved" (as have indicated).

SSL Partially encrypted -

i new ssl. got standard ssl installed in server, when go shopping cart, says it's partially encrypted. chrome crosses out https in url location bar. understand, there http links in page (images, js), there tools check that? workarounds? looked manually , found 1-2 images using http instead of https in page, can reason block ssl?? please help,crossed https link on page looks worse no https @ all.. i have read, stops (showing partial ssl) sometimes.. wonder maybe there time frame or smth effecting it.. update: figured myself...it javascript using widget (using http), disabling solved problem. not sure how close ticket :) use scheme-relative urls (they relative http / https part). makes them protocol-independent, , problems should solved. example, instead of: <img src="http://example.com/path/to/image"/> use <img src="//example.com/path/to/image"/> recommended reading network-path reference uri / scheme relative urls is ...

sql - help to get rid of HTML special chars in database -

i've migrated site interspire cms joomla! cms. i've managed migrate database of articles, of them have weird issue - when access page joomla, title contains html entities &rsquo; . as can guess cms's use, rely on php server side, , mysql database. i tried go on titles of articles in database htmlspecialchars_decode , html_entity_decode in order rid of those, had no effect. if grab example db , echo it, ok: what’s pleasure, lasagna or pizza manchester style? if go article page in joomla this: what&rsquo;s pleasure, lasagna or pizza manchester style? when go phpmyadmin see directly in database, contents of title: what&rsquo;s pleasure, lasagna or pizza manchester style? i tried remove symbol with: str_replace("&rsquo;","",$title); or replace this str_replace('&rsquo;',"'",$title); but nothing. when tried encode again instead of decoding (just see if i'm on right db) worked , encoded a...

iphone - Are there any good game editor open source for level designer? -

i'm finding game editor open source (c/c++/objective-c) specially level designer. @ now, know tiled map editor focus on tile map. in brief, need tool can design many game levels on (design dragging game objects (actor, wall, ball, tree, etc) screen editor, define properties (density, restitution, friction, etc) each objects, etc) exporting them xml file , game code read xml file generate interface. please comment if don't understand question clearly. many thank in advance advices on this. tien i have been looking myself time now, , think found our answer in question: check out nitro level editor - it's xml based , fit virtually 2d game or application. http://nle.nickmania.com/ from this question

.net - PermissionSet - where are an assembly's security restrictions set? -

i have inherited solution contains class library method decorated with: [permissionset(securityaction.assert, name = "fulltrust")] the attribute required, because if comment out attribute, method throws following exception: system.security.securityexception: request permission of type 'system.security.permissions.fileiopermission, mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' failed. as far can see, executable references assembly running in full trust, beccause when in executable's app.manifest, can see: <requestedexecutionlevel level="asinvoker" uiaccess="false" /> as run visual studio administrator, assume hitting debug run executable in administrator mode, should have full permissions (though might misunderstanding entirely). the assemblyinfo of library doesn't seem have interesting security restrictions. so can't see why library running @ lower trust level star...

https - Cloudfront serving over own SSL certificate -

does know if possible serve cloudfront on https own certificate while using own cname? can't find way set own ssl cert on s3... im not sure if possible. update: if interested in update issue - maxcdn.com offers host ssl cert on domain $59 flat fee month. it's not amazon supports pulling server , hosting forever or if send cache control header whatever time specify until fetches original url again. the whole offer pretty neat. :d i looked extensively, , no, it's not possible use https cnames unless you're able ignore cert name mismatches on client side. https works "simple" bucket names, cnames work bucket names fully-qualified domains. aws adding new features, can see them being able serve custom certificates @ point, there's no support yet. see: http://stackoverflow.com/questions/3048236/amazon-s3-https-ssl-is-it-possible edit: still not possible direct access s3, possible through cloudfront: http://aws.amazon.com/cloudfront/...

testing - i want append html content into DIV tag -

var test ="<html><head><title>json template</title><script type='text/javascript'>widgetbuilder.render({'displayparams':{'wtitle':'columns','target':'wid1','classlist':{"+result+"},'displimit':'5'},'contentparams':{'channel':'news','category':'columns','wid':'widget1','entity':'article','limit':'6'}});</script></head><body><div><ul id='wid1'></ul></div></body></html>"; $("#lightbox-panel").append(test); the tag nothing more container other tags. body tag, div elements block elements , work behind scenes grouping other tags together. use following attributes div element, else should reserved css id width height title style

internet explorer 7 - Socket.io Node.js error in IE7 - Access Denied -

i using socket.io connect node server using following script: $socket = new io.socket(null,{port:8086,remembertransport:false}); $socket.connect(); if works fine in ie8/9, chrome, safari & ff. when try in ie7, connection established following error pops up: an error has occured in script on page. error: access denied. the client disconnected node server. i runnig node.js v0.4.1. does 1 have ideas? thank you. it caused because did not have secure:true statment in io.connect. should read: var socket = new io.socket(null, {port: 443, secure: true, remembertransport: false}); socket.connect();

c++ - issue creating java native interface -

i tried implement jni. first create java class containing 1 native method, , compile using "javac helloworld.java" , create header file using "javah helloworld" ... here code class helloworld { private native void print(); public static void main(string[] args) { new helloworld().print(); } static { system.loadlibrary("helloworld"); } } helloworld.h file shown below ..... /* not edit file - machine generated */ #include /* header class helloworld */ #ifndef _included_helloworld #define _included_helloworld #ifdef __cplusplus extern "c" { #endif /* * class: helloworld * method: print * signature: ()v */ jniexport void jnicall java_helloworld_print (jnienv *, jobject); #ifdef __cplusplus } #endif #endif after created helloworld.c file ... here code #include #include #include "helloworld.h" jniexport void jnicall java_helloworld_print(jnienv *env, jobje...

Android Default Calendar Application, Can I Use It's Day View Object I Can Use In My Application -

i have been looking around , have found google code project calendar view it's not i'm looking for. what i'd ability use view default day view of default calendar application. know whether or not can use it's day view in app or if 1 developed , released can use? again don't want full month view or week view. @ moment want day view many of use glance @ we've got going on day. i'm not interested @ time of fetching google calendar appointments or merging them. separate list of appointments / tasks own data source. have done i'm trying find pretty way display them (listview tad bit basic lol). does know whether or not can use it's day view in app or if 1 developed , released can use? you can find source code in android open source project, may not designed reuse. android 3.x has calendarview widget; once source code android 3.x released (hopefully later year), may can back-port older android versions. the iosched applicatio...

java - JavaFX: Why are there two different styles? -

i learning javafx. i'm adding java desktop app , i'm doing using netbeans 7. i've been searching internet javafx examples whatever want (embed in swing, set background, add gradient, incorporate animation...). finding 2 javafx styles. 1st example: http://download.oracle.com/javafx/2.0/visual_effects/jfxpub-visual_effects.htm 2nd example: http://javafx.com/samples/mediabox/ i found http://netbeans.org/features/javafx/composer.html says javafx support not available in netbeans ide 7.0. , screen shot handling fx project don't have choice make in netbeans 7. have sample fx projects can make these java projects fx in (the 1st style of fx). my guess javafx has been redesigned in latest version, javafx 2. 2nd example being older style , 1st being newer. seems me 1st example more addition java instead of separate language. did guess right? what's 2 styles of fx? the netbeans javafx composer tool create customnodes javafx components, works javafx 1...

Integrating meta_search gem in index with existing geocoder gem search (rails) -

i have implemented location based search using geocoder , having trouble integrating meta_search gem. i'm trying integrate meta_search object_controller index allow users filter , sort search results objects :attributes after have searched location. my object_controller: def index if params[:search].present? @objects = object.near(params[:search], 50, :order => :distance).paginate(:page => params[:page], :per_page => 9) else @objects = object.paginate(:page => params[:page], :per_page => 9) end end any idea how best integrate @search index required meta_search gem? here meta_search github recommends index: def index @search = article.search(params[:search]) @articles = @search.all # load matching records # @articles = @search.relation # retrieve relation, lazy-load in view # @articles = @search.paginate(:page => params[:page]) # doesn't love will_paginate? end thanks much, will i believe both geocoder , met...

java - How does unhandled exceptions affect JVM? -

my project got 20 unhandled exceptions, doesn't matter why, , wondering how affect jvm? doesn't crash, i'm still wondering footprint in jvm. go? all exception handled either code or "uncaught exception handler" way avoid handling exception return block or exiting program. an unhandled exception/error result in end of running thread. acceptable response, there no reason needs upset application. one problem exceptions have overhead , if create excessive numbers of them can hurt performance.

javascript - Help with Prototype JS and event binding -

i working on website has form , includes js file: http://assets.sprint.degreesearch.org/assets/defaults.js?1311179143 what trying dynamically apend function on form submit (either via onclick function on submit button or via overwriting functions included in js gets triggered on form submit. the problem not familier prototype.js , unable execute function on form submit. when on onclick, triggers gets canceled prototype believe , execution stopped mid way. the website in question step4 of http://sprint.degreesearch.org/collegefunnel website, on step4, while pressing submit, want run js function ideally takes around 200-300ms any pointers how can unbind event associated mouse press , insert dynamic script ahead of , bind whatever has been binded default thanks sparsh gupta prototype has stopobserving method unbinding events. depending on events being bound, call stopobserving on form submit or other elements' mouse events. however, don't think that...

python - Pythonwin - print function not working -

this question has answer here: syntax error on print python 3 [duplicate] 10 answers i'm running pywin32 build 216.1 , having trouble using simple print function - example: >>> print 'hello!' should return: hello! but instead get: traceback ( file "<interactive input>", line 1 print 'hello!' ^ syntaxerror: invalid syntax it doesn't matter try , use print, gives me same error. able other things fine long don't involve use of print function. can help? in python 3, print function, not statement. call like: print("hello!")

javascript - Splitting a map value -

i have map has data of type: {4e237b32eca4a6103061abf7:"27.94904038727,-82.6213887207031,test again,"} i trying split value below code states split not valid command. suspect not seeing string. $.each(arrayremove, function (key, value) { var data = value.split(","); var mylatlng = new google.maps.latlng(data[i + 0], data[i + 1]); ... can cast or how should done? in case value {4e237b32eca4a6103061abf7:"27.94904038727,-82.6213887207031,test again,"} object without method split. might need go deeper: $.each(arrayremove, function (key, value) { $.each(value, function (key, str) { var data = str.split(","); var mylatlng = new google.maps.latlng(str[i + 0], str[i + 1]);

How can I invoke the MySQL interactive client from PHP? -

i'm trying get `mysql -uroot`; to enter mysql interactive client executing $ mysql -uroot from shell does. it's okay if php script exists after (or before), need invoke mysql client. i've tried using proc_open() , of course system(), exec() , passthru(). wondering if has tips. new solution: <?php $descriptorspec = array( 0 => stdin, 1 => stdout, 2 => stderr ); $process = proc_open('mysql -uroot', $descriptorspec, $pipes); old one: save tab completion (you in there if read out bytes fread instead of using fgets), gets on way, lots left tweak: <?php $descriptorspec = array( 0 => array("pty"), 1 => array("pty"), 2 => array("pty") ); $process = proc_open('mysql -uroot', $descriptorspec, $pipes); stream_set_blocking($pipes[1], 0); stream_set_blocking($pipes[2], 0); stream_set_blocking(stdin,0); { echo stream_get_contents($pipes[1]); echo stream_get_co...

Having Trouble with jQuery tooltips -

i'm using jquery tools tooltip plugin found here . it's intended behavior: have 3 elements, in case div s, which, when clicked, popup tooltip. tooltip div on page hidden via css. when pops out, need stay visible until either user clicks on 1 of div s in tooltip (or inside tooltip if not possible) or click on 1 of other initial 3 div s. the problem: unexpected behavior when doing this. example, first div click (no matter one), works expected: tooltip pops , stays unless click inside of or 1 of other div s. however, when doing again div , disappears once mouse leaves div area. can still click on first 1 clicked on no problems tho... i'm not sure what's wrong here. =/ test code below <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en' dir='ltr'> <head> ...

jaxb - Can JAX-B include an XML-valued attribute verbatim? -

i have object return value web service method. 1 of properties contains xml document. ideally, i'd have jax-b include xml document verbatim in web service response, rather escaping or having unmarshal allow webservice mapping marshal again immediately. can done via annotations or custom binding definition? edit: reason want xml document retrieved oracle db (column type xmltype), , want avoid unnecessary parsing/formatting steps in getting out webservice client. i think you'll have convert xml string org.w3c.dom.element object first, add model, , annotate @xmlanyelement . jaxb serialize verbatim xml (schema validation not withstanding).

sas - How do I implement MVCC? -

i have located many resources on web giving general overviews of mvcc (multi-version concurrency control) concepts, no detailed technical references on how should work or implemented. there documents online, or books offline, contain enough theory (and bit of practical help, ideally) on base implementation? wish emulate more or less postgresql does. (for info implementing in sas using sas/share - provides locking primitives , concurrent read/write access underlying data store, nothing in way of transaction isolation or proper dbms features. if familiar sas/share , thinks impossible task, please shout!) transaction processing: concepts , techniques , transactional information systems: theory, algorithms, , practice of concurrency control , recovery authoritative source of transaction processing. both these books mentioned in postgresql wiki .

parsing HTML to a string in Java -

i have email's content (html format) , save string should parsed required details , prepare xml output. i using james , want done in java. how can dump html page string? think won't problem double inverted commas, spaces, backward slash while parsing? now testing mailserver on localsystem. sent mail user1@localhost user2@localhost in format html @ other end want convert parse html page create xml document desired values .. can try example. dumps html page , writes data data.html file. bellow code can append result stringbuffer , replace html special chars. public class urlreadpagedemo { public static void main(string[] args) { try { url url = new url("http://example.com"); bufferedreader reader = new bufferedreader(new inputstreamreader(url.openstream())); bufferedwriter writer = new bufferedwriter(new filewriter("data.html")); string line; while ((line = reader.readline()) != null) { ...

c# 4.0 - object reference after Serialization and De-Serialization -

why after de-serialization object reference not same before serilization. ok let me explain this i having string string test = "teststring"; now serilization datacontractjsonserializer _datacontractjsonserializer = new datacontractjsonserializer(typeof(string)); memorystream ms = new memorystream(); _datacontractjsonserializer.writeobject(ms, test); var jsonstring = encoding.default.getstring(ms.toarray()); now deserilization jsonstring actual value memorystream ms1 = new memorystream(encoding.unicode.getbytes(jsonstring)); datacontractjsonserializer serializer = new datacontractjsonserializer(typeof(string)); string deseriliaedstrring = serializer.readobject(ms1) string; here in deseriliaedstrring got actual value if check there reference not equal bool isreferenceequal = object.referenceequals(deseriliaedstrring, test); whe...

question about PNG image format the lossless data compression -

if take simple bitmap ( image without compression ) , compress png format , extract original bitmap - same image ? because first step of png compression pre-compression => filtering ( prediction current pixel according the pixel before ) on original bitmap - , mean after image not same if extract after compression. png uses lossless compression, answer yes , same data after decompressing. filtering stuff not lose information, it’s preprocessing stage yield better compression ratios common sample patterns (like constant color lines or gradients).

python - Missing OAuth request token cookie error using tornado and TwitterMixin -

i'm using tornado , twittermixin , use following basic code: class oauthtwitterhandler(basehandler, tornado.auth.twittermixin): @tornado.web.asynchronous def get(self): if self.get_argument("oauth_token", none): self.get_authenticated_user(self.async_callback(self._on_auth)) return self.authorize_redirect() def _on_auth(self, user): if not user: raise tornado.web.httperror(500, "twitter auth failed") self.write(user) self.finish() for me works sometimes, users of application 500 error says: missing oauth request token cookie i don't know if comes browser or twitter api callback configuration. i've looked through tornado code , don't understand why error appears. two reasons why might happen: some users may have cookies turned off, in case won't work. the cookie hasn't authenticated. it's possible oauth_token argume...

c# - Is there a Css writer for .net? -

i've noticed microsoft has implemented csstextwriter internal internal sealed class csstextwriter : textwriter { .... } is there css writer .net that? for example write code such as: csstextwriter writer = new csstextwriter(textwriter); writer.writebegincssrule("p"); writer.writeattribute("font-family", "arial,liberation sans,dejavu sans,sans-serif"); writer.writeendcssrule(); the above code output stream follows: p { font-family: arial,liberation sans,dejavu sans,sans-serif; } dotless http://www.dotlesscss.org/ looks job, bit needed single clss i wrapped calls internal microsoft class (yes naughty , might go away in future releases of .net etc....) public class csstextwriter { public csstextwriter(textwriter writer) { if (writer == null) { throw new argumentnullexception("writer"); } this.writer = writer; this.initialize(); } /// <summar...

seam - Check for validation errors in part of a form in JSF -

i'm building seam application, huge form divided different parts, or modules. need way figure out when module "complete", meaning validation fields in module passes. need in view, setting css-class or whatever. something like: <a:region id="region1"> <s:div styleclass="#{invalid ? 'errors' : ''}"> <h:inputtext required="true" id="input1" /> <h:inputtext required="true" id="input2" /> <h:commandbutton value="save section" rerender="region1" /> </s:div> </a:region> i figured had 2 options: using sort of view-logic (like #{invalid} single field) using method in bean, components module programmatically, , check them validation errors. however, can't find way of them. ideas if possible? we're using jsf 1.2 seam. thanks. you can use uiinput#isvalid() check if validation error...

SQLite Count Summary Query -

i'm trying query summarize each employees work week. example, john doe did total of 12 tickets week, 4 of break/fixes, , 4 enhancement, , 4 uncategorized. this have far: select (users.first_name || ' ' || users.last_name) name, count(tickets.id) 'number of tickets closed', count(tickets.category = 'maintenance') 'maintenance tickets', count(tickets.category = 'after hours') 'after hours tickets', count(tickets.category = 'break fix') 'break fix tickets', count(tickets.category = 'enhancement') 'enhancement tickets', count(tickets.category = '') 'non categorized tickets' tickets, users on tickets.assigned_to=users.id (tickets.status = 'closed') , (tickets.closed_at >= '2011-07-16 00:00:00') , (tickets.closed_at <= '2011-07-22 23:59:59') group name; here sample result: john doe1 10 10 10 10 10 10 john doe2 2 2 2 2 ...

mysql - entering names dynamically using php for loop -

ive got number of textboxes filled in name database. i create 5 textinputs, using for.. loop for($i=1; $i<=5; $i++) { echo '<input type="text" value="">'; } my question how enter names each textboxes dynamically. i tried: $q = $db->query("select * att id_bs_res='$id_bs_res'"); for($i=1; $i<=5; $i++) { while($r = $q->fetch_assoc()) { echo '<input type="text" value="'.$r['att_name'].'">'; } } if there 3 names in database, show 3 instead of 5 textboxes? want shows textboxes if rest of textboxes blank. sample textboxes 1. names 2. names 3. names 4. ------ 5. ------ remove inner while loop. $q = $db->query("select * att id_bs_res='$id_bs_res'"); for($i=1; $i<=5; $i++) { $r = $q->fetch_assoc(); echo '<input type="text" value="'.isset($r['att_name'])?$r[...

sql - HQL: using elements() on objects -

say have database 2 tables: classes , students. each table contains metadata relevant topic. example, classes contains fields 'classid', 'name' , 'room_number' , students contains fields 'name', 'classid', 'age' , 'height' (say student can in 1 class). what if want write hql query me classes include students names 'joe', 'bob', , 'fred'? if students contained 'classid' , 'name' think write following in hql. from classes class 'joe' in elements(class.students) , 'bob' in elements(class.students) , 'fred' in elements(class.students) however, students object in case. need perform joins explicitly? from classes class join class.students s1 join class.students s2 join class.students s2 s1.name = 'joe' s2.name = 'bob' s3.name = 'fred' i imagine using 'fred' in elements performs these joins, more compact wr...

php - utf-8 encoding in HTML and utf8_unicode_ci char set & collation for MySQL - can I store & display any type of text in it now? -

i want dvp small web app ideally used worldwide. sake of discussion, let's it's recipe sharing site - it's enough metaphor. my app allow users enter or upload text in native languages. html header says site uses utf-8 encoding. creating mysql db, , suppose should select utf8_unicode_ci char set & collation. is correct? is need able receive, store, , display safe user-generated-content in chosen language? if not, missing? (i aware of safety concerns associated displaying ugc, not question - here solely looking advice deal safe content.) it html , db part, must ensure programming language utf-8 aware doesn't garble stuff. if use php make sure functions use utf-8 aware. if isn't manual mentions it.

uinavigationcontroller - Change color of translucent black UINavigationBar -

i stumbled upon many times, never found solution. uinavigationcontroller's navigationbar can set black translucent like: self.navigationcontroller.navigationbar.barstyle=uibarstyleblacktranslucent; also, there translucent property in uinavigationbar, docs say: when yes, navigation bar drawn partial opacity, regardless of bar style. amount of opacity fixed , cannot changed. permissible set value of property when navigation bar being managed navigation controller object. i tried self.navigationcontroller.navigationbar.tintcolor=[uicolor bluecolor]; self.navigationcontroller.navigationbar.translucent=yes; and thousand variations: setting translucent property first, setting in appdelegate , in viewcontroller, setting barstyle first. result same: no transparency. hence question: is possible change color of translucent uinavigationbar different black (preferably within uinavigationcontroller)?. i hope there review-safe solution. thanks, m once k...

javascript - How can I execute a function when a disabled checkbox is clicked? -

i have checkbox on page disabled until criteria met. in effort give user information, i'd have 'tool tip' display when user tries click on disabled checkbox. problem i'm having can't onclick event trigger on checkbox. here sample code: <script> function notify() { alert("hello"); } </script> <input type="checkbox" onclick="notify();" id="thisoneworks"/> <input type="checkbox" onclick="notify();" id="thisonedoesnt" disabled/> when checkbox enabled, onclick event fire. when checkbox disabled , onclick event not fire. my question is: how can execute function when disabled checkbox clicked? i looking through stackoverflow yesterday , found solution in question somewhere, can't find again. when find it, i'll link it. the fix in order capture clicks on disabled checkbox, can overlay div above disabled checkbox, , div receive o...

.net - Is there any way of decorating a method with an attribute to be executed in other thread -

is there way of decorating method in .net attribute mean method executed in other thread? i have lot of methods execute in other thread don't want recode them again, attribute let me choose sync, async smoothly. ideas or workaround? thanks. the framework has no such attribute. in case don't have recode method invoking, invoker. can use delegate create async invocation or better yet use task. make sure taking care of syncronization issues. following link contains excellent info on subject: http://www.albahari.com/threading/ and here: how create asynchronous method

selector - Jquery - Trying to figure out how to find a certain class then name -- and then do something with them -

i'm trying figure out how find class name within div name, in same div. i'm having trouble finding besides parent/child, or maybe i'm off-base. i'd pick out each of these , add how many there this, total. thanks. try this: var items = $(".<class-name>[name='<element-name>']", "#idofdiv"); alert(items.length); e.g: var items = $(".someclass[name='somename']", "#interesteddiv"); //if div should identified different selectors replace #intereseddiv other selector. alert(items.length);

scipy - fit data(measurements) with numerical datasets -

i have data have set of numerically determined model curves. find 1 least square deviation, need vary 1 parameter, amplitude of these model curves. i used fitting analytic functions, did not find way handle such problem. is there solution? thanks lot! one of optimize functions should trick. can read section on optimization in manual . without specifics on data or model wish match, it's hard recommend more specific. example, if cost function has many maxima , minima or not differentiable, you'll have choose of more expensive routines.

ruby on rails - Make a controller -

i've website made in html/css. , i'm starting learn rubyonrails , i'd turn url links controllers. made new controller, , don't know how go forward. got email button made controller mail_controller.rb , want link email adress. you need not controller, routes that. make sure have on config/routes.rb file route mapping url want controller made. perhaps may want take @ guides: http://guides.rubyonrails.org/getting_started.html

java - How to wadl2java these days? -

i have real difficulty finding commandline tool convert wadl java. no matter how try google, follow blogs or java.net doc, there no real download link. (links broken or obsolete). what particular vendor, community group supplying tool ? free download link exist ? the generated code should able reconstruct pojos xml responses , survive inside tomcat 7. thank you answer: (this works after june 2011): take apache-cxf-2.4.1.zip (not of earlier versions) extract root folder take apache-cxf-2.4.1.src.zip search folder named distribution inside src extract ditribution folder , merge no overwrites root folder goto bin , spot wadl2java.bat run wadl2java.bat command prompt continue no brainer details apache cxf added support wadl-first development of rest services. more background information on wadl2java tool, blog entry 1 of cxf committers should help.

php - Show tab without refreshing whole page -

i have following code in php page. these 2 tabs inbox , sinbox. when user clicks on them refreshes whole page go other tab. there way make these tabs when user click on 1 of tab there no page refresh? when answering please provide full code example beginner. <ul id="toptabs"> <li class="selected"><a href="acc/inbox"> inbox </a></li> <li><a href="acc/sinbox"> sinbox </a></li> </ul> one of simplest ways using jquery ui tabs . can find nice detailed beginner-friendly tutorial here .

multithreading - C++11 threading on Windows -

is there anyway use std::thread c++11 standard library in windows when compiling g++ 4.5.2 in mingw? i'm gunna assume no i've seen many things saying have compile pthreads option figure i'd ask anyway. there experimental support std::thread in mingw-w64 toolchains. specifically, gcc 4.6 builds provide usable std::thread through mingw-w64's winpthreads library. you can find downloads here: 64-bit . 32-bit . apart that, msvc11 (visual studio 2012) has <thread> , <chrono> , , <atomic> . can download express edition here .

internet explorer 6 - IE6 HTTP \ HTTPS mixed content error -

i getting error says content being delivered non secure on secure page , yes|no|more info dialog box. is there way in ie6 find out element on page causing error? i have developer tools, doesnt seem tell me anything. thanks what can use fiddler2 . clear cookies , cache, , run load page see resources load. there easy see what's loading insecurely.

How to get substring from string in c#? -

i have large string , stored in string variable str. , want substring in c#? suppose string : " retrieves substring instance. substring starts @ specified character position." substring result want display is: the substring starts @ specified character position. you manually or using indexof method. manually: int index = 43; string piece = mystring.substring(index); using indexof can see fullstop is: int index = mystring.indexof(".") + 1; string piece = mystring.substring(index);

windows - Are Unix/Linux systems vulnerable to leaking global kernel objects? -

in windows there're objects maintained system - events, file access handles, windows, timers, etc, not unlimited programs in system can create no more 50k objects (i'm not sure of exact figure, it's not critical question). so if program runs long time , creates lots of objects , doesn't release them (exactly memory leak, here system objects leaked) system runs out of objects , other programs try requires creating new system objects start getting error indications system functions. example, program runs , leaks objects available system , program b tries open file , fails because system has no resources service request. solution @ point restart program leaked resources reclaimed system. does same problem exist on unix/linux systems or somehow protected against that? they're subject same problems, can degree hardened/limited. default, there's limits per process that's way below cause systemwide problems. have start lot of processes though. of ...

objective c - Question regarding @property -

i'm kinda new in obj-c , ask why need write this? @property (_something, _something) nsstring* name; what @property indicates for? why need put _something in bracket? ps: know there no _something, should nonatomic, retain, copy , on. since has many options, that's why put word indicate content inside bracket. (where can list of available options?) thanks :d @property indicates defining property, @ basic level syntactic sugar allows variable = object.property , object.property = value instead of variable = [object property] , [object setproperty:value] . if wanted, skip declaring properties , declare getter , setter methods directly , runtime hardly notice difference. the things inside parentheses modify property. many useful properties getter and/or setter implementations created using @synthesize in @implementation block. example, assign (the default) says value set set; retain says object set automatically have retain method called (and previ...

Implement a Delphi interface using an 'anonymous' class -

i have interface. type iprogressobserver = interface(iinterface) procedure reportprogress(progress:integer); procedure reporterror(message:string); end; i have implemented interface using named class, follows: type tprogressobserver=class(tinterfacedobject, iprogressobserver) procedure reportprogress(progress:integer); procedure reporterror(message:string); end; ... implementation of methods go here ..... addprogressobserver(tprogressobserver.create); is possible create instance of interface without declaring class? (imaginary) code, same thing above: addprogressobserver(iprogressobserver.create() begin procedure reportprogress(progress:integer) begin showmessage('progress observed!'); end procedure reporterror(message:string) begin log(message); end end;); delphi has anonymous procedures, have anonymous classes?? i found this similar question , it's in java. i using delphi 2010 you can pret...

java - How to attach a maven plugin to a phase by default? -

i have maven plugin should run in compile phase, in project consumes plugin, have this: <executions> <execution> <phase>compile</phase> <goals> <goal>my-goal</goal> </goals> </execution> </executions> what need by default attach my-goal compile phase if user has included plugin (ideally above part wouldn't necessary, plugin declaration). is possible? put @phase annotation in mojo classdef annotations. the doc says: @phase <phasename> this annotation specifies default phase goal. if add execution goal pom.xml , not specify phase, maven bind goal phase specified in annotation default. if doesn't work, guess jira warranted.

iphone - How can I make the large image into small with as good quality as the original image? -

i using imagview size of 80x80 display large image (1024 x 780). while placing large image imageview, image looks squeezed, compressed not quality one. my question is, how can make large image small quality original image ? in image view, please make imageview.mode centre not scale fit or other. believe put ur scaled image @ finest quality in ur 80x80 dimension.

Maximum code size for Google App Engine -

is 10mb files, or 10mb / file, 150mb in total? i'm using python. looks these have been updated. current file limit 10k max size of application file: 32m full limits: https://developers.google.com/appengine/docs/java/runtime#quotas_and_limits , https://developers.google.com/appengine/docs/python/runtime#quotas_and_limits

Java ASN.1 validation library -

is there free open-source java library validate asn.1 ber/der/xer on module definitions file . yes, there (usually part of encoder/decoder library) e.g.: jac (java asn.1 compiler) tool if want (1)parse asn1 file (2)create .java classes , (3)encode/decode instances of classes.

objective c - Regular expression for separating words by uppercase letters and numbers -

i wondering if might know regular expression turn this: west4thstreet into this: west 4th street i'm going add spaces string in objective-c. thanks! i don't know want put in spaces, try [a-z.-][^a-z .-] , put space between 2 characters in each match.

database - what is the best approach to make an application to work with multiple ado.net providers? -

we develop set of industrial applications use sql server. as demand expands, customers want use our applications own rdbms such oracle, mysql , others. currently, applications uses oledb provider, , other uses native sqlserver various reasons, including programming experience , religion. we seek unified approach. project manager prefers oledb because "it works everything." personally, hate because how queries parameters handled... i have 2 solutions in mind : the first use sqloledb keeping existing code , adapt each sql statement in case of incompatibility using branch instructions. go quickly, sql not differ , please project manager. however, might turn code spaghetti. the second use native ado.net provider each rdbms, , develop library of data access each. each library might contain common part avoid code duplication. of course take time, lead clean architecture , optimal performances. it's client server applications. parts of our database dynamically ...

c# - Generic method calling duplication -

i have following code: switch (objecttype) { case objecttype.userreview: return mymethod<userreview>(); case objecttype.professionalreview: return mymethod<professionalreview>(); case objecttype.question: return mymethod<question>(); case objecttype.news: return mymethod<news>(); default: throw new argumentoutofrangeexception("objecttype"); } now need same code calling method. there options implement without duplication , reflection? sounds ideal opportunity replace conditional polymorphism . can promote objecttype.userreview class (it looks enum @ moment) , put switch block polymorphic method?

Use of action hint ActionHint in CodeRush -

i wanted point action hint arrow methodcall named mymethod in current class. if there methodcall name mymethod arrows should pointing them when click combination of keys. i tried actionhint steps given here. have no idea event use. then tried call coderush.actionhint.pointto() through codeprovider did not work. is possible write such plugin? if yes version of pointto() method should use. a sample code if possible helpful. thanks in advance. the reason action hint doesn't appear source code point might outside of visible screen bounds. before calling pointto(), make sure target point visible. can use following pointto overload: coderush.textviews.active.makevisible(mymethodinstance.namerange); coderush.actionhint.pointto(mymethodinstance.namerange.start, "mymethod", color.red);

iphone - how to go to datepickerview from date textfield? -

how go datepickerview date textfield? if got right - you should add datepickerview inputview of textfield. textfield.inputview = datepickerview; this line make app lunch date picker when text field becoming first responder. good luck

Implementing screen lock in Android 2.0 -

i implementing screen lock in android 2.0 programmatically , here code. this.devicemanager = (devicepolicymanager)getsystemservice(context.device_policy_service); devicemanager.locknow(); but problem getting security exception. 03-07 12:38:33.665: error/androidruntime(806): fatal exception: main 03-07 12:38:33.665: error/androidruntime(806): java.lang.securityexception: no active admin owned uid 10075 policy #3 03-07 12:38:33.665: error/androidruntime(806): @ android.os.parcel.readexception(parcel.java:1247) 03-07 12:38:33.665: error/androidruntime(806): @ android.os.parcel.readexception(parcel.java:1235) 03-07 12:38:33.665: error/androidruntime(806): @ android.app.admin.idevicepolicymanager$stub$proxy.locknow(idevicepolicymanager.java:830) 03-07 12:38:33.665: error/androidruntime(806): @ android.app.admin.devicepolicymanager.locknow(devicepolicymanager.java:569) 03-07 12:38:33.665: error/androidruntime(806): @ com.anquetmap.main.onclick...

sql - Oracle's imp.exe problems over tunneled connection -

we have oracle server running in remote server has ssh connection , need run data import process against that. i tried different ssh tunnel combinations: 127.0.0.1:1521 127.0.0.1:1522 127.0.0.1:11111 127.0.0.107:1522 127.0.0.107:11111 but none of them work imp.exe. intresting thing combinations works fine sql developer , scriptella scripts use jdbc. following error shown in standard error output: imp-00058: oracle error 12514 encountered ora-12514: tns:listener not know of service requested in connect descriptor imp-00000: import terminated unsuccessfully and following appears in sqlnet.log: *********************************************************************** fatal ni connect error 12514, connecting to: (description=(connect_data=(service_name=tktdb1)(cid=(program=c:\oraclexe\app\oracle\product\10.2.0\server\bin\imp.exe)(host=...)(user=...)))(address=(protocol=tcp)(host=127.0.0.1)(port=11111))) version information: tns 32-bit windows: version 10.2.0.1....

sql server - SQL Date Diff disregarding Year -

i want make select, users birthday(date field) less 30 days. best way to it? tried datediff, don't know how put year aside. thanks you use datepart function dayofyear datepart value. edit: honestly, there boundary issue in previous answer (many damien ): e.g. 2010-12-25 , 2011-01-07 => difference should less 30 days, datepart(dayofyear, @date) - datepart(dayofyear, [birthday]) < 30 condition skip record. added additional contition answer: datepart(dy, @d) - datepart(dy, [birthday]) < 30 or ( datepart(mm, @d) = 12 , datepart(dy, dateadd(m, 1, @d)) - datepart(dy, dateadd(m, 1, [birthday])) < 30 ) it adds 1 month each date in case when month part of first date december , compares difference.

iphone - XML attribute pasrsing problem -

i have parse xml , link of xml is http://qasimshah.sitesled.com/schedule.xml and may parse is: -(ibaction)autologinbtn{ nsstring *url=[nsstring stringwithformat: @"http://qasimshah.sitesled.com/schedule.xml"]; [self parsexmlfileaturl:url]; } - (void)parsexmlfileaturl:(nsstring *)url { xmldataarray1 = [[nsmutablearray alloc] init]; //you must convert path proper nsurl or won't work nsurl *xmlurl = [nsurl urlwithstring:url]; // here, reason have use nsclassfromstring when trying alloc nsxmlparser, otherwise object not found error // may necessary toolchain nsxmlparser *rssparser = [[nsxmlparser alloc] initwithcontentsofurl:xmlurl]; // set self delegate of parser receive parser delegate methods callbacks. [rssparser setdelegate:self]; // depending on xml document you're parsing, may want enable these features of nsxmlparser. [rssparser setshouldprocessnamespaces:no]; [rssparser setshouldreportnamespa...

php - Drupal form filter -

i have created basic drupal form. want, if example ingenieur student choose training industrial sciences must al titles of books appear. but, if economics student choose training business must al titles of books appear business , not titles of industrial sciences or others. think filter fix problem. have link tutorial? thanks in advance! without knowing specifics, catch-all solution implement hook_form_alter specific form, way switch id of vocabulary/list options loaded depending on roles user has/group user belongs to, here an example . however if know more specifics, there may more targeted solutions existing.

ios - Detect which button is pressed with an UIButton Array -

i have uibutton array this: @property (nonatomic, retain) iboutletcollection(uibutton) nsarray *btn_impact_collection; and have function: - (ibaction)impactaction:(id)sender; in xib file have 9 button, each button connected btn_impact_collection array referencing outlet collection. touch_inside property of each button connected function impactaction. now, when button clicked impactaction function called, inside function, how can know button pressed? thanks in advance answer! cast sender uibutton class, , give instance of clicked button. don't have xcode me like: if ([sender ismemberofclass:[uibutton class]]) { uibutton *btn = (uibutton *)sender; // can reference title or tag of clicked button further conditional logic if want. if([btn.currenttitle isequaltostring:@"title of button"]) { // something. } else if(etc...) }

Google Static Maps custom icon url problem -

can google static maps hold custom marker https url? have same behavior google maps api premier? from this note static maps api not support custom icon urls use https; default icon displayed.

android - How to change the size of bitmaps when loaded from xml -

i know can change size of bitmaps loaded programmatically using bitmapfactory.options (i.e. forcing 32 via argb_8888 or 16 bit via rgb_565). there equivalent when loading bitmaps via xml (such when defining drawables , background images in layout)? if there isn't built-in switch available configures this, there way accomplish other stripping graphics out of xml , handling them manually? you cannot xml, have code.