Posts

Showing posts from September, 2010

c# - The request channel timed out while waiting for a reply -

i have small application uses wcf communicate webserver. program used 200 clients, , each client sending in 5-20 requests/min. looking @ error logs get: the request channel timed out while waiting reply after 00:00:59.9989999 the requests made follows: clientservice client = new clientservice(); client.open(); client.updateonline(userid); client.close(); this app.config <configuration> <configsections> </configsections> <startup><supportedruntime version="v2.0.50727"/></startup><system.servicemodel> <bindings> <wshttpbinding> <binding name="wshttpbinding_iclientservice" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00" bypassproxyonlocal="false" transactionflow="false" hostnamecomparisonmode="strongwildcard" ...

mysql - having trouble writing a query that list all salesmen that did not sell to a particular customer -

i successful in writing query lists salesmen did sell particular customer, not have not. suspect because same salesmen sold specific customer, sold other customers. select a.name salesperson inner join orders b on a.salesperson_id = b.salesperson_id cust_id="4"; i thinking modifying same query trick: .... a.salesperson_id <> b.salesperson_id cust_id="4"; but result lists salesmen. due fact same salesmen returned in original query, sold other customers the 3 tables this: salesperson table salesperson_id, name, age, salary 1 abe 61 140000 2 bob 34 44000 5 chris 34 40000 7 dan 41 52000 8 ken 57 115000 ...

java - Why does DefaultHttpClient send data over a half-closed socket? -

