Posts

Showing posts from March, 2010

windows phone 7 - c# How to login to Google Reader -

i'm looking code fragment show me how sid google reader in c#. know of such beast? it's quite easy. first should perform get request https://www.google.com/accounts/clientlogin page login , password (don't forget url encode them). , parse response (there several parameters divided new line character \n ) sid . here simplest example (no error handling): var url = string.format("https://www.google.com/accounts/clientlogin?service=reader&email={0}&passwd={1}", httputility.urlencode(email), httputility.urlencode(password) ); var web = new webclient(); web.downloadstringcompleted += (sender, e) => { var sid = e.result.split('\n') .first(s => s.startswith("sid=")) .substring(4); }; web.downloadstringasync(new uri(url)); but make code more elegant using asyncctp .

sql - Running Sums for Multiple Categories in MySQL -

i have table of form category time qty 1 20 b 2 3 3 43 4 20 b 5 25 i need running total calculated category in mysql. result this: category time qty cat.total 1 20 20 b 2 3 3 3 43 63 4 20 83 b 5 25 28 any idea how efficiently in mysql? have searched far , wide, can find info on how insert 1 single running total in mysql. wonder if there's way use group or similar construct achieve this. you calculate sum in subquery: select category , time , qty , ( select sum(qty) yourtable t2 t1.category = t2.category , t1.time >= t2.time ) cattotal yourtable t1 trading readability speed, can use mysql ...

How can I filter out profanity in numeric IDs? -

i want use numeric ids in web application developing... however, id visible users url, want filter out profanity. things (i'll leave figure out are): page.php?id=455 page.php?id=8008135 page.php?id=69 has solved this? real problem? does make sense skip numbers in database sequence? see also: how can filter out profanity in base36 ids? . how using guids? encode actual numbers. bet users don't notice on url.

batch file - Hudson Build Server - problem with shutdown slave machine -

i new hudson , have question. i'm trying build jobs on dumb slave , after need shutdown slave.(the machine). however, there following issue: i've tryed many ways, using "shutdown /s /t 120", starting .bat file copyed @ slabe content, starting .jar file shutdown. , result negative. when running "shutdown /s /t 120" receive "'shutdown' not recognized internal or external command, operable program or batch file.". solved such issue or have suggestions? thanks :) try running cmd.exe /c shutdown /r /t 120

mySQL: How to select FROM table WHERE IN LIST and NOT IN another list -

is possible select values table, don't exist in 1 list, exist in another... or other way around? e.g. select count(g.`property`) `number`, g.`property` `foo` g `theid` in (select `theid` `tableofids` `theid` = '54252') , not in (select `theid` `anothertableofids` `theid` = '54252') select count(g.`property`) `number`, g.`property` `foo` g `theid` in (select `theid` `tableofids` `theid` = '54252') , `theid` not in (select `theid` `anothertableofids` `theid` = '54252') group g.`property` alternativly, can use joins perform better: select count(g.`property`) `number`, g.`property` `foo` g join ( select `theid` `tableofids` `theid` = '54252' ) id1 on g.theid = id1.theid left join ( select `theid` `anothertableofids` `theid` = '54252' ) id2 on g.theid = id2.theid id2.theid n...

c# - How do I get Html.RouteLink() to work with a RouteValueDictionary while passing Html Attributes? -

hey there so... here's riddle: <%: html.routelink("asd",item.routevalues) %> <%: html.routelink("asd",item.routevalues, new{title="title"}) %> the first line correctly spits out code: <a href="/">asd</a> the second line incorrectly spits out code: <a href="/?count=4&amp;keys=system.collections.generic.dictionary%602%2bkeycollection%5bsystem.string%2csystem.object%5d&amp;values=system.collections.generic.dictionary%602%2bvaluecollection%5bsystem.string%2csystem.object%5d" title="title">asd</a> i expecting code this: <a href="/" title="title">asd</a> so tried bit more explicit in view writing way: <%: html.routelink("asd",(routevaluedictionary)item.routevalues, new{title="title"}) %> but had same (incorrect) result. any thoughts? the problem there no overload html.routelink(...

dom - Omit empty attributes with groovy DOMBuilder -

groovy's markupbuilder has omitnullattributes , omitemptyattributes . dombuilder doesn't. code have >>> def xml = dombuilder.newinstance() >>> def maybeempty = null >>> println xml.foo(bar: maybeempty) <foo bar=""/> i want bar omitted if empty. found workaround in answer groovy antbuilder, omit conditional attributes... findall empty attributes , remove them. since have complex dom generated, i'm looking other options. i believe there no built-in option that, if need dombuilder, subclass , filter attributes... @groovy.transform.inheritconstructors class dombuildersubclass extends groovy.xml.dombuilder { @override protected object createnode(object name, map attributes) { super.createnode name, attributes.findall{it.value != null} } } you might want tune construction in standard dombuilder, example. def factory = groovy.xml.factorysupport.createdocumentbuilderfactory().newdocumen...

javascript - Developing asp.net application, use Google maps or bing maps? -

