Posts

Showing posts from April, 2010

sql server - Random Weighted Choice in T-SQL -

how randomly select table row in t-sql based on applied weight candidate rows? for example, have set of rows in table weighted @ 50, 25, , 25 (which adds 100 not need to), , want select 1 of them randomly statistical outcome equivalent respective weight. dane's answer includes self joins in way introduces square law. (n*n/2) rows after join there n rows in table. what more ideal able parse table once. declare @id int, @weight_sum int, @weight_point int declare @table table (id int, weight int) insert @table(id, weight) values(1, 50) insert @table(id, weight) values(2, 25) insert @table(id, weight) values(3, 25) select @weight_sum = sum(weight) @table select @weight_point = floor(((@weight_sum - 1) * rand() + 1), 0) select @id = case when @weight_point < 0 @id else [table].id end, @weight_point = @weight_point - [table].weight @table [table] order [table].weight desc this go through table, setting @id each record's id value while @ ...

asp.net - What is the best way to keep an asp:button from displaying it's URL on the status bar? -

what best way keep asp:button displaying it's url on status bar of browser? button defines this: <asp:button id="btnfind" runat="server" text="find info" onclick="btnfind_click"> </asp:button> update: this appears specific ie7, ie6 , ff not show url in status bar. i use ff never noticed this, link in fact appear in status bar in ie.. i dont think can overwrite :( thought maybe setting tooltip (al la "title") property might it.. seems not.. looking @ source, appears found, browser issue, don't think can in code.. :( update yeah, looks ie posts whatever form action is.. can't see way override it, yet.. perhaps try explicitly setting via js? update ii done more googleing. don't think there "nice" way of doing it.. unless remove form , post data other way.. is worth much? tends page name?

Why do all methods in the Google Analytics tracking code start with an underscore? -

prefixing variable , method names underscore common convention marking things private. why methods on page tracker class in google analytics tracking code ( ga.js ) start underscore, ones public, _gettracker , _trackpageview ? because google can't bothered follow module pattern , therefore don't want accidental collisions in global namespace?

What's the better database design: more tables or more columns? -

a former coworker insisted database more tables fewer columns each better 1 fewer tables more columns each. example rather customer table name, address, city, state, zip, etc. columns, have name table, address table, city table, etc. he argued design more efficient , flexible. perhaps more flexible, not qualified comment on efficiency. if more efficient, think gains may outweighed added complexity. so, there significant benefits more tables fewer columns on fewer tables more columns? i have few simple rules of thumb follow when designing databases, think can used make decisions this.... favor normalization. denormalization form of optimization, requisite tradeoffs, , such should approached yagni attitude. make sure client code referencing database decoupled enough schema reworking doesn't necessitate major redesign of client(s). don't afraid denormalize when provides clear benefit performance or query complexity. use views or downstream tables impleme...

user interface - Native Tongue as Default Language For an Application -

when downloading both firefox , chrome, i've noticed default version got in native tongue of hebrew. don't applications in hebrew, since i'm used english ui conventions embedded in me since long ago by: the lack of choice: programs don't offer interfaces in multiple languages , when do, languages english , developer's native tongue. programming languages bound english language. my question this: if translate applications, limit ui user's native tongue or give them choice enabling more 1 language pack default? which language application default (which interesting if install 1 language pack application)? and i'd know how value put translating applications on whole. i've helped develop application used dutch, english, spanish , portuguese speaking users. because application installed cd added language packs. because saved lot of work not having maintain 4 different versions. if application distributed website , have support mo...

WPF - Programmatic Binding on a BitmapEffect -

i able programmatically bind data dependency properties on bitmapeffect . frameworkelement textblock there setbinding method can programmatically these bindings like: mytextblock.setbinding(textblock.textproperty, new binding("someproperty")); and know can in straight xaml (as seen below) <textblock width="auto" text="some content" x:name="mytextblock" textwrapping="wrap" > <textblock.bitmapeffect> <bitmapeffectgroup> <outerglowbitmapeffect x:name="myglow" glowcolor="white" glowsize="{binding path=myvalue}" /> </bitmapeffectgroup> </textblock.bitmapeffect> </textblock> but can't figure out how accomplish c# because bitmapeffect doesn't have setbinding method. i've tried: mytextblock.setbinding(outerglowbitmapeffect.glowsize, new binding("someproperty") { source = someobject }); but doesn...

iphone - NSFetchedResultsController - phantom row -

just run tricky nsfetchedresultscontroller problem. the following code works fine in cases except first entry core data database when reports 2 rows! id <nsfetchedresultssectioninfo> sectioninfo = [[fetchedresultscontroller sections] objectatindex:section]; numberofrows = [sectioninfo numberofobjects]; if add additional entries these reported correctly. , if delete both of 2 initial rows works fine. any suggestions? if it's help, using: -com.apple.coredata.sqldebug 1 i can see there 1 insert , 2 selects. also, problem doesn't seem happen if i've visited view containing nsfetchedresultscontroller code (i.e. before doing inserts). ==== update 1: wonder if walk through code help... 1. viewcontroller starts background nsoperation download 2. when completes sends notification appdelegate 3. when appdelegate gets notification imports data (doing check make sure it's on main thread before doing so) here's relevant bit of importerdidsa...

.net - C# NetCDF Library -