i'm using defaulthttpclient threadsafeclientconnmanager on android (2.3.x) send http requests rest server (embedded jetty). after ~200 seconds of idle time, server closes tcp connection [fin]. android client responds [ack]. should , leave socket in half-closed state (server still listening, can't send data). i expect when client tries use connection again (via httpclient.execute ), defaulthttpclient detect half-closed state, close socket on client side (thus sending it's [fin/ack] finalize close), , open new connection request. but, there's rub. instead, sends new http request on half-closed socket. after sending half-closed state detected , socket closed on client-side (with [fin] sent server). of course, server can't respond request (it had sent [fin]), client thinks request failed , automatically retries via new socket/connection. the end result server sees , processes 2 copies of request. any ideas on how fix this? (my server correct thing...

mysql - PHP Get the most popular item in table -

lets table looks like: username userid a1 1 a1 1 a1 1 b2 2 c2 3 d2 3 the popular username: a1 how find popular item in table? select username, count(*) frequency your_table group username order frequency desc limit 1 would yield single row: username | frequency ---------+---------- a1 3

php - Deleting a database value after a confirmationscreen - value not deleting -

i posted likewise question yesterday ran other problem. made confirmation screen use of javascript, after pressing "ok" value isn't deleted. this code: <script type="text/javascript"> function confirmation() { var answer = confirm("weet u zeker dat u deze activiteit wilt verwijderen?"); if (answer){ alert("de activiteit wordt nu verwijderd."); window.location ="roosters_verwijderen.php"; } else{ alert("de activiteit niet verwijderd."); } } </script> this button: <a href="roosters_verwijderen.php?activiteitid='. $row['activiteitid'] .'" onclick="confirmation(); return false"><img src="iconen/kruis.png" border="0"></a> the problem here is, "activiteitid" isn't sent page "roosters_verwijdweren.php" anymore. can me solve this? try code of function: ...

c# - How to format a column with number decimal with max and min in DataGridView? -

i want format decimal places displayed , captured in datagridview, have minimum number of decimal places , maximum number of decimal places. example: if caught, "120.0" display "120.00" if caught "120.01" display "120.01" if caught "120,123" display "120,123" if caught "120.1234" display "120.1234" if caught "120.12348" display "120.1235" (round) in datagridview column "txtcdecimal" has property (from designer) txtcdecimal.defaultcellstyle.format = "n2"; txtcdecimal.defaultcellstyle.format = "0.00##"; // answer. not work event interfered the mask "0.00##" work "n2" 2 decimals correct rounding 2 decimal places not need (as show in example) how can in simple manner without consuming many resources? thanks harlam357 & tom garske to format between 2 , 4 decimal places can use custom format string. txtcdecimal....

C# security of resource files -

i looking hour, didn't find anything. read tutorial resource files , decided try them. surprised when saw output, because resource files changed in dlls , weren't in .exe file. my question are: how these files safe? what safe store in them? the first google hit on "resource files security site:msdn.microsoft.com" states: caution do not use resource files store passwords, security-sensitive information, or private data. they don't no reason: resource file default not encrypted or obfuscated, program resource editor, msil.exe, or justdecompile can see contents of resource file. you can apply encryption using sort of key, again you'd have store key somewhere decrypt resources. key subject same problems: securely store that, attacker can't use decrypt resources? it's nigh impossible if have distribute program, alternate solution. perhaps explaining you're trying helps towards useful answer.

Android : Horizontal slide activity (such as Play Store) -

what best way make sliding activity , / or of images such play store ? know viewpager, image sliding? there other methods ? thanks you should read bit horizontalscrollview , galleryview , pager . good luck.

How to retrieve certificate information of a .Net dll in c# -

i want retrieve certificate information e.g, "issued to", "issued by" values of given .net dll programmatically. thanks in advance!! you should able like: assembly asm = assembly.loadfrom("your_assembly.dll"); string exe = asm.location; system.security.cryptography.x509certificates.x509certificate executingcert = system.security.cryptography.x509certificates.x509certificate.createfromsignedfile(exe); console.writeline (executingcert.issuer);

php - mysqli_query "where = $some_array" need just one match -

possible duplicate: i have array of integers, how use each 1 in mysql query (in php)? i trying create filtering function , know if possible, within mysqli query, check if table row has value equal 1 of in array. hope code make clearer: $age=array(37,35); $query = mysqli_query($link, "select * users age = $age"); so want query return rows of users age either 37 or 35, above code doesn't work. using ...where age = 35 or age = 37" won't do, because want dynamic speak. thanks use sql's in() clause. sql example: select * users age in (35, 37) php example: $query = "select * users age in (" . implode(',', array_map('intval', $age)) . ")"; note: mindful of sql injection .

javascript - Find elements which have jquery widgets initialized upon them -

i using jquery-file-upload widget (although believe question can generalize jquery widget). api instructs user initialize the widget using fileupload method, thus: $('#fileupload').fileupload(); my question is: without knowing ids, how can find #fileupload (and other elements have had .fileupload() called upon them? jquery file upload uses jquery ui widget factory under hood, , factory known register widgets instances elements extend using data() . therefore, can use filter() , write like: // restrict ancestor if can, $("*") expensive. var uploadified = $("#yourancestor *").filter(function() { return $(this).data("fileupload"); }); update: jquery ui 1.9 onwards, the data() key becomes widget's qualified name, dots replaced dashes . therefore, code above becomes: var uploadified = $("#yourancestor *").filter(function() { return $(this).data("blueimp-fileupload"); }); using unqualifie...

Detailed and clear specification for datanucleus jdo extensions? -

i can't find clear or detailed specification datanucleus jdo extensions. suppose that's page extensions: http://www.datanucleus.org/plugins/index.html am correct ? i'm confused because page "plugins", mean "extensions" ?! now after opening page, looks you'll have go through each single link find need. , when open sub-page, it's not helpful @ ! any information topic appreciated, lot.

proxy - HttpWebRequest giving "target machine actively refused" error -

i trying access uri through httpwebrequest , getting "target machine actively refused" error. i know machine has no proxy works fine , know corp internet uses pac file determine proxy doesnt seem picking me. here know: my app.config has i presume dont need specify webrequest.defaultwebproxy makes no difference i can explictly set proxy webproxy , networkcredentials works any ideas? have experience pac files , why can access target through ie not through code. if hardcode proxy works seem same proxy not being auto detected?

Java/Android xml parsing -

i trying parse data google api: http://gdata.youtube.com/feeds/base/videos?q=kittens&client=ytapi-youtube-search&v=2&start-index=1 like this try { documentbuilder db = dbf.newdocumentbuilder(); doc = db.parse(new inputsource(new stringreader(xml.trim()))); } catch (parserconfigurationexception e) { system.out.println("xml parse error: " + e.getmessage()); return null; } catch (saxexception e) { system.out.println("wrong xml file structure: " + e.getmessage()); return null; } catch (ioexception e) { system.out.println("i/o exeption: " + e.getmessage()); return null; } and keep getting 'saxexception'.. doing wrong ? the precise error message is:i/system.out(19026): wrong xml file structure: unexpected token (position:text null@1:104174 in java.io.stringreader@410c2448) i have made , works me : public static void readgdata(){ ...

objective c - how to insert data in database and get data from database -

i new on iphone development. making app, using sqlite3 database. create tables sqlite3 manager 3.9.5 , write code copy database in appdelegete.m file , database copy successfully. i insert data in database , insertion takes place primary key when access data database, sends null , if open database , open tables not show data entered in table. here code insert data , data database. - (ibaction)addrecord:(id)sender { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *path = [documentsdirectory stringbyappendingpathcomponent:@"ebirthdaydatabase.sqlite"]; if (sqlite3_open([path utf8string], &database) == sqlite_ok) { const char *sqlstatement = "insert name(name) values(?)"; sqlite3_stmt *compiledstatement; if (sqlite3_prepare_v2(database, sqlstatement, -1, &compiledstat...

ruby - Rails 3 - Routing error when submitting forms using nested resources -

i'm new rails , i'm having lot of trouble getting nested resource/models work. i'm getting routing error whenever try submit form. no route matches {:action=>"show", :controller=>"tests", :test_suite_id=>#<test id: 8, name: "1", test_type: "1", result_type: "1", input: "1", created_at: "2012-06-29 07:01:11", updated_at: "2012-06-29 07:01:11", date: "1", test_suite_id: 4>} can explain me why there occurrences of test_suite_id in exception output , why action "show" instead of "index"? when submit form, want go index /test_suites/:test_suite_id/tests. below relevant code: routes.rb resources :test_suites resources :tests end tests_controller.rb class testscontroller < applicationcontroller # /tests # /tests.json def index @testsuite = testsuite.find(params[:test_suite_id]) @tests = @testsuite.tes...

android - How to force an IntentService to stop immediately with a cancel button from an Activity? -

i have intentservice started activity , able stop service activity "cancel" button in activity. "cancel" button pressed, want service stop executing lines of code. i've found number of questions similar (i.e. here , here , here , here ), no answers. activity.stopservice() , service.stopself() execute service.ondestroy() method let code in onhandleintent() finish way through before destroying service. since there apparently no guaranteed way terminate service's thread immediately, recommended solution can find ( here ) have boolean member variable in service can switched in ondestroy() method, , have every line of code in onhandleintent() wrapped in own "if" clause looking @ variable. that's awful way write code. does know of better way in intentservice? stopping thread or process dirty thing. however, should fine if service stateless. declare service separate process in manifest: <service android:process=...

c# - Get IVsExpansion object from IWpfTextView, ITextBuffer or ITextDocument -

i want insert custom snippet xml file code within extension package. does know how ivsexpansion object when have iwpftextview, itextbuffer or itextdocument? http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.textmanager.interop.ivsexpansion.aspx can me please? did post other day on msdn vs extensibility forum? if answered there possible approach (i haven't tried , not editor dev): http://social.msdn.microsoft.com/forums/en-us/vsx/thread/c43699d3-4ed1-4a68-b1c8-d207efc98a04 in short believe can use ivseditoradapterfactoryservice map itextbuffer -> ivstextbuffer, , msdn says ivsexpansion implemented same object implements ivstextbuffer if cast ivstextbuffer ivsexpansion should succeed. ryan

python - How can I vectorize this triple-loop over 2d arrays in numpy? -

can eliminate python loops in computation: result[i,j,k] = (x[i] * y[j] * z[k]).sum() where x[i] , y[j] , z[k] vectors of length n , x , y , z have first dimensions length a , b , c s.t. output shape (a,b,c) , each element sum of triple-product (element-wise). i can down 3 1 loops (code below), stuck trying eliminate last loop. if necessary make a=b=c (via small amount of padding). # example 3 loops, 2 loops, 1 loop (testing omitted) n = 100 # more 100k in real problem = 2 # more 20 in real problem b = 3 # more 20 in real problem c = 4 # more 20 in real problem import numpy x = numpy.random.rand(a, n) y = numpy.random.rand(b, n) z = numpy.random.rand(c, n) # outputs of each variant result_slow = numpy.empty((a,b,c)) result_vec_c = numpy.empty((a,b,c)) result_vec_cb = numpy.empty((a,b,c)) # 3 nested loops in range(a): j in range(b): k in range(c): result_slow[i,j,k] = (x[i] * y[j] * z[k]).sum() # vectorize loop on c (2 nested loops)...

asp.net mvc - How would authentication and authorization be implemented using RavenDb in an MVC app? -

while i'm used using standard asp.net membership provider new mvc web applications, i've been getting kick out of using ravendb lately still don't believe have grasp on best practice implementing user authentication , role authorisation. the code have replaced register , logon methods in accountcontroller looks following: [httppost] public actionresult register(registermodel model) { if (modelstate.isvalid) { using (idocumentsession session = datadocumentstore.instance.opensession()) { session.store(new authenticationuser { name = email, id = string.format("raven/users/{0}", name), alloweddatabases = new[] { "*" } }.setpassword(password)); session.savechanges(); formsauthentication.setauthcookie(model.username, createpersistentcookie: false); // ...etc. etc. [httppost] public jsonresult jsonlogon(logonmodel model, string returnurl) { ...

ios - How to change the position of the button through coding xcode -

i trying align button created through code, can't seem change position, code: - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { self.backgroundcolor = [uicolor whitecolor]; self.linewidth = default_width; self.linecolor = default_color; uibutton* btn = [uibutton buttonwithtype:uibuttontyperoundedrect]; btn.frame = cgrectmake(20,100, 50, 50); //[btn setframe:cgrectmake(3,20, 50, 50)]; btn.center = self.center; [btn settitle:@"clear" forstate:uicontrolstatenormal]; [btn addtarget: self action: @selector(clearbuttonpressed:) forcontrolevents: uicontroleventtouchdown]; [self addsubview:btn]; } return self; } if remove "btn.center =self.center" , try set x , y position as "btn.frame =cgrectmake(3,20,50,50)" it doesn't display button. please appreciated , in advance! have...

javascript - SQL - Check For Duplicate Values -

(this project written in js) so, have table called paid_offers , , 2 columns called offer_id , entity_id i'm trying count of offer_id values associated single entity_id . edit: example: entity_id has 35 offers available (so, there 35 rows unique offer_ids, same entity_id) so, getting count no problem arraylist.length , need approach getting actual array. help! edit: per request, more information! i'm going using output array. so, project written using titanium (from appcelerator). don't need besides query. so, it'd what's inside quotes here, don't know. var offerslist = db.execute("select entity_id paid_offers"); now, goal not list of id's instead list of offer_id values associated each unique entity_id value. think close to: var offerslist = db.execute("select offer_id paid_offers entity_id = entity_id except wouldn't work, that's train of thought while looking through this. if you're trying co...

Haskell load external txt file into list -

hello following code wordfeud program. allows search through list of words matching prefix, suffix, , letters. question is, instead of using list @ bottom, want use external text file containing words , load list. how go doing this? count :: string -> string -> int count _[] = 0 count [] _ = 0 count (x:xs) square |x `elem` square = 1 + count xs (delete x square) |otherwise = count xs square check :: string -> string -> string -> string -> bool check prefix suffix word square | (length strippedword) == (count strippedword square) = true | otherwise = false strippedword = drop (length prefix) (take ((length word ) - (length suffix)) word) wordfeud :: string -> string -> string -> [string] wordfeud b c = test1 test =["horse","chair","chairman","bag","house","mouse","dirt","sport"] test1 = [x| x <- test, `isprefixof` x, b `issuffixo...

compression - Word Length as defined in the .ZIP format specification -

so i've been reading through pkware's specification of .zip file format , have noticed in several places give block sizes in terms of words (the processor word, not dictionary word :-) ). now, way understand it, byte size of word specific processor family. if file zipped on i386 , unzipped on x64-86, 2 architectures have different definitions of word (4 bytes vs. 8 bytes) , therefore interpret block data differently. am missing here? or folks @ pkware assume 1 word = 4 bytes? seems option me - i've checked zip files hex editor , 4-byte definition fit, i'd confirmation because not have whole bunch of different processors test :) thanks in advance, , sorry if question exists - did try searching it's little difficult because word "word" ambiguous (see mean?) where specification says "word" stored block in deflate format, means 2 bytes (in lsb order). for zip decryption (where said encryption should not used since it's weak)...

mysql - OS X Lion with xampp + rails + mysql2 gem -

i'm stuck trying figure out how os x lion xampp installation's mysql work mysql2 gem in rails. here's i've tried: installed xampp dev kit installed mysql5-server both port , brew. both of i've uninstalled. didn't fix problem. installed mysql5 community edition dmg file. uninstalled didn't fix problem. downloaded 32-bit version of mysql5 community edition tar. extracted folder '/var/mysql' here's command i'm running try , installed: gem install mysql2 -- --with-mysql-dir=/var/mysql --with-mysql-include= /var/mysql/include --with-mysql-lib=/var/mysql/lib --with-mysql-config= /applications/xampp/xamppfiles/bin/mysql_config i'm @ loss how work. thing can think of i'm somehow not pointing directories correctly. i've tried removing /include/, /mysql/ , /lib/ with-mysql-include, with-mysql-dir , with-mysql-lib configuration options. no luck that. i've tried pointing xampp installation. no luck still. the error re...

glsl - Alpha-channel all 1.0 in WebGLRenderTarget when reading rendered image for post-processing -

i using three.js render world webglrendertarget. world not full whole screen , thus, has transparent background. purpose provide alpha-channel aware image effects. i render world webglrendertarget buffer i try post-process reading buffer , writing real screen my post-processing function depends on alpha channel. however, looks somehow three.js post-processing shader fails read alpha channel correctly - 1.0 no matter values try put in webglrendertarget. the simple way demostrate problem. i create render target: var rtparameters = { minfilter: three.linearfilter, magfilter: three.linearfilter, format: three.rgbaformat}; for(var i=0; i<this.buffercount; i++) { this.buffers[i] = new three.webglrendertarget(this.width, this.height, rtparameters); } i clear buffer setting alpha 0.3:: function clear(buf) { // debugging purposes set clear color alpha renderer.setclearcolor(new three.color(0xff00ff), 0....

linux - How to get standard output from subshell? -

i have script this? command='scp xxx 192.168.1.23:/tmp' su - nobody -c "$command" the main shell didn't print info. how can output sub command? you can of output redirecting corresponding output channel: command='scp ... ' su - nobody -c "$command" > file or var=$(su - nobody -c "$command") but if don't see anything, maybe diagnostics output of scp disabled? there "-q" option somewhere in real command?

How do I execute a stored procedure on linked Firebird server in SQL Server 2008 -

i have linked firebird database on sql server 2008 via odbc. i can execute query , wanted results: select * openquery(linked_server_name, 'select * table_name') now wonder how can execute stored procedure 1 parameter input. i have tried: select * openquery(linked_server_name, 'stored_procedure_name 00001') and exec linked_server_name.stored_procedure_name '00001' with no success... any tip appreciated ! i dont know in mssql can try select * openquery(linked_server_name, 'select * stored_procedure_name(00001)')

google api - Retrieve User email using GTM OAuth2 for iOS -

i have implemented authentication using gtm oauth 2 library. want have email id of user. how should proceed. know have call in here :- - (void)viewcontroller:(gtmoauth2viewcontrollertouch *)viewcontroller finishedwithauth:(gtmoauth2authentication *)auth error:(nserror *)error { if (error != nil) { nslog(@"sign in error : %@", error.description); // authentication failed } else { // authentication succeeded } } when signing in google services gtm-oauth2, user's email address available after sign-in in auth object's useremail property.

c# - Is a static readonly value type lifted in a closure? -

if have following: static readonly timespan expiredafter = timespan.frommilliseconds(60000); foreach (moduleinfo info in modulelist.where(i => datetime.now - i.lastpulsetime > expiredafter).toarray()) modulelist.remove(info); does expiredafter lifted or compiler know can access directly? more efficient write this: static readonly timespan expiredafter = timespan.frommilliseconds(60000); static bool hasexpired(moduleinfo i) { return datetime.now - i.lastpulsetime > expiredafter; } foreach (moduleinfo info in modulelist.where(hasexpired).toarray()) modulelist.remove(info); a static (or matter, any) field can't possibly captured. from language spec: 7.15.5 outer variables local variable, value parameter, or parameter array scope includes lambda-expression or anonymous-method-expression called outer variable of anonymous function. in instance function member of class, this value considered value parameter , outer variable of anony...

Ruby Configatron, multiple values? -

if i'm setting configuration ruby application logging using configatron , know how to: 1. enum values, e.g. configatron.log.level = 'debug' other acceptable values such error, warn, info. forced , other values other these rejected? 2. multiple values e.g. configatron.log.logto = [:file, :udp, :stdout] i'd these values enforceable. any clues appreciated.

Proofing (fixing punctuation, spaces, uppercase letters) a bio page text with php -

i need in trimming bio info users submit inside profiles. there proofing problems: "this bio of mike, of being uppercase no reason!there no space between question mark , word there?also question mar should have space.also after stop sign there should upper case,and spaces between commas,and,this,one" here thinking: first i'd trim $bio var $bio = trim($bio); then i'd add spaces after punctuation marks - pretty sure not correct because replaces every punctuation type comma. $bio = str_replace(array(",","!","?"),", ", $bio); then i'd turn letters lowercase; won't work becouse need keep uppercase first letter of first word of sentences inside $bio variables. $bio = strtolower($bio); and i'd upper case first one; need way upper case each first letter of every word separated ! ? - or stop sign, know... except commas. $bio = strtoupper($bio); hope can help i have warn looks hopeless. a...

compression - need mysql compatible compress()/decompress() for Java -

i'm thinking of applying mysql compress() function field varchar , tends run few thousand characters more million, per column. text normal english, 8-to-1 or ever better compression. since have millions of records , ever want @ data, compression seems engineering tradeoff. i need of processing in java, , there nice implementations of zip, gzip , bzip2. cool. but i'd love able use standard mysql client queries such as select decompress(longcolumn) ... so i'd java code use same, or compatible compression algorithm built in function. documentation find says "compiled compression library such zlib" this bit vague, how can know use? === edited == clear, want able use "mysql" client program debugging, things like: select decompress(longcolumn) ... don't use java @ all. want updates , inserts using jdbc. , mainline usage, has compressed blog, , decompress it. sort of wrapper or zipinputstream fine. i'm not certain, i'd ...

linux - Synchronization not working properly when Multi-threading in C -

i trying create simple bar program amount of customers can inside bar @ same time. , every time customer asks beer, bartender should server customer beer. for reason in program, bar tender serves customer after he/she leaves bar how can fix this? suggestions? here code: #include <pthread.h> #include <stdio.h> #include <stdlib.h> //for declaration of exit() #include <semaphore.h> //to use semaphores pthread_mutex_t serve = pthread_mutex_initializer; pthread_barrier_t barrier1; sem_t oktoenter; int cid = 0; void enterbar(); void orderstart(); void servestart(); void servedone(); void orderdone(); void drinkbeer(); void leavebar(); void* bartender(void *arg) { servestart(); servedone(); } void* customer(void* id) { cid =(int)id; enterbar(); leavebar(); } void enterbar(){ printf("customer %d enters bar.\n", cid); int cups; pthread_t order; for(cups=0;cups<(cid%3+1);cups++){ pthread_mutex_lo...

asp.net mvc 3 - How to use different action in Command Column in Grid for Telerik MVC extension -

i using telerik mvc extension version 2012.1.419.340. had problem command column in grid. use example code on telerik website explain problem. i have view like: @model ienumerable<order> @(html.telerik().grid(model) .name("grid") .columns(columns => { columns.bound(o => o.orderid).width(100); columns.bound(o => o.shipaddress); columns.command(commands => commands .custom("viewdetails") .text("view details") .dataroutevalues(route => route.add(o => o.orderid).routekey("orderid")) .ajax(true) .action("viewdetails", "grid")) .htmlattributes(new { style = "text-align: center" }) .width(150); }) .clientevents(events => events.oncomplete("oncomplete")) .databinding(databinding => databinding.ajax().select("_customcommand", "grid")) .pageable(...

jquery - zepto.js: Viewport and Lazyload plugins? -

i used work jquery , using jquery lazyload plugin http://www.appelsiini.net/projects/lazyload jquery viewport plugin http://www.appelsiini.net/projects/viewport i'm using zepto.js instead of jquery , of course plugins both through following errors. uncaught referenceerror: jquery not defined if update both plugins })(jquery); })(zepto); following errors come … uncaught typeerror: cannot read property ':' of undefined any ideas on that? possible make plugins work zepto? isn't zepto same jquery without older browser compatibility , additional touch events? thank in advance. matt the line causing error appears be: .extend($.expr[':'], { jquery uses own css-style selector evaluator called sizzle. in addition letting use $('#id .cls1 .cls2, #otherid') , standard css pseudo-selectors, supports extension custom selectors built-in :visible selector or :above-the-fold selector provided plugin. since modern mo...

javascript - Safari/Chrome overlapping elements that are set with inline-block -

i trying build page display 2 images side side. want these items centered on screen in book format , browser resized, images height changed fill window. in order using display inline-block text-aligned center achieve affect. works great on ff when open in safari or chrome on resize divs begin overlap. created jsfiddle show example of dom. need pageone , pagetwo divs inline-block because later absolutely position links on top of page images. what missing? in order see issue, you'll need open jsfiddle in safari/chrome , make result pane larger default. start browser 1/2 normal width/height. run jsfiddle, enlarge browser , notice how 2 images begin overlap. if open in ff wont overlap. http://jsfiddle.net/x9nnh/1 i able close effect want in browsers using tables: http://jsfiddle.net/x82uk/ indeed, tricky because inline-block containers don't resize fit contents contents scale. though make job harder (read: require javascript) when comes absolutely posi...

sql server - Visual Studio Report Designer: How do I print something on every second page of a report? -

i have report in visual studio report designer prints contract. want have terms , conditions on of every page. how can print on every second page (which i'll duplex)? i've tried putting in page header\footer (it gets cut off), , i've tried controlling visibility of in body of report using page numbers (but can't use global page numbers variable in body of report). how can wrangle report want? alas, mention: can't access page number in body of report. don't think requirement can satisfied, there's no real workaround know of. alternatives (which may have considered) can see far, ordered bad progressively worse: print note entirely in header or footer print on every page post-process rendered report (pdf?) , add afterwards do report twice. once notice on each page, once without. own "duplexing": print odd pages document without, put paper in printer, , print pages. (like said, workarounds progressively worse top bottom :d) in ...

multithreading - non blocking thread-safe file write -

i trying write in file @ different offset locations using threads shouldn't blocked. not sure how proceed same. guessing need open file o_nonblock flag. is need open file o_nonblock flag , writing process same ? any sample piece of code helpful explanation thanks on unix/linux file descriptors associated files ready read , write . in other words, o_nonblock has no effect on regular files. normally, writing file copies data kernel page cache , returns. unless file opened o_direct flag, or kernel page cache has many dirty pages in case write becomes blocking. if need non-blocking writes file either create dedicated thread writing, or use asynchronous i/o .

WordPress - Blue Bar Showing in Header -

Image
i playing around responsive wordpress theme based on skeleton , have hit annoying problem. thin blue horizontal bar has appeared @ top of screen, can't anymore 15-18px height , has absolute positioning because stay @ top of page when scroll down. i've used both chrome , firefox (with firebug) find out has come no avail, it's not showing in css or source code. has else experienced or know why happening? n.b. appears in browsers ie, chrome & ff. url: http://www.produceme.co.nz/ the blue background seeing css, have this: background:#fcfcfc url(.../images/border_top.png) in body style, find , remove it, , you're go.

ios - How do I get rid of dimming when playing youtube video? -

i'm using following code launch youtube video. works great except every 30 seconds screen goes dim. tapping screen brightens again (and brings video controls expected.) happens if have auto-lock turned off ipod touch. going on? nsstring* embeddedcode =@"<html><body bgcolor='#008080'><center><iframe width='212' height='172' src='http://www.youtube.com/embed/[videoid]?rel=0' frameborder='0'></iframe><p style='color: yellow;'>youtube video</p><p style='color: yellow;'>(requires internet access.)</p></center><body></html>"; uiwebview* videoview = [[uiwebview alloc] initwithframe:cgrectmake(0, 0, 320,350)]; [videoview loadhtmlstring:embeddedcode baseurl:nil]; [self.view addsubview:videoview]; never mind, found section of code i'm deliberately dimming screen. don't want in case.

Can I launch an iOS app from the calendar? -

is possible launch of apps made directly calendar? if have particular entry in calendar can link app? no not. codafi stated, try implement custom url schemes in app , note appropriate url in calendar event. update: no, doesn't work url inside calendar event because doesn't recognizes link. update 2: i've found question same problem. sadly it's not working me, can test on ios6 , may broken there.

java - Wro4j LessCss Support -

i'm trying implement less css working webapp. wro4j works default settings provided here: http://alexo.github.com/wro4j/ but adding init-params filter provided here: http://code.google.com/p/wro4j/wiki/lesscsssupport 1. runs exception because url unknown (there's uri, changed uri) 2. runs 404 when open localhost:8080/template/res/all.css here's necessary code: <!-- wro4j filter --> <filter> <filter-name>webresourceoptimizer</filter-name> <filter-class>ro.isdc.wro.http.wrofilter</filter-class> <init-param> <param-name>configuration</param-name> <param-value>deployment</param-value> </init-param> <init-param> <param-name>managerfactoryclassname</param-name> <param-value>ro.isdc.wro.extensions.manager.extensionsconfigurablewromanagerfactory</param-value> </init-param> <init-param> <pa...

android - Servlet: java.lang.ClassNotFoundException: org.json.simple.parser.ParseException -

i implementing google cloud messaging service android. have created test server sends push notifications application users. server have created generating following error. using java servlet @ server side , have included gcm-server.jar file in project. here log: java.lang.classnotfoundexception: org.json.simple.parser.parseexception @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1680) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1526) @ com.mgcm.sendgcmmessage.processrequest(sendgcmmessage.java:48) @ com.mgcm.sendgcmmessage.dopost(sendgcmmessage.java:40) @ javax.servlet.http.httpservlet.service(httpservlet.java:637) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:290) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apa...

php - What is the proper syntax for inserting variables into a SELECT statement? -

i believe have simple syntax problem in sql statement. if run code, error in database query. $user = $_get['linevar']; echo $user; // testing - url variable echos correctly $sql = "select * `useraccounts` `name` = $user"; $result = mysql_query($sql) or die("error in db query"); if replace $user in $sql string 'actualname' or known record in table, code works fine. using $ variable incorrectly in sql string? you need surround value you're getting $user quotes, since it's not number: $sql = "select * `useraccounts` `name` = '$user'"; just note, should read on sql injection, since code susceptible it. fix pass through mysql_real_escape_string() : $user = mysql_real_escape_string( $_get['linevar']); you can replace or die(); logic bit more informative error message when bad happens, like: or die("error in db query" . mysql_error());

Spring 3.1 MVC: GET & POST on the same mapping, can it work? -

i'm learning spring 3.1. my webapp name "acme". the url https://blah.blah.blah/acme that url set display login.jsp i have "/login" mapping in controller login.jsp submits to if goes wrong return user login.jsp url in browser: https://blah.blah.blah/acme/login the "/login" mapping set handle post requests, concerned users bookmarking https://blah.blah.blah/acme/login , , getting error message of "get request not supported" so, thought put in function handle requests /login reroute through general mapping handler "/" , "/home": login.controller.java package gov.noaa.acme.controller; import java.security.principal; import javax.servlet.http.*; import org.springframework.stereotype.controller; import org.springframework.validation.*; import org.springframework.ui.modelmap; import org.springframework.web.servlet.modelandview; import org.springframework.web.bind.annotation.requestparam; import org.spri...

python - namedtuple and optional keyword arguments -

i'm trying convert longish hollow "data" class named tuple. class looks this: class node(object): def __init__(self, val, left=none, right=none): self.val = val self.left = left self.right = right after conversion namedtuple looks like: from collections import namedtuple node = namedtuple('node', 'val left right') but there problem here. original class allowed me pass in value , took care of default using default values named/keyword arguments. like: class binarytree(object): def __init__(self, val): self.root = node(val) but doesn't work in case of refactored named tuple since expects me pass fields. can of course replace occurrences of node(val) node(val, none, none) isn't liking. so there exist trick can make re-write successful without adding lot of code complexity (metaprogramming) or should swallow pill , go ahead "search , replace"? :) set node.__new__.__defaults...

ruby - Why doesn't require add all names? -

i have file, my_helper.rb , looks this: require 'cgi' require 'enumerator' module myhelper # ... end class myupstreamerror < standarderror # ... end when require 'my_helper' elsewhere, myhelper becomes visible, myupstreamerror not. why this? ruby's require analogous include in c. you might want have read though: http://rubylearning.com/satishtalim/including_other_files_in_ruby.html http://ionrails.com/2009/09/19/ruby_require-vs-load-vs-include-vs-extend/

inner join - Cross referencing tables in a mySQL query? -

i have 2 tables. 1 table of users unique id field, , other table of data, column holds user id of whoever generated piece of data. i want select data,genned_by datatable; want replace results genned_by select username users id = genned_by so results query changes userid username corresponds other table. i did research , figured inner join might i'm looking for, i'm left unsure of how use after reading it. help? select datatable.data,users.username datatable, users users.id = datatable.genned_by

android-Way of detecting low battery notification -

is there way detect low battery notification in android eclipse?i have action game needs paused when appears. there tutorial in official developers web monitoring battery level , charging state. hope helps you. http://developer.android.com/training/monitoring-device-state/battery-monitoring.html

c# - Reading and/or Filtering on MSMQ name using WMI -

i trying read msmq information on remote machine. the main difficulty experience getting name of queue. names of queues pretty long, more 64 characters. using wmi names truncated 64 characters, results me in queuenames can't differentiate (similar prefix first 64 characters). i tried using .net 3.5 sp1 , wmi multi query tool , no differences. not couldn't read name, providing suffix make difference wmi query didn't also. any hints how make work? there old entry in ms support db explanation behavior. although there (2004) said might fixed in vs 2005. either has never been fixed, or maybe there different wrong. i not think have chance getting real long-length names using wmi. john breakwell has blogged it: how long msmq queue names displayed ... or not instead limit in how queue names stored in active directory. [...] public queues, though, first 64 characters fit in field used store name in active directory , remainder of name gets ...

File reading and writing in c# -

my code is try { string mtellthemepath = configurationmanager.appsettings["mtellthemepath"] == null ? server.mappath("~/app_themes/") : configurationmanager.appsettings["mtellthemepath"].contains("%%") ? server.mappath("~/app_themes") : configurationmanager.appsettings["mtellthemepath"]; string[] folderpaths = directory.getdirectories(mtellthemepath); string currentsurveythemename = hfsurveyname.value + "_" + hfclientid.value; string clonesurveythemename = lstsurvey[0].surveyname + "_" + identity.current.userdata.clientid; string clonesurveythemepath = mtellthemepath + "\\" + lstsurvey[0].surveyname + "_" + identity.current.userdata.clientid; string cssfile = clonesurveythemepath + "\\" + clonesurveythemename + ".css"; string skinfile = clonesurveythemepath + ...

Keil arm startup.s assembly code -

i trying understand keil startup assembly code because initializes minimal hardware work c language. stuck @ line: if pll_setup <> 0 what meaning of above line? specifically, <> symbol? please me figure out assembly instruction. this line not assembly per se control directive . <> means "not equal" . so, if preprocessor symbol pll_setup not 0, following block (until else or endif) passed assembler, otherwise it's skipped.

Importing perforce projects into eclipse from plugin -

i trying import bunch of perforce projects eclipse checked out. have necessary .project , .classpath files. use psf import file. can file>import>team project set manually, , after setting location of file, perforce plugin kicks in, , hard work. now, wish automatically, plugin of own. plugin of mine creates temporary psf file on fly. ideally somehow pass psf file's location perforce plugin, skipping "import team project set" dialog box altogether, , making import projects. alternatively, if proves not possible, able open "import team project set" window plugin, automatically set location of temporary psf file on it, "click" on finish button, perforce plugin again kick in, , work me. i've been looking solution past 2 days. there can me this? in advance.

if statements, comparing lists, python -

what doing wrong if statement doesn't recognise if element in equal 0? attempting print ever 0 program prints . , ever 1 # . cheers. a=[0,0,1,0,1,1,0,1,1,0,0,0,0,1] print(a) in range(len(a)): if a[i]==[0]: print('.', end='') else: print('#', end='') print() bash: [0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1] ############## you want if a[i] == 0: instead of if a[i] == [0]: you want compare items integer value 0 , not single-element list [0] .

watir - focus on window without title -

i use watir in radrails ide. need attach new window it's title, in web application there error, title missed. can't use code: ie3=watir::ie.attach(:title, 'mt title') . the page loaded , can perform actions there. there way focus on window not using page title? or how can define page title? maybe there possibility of choosing window name or other attribute , if not know exact name can define or define names of opened windows? if there 1 ie window work: browser = watir::browser.attach(:title, //) if want check if there page title, try this: begin browser = watir::browser.attach(:title, "teh codez") rescue watir::exception::nomatchingwindowfoundexception puts "could not find browser" end

java - Synchronized keyword- how it works? -

if have class, call x , x contains collection (assume not using 1 of synchronized colections, normal one). if write own method synchronized add()- how locking work? locking done on instance of x, , not on collection object? so synchronizing add() method not stop many instances of x calling add() , inserting collection- therefore still have threading problems? a synchronized method locks object. if x.add synchronized, prevent concurrent execution of other synchronized methods of same x object. if out of x object has access same collection, collection not protected. if want collection protected, make sure not accessible rest of world in way other synchronized method of x . also, bit unclear in question, note synchronized non-static method locks object . assuming each x instance have collection of own, won't interfere each other. another option, btw, lock collection instead of x object: void add(object o) { synchronized(mycollection) { mycollection...