i need use map in application develop. in application want use pins show infoboxes on map. use zoom in, zoom out functionality , ability show several maps on same page. won't need use search locations or routing directions. which type of maps should use? google or bing? understand, both have user interface, 1 easier develop with? if i'll use bing more microsoft like, mean, let me use visual studio convenient programming? more or less javascript hassle debug it? in truth doesn't matter. they'll both same results. need licensing agreements between 2 of them. going real deciding factor. personally, bing better, entirely opinion. people google tell easier. depends on used , like. mock both , see better you. i check here . comparison between 2 , writer's breakdown of experienced. bing maps example drawing circle in bing maps sorry don't have examples of google's. haven't used while.

asp.net - .NET Chart Control - Axis X Text Rotation -

how rotate text orientation of text on x axiz of microsoft asp.net chart control? using .net 4. is done under series? mychart.chartareas[0].axisx.labelstyle.angle = -90; // can vary -90 90.

Fragment (anchor #) in .NET 4 WebBrowser Control getting lost with Adobe PDF Reader and file:// -

i create uri fragment (aka anchor #). uribuilder ub = new uribuilder("file://path/doc.pdf"); ub.fragment = "chapterx"; the url shown correctly in debugger (ub -> file://path/doc.pdf#chapterx ). when assign webbrowser control, fragment part gets lost (reason fragment see pdf open parameter ). this._mywebbrowser.url = ub.uri; // alternative this._mywebbrowser.navigate("file://path/doc.pdf#chapterx"); when check this._mywebbrowser.url displays file://path/doc.pdf . this._mywebbrowser.url.fragment empty - readonly , cannot assigned. as c.haas has shown below, concept works in general, reasons fails when resource local(!) pdf file. summary: works if protocol http works if resource .htm / .html - when protocol file:// works if file .pdf , protocol http (same 1.) fails if refers local pdf file, fragment gets lost any workaround this? revisions: 20110219 - update c.haas. chris shows, ok ".htm", fails ".pdf" ...

Websites in Asp.Net does not work in Windows Vista -

i have strange question! have developed website in asp.net webforms, i've tested website in ie7, ie8, ie9 (rc), firefox, chrome , safari, in windows xp , windows 7. works fine. but in internet explorer in windows vista, not working. website opens in browser, when application needs postback not work. don't know why happening. if suggest accomplish this? appretiate! thank you! att, a failed postback due javascript error. have tried using javascript console (shift+f12) in ie8, or using firebug lite in versions lower ie8? turn off surpressing javascript error notifications see if presents issue?

ruby on rails - How can I add page numbers to PDFKit generated PDFs? -

i have multiple pages generated using pdfkit. how can add page numbers bottom? you need specify footer this: kit = pdfkit.new(your_html_content_for_pdf, :footer_html => "#{path_to_a_footer_html_file}") then in footer file have this: <html> <head> <script type="text/javascript"> function subst() { var vars={}; var x=document.location.search.substring(1).split('&'); for(var in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);} var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; for(var in x) { var y = document.getelementsbyclassname(x[i]); for(var j=0; j<y.length; ++j) y[j].textcontent = vars[x[i]]; } } </script> </head> <body style="margin: 0;" onload="subst();"> page <span...

php - wordpress show random posts while paged -

i have 700 artworks (custom post type) , want break them in pages, have in random places each time. the problem when use 'paged'=>$paged, 'posts_per_page' => 60, 'orderby'=>rand each page repositions post , can find same post on ex. 2nd , 7th page. is there way first random posts , break them pages? or randomise posts per session, or per ip? my assumption 'orderby' => rand selects random post 1 @ time, each time has option display post option rand chooses 1 database @ random, independent of rest of page , posts. a possible solution problem take different approach together. every time homepage visited call php script randomly generate list of unique numbers, once every post (in case, 0-700). modify database (either adding column posts row, or modify/append existing one) said random number. set order new/modified column, ensuring the posts randomized every visitor page, never displays same post twice. however......

java - Mapping a missing native thread id to a thread dump -

how identify thread in java process when native thread id doesn't match of threads listed in thread dump? context: running on windows, i'm using sysinternals process explorer monitor java.exe running tomcat host webapp use in our lab. we're watching because cpu profile has been crazy of late. when server unresponsive, @ properties of java image, , switch thread tab, , order cpu column. there typically 1 tid - example 62504 - parked @ or near top of list. convert tid hex representation (f428), check thread dump - sure enough "vm thread" prio=10 tid=0x33d45000 nid=0xf428 runnable that makes me think method mapping ids adequate. but because we're focused on cpu right now, i'm interested in native thread 61136, in hour of running more 5 minutes of kernel time. 61136 -> 0xeed0, none of thread dumps ever include nid=0xeed0 entry. edit: further testing reveals startaddress critical piece of information - of msvcr71.dll threads appear in d...

How do I implement a facebook PHP Login as a fallback to single sign on with FBML -

i have working single sign on facebook works (most of time) whatever reason error. i'm trying write fallback method uses php sdk login directs facebook , forwards url, once facebook redirects page can see session data in url under $_get['session'] json string, need figure out how use string make valid api calls. <?php require_once "facebook_sdk.php"; $facebook = new facebook(array('appid' => '123','secret' => '456','cookie' => true,)); $session = null; $_fb_profile = null; $session = $facebook->getsession(); //get links login/logout $loginurl = $facebook->getloginurl(); $logouturl = $facebook->getlogouturl(); if($session){ try { $facebook_id = $facebook->getuser(); $_fb_profile = $facebook->api('/me'); //if not null valid session $facebook_name = $_fb_profile['name']; $facebook_link = $_fb_profile['link']; } cat...

linux - Is there a way to wait until root filesystem is mounted? -

i have statically linked code(not module) in kernel should launch kernel thread after root file system mounted. problem don't know how without modifying prepare_namespace() kernel function. thought it's possible via initcalls they're executed before kernel takes care rootfs. know best way this? update [1]: @benvoigit suggested following solution in comments: seems should open /proc/mounts , poll_wait on it. see source `mounts_poll' update [2]: looked @ rsbac patches, rsbac modifies prepare_namespace() function make actions after filesystem mounted. seems easiest way. well, current linux images big fit pc boot sector. modern bootloaders grub mount small filesystem in ram before real one. to understand happening under hood, can open disk image located under /boot. example, in ubuntu: mkdir test cd test zcat /boot/initrd.img-2.6.35-24-generic > image.cpio cpio -i < image.cpio vim init in end, it's bunch of shell scripts - simplicity poe...

iphone - How to change the thumb of my Slider and the Bar with particular image -

in app have slider need customize. have pictures want put on bar , thumb of slider. can me this? thanks, did in documentation? uislider has several methods change appearance: setminimumtrackimage:forstate: setmaximumtrackimage:forstate: setthumbimage:forstate: if that's not enough needs (e.g. because 1 image per slider element not enough), you'll have subclass uislider , draw slider yourself.

does SQL server query performance depend on the speed of network to the client? -

my test query runs faster when remote desktop connection sql server box, , open management studio there, when connect using management studio remote workstation. question is: why?! my query not return data back. here's exact text of query: set quoted_identifier off set arithabort off set numeric_roundabort off set ansi_warnings on set ansi_padding on set ansi_nulls off set concat_null_yields_null on set cursor_close_on_commit off set implicit_transactions off set language us_english set dateformat mdy set datefirst 7 set transaction isolation level read committed exec dbo.test where test defined follows: create procedure dbo.test begin declare @cnt int = 0 declare @d datetime set @d = dateadd(ss,5,getdate()); while getdate() < @d begin set @cnt = @cnt + 1 end print @cnt end both queries take 5 seconds execute, local run returns 7 times bigger value of cnt remote run. looking @ profiler, lpc protocol used locally, while tcp/ip used remo...

tsql - T-SQL: Performance when using an inner query on a join -

here's situation i'm dealing with. original query had was: select c.custid, a.city, a.country customers c left outer join addresses on c.custid = a.custid c.lastname = 'jones' so i'd show customers last name jones, ones without address entries, , show associated addresses them. if want clause on addresses still show customers? example if this: select c.custid, a.city, a.country customers c left outer join addresses on c.custid = a.custid c.lastname = 'jones' , a.country = 'united states' i lose customers not in united states. that's not want. want all customers last name 'jones', , omit addresses not in united states. solution came with: select c.custid, a.city, a.country customers c left outer join (select city, country addresses country = 'united states') on c.custid = a.custid c.lastname = 'jones' in case, still customers last name jones, don't see addre...

can a JSON start with [? -

Image
from can read on json.org , json strings should start { (curly brace), , [ characters (square brackets) represent array element in json. i use json4j library, , got input starts [ , didn't think valid json. looked briefly @ json schema, couldn't find stated json file cannot start [ , or can start { . json can either array or object. off of json.org: json built on 2 structures: a collection of name/value pairs. in various languages, realized object, record, struct, dictionary, hash table, keyed list, or associative array. an ordered list of values. in languages, realized an array, vector, list, or sequence. it goes on describe 2 structures as: note starting , ending characters curly brackets , square brackets respectively. edit , here: http://www.ietf.org/rfc/rfc4627.txt a json text sequence of tokens. set of tokens includes 6 structural characters, strings, numbers, , 3 literal names. a jso...

iphone - get elements using youtube API on objective C -

i have gone through documentation, used sample project , have retrieval of youtube feed working on app unable individual elements displays desire. i able example first video using objectatindex:0 don't know how title, id, url, etc. here nslog of firs video in feed. entry: gdataentryyoutubevideo 0x9eb8d50: {v:2.0 title:evolution of dance - judson laipply contentsrc:http://www.youtube.com/v/dmh0bheirng?f=standard&d=avezc5trxmdfhc6pnaqxlmio88hsqjpe1a8d1gxqngdm&app=youtube_gdata etag:w/"a0chq347ecp7ima9wx9uguo." authors:1 categories:4 links:alternate,video.responses,video.ratings,video.complaints,video.related,self id:tag:youtube.com,2008:video:dmh0bheirng rating:+706815/-62385 comment:gdatacomment 0x9ebeb50: {feedlink:gdatafeedlink 0x9ebf2c0: {href:http://gdata.youtube.com/feeds/api/videos/dmh0bheirng/comments counthint:500786 href:http://gdata.youtube.com/feeds/api/videos/dmh0bheirng/comments counthint:500786}} stats:gdatayoutubestatistics 0x9ebfeb0: {viewc...

integer - Find out how often can x be divided by 2 without loop in C -

i'm looking way find how can divide constant x 2 (and not remainder) without using loops, recursion or logarithm. since same problem finding index of least significant non-zero bit, hoping there way use bitwise operations this. unfortunately wasn't able come it. ideas? background: have loop doubles counter on every iteration until no longer divides constant x. want loop unrolled, nvidia cuda compiler isn't smart enough figure out number of iterations, want rewrite loop in such way number of iterations becomes more obvious compiler: for(i=1; const & == 0; *= 2) bla(i); should become like #define iterations missing_expr_with_const for(i=0; < iterations; i++) fasel(i); this can directly solved using this code 32 bit numbers (i take no credit). unsigned int v; // find number of trailing zeros in 32-bit v int r; // result goes here static const int multiplydebruijnbitposition[32] = { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, ...

python - Designing a Django voting system without using accounts -

we considering implementing voting system (up, down votes) without using type of credentials--no app accounts nor openid or of sort. concerns in order: prevent robot votes allow individuals under nat vote without overriding/invalidating else's vote preventing (or, @ least making difficult for) users vote more once my questions: if you've implemented similar, tips? any concerns perhaps i'm overlooking? any tools should perhaps into? if have questions in forming answer of these questions, please ask in comments! to address concerns: 1: simple captcha trick, if google "django captcha", there bunch of plugins. i've never used them myself, can't best. 2 & 3: using django's sessions addresses both of these problems - save cookie on user's browser indicate person has voted. allows people vote via different browsers or clearing cache, depends on how important people not allowed vote twice. imagine small percentage...

vmware esxi 4.1 with sata ssd -

is possible use sata ssd (e.g., intel x25-m) vmware esxi 4.1? this used in dell poweredge r310 (just has onboard sata, no raid controller). @ point, standard 7200 rpm sata drives working without issue. i can't find ssd's on hardware compatibility list. esxi recognize one? how perform trim functions, esxi this? problems come mind? thanks in advance. this work trim commands not issued drive. see post info: trim , esxi

Huge files in hadoop: how to store metadata? -

i have use case upload tera-bytes of text files sequences files on hdfs. these text files have several layouts ranging 32 62 columns (metadata). what way upload these files along metadata: creating key, value class per text file layout , use create , upload sequence files ? create sequencefile.metadata header in each file being uploaded sequence file individually ? any inputs appreciated ! thanks the simplest thing make keys , values of sequencefiles text. pick meaningful field data make key, data value text. sequencefiles designed storing key/value pairs, if that's not data don't use sequencefile. upload unprocessed text files , input hadoop. for best performance, not make each file terabytes in size. map stage of hadoop runs 1 job per input file. want have more files have cpu cores in hadoop cluster. otherwise have 1 cpu doing 1 tb of work , lot of idle cpus. file size 64-128mb, best results should measure yourself.

xdebug - Eclipse Helios not stopping at breakpoints -

i upgraded eclipse galileo helios. helios stops @ breakpoints when debugging "as php script", not when debugging "as web page". when debugging web page, looks correct debug query string start debug session getting tacked on url, so: http://localhost/hello.php?xdebug_session_start=eclipse_dbgp &key=129798139020511 but elipse not stop @ breakpoints. zooms thru code , displays output in browser. this xdebug configuration in php.ini works galileo, not working helios: (click here see entire xdebug config settings) ;extension=xdebug.so <-- needed? zend_extension=" /applications/mamp/bin/php5.3/lib/php/extensions/no-debug-no n-zts-20090626/xdebug.so " xdebug.remote_enable=on xdebug.remote_autostart=off xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 xdebug.idekey= ; enable remote debugging zend_debugger.allow_hosts=127.0.0.1/32 zend_debugger.expose_remotely=always can post xdebug con...

android - How to load contacts in text view at the time of editing? -

hi creating contact based application.in have text view in want load contacts phone @ time of editing text view. please 1 me how in advance you can use textwatcher notified when editing starts. more information on how query contacts can take @ contacts tutorial provided @ http://blog.app-solut.com/2011/03/working-with-the-contactscontract-to-query-contacts-in-adroid/ how query contacts , basic information on contacts.

imap - Good java webmail applications -

are there java webmail applications, can used connect standalone imap servers? something roundcube can deployed in application server. thanks some open source solutions can found here: http://java-source.net/open-source/web-mail jwebmail webmail claros intouch yawebmail

android - At what point in the Activity Lifecycle does an ActivityMonitor fire? -

i have test using activitymonitor wait activity start, e.g. // ins instance of instrumentation class. instrumentation.activitymonitor mon = new instrumentation.activitymonitor((string)null, null, false); ins.addmonitor(mon); // start activity activity = ins.waitformonitorwithtimeout(mon, mswaittime); at point when waitformonitorwithtimeout returns, point in activity lifecycle activity at, has been through create/start/resume etc, or still going on ? docs returns started activity, no indication of state activity in. this doesn't appear documented anywhere, testing shows waitformonitorwithtimeout call returns in new activities lifecycle, far can tell, after oncreate returns.

.net - Call a DTO translator inside IQueryable's Select -

i have following code query entitycontext (through repository) , map unto dto: public class queryquestionsconsumer : iconsumerof<queryquestionsrequest> { public void consume(queryquestionsrequest request) { var repo = ioc.resolve<iunitofwork>().createrepository<question>(); var filter = filtertranslator.createfilterexpression<question>(request.filters); var questions = repo .getall() .where(filter) result = questions.select(question => questiontranslator.todto(question)).toarray() } } this fail because todto() isn't recognized function in entityframework provider. create dto object using object initializer i'd delegate class (questiontranslator). what do in case? updated: additionally, don't want hydrate full question object that. i'd count on provider's ability create dto objects. besides obvious option of using questions.asenumerable().select(...)...

Guide to using Sphinx with PHP and MySQL -

i'm looking complete guide using sphinx php , mysql. i'd 1 that's bit simpler , easygoing 1 provided on site. i'm looking few concepts on how works. i have server php, html, other data , mysql database. how go setting sphinx power search , results being returned? i'd able pass search terms php script , have deal sphinx , return data. p.s. i'm open suggestion regarding other alternatives sphinx. here sphinx tutorial ibm.

How to cope with Exceptions in Linq Queries? -

i have found using linq useful experience when querying lists, , provides succinct, readable code. the issue have found when error occurs hard debug part of query failing. is there way find out? highlights whole query , returns error. an example if have list: class person { public ilist<string> pets { // please, don't @ home :) { throw new invalidoperationexception(); } } } person person = new person(); list<person> mystrings = new list<person>(); mystrings.add(person); var people = p in mystrings p.pets.count > 0 select p; obviously checking null simple solution, more convoluted errors may not obvious, how should locate in query failing? is there linq profiler or something? you can set visual studio break on exceptions, , break exception thrown, inside lambda. this can uncover subtle bugs; highly recommend it. however, old, exception-laden code, nightmare.

Could someone confirm whether texture mapping in fragment shaders is supported on iPads running 3.2.x? -

in simulator don't issues when testing under 3.2, however, on device texture doesn't show up. under 4.2 works fine, both in simulator , device. i'm trying pinpoint problem , wondering if confirm whether there's bug particular functionality in 3.2.x (ipad only). if have other ideas might wrong, please let me know. i'm not experience opengl. i haven't been able confirm this, switched using es1 in ipad environment.

wolfram mathematica - How to make an analog of InString[]? -

i have discovered instring[] not work in mathlink mode when sending input enterexpressionpacket header. need define own function returns previous input line. 1 way have developed here not work in cases: in[1]:= unevaluated[2 + 2] with[{line = $line - 1}, holdform[in[line]]] /. (downvalues[in]) out[1]= unevaluated[2 + 2] out[2]= 2 + 2 this because ruledelayed has no holdallcomplete attribute. adding attribute makes ok: in[1]:= unprotect[ruledelayed]; setattributes[ruledelayed, holdallcomplete]; protect[ruledelayed]; unevaluated[2 + 2] with[{line = $line - 1}, holdform[in[line]]] /. downvalues[in] out[4]= unevaluated[2 + 2] out[5]= unevaluated[2 + 2] but modifying built-in functions not idea. there better way this? it seems have solved problem. here function: in[1]:= getlastinput := module[{num, f}, f = function[{u, v}, {u /. {in -> num, holdpattern -> first}, holdform[v]}, holdallcomplete]; first@cases[ block[{ruledelayed = f}...

sql - Materialized view with trigger? -

can create trigger on materialized view? i'm using oracle 10g. yes, can. careful. oracle documentation says: if create trigger on base table of materialized view, must ensure trigger not fire during refresh of materialized view. during refresh, dbms_mview procedure i_am_a_refresh returns true.

java - any good OSGi remote service references/books/tutorials? -

first of all, know if osgi remove service has been implemented? i thinking of solution messy system working on. standalone java components scattered in cluster of servers asynchrously communicating via jms. (btw, electronic trading platform). i searched web while ago looking reference found articles. can please point me right direction? thank you... that depends entirely on mean successfully , implemented , available . :-) generally speaking situation sad: none of readily available implementations work or offer people seem need in practice. first of important distinguish between "remote services" , "remote service admin" specs. former convention exposing services in osgi service registry; latter "the real spec" , includes discovery, coordination between transports, selective import/export control etc. hard bit, though there no reason why toolkit/mini-framework should not available open-source package people can concentrate on wri...

java - saving an image from applet -

is there way save image java applet been asked before: java applet - saving image in png format or save image file in applet? please first search question or @ least check out related questions type question in. it's helpful finding other users common issues.

php - Localizing sentences -

i'm localizing php project gettext ... no problem part. thing that, example, have sentence "remember password". can put in code next (to use gettext) : echo _("remember password") that generate line in po file key "remember password", , translate in english file "remember password", , in spanish site "recordar password" in mo files. if in future, want change sentence , put in english "remember password forever" (for example again) ... issue key "sentence" different english translation. two possible situations: 1) so, if want have clean, change key again, , change php code again, not useful. 2) in other hand, use generic key, "login page - remember", can used , serves future different sentences. extends time of "localizing", since it's not fast adding _(" , ") what use ? other 3rd option ? thank comments you pretty have summed 2 options have. keep in m...

changing date format in javascript dynamically in userside -

how change date format dynamically in clientside using javascript..as cant change in serverside..say jsps..as these things meeds 2 b changed frequently. i using eclipse,j2ee,jscript var = new date(); now.format("m/dd/yy"); // returns, e.g., 6/09/07 here article example

Is their an issue with importing Excel files with null rows into SQLServer 2005 tables -

i using openrowset() function import excel file temporary sqlserver 2005 table. it works fine in cases. if first 10 rows of excel file null, remaining non-null rows imported null. has encountered issue previously? thoughts on how overcome it? this caused how oledb driver determines datatypes in excel. default scans first 8 rows determine datatype of fields. you used able set "maxscanrows" in connection string configure rows scan in worksheet. setting unfortunately not work anymore since jet 4.0. way force set th registry key [hklm\software\microsoft\jet\4.0\engines\excel\typeguessrows]. possible values 1-16 or 0 scan whole file. there imex setting (which means importmixedtypes) when set 1 means "importmixedtypes=text". solves lot of issues driver determines datatype based on amount of values in type finds.

smalltalk - Where did the Self language get its name? -

why language given such hard google name? from here : it called 'self' because dr david ungar got called many many nerd lecturers , got sick of writing name on name badge , wrote 'self' instead. self name automatically assumes default self method calls automatic inheritance.

Clear ASP.NET MVC3 browser debug preview in Visual Studio 2010 -

how can clear cache of web browser in such way show me updated page when run debug of asp.net mvc3 application in visual studio 2010? there easy way it? problem i'm working on project , every time modify in css style debug "preview" in web browser window not update. if recompile, rebuild solution , on. i press f5 (in browser) reload page, , referenced resources. this works in browser know (ie, ff, chrome, opera).

Does SQL Server optimize LIKE ('%%') query? -

i have stored proc performs search on records. the problem of search criteria,which coming ui, may empty string. so, when criteria not specified, statement becomes redundant. how can perform search or sql server? or, optimize like('%%') query since means there nothing compare? the stored proc this: alter proc [fra].[mcc_search] @mcc_code varchar(4), @mcc_desc nvarchar(50), @detail nvarchar(50) begin select mcc_code, mcc_desc, createdate, creatinguser fra.mcc (nolock) mcc_code ('%' + @mcc_code + '%') , mcc_desc ('%' + @mcc_desc + '%') , detail ('%' + @detail + '%') order mcc_code end the short answer - no long answer - absolutely not does optimize like('%%') query since means there nothing compare? the statement untrue , because there is compare. f...

fbml - Facebook pages question -

i have few questions hope can with, creating facebook page business , wanting display list of products, pulled directly there own website, possible pull xml feed website, display data using fbml? secondly possible show content if user has 'liked page'? thanks you have script on server. e.g. php-script fetches xml , outputs fbml.

php - The single quote problem -

i'm .net developer. i blog @ http://www.ruchitsurati.net personal blog. i'm facing stupid issue driving me nuts. in wordpress blog admin, write post , hit save.all works fine upon save,all single-quotes doubled given input. ex: original text i'm writing post converted i''m writing post , , next time when save it, becomes i''''m writing post i have no idea, causing problem. there encoding while saving ? please me.. add .htaccess : # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on php_value magic_quotes_gpc 0 php_flag magic_quotes_runtime 0 </ifmodule> # end wordpress

ios - UIView animations with autoreverse -

i have problem setting uiviewanimationoptionautoreverse . here code. calayer *anilayer = act.viewtochange.layer; [uiview animatewithduration:2.0 delay:1.0 options:(uiviewanimationcurvelinear | uiviewanimationoptionautoreverse) animations:^{ viewtoanimate.frame = gcrectmake(1,1,100,100); [anilayer setvalue:[nsnumber numberwithfloat:degreestoradians(34)] forkeypath:@"transform.rotation"]; } completion:nil ]; the problem that, after animation has reversed, view jumps frame set in animation block. want view grow , "ungrow" , stop @ original position. is there solution without programming 2 consecutive animations? you have 3 options. when use -[uiview animatewithduration:…] methods, changes make in animations block applied views in question. however, there implicit caanimation applied view animates old value new value. when caanimation active on view, changes displayed view, not change actu...

c# - ASP.net MVC Grouping within a SelectList -

i want create grouped select list, e.g. similar travel sites: - europe - london - paris - madrid - north america - new york - toronto - asia - hong kong - bangkok my model looks this: public class topic { public virtual guid id { get; private set; } public virtual string code { get; set; } public virtual string description { get; set; } public virtual string groupdescription { get; set; } } where code value select, description text want show, , groupdescription want group by. i found groupby method on selectlist - i'm not sure how use achieve end (if indeed correct method use!) i create selectlist in controller this: private ienumerable<selectlistitem> generatetopiclist() { var selectoptions = concern in _topicsrepository.listtopics() select new selectlistitem { value = concern.code, text = concern.groupdescription + " : "...

.net - How to create multiple threads in Windows azure worker role -

i want multiple operations in single worker role. how create threads in worker role? ashwani you add multiple workers in workerrole::onstart() described here http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2010/12/running-multiple-threads-on-windows.html public class workerrole : threadedroleentrypoint { public override void run() { // sample worker implementation. replace logic. trace.writeline("worker role entry point called", "information"); base.run(); } public override bool onstart() { list<workerentrypoint> workers = new list<workerentrypoint>(); workers.add(new imagesizer()); workers.add(new imagesizer()); workers.add(new imagesizer()); workers.add(new housecleaner()); workers.add(new turkhandler()); workers.add(new crawler()); workers.add(new cr...

using scanf and family to read in two strings separated by a space from a file in c -

i trying read in 2 string separated space file. whatever try keep getting 1st string initialized second string null. some of formatters have tried "%s%s" , "%s %s" , "%s[\n\t ]%s" any ideas of doing wrong? i think has internal buffer of scanf -- reads first %s puts invisible character in buffer reads 2nd %s read , second string null when complete. what strings like? i don't think hypothesis of fscanf() modifying input data placing "some invisible character in buffer" true. it seems more strings don't conform requirements of %s format specifier.

jsf 2 - JSR303 ConstraintValidator, how to show the message without an error page -

im working jsf 2.0 , glassfish v3. testing functionality of jsr303 bean validation, created validator implements constraintvalidator , annotate on property wich want validate. it works fine, displays glassfish default error page. don't want displayed, rather have message displayed in <h:outputtext> or something. does know how achieve this? here validator method: @override public boolean isvalid(string searcharg, constraintvalidatorcontext ctx) { boolean searchargcorrect = true; facesmessage msg; if(searcharg!=null) { ctx.disabledefaultconstraintviolation(); if(searcharg.length() < 3) { ctx.buildconstraintviolationwithtemplate("searcharg short").addconstraintviolation(); searchargcorrect=false; msg = new facesmessage( facesmessage.severity_error, "searcharg short", null); throw new validatorexception(msg); } } ...

html - Multiple background images -

first, warning, have come years break of html/css , have pretty forgotten everything, i'm @ newbie level again. i have been trying add background images - 1 @ top left , 1 @ bottom right. have @ moment can seen here: http://test.nihongohub.com/mainsite/firstsite.php can see if change width of browser div containing img hit main part , ruin it. i have tried few fixes suggested on stack overflow none of them worked. have suggestions how fix this. friend suggested add img footer , squeeze out, don't idea. 2 things want image do, move browser window, , able go behind main page. thanks offered you try using fixed positioning , use z-index move back, ie. #bottom_leaf_holder { position: fixed; bottom: 50px; right: 0; z-index: -1; } edit: ment fixed , changed answer.

sql - date time in combobox -

i using visual stdio 2008 , sql server 2005 dim selectquery = "select purchase_master.customer_name, purchase_details.item_code, item_master.name, purchase_details.quantity, purchase_details.cost, purchase_master.date item_master inner join (purchase_master inner join purchase_details on purchase_master.bill_id = purchase_details.bill_id) on item_master.item_code = purchase_details.item_code purchase_master.date= " + cbopdate.selectedvalue.tostring() when selectquery executed gives me error "error near syntax 12" my cbopdate combobox binded database return's data , time in "2/18/2011 12:00:00 am" please me out i suspect treating delimiter.it better change to where purchase_master.date=@your_date and add date parameter, prevent sql injection attacks , promote plan caching

windows phone 7 - Error Pop up in WP7 -

i want show pop user when want submit text on textbox , click on button submit it. if example want save wrong text or that. or try messagebox .

sql - Best query for getting success/failure ratio from warehouse fact table -

i'm trying fine tune query , feedback. have job_fact warehouse table unit of measure job's final event ( final_event_type ). i'm trying run query on fact give me success/failure ratio. here's have far: select case when jf.final_event_type in (4,6,8,9) count(final_event_type) end num_failures, case when jf.final_event_type in (5,7,10) count(final_event_type) end num_successes job_fact jf group jf.final_event_type; this query gives me raw succes , failure values in two-row result: +----------------------+-----------------------+ | num_failures | num_successes | +----------------------+-----------------------+ | [null] | 6 | | 14 | [null] | +----------------------+-----------------------+ does know if there's way a) results on 1 line, , b) able calculate ratio between 2 (e.g. failure percentage). i'm assuming tell me i'm better off writing procedure this, i'd...

active directory - Check IsInRole against AD -

i tried work windowsprincipal getting confused. use code snippet: windowsprincipal principal = new windowsprincipal(windowsidentity.getcurrent()); messagebox.show(thread.currentprincipal.isinrole("mydomain\\users").tostring()); it returns true it's ok. thought "isinrole" check works against active directory. when unplug network cable still returns true. how come? there easy way check whether logged user in specific domain against ad? active directory credentials can cached on local system, including role membership (to support group policy enforcement). can turn off credential cache described in msdn kb cached domain logon information , i'm not sure clear cache. while cannot confirm (as i'm not on system cached credentials), believe stored hashes under registry key hkey_local_machine\security\cache\ in values labeled "nlx" x integer.

.net - Single vs. Multiple Unit Test Projects per Solution? -

i have typically had 1:1 mapping between product assemblies , unit test assemblies. try keep overall number of assemblies low, , typical solution may like... client (contains views, controllers, etc) client.tests common (contains data/service contracts, common utilities etc) common.tests server (contains domain, services, etc) server.tests server.webhost lately @ work, people have been mentioning having single unit test project vs. breaking them down assembly testing. know in day, made life easier if running ncover etc part of build (no longer matters of course). what general rational behind single vs. multiple unittest projects? other reducing number of projects in solution, there concrete reason go 1 way or other? impression may 1 of "preference" things, googling hasn't turned much. there no definite answer because depends on work on personal taste. however, you want arrange things in way can work effectively . for me means, want find thing...

c# - adding integer and to an hours value -

i have combobox has values 1-25. have 2 datetimepickers display time values. if choose 10:00 am first datetimepicker , 2 combobox, i'd result 12:00 pm in second datetimepicker. how can done? seconddatepicker.value = firstdatepicker.value.addhours(convert.toint32(combobox1.selectedvalue));

url - Umbraco incorrect 'Link to document' when setting hostname -

basically defined domain (manage hostnames option) node1 , have umbraco tree structure content + en + node1 + subnode1 + subnode2 + node2 + es + node3 … when check ‘subnode1’ properties have ‘link document’ , ‘alternative links’ path inconsistent: link document: /node1/subnode1.aspx alternative links: http://www.domain.com/subnode1.aspx i rid of folder ‘/node1/’ in ‘link document’, returned in niceurl , messing url links on pages. i have: link document: /subnode1.aspx alternative links: http://www.domain.com/subnode1.aspx tried follow steps in http://our.umbraco.org/forum/using/ui-questions/3505-change-site-root-node,-niceurl-doesnt-change no luck thing is: page not found umbraco tried match using xpath query'/domainprefixes-are-used-so-i-do-not-work') page can replaced custom 404 page hope helpful reply :) thanks try implementing solution here: http://our.umbraco.org/forum/using/ui-q...

help debugging an ajax problem -

anyone have idea why isn't working? $(function(){ console.log('ready'); $.ajax({ datatype : 'jsonp', jsonp : 'js', url : 'http://monitor.302br.net/monitorscoreservlet', beforesend : function(jqxhr, settings) { console.info('in beforesend'); console.log(jqxhr, settings); }, error : function(jqxhr, textstatus, errorthrown) { console.info('in error'); console.log(jqxhr, textstatus, errorthrown); }, complete : function(jqxhr, textstatus) { console.info('in complete'); console.log(jqxhr, textstatus); }, success: function(data, textstatus, jqxhr){ console.info('in success'); console.log(data, textstatus, jqxhr); } }); }); this working till recently. beforesend handler never fires, can see ajax call being made in firebug, ,...

how to change Qt qListView Icon selection highlight -

when using qlistview in icon mode need remove hilighting when icon selected. using code below text under icon no longer highlighted still blue color on icon when selected qstring stylesheet = ""; stylesheet += "qlistview::item:alternate {background-image: transparent; background-color: transparent;}"; stylesheet += "qlistview::item:selected {background-image: transparent; background-color: transparent;padding: 0px;color: black;}"; stylesheet += "qlistview::item:selected:active{background-image: transparent;background-color: transparent; color: black;}"; stylesheet += "qlistview::item:selected:!active{background-image: transparent;background-color: transparent;color: black;}"; setstylesheet(stylesheet); does know how change selected color on icon without having subclass qstandarditem? for qlistview qstandarditem's it's possible want. create icon add same pixmap both normal , selected states. setic...

python - Google App Engine - Hello World Tutorial - Segmentation Fault -

i starting use google app engine , have started running tutorial. when this: $ python2.5 google_appengine/dev_appserver.py helloworld/ it says 'segmentation fault'. i running ubuntu 10.10. installed python 2.5 site this site . the reason have python2.5 @ beginning of command did altinstall of python 2.5 still able use python 2.7. everything looks should work isn't. know issue is? i able run python 2.5 interactively. when run dev_appserver.py seg fault. did more tests , when run: $ ./google_appengine/dev_appserver.py it gives me seg fault. don't know if helps, thought might. i ran verbose output: # installing zipimport hook import zipimport # builtin # installed zipimport hook # /usr/local/lib/python2.5/site.pyc matches /usr/local/lib/python2.5/site.py import site # precompiled /usr/local/lib/python2.5/site.pyc # /usr/local/lib/python2.5/os.pyc matches /usr/local/lib/python2.5/os.py import os # precompiled /usr/local/lib/python2.5/os.pyc import e...