i working on (or @ least planning) couple of projects work large amounts of repetitive data. kind of data works in spreadsheet or database, nasty in xml. :) netcdf seems great option file format. however, work in c# , there no "official" netcdf implementation available. there "official" python version potentially use ironpython. option "netcdf library .net" on codeplex seems pretty quiet ( http://www.codeplex.com/netcdf ). has worked either of these libraries? can provide recommendations? first, sure netcdf right choice? if want interact other programs need read in large amounts of data , support netcdf, it's great choice. there aren't many standard , well-supported file formats support large multidimensional arrays. if you're going reading , writing files c#, may not such choice. i'm big fan of "classic" netcdf file format. it's compact , extremely simple, flexible enough support lots of common kinds of...

asp.net - Best way to determine the number of servers needed -

how traffic can 1 web server handle? what's best way see if we're beyond that? i have asp.net application has couple hundred users. aspects of processor intensive, far have done fine 1 server run both sqlserver , site. it's running windows server 2003, 3.4 ghz 3.5 gb of ram. but lately i've started notice slows @ various times, , wondering what's best way determine if server overloaded usage of application or if need fix application (i don't want spend lot of time hunting down little optimizations if i'm expecting box). what need info on capacity planning .. capacity planning process of planning growth , forecasting peak usage periods in order meet system , application capacity requirements. involves extensive performance testing establish application's resource utilization , transaction throughput under load. first, measure number of visitors site receives , how demand each user places on server, , calculate computing resources (cpu, ...

continuous integration web service -

i in position become team leader of team distributed on 2 countries. team tech. team start company plan bootstrap on limited funds. trying find out ways minimize upfront expenses. right planning use java , have lot of junit tests. planing on using github vcs , lighthouse bug tracker. in addition want add continuous integration server not know of continuous integration servers offered web service. does know if there continuous integration servers available in software service model? p.s. if knows can these 3 services @ 1 location great know to. note: outdated answer 2008. there plenty of such services things amazon's elastic cloud compute service (for example, travis-ci ) i rather doubt you'll find service build stuff you. building requires lot of cpu power, , if you're having rebuild every time commits, hard scale such service.. , i'm sure there's security issues , likes well.. as @eed3si9n said, run cruisecontrol on spare (virtual-)mach...

2D drawing with Android -

im trying understand how android drawings work. i hoping can explain how drawing components relate each other (view, drawable, canvas, bitmap) it seems confusing , documentation doesnt job explaining it. does bitmap inside canvas object injected in view's via ondraw() represent whole display, or chunk view draws? what drawable do, objects encapsulate set of commands canvas object? im hoping can me basic understanding on how works, dont have eny java background action script , c# (silverlight). this pretty vague question, i'll give shot. first answer on site , no means expert have found myself doing lot of tinkering drawing in android. from i've read , experienced, each view has bitmap, used draw view on screen. each view has canvas. canvas allows programmer control drawn onto bitmap. every view object has ondraw(canvas c) method used draw it. if want draw yourself, can create subclass of view class extending view , can override ondraw(canvas c) ...

What's the best way to write JavaScript/Ruby applications on Windows Mobile device? -

i bought windows mobile device , since i'm developer want use development platform. yes, it's not supposed used it's me , laptop isn't. know cke editor code how can run javascript/ruby code without of headache? i write web application, send code , results maybe there's better solutions? there possibility run ruby on windows mobile check article steps: human vs machine javascript bit crippled on windows mobile. follow discussions here: windows mobile ie team blog next version if pocket internet explorer supports better!

oop - C++ function pointers and classes -

say have: void render(void(*call)()) { d3ddevice->beginscene(); call(); d3ddevice->endscene(); d3ddevice->present(0,0,0,0); } this fine long function want use render function or static member function: render(mainmenurender); render(mainmenu::render); however, want able use class method since in cases rendering function want access member variables, , id rather not make class instance global, e.g. render(mainmenu->render); however have no idea how this, , still allow functions , static member functions used. there lot of ways skin cat, including templates. favorite boost.function i've found flexible in long run. read on boost.bind binding member functions many other tricks. it this: #include <boost/bind.hpp> #include <boost/function.hpp> void render(boost::function0<void> call) { // before... } render(boost::bind(&mainmenu::render, mymainmenuinstance));

c# - Excel Data using LinQ Intersecting -

my intersect in linq somehow dont seem work. have 2 excel sheets. fetch using linqtoexcel , ( linqtoexcel not support visitsubqueryexpression have work ). list<boardsheet> sourcetest = (from t in boards[0] t["board"] == boardname select new circuitset { id = string.format(t["id"]), data = string.format(t["data"]), ctrltype = string.format(t["ctrltype"]), sys = string.format(t["sys"]), code = string.format(t["code"]) } ).tolist<boardsheet>(); list<boardsheet> targettest = (from t in boards[0] t["board"] == boardname ...

c++ - Cross platform IPC -

i'm looking suggestions on possible ipc mechanisms are: cross platform (win32 , linux @ least) simple implement in c++ most common scripting languages (perl, ruby, python, etc). finally, simple use programming point of view! what options are? i'm programming under linux, i'd write portable other oses in future. i've thought using sockets, named pipes, or dbus. in terms of speed, best cross-platform ipc mechanism pipes. assumes, however, want cross-platform ipc on same machine. if want able talk processes on remote machines, you'll want @ using sockets instead. luckily, if you're talking tcp @ least, sockets , pipes behave pretty same behavior. while apis setting them , connecting them different, both act streams of data. the difficult part, however, not communication channel, messages pass on it. want @ perform verification , parsing you. recommend looking @ google's protocol buffers . create spec file describes object want p...

c++ - Why can a Boost.Bind function be called with extra parameters? -

#include <iostream> #include <string> #include <boost/bind.hpp> void foo(std::string const& dummy) { std::cout << "yo: " << dummy << std::endl; } int main() { int* test; std::string bar("platypus"); (boost::bind(&foo, bar))(test, test, test, test, test, test, test, test); } when run, prints out, "yo: platypus." appears ignore parameters. i'd expect compile error. accidentally introduced bug code way. i don't know why allowed, know expected behavior. here : bind can handle functions more 2 arguments, , argument substitution mechanism more general: bind(f, _2, _1)(x, y); // f(y, x) bind(g, _1, 9, _1)(x); // g(x, 9, x) bind(g, _3, _3, _3)(x, y, z); // g(z, z, z) bind(g, _1, _1, _1)(x, y, z); // g(x, x, x) note that, in last example, function object produced bind(g, _1, _1, _1) not contain references arg...

objective c - simple NSMutable array question -

umm simple question here: i have instance of nsmutablearray declared in header nsmutablearray *day19; @property (nonatomic, retain) nsmutablearray *day19 implementation: @synthesize day19; in viewdidload self.day19 = [[nsmutablearray alloc] init]; in mymethod want add objects array i: nsobject *newobject = [[nsobject alloc] init]; [day19 addobject:newobject]; however... when check day19 array there nothing in it. if conversely add newobject temparray within mymethod scope , set day19 array temparray, day19 has objects. super basic know must confused morning or something... thanks help in viewdidload self.day19 = [[nsmutablearray alloc] init]; in mymethod want add objects array i: nsobject *newobject = [[nsobject alloc] init]; [day19 addobject:newobject]; however... when check day19 array there nothing in it. if conversely add newobject temparray within mymethod scope , set day19 array temparray, day19 has objects. let me gues...

regex - PHP: preg_split -

i need on regular expression here. i want php able split string in sections of arrays such substring enclosed <%me %> in own slot. so example, hi there how <%me date(); %> => {"hi there how ", "<%me date(); %>} hi there how you<%me date(); %> => {"hi there how you", "<%me date(); %>} hi there how you<%me date(); %>goood => {"hi there how you", "<%me date(); %>, "good" hi there how you<%me date(); %> => {"hi there how you", "<%me date(); %>}, " good"} note white space won't stop tags getting parsed in. on capturing splitting delimiter in preg you can use preg_split_delim_capture split on , capture delimiter. remember put delimiter in capturing group (…) work properly. here's example: $text = 'abc123xyz456pqr'; $parts = preg_split('/(\d+)/', $text, -1, preg_split_delim_capture); print_r(...

php - How To Discover RSS Feeds for a given URL -

i url user. need know: a) url valid rss feed? b) if not there valid feed associated url using php/javascript or similar (ex. http://techcrunch.com fails a), b) return rss feed) edit: see answer below found wanted: google's ajax feed api has load feed , lookup feed function (docs here ). a) load feed provides feed (and feed status) in json b) lookup feed provides rss feed given url theres find feed function searches rss feeds based on keyword. planning use jquery's $.getjson

Recovering from a broken TCP socket in Ruby when in gets() -

i'm reading lines of input on tcp socket, similar this: class bla def getcmd @sock.gets unless @sock.closed? end def start srv = tcpserver.new(5000) @sock = srv.accept while ! @sock.closed? ans = getcmd end end end if endpoint terminates connection while getline() running gets() hangs. how can work around this? necessary non-blocking or timed i/o? you can use select see whether can safely gets socket, see following implementation of tcpserver using technique. require 'socket' host, port = 'localhost', 7000 tcpserver.open(host, port) |server| while client = server.accept readfds = true got = nil begin readfds, writefds, exceptfds = select([client], nil, nil, 0.1) p :r => readfds, :w => writefds, :e => exceptfds if readfds got = client.gets p got end end while got end end and here client tries break server: require 'socket...

user interface - How to determine the size of the button portion of a Windows radio button -

i'm drawing old school (unthemed - themed radios whole other problem) radio buttons myself using drawframecontrol: drawframecontrol(dc, &rectradio, dfc_button, ischecked() ? dfcs_buttonradio | dfcs_checked : dfcs_buttonradio); i've never been able figure out sure fire way figure out pass rect. i've been using 12x12 rectangle i'de windows tell me size of radio button. drawframecontrol seems scale radio button fit rect pass have close "right" size of radio looks off other (non-owner drawn) radios on screen. anyone know how this? this page shows sizing guidelines controls. note sizes given in both dlu (dialog units) , pixels, depending on whether placing control on dialog or not: http://msdn.microsoft.com/en-us/library/aa511279.aspx#controlsizing i thought getsystemmetrics api might return standard size of common controls, didn't find anything. there might common control specific api determine sizing.

javascript - iframe wikipedia article without the wrapper -

i want embed wikipedia article page don't want wrapper (navigation, etc.) sits around articles. saw done here: http://www.dayah.com/periodic/ . click on element , iframe displayed , links article (no wrapper). how'd that? seems javascript handles showing iframe , constructing href after browsing pages javascript ( http://www.dayah.com/periodic/script/interactivity.js ) still can't figure out how url built. thanks. the periodic table example loads printer-friendly version of wiki artice iframe. http://en.wikipedia.org/wiki/potasium ? printable=yes it's done in function click_wiki(e) (line 534, interactivity.js) var article = el.childnodes[0].childnodes[n_name].innerhtml; ... window.frames["wikiframe"].location.replace("http://" + language + ".wikipedia.org/w/index.php?title=" + encodeuricomponent(article) + "&printable=yes");

c# - Is there a Transformation engine or library using .NET? -

we're looking transformation library or engine can read input (edifact files, csv, xml, stuff that. files (or webservices results) contain data must transformed known business object structure.) data should transformed existing business object using custom rules. xslt both complex (to learn) , simple (not enough features) can recommend c# library or engine? have seen altova mapforce can send out dozens of people build / design own transformations without having pay dozens of altova licenses. if think xslt difficult you, think can try linq xml parsing xml files. integrated in .net framework, , can use c# (or, if use vb.net 9.0, better because of xml literals) instead of learning language. can integrate existing application without effort , withouth paradigm mismatch between language , file management occurs xslt. microsoft linq xml sure, it's not framework or library parsing files, neither xslt is, so...

erlang - Merging records for Mnesia -

i trying refactor code have software collects current status of agents in call queue. currently, each of 6 or events listen to, check in mnesia table if agent exists , change values in row depending on event or add new if agent doesn't exist. have mnesia transaction in each event , of course bunch of repeated code checking existence of agents , on. i'm trying change there 1 function change_agent/2 call events handles me. my problems of course records.... find no way of dynamically creating them or merging 2 of them or anything. preferably there function call like: change_agent("001", #agent(id = "001", name = "steve")). change_agent("001", #agent(id = "001", paused = 0, talking_to = "none")). i wrote code while ago merges 2 records. not entirely dynamic, whith macros use several records. it works this: merge/2 function takes 2 records , converts them lists empty record reference (the record type d...

c - Asynchronous APIs -

when trying implement asynchronous api calls / non-blocking calls, know little in plain-c application have, read apm (asynchronous programming model) 'delegates'. want call 1 api f1() functionality(which takes long time 8-10 seconds), call api f1() , forget it, , continue doing other work, e.g. i/o fetch data next call of f1() or functionality not dependent on result of f1() . if 1 has used apm model of programming, looking @ concise explanation implementing non-blocking calls. is there other way of implementing asynchronous apis , other library/framework might in this? you need create multi-threaded (or multi-process) application. f1() api needs spawn thread (or process) process data in separate execution space. when completes, f1() routine needs signal main process execution done (signal(), message queues, etc).

Setting the namespace of a WinForms UserControl in VB.NET -

how define usercontrols being in namespace below project namespace, ie. [rootnamespace].[subsectionofprogram].controls? edit due camainc's answer: have constraint have have code in single project. edit finalise question: suspected isn't possible required camainc's answer nearest solution. i'm not sure if asking, how it. we namespace of our projects in consistent manner, user controls no different. namespace using project settings window, although through combination of project window , in code. each solution gets namespace this: [companyname].[solutionname].[projectname] so, our user controls in project called "controls," have namespace of: ourcompany.thissolution.controls if have controls might span several different solutions, namespace so: ourcompany.common.controls then, in our code import library, or add project solution. imports ourcompany imports ourcompany.common imports ourcompany.common.controls we name folders ...

functional programming - How to define and use static variables in F# class -

is there way have mutable static variable in f# class identical static variable in c# class ? you use static let bindings (note: while necessary times, it's none functional): type staticmembertest () = static let mutable test : string = "" member this.test get() = test <- "asdf" test

c# - Applying AOP -

i've been using basic aop style solutions cross-cutting concerns security, logging, validation, etc. solution has envolved around castle windsor , dynamicproxy. i've gone down route because can apply using boo based dsl , keep code clean of attributes. told @ weekend have @ postsharp it's supposed "better" solution. i've had quick @ postsharp, i've been put off attribute usage. has tried both solutions , care share experiences? i looked @ castle-windsor short time (yet) can't comment on did use postsharp. postsharp works weaving @ compile time. ads post-compile step build modifies code. code compiled if programmed cross cutting concerns code. bit more performant runtime weaving , because of use of attributes postsharp easy use. think using attributes aop isn't problematic using di. that's personal taste. but... if use castle dependency injection don't see reason why shouldn't use aop stuff. think though aop @ ...

xml - PHP Increase Indentation of DOMDocument->saveXML? -

i need increase indentation of formatted xml file 4 spaces 2 tried using regex powered xml formatter forgot indent closing tags on new line. what options have, using preg_replace seems best option, search regex /( {2}^anything_except_space)/ that's far can seem get. thanks, xeross preg_replace('/^[ ]+(?=<)/m','$0$0',$string);

using load() to load page that also uses jQuery -

i'm trying load page edit form inside dialog (ui.dialog). can load page fine external (i'm using asp.net) page. the problem inside of "popup" form, need $(function() {my function here}); syntax stuff when page loads, along registering .fn extensions dynamic dropdowns using ajax calls. i have created don't think these being included, , $(function) not being called. is possible or need find way of accomplishing need do? if need load form via ajax javascript stuff in $.ajax callback itself. so, load popup form this: $.ajax({ //... success: function(text) { // insert text container // code $(function() {}); } });

osx - What facets have I missed for creating a 3 person guerilla dev team? -

sorry windows developers out there, solution macs only. this set of applications accounts for: usability testing, screen capture (video , still), version control, task lists, bug tracking, developer ide, web server, blog, shared doc editing on web, team , individual chat, email, databases , continuous integration. assume team members provide own machines, , 1 person has spare old computer source repository , web server. under $200 bucks. usability silverback licenses = 3 x $49.95 "spontaneous, unobtrusive usability testing software designers , developers." source control server , clients (multiple options) subversion = free subversion open source version control system. versions (currently in beta) = free versions provides pleasant work subversion on mac. diffly = free "diffly tool exploring subversion working copies. shows files changes and, clicking on file, shows highlighted view of changes file. when ready commit diffly makes easy sele...

c - When is "undefined" fatal or just warning? -

test.c(6) : warning c4013: 'add' undefined; assuming extern returning int i've encountered many times when undefined function report error ,thus stopping building process. why time warning? perhaps code in c++, , c program. c++ stricter c; won't let call undeclared functions.

c# - How to get ObjectSet<T>'s entity key name? -

i've created generic objectset<t> in generic repository. what name of entitykey of objectset<t> can use in datacontext.getobjectbykey . i've searched around , dug deep, can't seem find value anywhere in objectset class. i looked while ago nice way , failed find one. end building getentitybykey extension method somewhere , within that, contatenating strings build entity keys trygetobjectbykey calls. general idea building entity key goes this: internal class program { private static void main(string[] args) { var dc = new adventureworkslt2008entities(); object c; dc.trygetobjectbykey(getentitykey(dc.customers, 23), out c); var customer = c customer; console.writeline(customer.emailaddress); } private static entitykey getentitykey<t>(objectset<t> objectset, object keyvalue) t : class { var entitysetname = objectset.context.defaultcontainername + "." + o...

haskell - Int vs Integer in class instance -

class visible tostring :: -> string size :: -> int inttostring :: (integral t) => t -> string inttostring 0 = "0" inttostring 1 = "1" inttostring 2 = "2" inttostring 3 = "3" inttostring 4 = "4" inttostring 5 = "5" inttostring 6 = "6" inttostring 7 = "7" inttostring 8 = "8" inttostring 9 = "9" inttostring n | ((div n 10) == 0) = (inttostring (mod n 10)) | otherwise = (inttostring (div n 10)) ++ (inttostring (mod n 10)) now instance visible int tostring = inttostring size n = length (tostring n) gives me error ambiguous type variable @ prompt if type (tostring 55) but instance visible integer tostring = inttostring size n = length (tostring n) does not. what gives? there 2 things going on here. remember numeric literals in haskell polymorphic. is: x = 55 really means x :: num => x = fromintegral 55 this true number...

How to store unicode in MySQL? -

how store unicode in free edition of mysql? there doesn't seem nvarchar type in sql server. unicode not supported in mysql? tried using text not working. you need choose utf8_* character set table. text , memo fields automatically stored in utf-8. support utf-16 coming in mysql 6.

java - Best practice to store .jar files in VCS (SVN, Git, ...) -

i know, in time of maven not recommended store libraries in vcs, makes sense, though. my question how best store them - compressed or uncompressed? uncompressed larger, if replaced couple of times newer ones, maybe stored difference between 2 uncompressed .jar files might smaller difference of compressed ones. did make tests? best practice store .jar files in vcs (svn, git, …): don't. it make sense in cvcs (centralized vcs) svn, can handle millions of files whatever size is. it doesn't in dvcs, 1 git (and its limits ): binary files don't fit vcs . by default, cloning dvcs repo all of history, jar versions. slow , take lot of disk space, not matter how jar compressed. try play shallow cloning , that's highly unpractical. use second repository, nexus , storing jars, , reference txt file (or pom.xml file maven project) in order fetch right jar versions. artifact repo more adapted distribution , release management purpose . all being sai...

html - Do I have always use .css files? -

are .css files needed? or may have .css "basic" file , define other style items inside html page? does padding , borders , on have defined in .css file stored separately, or may embed html page? it technically possible use inline css formatting exclusively , have no external stylesheet. can embed stylesheet within html document. best practice in web design separate out css separate stylesheet. reason css stylesheet exists purpose of defining presentation style of document. html file exists define structure , content of document. , perhaps may have javascript files exist add additional behavior document. keeping presentation, markup, , behavior separate creates cleaner design. from practical perspective, if have single external css stylesheet browser can cache it. if multiple pages on site have same , feel, can use same external stylesheet needs downloaded once web browser. make network bandwidth bills lower creating faster end user experience. ...

windows - MSI installer: Adding multiple properties to SecureCustomProperties -

i'm looking way add multiple properties securecustomproperties value in .msi installer's property table. i've tried comma delimiting, semi-colon delimiting, , space delimiters. none of above seem work. hints? ok, there ... semi-colon delimited no spaces . appears trick.

java - Stopping looped notifications with VetoableChangeListener -

i have problem design of vetoablechangelistener . implement vetoablechangelistener interface listen changes of property in model class, when model fires vetoablechange(propertychangeevent evt) throws propertyvetoexception …i try save change in db, fail (by sqlexception , example). if fails throw propertyvetoexception revert changes in model. the model delegating in vetoablechangesupport (jdk class), when receives propertyvetoexception catches , notifies revert vetoablechangelistener , oldvalue / newvalue interchanged (later rethrows exception), event comes class again , try save in db again, etc... i have workaround model not change until nobody throws propertyvetoexception , in vetoablechangelistener first check if data i'm going save in database not equal data in model, if it's equal ignore change. is there another, better workaround? your "workaround" not workaround in fact sounds proper solution me: confirming there in fact change curr...

Developing an operating system for the x86 architecture -

i planning develop operating system x86 architecture. what options of programming languages have? what types of compilers there available, preferably on windows environment? are there sources me learn more operating system development? is better test operating system on virtual machine or on physical hardware? any suggestions? for final year project in collage developed small x86 os virtual memory manager, virtual file system , preemptive multitasking. made open source , code heavily commented, check out source forge page at: https://github.com/stephenfewer/nonameos from experience can recommend following: you will need x86 assembly language various parts, in unavoidable, can kept minimum. running c code, proven choice os development. once have sort of memory manager available can go c++ if (you need kind of memory manager things new , delete). no matter language choose still need assembly & c bring system boot bios leaves useable form. ultimately, ...

command line arguments - Storing ksh input array to variable and passing to another script -

i have modify existing ksh script looks @ command-line arguments using 'shift', , empties $@, want pass original arguments second script afterwards. in mainline case can coping $@ variable , passing second script, can't work quoted command-line arguments. if have script called 'printer' below: #!/bin/ksh input=$@ echo "printing args" until [[ $# -eq 0 ]];do echo $1 shift done ./printer2 $input and printer2 below: #!/bin/ksh echo "printing second args" until [[ $# -eq 0 ]];do echo $1 shift done i output of ./printer first second "third forth" to : printing args first second third forth printing second args first second third forth i've tried various combinations of quotes around variables (both in assignment of $input , when passing printer2) can't figure out. can help? ok think i've found solution after awful lot of trial , error. assigning $input this: set -a input ...

c# - Using a webservice with vbscript - "An operations error occurred." -

i've been fiddling bit c# webservices , vbscript. things work fine if trigger services manually through ie directly on webserver, when try run same service vbscript throws "an operations error occurred." exception. the service pretty simple, create computer object in active directory. directoryentry container = new directoryentry("ldap://ldapgw/" + ldaplocation); directoryentries computerou = container.children; directoryentry computerobject = computerou.add("cn=" + computername, "computer"); computerobject.invokeset("samaccountname", computername); computerobject.invokeset("description", "reserved"); computerobject.invokeset("useraccountcontrol", 4128); computerobject.commitchanges(); it's triggered way: set soap = createobject("msxml2.xmlhttp") 
 soap "post", url, false, username, password 
 soap.setrequestheader "content-type", "text/xml; char...

.net - How to add text in Deep Zoom Composer? -

i want compose own project in deep zoom composer know on how add text per image zoomed in hard rock memorabilia i want consume it, using silverlight 4.0 as notice, under right pane, has description image. thank you. this http://www.freeimagehosting.net/uploads/43b14a3d53.png this doable. i've done similar , worked great. following example show information specific clicked image. can modify depending on if want information dispayed on mouseover, click, or when zoomed. it's entirely you. first off, add multiscaleimage canvas... <multiscaleimage x:name="deepzoomobject" source="/generatedimages/dzc_output.xml" /> ...and somewhere else on canvas, add textblock used display information: <textblock x:name="tbinfo" /> next, create class hold information each "tile", add dummy information, , add bunch of tiles list: public class tiledetail { public int index { get; set; } public ...

tfs2008 - TFS reports on daily basis -

my team using tfs 2008 , conchango template scrum. use sprint burndown chart, sprint view , sprint task board reports track status of tasks on daily basis. burndown chart , sprint view shown on lcd tv screen. these reports manualy exported daily pdf files. is there utility can pull reports daily @ scheduled interval , export them pdf? if reports available in report server, need create subscription. go report server (e.g. http://tfs/reports ) find report , click on run once. click on "subscriptions" tab. fill out details, , should go. if reports available in vs ide, might need re-create them in ssrs.

java - Struts / Internationalization (I18N) -

i've got web app working on, , have each of languages broken *_lang.properties. if change browser language, appropriate language appears in ui great, requires browser (both ff , ie) restarted. other websites recognize language change page refresh. is there missing in order not force browser restart? most language settings stored in session on server side. should able change part of code responsible loading resource bundles check request headers see locale's resource bundle should loaded.

validation - XHTML and code inside textareas -

on site of mine in textarea used submission, have code can appear along lines of following: <textarea><p>text</p></textarea> when validating (xhtml 1.0 transitional), error arises, line 88 column 50 - error: document type not allow element "p" here if not valid method, expected? workaround onload javascript event, seems needless. regardless doesn't affect output, i'd rather site validate. is there reason you're trying put <p> within <textarea> ? found out it's not valid. if it's display purposes (ie, showing code) should translated: <textarea>&lt;p&gt;text&lt;/p&gt;</textarea> beyond validation issues, allowing arbitrary tags (which not encoded above) display can huge security issue. it's paramount make sure user supplied input has been sanitized before displayed.

scrum - Is our agile plan standard? -

we have been trying scrum while , trying formalize within our own version of agile application development. here's how our current process works. there 2 main drawbacks stands right now. wanted input on whether have similar approach , if community has practical tips impediments have. scrum team = 4 developers, 2 qa, 1 tech writer, 1 po(pm), 1 scrum master (engg dir) release = 3 sprints sprint = 2 weeks po , customers create product backlog of user stories , related acceptance criteria. 1 week sprint planning @ start of each iteration day 1# estimate sprint backlog , agree on priority day 2-5# scrum team discuss stories , work on details of each story in sprint backlog (get details on story, process flows if any, identify ue guidelines apply, details ui items/fields/widgets , behavior if specific required, understand acceptance criteria , create tests) 2 week sprint 15 min daily scrum repeat 3 week cycle the 2 major drawbacks we're having in are: the d...

javascript - need to use variable inside a function globally -

i have following javascript code inside function trying soft_left , soft_top variable used in other functions. having little if success. shown relevant code. function drawcart() { $(".soft_add_wrapper").multidraggable({"containment":"#content"}); $(".soft_add_wrapper").draggable({stop: function(event, ui) { soft_left = $(".ui-draggable").css('left'); soft_top = $(".ui-draggable").css('top');} } when put alert(soft_top) alerts value. $(".soft_add_wrapper").draggable({stop: function(event, ui) { soft_left = $(".ui-draggable").css('left'); soft_top = $(".ui-draggable").css('top'); alert(soft_top);} when put alert here nothing. function drawcart(index) { $(".soft_add_wrapper").multidraggable({"containment":"#content"}); $(".soft_add_wrapper").draggable({stop: function(event, ui) { s...

.net - Password hashing in a C# Windows app, absent ASP.NET's FormsAuthentication? -

my win form app doesn't seem formsauthentication, i'm totally new hashing convert welcome. thanks. //write hash protected textbox tbpassword; protected literal lihashedpassword; { string strhashedpassword = formsauthentication.hashpasswordforstoringinconfigfile(tbpassword.text, "sha1"); lihashedpassword.text = "hashed password is: " + strhashedpassword; } //read hash string struserinputtedhashedpassword = formsauthentication.hashpasswordforstoringinconfigfile( tbpassword.text, "sha1"); if(struserinputtedhashedpassword == getusershashedpasswordusingusername(tbusername.text)) { // sign-in successful } else { // sign-in failed } using system.security.cryptography; public static string encodepasswordtobase64(string password) { byte[] bytes = encoding.unicode.getbytes(password); byte[] inarray = hashalgorithm.create("sha1").computehash(bytes); return convert.tobase64string(inarray); }

.net - dbmetal visual metal error:"magma string must not be empty" -

i trying generate classes linq mysql dbmetal / visual metal , keep running error: "magma string must not empty"... i've googled, i've recompiled locally, checked references etc. , don't want start debugging this... had same issue before or knows of way generate classes? thanks actually, believe or not, caused field names in table ending underscore (_)... future reference, might save else many hours...

Is there a CSS selector by class prefix? -

i want apply css rule element 1 of classes matches specified prefix. e.g. want rule apply div has class starts status- (a , c, not b in following snippet): <div id='a' class='foo-class status-important bar-class'></div> <div id='b' class='foo-class bar-class'></div> <div id='c' class='foo-class status-low-priority bar-class'></div> some sort of combination of: div[class|=status] , div[class~=status-] is doable under css 2.1? doable under css spec? note: know can use jquery emulate that. it's not doable css2.1, possible css3 attribute substring-matching selectors (which are supported in ie7+): div[class^="status-"], div[class*=" status-"] notice space character in second attribute selector. picks div elements class attribute meets either of these conditions: [class^="status-"] — starts "status-" (obviously). [class*=" ...

css - HTML to create tournament final four bracket? -

is there website can create html final 4 bracket? or there html out there create automatically , can fill in specifics? this nba playoff bracket built html/css , the blog post it may provide inspiration.

qt - What's difference between class QWebView; vs. #include <QWebView> -

what's difference between these defining; #include "qwebview" class qwebview; class qwebview; called forward declaration . means, can't access details of class (like methods/public variables) until type declared. forward declaration, tells compiler that particular type exists , whereas full include tells compiler, methods etc. class provides. if wan't use type in declaration, it's fine. soon, call method on variable of type qwebview , error, if don't include full declaration.

delphi - Add File Summary tab data in runtime in NTFS in WinXP SP3 -

i have given tryng figure out reason of issue, here story , hope give tip... as develop unique app ( http://code.google.com/p/sedev ) , therefore need polish it. have add file summary ( useful info in opinion ) created files app, decided go ntfs compatible structure edit : code snippet in problem occurs: if (fileexists(baselocation + leftstr(getsswdata, length(getsswdata) - 1) + '.vkp') = true) // add ntfs descriptive information output file try setfilesummaryinfo (pwidechar(baselocation + leftstr(getsswdata, length (getsswdata) - 1) + '.vkp')); // in testcase files full path is: c:\documents , settings\kludge\desktop\sedevrpg\sedev_rpg_o_710.vkp showmessagepos('patch created successfuly!' + #13#13 + 'please verify created data www.se-developers.net.', paramstr2x, paramstr3y); messagebeep(0); except // exception handler not fire o...

c# - Cannot use local variable before it is declared ASP.NET -

i have code this: [acceptverbs(httpverbs.post)] public actionresult save([bind(prefix="")]person person) { string s = person.property; /* ... */ } but throws error: "cannot use local variable 'person' before declared". what simple thing missing? it receiving error because same variable being declared later in same code block. according compiler rules, variable reference refer default matching declaration withing same block if same declaration exists outside of block in in logical scope flow. so in short, check see if variable isnt being declared later on(a couple of lines down) in same application block.

Membership API redirects me to login page after successful authentication -

i'm using membership api forms authentication. sometimes, when user try go login.aspx page (for example www.mysite.com/login.aspx ), there redirect event happening , address bar shows www.mysite.com/login.aspx?returnurl=login.aspx i'm draw attention that: user enter login , password , redirected login page again. i have tried reproduce bug under debug session, couldn't. tell me please why happening? are having roles problems? user have access return url page? without more information, can't suggest answers, might find so:62013 or forums:1318557 or this blog post helpful. if not, take in trace log , see if you're ever getting return url. in problem i'm having @ moment can see: 19 9/7/2010 5:50:03 pm /login.aspx 302 post view details 20 9/7/2010 5:50:03 pm /default.aspx 302 view details 21 9/7/2010 5:50:03 pm /login.aspx 200 view details so i'm getting successful login, return url redirecting ...

html - A:Hover problem in chrome -

i seem having problem styling links chrome, yet works in safari. i have normal styling this: a:link { color:#000; text-decoration:none; } a:hover { color:#c40000; } etc.... now works on of links doesn't work on them all, can work on other ones drilling down in div.. example: .col a:hover { color:#c40000; } i have searched haven't found solutions apart setting styles every div has link in it... seems stupid. thanks lot. update - checked on laptop , osx issue, works fine on chrome on vista laptop not on imac ;/ try using: a:hover { color:#c40000 !important; } the !important keyword override previous styles.

internet explorer - Opening an URL with request parameters in IE using Java Runtime class -

i've code block open given url in default browser. i've problem opening urls parameters in ie, when default browser firefox works fine, seems ie removing parameters!!! other way solve problem? code using is: runtime.getruntime().exec("rundll32 url.dll,fileprotocolhandler \"" + url + "\""); i've problem urls " ...test.html?param1=val1&param2=val2 " in ie thanks, rakesh.a if using java 1.6, try following instead: desktop.getdesktop().browse(new uri(url)) this ( java.awt.desktop#browse(..) ) platform independent way of opening default browser.

javascript - Jquery validation stopped working -

here's call validate function. works fine code. $('#createform').validate(function () { }); but when try modify bit, whole validation stop working: $('#createform').validate(function () { errorplacement: function(error, element) { error.insertafter(element); }, debug:true }); any idea? you shouldn't have function() in there. change to: $('#createform').validate( { errorplacement: function(error, element) { error.insertafter(element); }, debug:true } ); the stuff in { } options. it's not function :)

How do I get the underlying type of a proxy object in java? -

i'd access classname of underlying class instance of java.lang.reflect.proxy . is possible? you can invocationhandler proxy created, calling proxy.getinvocationhandler(proxy) note in case of java.lang.reflect.proxy there no underlying class per se. proxy defined by: interface(s) invocation handler and wrapped class passed concrete invocation handler.

performance - How do I count bytecodes in Python so I can modify sys.setcheckinterval appropriately -

i have port scanning application uses work queues , threads. it uses simple tcp connections , spends lot of time waiting packets come (up half second). threads don't need execute (i.e. first half sends packet, context switch, stuff, comes thread has network data waiting it). i suspect can improve performance modifying sys.setcheckinterval default of 100 (which lets 100 bytecodes execute before switching thread). but without knowing how many bytecodes executing in thread or function i'm flying blind , guessing values, testing , relying on testing shows measurable difference (which difficult since amount of code being executed minimal; simple socket connection, network jitter affect measurements more changing sys.setcheckinterval). thus find out how many bytecodes in code executions (i.e. total function or in execution of thread) can make more intelligent guesses @ set sys.setcheckinterval to. for higher level (method, class) wise, dis module should help. ...

How can I use more than one sprite sheet? cocos2d/iPhone -

i'm trying use more 1 sprite sheet because can't fit them on 1 , having 2 makes ordering them easier (sprite sheet 1 sprites in , have lower zorder). i'm doing: spritesheet1 = [[ccspritesheet spritesheetwithfile:@"spritesheet1.png" capacity:3] retain]; [[ccspriteframecache sharedspriteframecache] addspriteframeswithfile:@"spritesheet1.plist"]; [self addchild:spritesheet1]; spritesheet2 = [[ccspritesheet spritesheetwithfile:@"spritesheet2.png" capacity:4] retain]; [[ccspriteframecache sharedspriteframecache] addspriteframeswithfile:@"spritesheet2.plist"]; [self addchild:spritesheet2]; ccsprite *sprite = [ccsprite spritewithspriteframename:@"sprite1.png"]; the last line crashes error: terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'invalid spriteframe sprite' sigabrt am not allowed cache more 1 sprite sheet? if not, there efficient way handle this? if...