Posts

Showing posts from June, 2015

How can I display just a portion of an image in HTML/CSS? -

let's want way display the center 50x50px of image that's 250x250px in html. how can that. also, there way css:url() references? i'm aware of clip in css, seems work when used absolute positioning. one way set image want display background in container (td, div, span etc) , adjust background-position sprite want.

msbuild - Best build process solution to manage build versions -

i run rather complex project several independent applications. these use couple of shared components. have source tree looking below. my project application a shared1 shared2 application b application c all applications have own msbuild script builds project , shared resources needs. run these builds on cruisecontrol controlled continuous integration build server. when applications deployed deployed on several servers distribute load. means it’s extremely important keep track of build/revision deployed on each of different servers (we need have current version in dll version, example “1.0.0.68”). it’s equally important able recreate revision/build been built able roll if didn’t work out intended (o yes, happends ...). today we’re using sourcesafe source control possible change if present reasons (ss it’s working ok so far). another principle try follow it’s code been build , tested integration server deploy further. "crusiecontrol build labels" sol...

Session management in Azure application -

link texti developed simple cloud application default webrole , implemented following steps. 1.created new cloud service application 1 default webrole1 2. extracted “ aspproviders.dll” , added reference current webrole1. 3. added new web form existing web role , named login.aspx 4. design page of login.aspx edit below 5. below line added in page load event of default.aspx response.write("hello, " + server.htmlencode(user.identity.name)); 6. edited web.config following changes ................. <!--below lines added avoid error occured related insecure end points connection --> ................. ................. ................ ................ ................. <sessionstate ...

hardware - What's your experience with Flash drives? -

emc marketing solid state flash drives , project thinking moving direction in future. have experience replacing traditional disk storage flash drives? besides price, have experienced downsides technology? i've used machines solid state drives in place of conventional hard drives. there seems no real benefit. think faster; not. think they'd consume less power, doesn't seem case either. the major downside have finite number of available writes. continually writing disk (as operating systems do) wear ssd out faster conventional drive.

c# - Any type mapping with different Id types -

i'm working on event-planning application contacts in phone book. avoiding public virtual , protected stuff, contact class looks like: class contact { //... int32 id { get; private set; } //primary key; string name { get; private set; } //... } a customer asked me handle both own phone book , application's one. thought extract icontact interface contact , , add class internalcontact (this name sucks, know), implementing same interface. problem customer's db uses assigned string primary key, contact ''s id type , internalcontact 's id type different. possible map invitation.contact property using <any> type mapping, id types different? thanks in advance, giulio not sure if asking create classes: interface icontact<t> { t id { get; } } public class contact : icontact<int> { public int id { get; private set; } } public class internalcontact : icontact<string> { public string id { get...

objective c - problem with logging in twitter through my iphone application -

i creating music application in integrating twitter in application when user clicks on particular song , click on twitter tab login page of twitter should displayed. after entering username , password should directed page can enter comment , post it.the problem when click on twitter tab login page diplayed when enter username , password , click on submit not redirect me page can post comment. here code: (ibaction) submit: (id) sender { // g=text3.text.integervalue; u=text1.text; p=text2.text; int flag; nslog(@"username,%d",u); //if((u!=@"") || (p!=@"")) //if((text1.text.length >= 20 && range.length !=0) ||(text2.text.length >= 8 && range.length!=0)) if([text1.text length] != 0 || [text2.text length]!=0) { twitterrequest * t = [[twitterrequest alloc] init]; t.username =[nsstring stringwithformat: @"%@",u]; //nsstring *username=[nsstring stringwithformat:@"%d",u]; t.password= [n...

c++ - C++0x: iterating through a tuple with a function -

i have function named _push can handle different parameters, including tuples, , supposed return number of pushed elements. for example, _push(5) should push '5' on stack (the stack of lua ) , return 1 (because 1 value pushed), while _push(std::make_tuple(5, "hello")) should push '5' , 'hello' , return 2. i can't replace _push(5, "hello") because use _push(foo()) , want allow foo() return tuple. anyway can't manage make work tuples: template<typename... args, int n = sizeof...(args)> int _push(const std::tuple<args...>& t, typename std::enable_if<(n >= 1)>::type* = nullptr) { return _push<args...,n-1>(t) + _push(std::get<n-1>(t)); } template<typename... args, int n = sizeof...(args)> int _push(const std::tuple<args...>& t, typename std::enable_if<(n == 0)>::type* = nullptr) { return 0; } let's want push tuple<int,bool> . how expect work: _pu...

sql server - SQL set-based range -

how can have sql repeat set-based operation arbitrary number of times without looping? how can have sql perform operation against range of numbers? i'm looking way set-based loop. know can create small table integers in it, 1 1000 , use range operations within range. for example, if had table make select find sum of numbers 100-200 this: select sum(n) numbers n between 100 , 200 any ideas? i'm kinda looking works t-sql platform okay. [edit] have own solution using sql clr works great ms sql 2005 or 2008. see below. i think short answer question use clauses generate own. unfortunately, big names in databases don't have built-in queryable number-range pseudo-tables. or, more generally, easy pure-sql data generation features. personally, think huge failing, because if did possible move lot of code locked in procedural scripts (t-sql, pl/sql, etc.) pure-sql, has number of benefits performance , code complexity. so anyway, sounds need in general sense ...

Javascript syntax highlighting in vim -

has else found vim's syntax highlighting of javascript sub-optimal? i'm finding need scroll around in order syntax highlighting adjusted, mysteriously drops highlighting. are there work-arounds or ways fix this? i'm using vim 7.1. you might try improved javascript syntax highlighter rather 1 ships vimruntime.

sql - Copying relational data from database to database -

edit : let me rephrase this, because i'm not sure there's xml way describing. yet edit : needs repeatable process, , has able set in way can called in c# code. in database a, have set of tables, related pks , fks. parent table, child , grandchild tables, let's say. i want copy set of rows database database b , has identically named tables , fields. each table, want insert same table in database b. can't constrained use same primary keys. the copy routine must create new pks each row in database b, , must propagate child rows. i'm keeping same relations between data, in other words, not same exact pks , fks. how solve this? i'm open suggestions. ssis isn't ruled out, doesn't me it'll exact thing. i'm open solution in linq, or using typed datasets, or using xml thing, or that'll work in sql server 2005 and/or c# (.net 3.5). best solution wouldn't require ssis, , wouldn't require writing lot of code. i'll conc...

mysql - Finding field with longest length in a column -

how find field longest length of specific column in mysql table? mysql has lot of string functions can use: select length(col) my_len my_table order my_len desc limit 1 more funky version (it works): select max(length(col)) my_table

terminology - What is the purpose of a Data Access Layer? -

i started project long time ago , created data access layer project in solution have never developed in it. purpose of data access layer? there sources learn more data access layer? in 2 words: loose coupling to keep code use pull data data store (database, flat files, web services, whatever) separate business logic , presentation code. way, if have change data stores, don't end rewriting whole thing. these days, various orm frameworks kind of blending dal other layers. typically makes development easier, changing data stores can painful. fair, changing data stores pretty uncommon.

Jquery: display div based on the selection from DropDownList -

i have dropdownlist (asp.net) , when user change selection , want display div based on selected dropdownlist. i have code here... <asp:dropdownlist id="ddlfilter" runat="server" width="221px"> <asp:listitem text="select..." value=""></asp:listitem> <asp:listitem text="date" value="date"></asp:listitem> <asp:listitem text="subject" value="subject"></asp:listitem> <asp:listitem text="status" value="status"></asp:listitem> </asp:dropdownlist> &nbsp; <asp:button id="btnsearch" text="search" runat="server" /> <div id="divdaterangesearch"> <div style="float: left"> <asp:label id="lbldaterange" runat="server" text="date range"></asp:l...

c# - LINQ: Sorting on many columns dynamically -

i have query of iqueryable , want apply sorting dynamically, sorting can on many columns (asc or desc). i've written following generic function: private iqueryable<t> applysorting<t,u>(iqueryable<t> query, expression<func<t, u>> predicate, sortorder order) { if (order == sortorder.ascending) { { return query.orderby<t, u>(predicate); } } else { { return query.orderbydescending<t, u>(predicate); } } } sortorder simple enum 2 values: ascending , descending then call function in loop, each column user requested sorting. i've noticed fails because sorts on last column used, ignoring other ones. then found there's 'thenby' method on iorderedqueryable valid usage is: var q = db.mytype.orderby(x=>x.col1).thenby(y=>y.col2); //etc. but how can make generic? tried test if que...

c# - What is the best way to handle a large table of data? -

i've been playing visual c# lately , have formulated project idea now. i'd able read in .csv file , display easy-to-read reports based on data contained within. as i'm new c#, , real programming @ all, wondering best or recommended way deal large amounts of data (with easy, flexible manipulation data report generation)? gridviews , data sets into. bet there's other ones pretty straightforward , works needs. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx

iphone - WebKit CSS transformations and animations in Javascript -

i'm working on iphone web application. starded playing webkit-transform , webkit-animation css rules. i've questions: example, there real advantage in using these instead of, say, jquery.animate(...)? resulting animations don't seem accelerated , fast. let's explain better: i've series of images have move on screen, gallery... set each image css rules this: -webkit-transition-property: left, top, right, bottom, width; -webkit-transition-duration: 200ms; then change style.left , style.top of each element want move new coordinates. result not fast expected. fast more or less jquery (not fluid @ all). i've seen there -webkit-animation , -webkit-transform still don't understand how use them properly. first 1 lets me move things around, doesn't generate animation, use following code: var trans = "translate(" + x + "px," + y + "px)"; element.style.webkittransform = trans; with element moves around, without animation....

html - CSS overlay problems, showing a splash page over flash element -

check out link below, can see overlay hidden behind flash element. however, blue bar 'continue' button appears above everything. know css changes need make overlay appear above below it? background loads iframe. thanks. http://honr.it/s4j i can't add wmode="transparent" embed tag, since have no control on page loaded in iframe. afaik need set wmode of flash player "transparent" in order work. along need css: #popup { position: relative; z-index: 1; } #flash-player { position: absolute; z-index: 0; } basically, z-index property needs have value lower popup.

asp.net mvc 2 - Is there End httpRequest event -

i have share objectcontext (from ef4) between many objects, i'm creating 1 context per 1 httprequest (i haven't found better way this), there little problem... when use using (objectcontext ctx = new ...) {} it disposes context after closing bracket. how should dealt when context lives httprequest? can call event after httprequest ends? or event when response sent? not disposing context may cause errors in situation when 1 context created per httprequest? sure, there's endrequest event . note di frameworks you, automatically. if you'd prefer yourself, can handle event in global.asax.cs .

How to move/drag an entire android view that contains a bunch of shapes inside? -

i know how drag ball around extending view , overriding ondraw , calculating new coordinates , redrawing ball. if have hundreds of shapes inside view , need entire view moved around shapes together. recalculating every single shape doesn't seem feasible. on iphone can draw bunch of things inside view , move entire view , takes care of drawing things inside view me. have recalculate coordinates of view , set position not inside view. possible on android? thanks, steven use canvas.translate() method offset being drawn within ondraw() handler. track translation offsets based on cursor movement or whatever, , use offsets in call translate() . you can similar effect canvas.scale() handle pinch-zoom. don't forget save() , restore() put canvas original state! if want move view around within view, adjust top/left properties , call invalidate() . if complex layout, within relativelayout , use layoutparams position everything.

magento - Recurring Profile and Bundled Item -

i have subscription service people pay monthly for, i’ve setup “virtual product” recurring profile. @ same time, want have can add different 1 time products. accomplish i’ve tried creating “bundled product” different 1 time products , adding “virtual product” “bundled product”. however, when go checkout says “nominal item can purchased standalone only. proceed please remove other items quote.” how allow people subscribe service , purchase products @ same time? note: using paypal website payment pro merchant account. unfortunately hardcoded restriction in mage_paypal code. you can see in mage_sales_model_service_quote::submitall() executes submitnominalitems() contains: $this->_validate(); $this->_submitrecurringpaymentprofiles(); $this->_inactivatequote(); $this->_deletenominalitems(); so, kills cart after submitting nominal items. i'm not sure why that, assume it's due way subscriptions created @ paypal. here code prev...

c# - Changing Foreach Order? -

is there anyway foreach through list end beginning rather beginning end (preferably without reordering list). using system.linq; foreach(var item in source.reverse()) { ... } edit: there 1 more step if dealing list<t> . class defines own reverse method signature not same enumerable.reverse extension method. in case, need "lift" variable reference ienumerable<t> : using system.linq; foreach(var item in list.asenumerable().reverse()) { ... }

php - Can a model house multiple functions querying different domains? -

i have domain users connects user table, includes information username, first name, , last name. then have domain emails, connects email table because user can have more 1 email. email table consists of fk connect user emails, , other fields address, status, etc. should have different domains separate tables, combine functions, call domains, in models? or maybe can it's not best practice. i new mvc thing , it's hurting brain right now. maybe, hasn't explained enough. question: when mention having "domain", referring user model, , email model? or design pattern? also, (but depends on application) having email database logic inside users model more logical (to me), since don't think going add email addresses without creating user. is, email model depends on user model, , perhaps only on user model, maybe should combined? the way it: put database logic inside models assume way have done it. create library or class place business logi...

c# - Setting Server Bindings of IIS 6.0 Programmatically -

i'm trying set installer register web site. currently, i've got creating application pool , web site under windows server 2003. unfortunately, whenever try modify serverbindings property set ip address, throws exception @ me. first tried because documentation here told me http://msdn.microsoft.com/en-us/library/ms525712%28vs.90%29.aspx . i'm using vb.net, c# answers okay need switch on using c# anyway. siterootde.properties.item("serverbindings").item(0) = "<address>" this throws argumentoutofrangeexception. checked it, , server bindings of size 0. when tried create new entry in list this: siterootde.properties.item("serverbindings").add("<address>") i comexception when try that. i looked @ registered property keys, , serverbindings found. however, when create web site through iis, generates serverbindings correctly , can see it. what need serverbindings appear? edit: moved code on c# , tried it. seems re...

sql - up table set number2 = number where number != "" and set number, number2 = $number where number = "";; -

is possible? update table set number2 = number number != "" , set number, number2 = $number number=""; or need do update table set number2 = number number != ""; update table set number = $number, number2 = number number = ""; i them 2 "separate" statements , not worry trying find clever solution (which clever imnsho). you'll see quoted word "separate" above since decent dbms provide transactional support make 2 of statements one, in terms of atomicity (the in acid). in other words, like: start transaction; update table set number2 = number number != ""; update table set number = $number, number2 = number number = ""; commit transaction; this invariably faster (assuming number indexed) clever solution using per-row functions case , if , on, since 2 fast passes better 1 slow pass :-)

How (and whether) to populate rails application with initial data -

i've got rails application users have log in. therefore in order application usable, there must 1 initial user in system first person log in (they can create subsequent users). i've used migration add special user database. after asking this question , seems should using db:schema:load, rather running migrations, set fresh databases on new development machines. unfortunately, doesn't seem include migrations insert data, set tables, keys etc. my question is, what's best way handle situation: is there way d:s:l include data-insertion migrations? should not using migrations @ insert data way? should not pre-populating database data @ all? should update application code handles case there no users gracefully, , lets initial user account created live within application? any other options? :) try rake task. example: create file /lib/tasks/bootstrap.rake in file, add task create default user: namespace :bootstrap desc "add de...

objective c - How can I tell NSTextField to autoresize it's font size to fit it's text? -

this question has answer here: get nstextfield contents scale 1 answer looking whatever cocoa equivalent of [uilabel adjustsfontsizetofitwidth] is. i've solved creating nstextfieldcell subclass overrides string drawing. looks whether string fits , if doesn't decreases font size until fit. made more efficient , have no idea how it'll behave when cellframe has width of 0. nevertheless enough™ needs. - (void)drawinteriorwithframe:(nsrect)cellframe inview:(nsview *)controlview { nsattributedstring *attributedstring; nsmutableattributedstring *mutableattributedstring; nssize stringsize; nsrect drawrect; attributedstring = [self attributedstringvalue]; stringsize = [attributedstring size]; if (stringsize.width <= cellframe.size.width) { // string small enough. skip sizing. goto drawstring; } ...

What is the lowest-cost, cross-platform approach to parse XML using ksh? -

need parse basic xml (one root element, 3-4 subelements, 1-3 attributes each) ksh script (ideally stick ksh, given script exists , it's trying read configuration created in xml program). i know can use sed , pattern matching, it's not foolproof given input xml change , attributes duplicated on various subelements (or new subelements). so far, i'm thinking of using xslt against xml extract few attributes (for specific elements) ksh script cares individual fields. can use oracle given db-driven product, , oracle installed on our systems, seems bit heavy handed. any other safe approach extract specific attributes input xml in cross-platform manner doesn't require access 3rd-party parser/transformer? you might want take @ pure bash implementation , if keeping in shell script important. that said, other scripting languages such python , perl highly portable, , make life lot easier. perl's xml::twig module, instance, comes end-user script called ...

APIs and Datasets for Natural Languages? -

are there apis , public datasets (dictionaries, phrases) working w/ natural languages? specifically, ones exist working on translation between english , korean? wordnet classic data resource english, semantic relationships.

multithreading - using asynchbeans instead of native jdk threads -

are there performance limitations using ibm's asynchbeans? apps jvm core dumps showing numerous occurences of orphaned threads. im using native jdk unmanaged threads. worth changing on managed threads? in perspective asynchbeans workaround create threads inside websphere j2ee server. far good, websphere lets create pool of "worker" threads, controlling way maximum number of threads, typical j2ee scalability concern. i had problems using asynchbeans inside websphere on "unmanaged" threads (hacked callbacks jms listener via "outlawed" setmessagelistener). "asking it" not using mdbs in first place, have requisites not feet mdb way.

drupal - what is CCK Computed Field? -

explaine me please in simple words cck computed field? a calculated cck field 1 filled in when record saved. actual field in database, rather 1 calculated when shown. i've used create fullname field, when user inputs his/her first , last names. the contents of computed field can like, adamg notes above (although age example isn't 1 because unless record updated, age never change). put in own php code executed when record saved. often don't need computed cck field; calculations/changes can done in module or template.

Programmatically show tooltip in winforms application -

how can programatically cause control's tooltip show in winforms app without needing mouse hover on control? (p/invoke ok if necessary). if using tooltip control on form, can this: tooltip1.show("text display", control) the msdn documentation tooltip control's "show" method has different variations on , how use them.

Help with Windows Geometry in Python -

why commands change window position before , after sleep(3.00) being ignored? if self.selectedm.get() == 'bump': w1 = getsystemmetrics(1) + 200 print w1 w1.wm_geometry("+100+" + str(w1)) w2.wm_geometry("+100+" + str(w1)) w3.wm_geometry("+100+" + str(w1)) w4.wm_geometry("+100+" + str(w1)) self.rvar.set(0) self.rvar2.set(0) self.rvar3.set(0) self.rvar4.set(0) s = self.wm_geometry() geompatt = re.compile(r"(\d+)?x?(\d+)?([+-])(\d+)([+-])(\d+)") m = geompatt.search(s) x3 = m.group(4) y3 = m.group(6) m = int(y3) - 150 p = m + 150 mh = w1 muh = y3 while y3 > m: sleep(0.0009) y3 = int(y3) - 1 self.update_idletasks() self.wm_geometry("+" + str(x3) + "+" + str(y3)) print 1 alp...

c# - Posted models (via jQuery) come back with all properties set to default -

i fetch of data models mvc app , operate on them on client side. when i'm done whatever user doing post model/array of models server. in specific scenario, i'm posting array 2 models in app. can see values of model in http...but when they're deserialized , passed controller come out "empty" -- is, properties set default values, collection has 2 elements in it. any ideas cause of this? sounds mvc isn't able deserialize http typed objects, can't see why "looks" ok in http. there process missing? if it's important have tried "receiving" data formal parameters of type ilist , mymodel[]...doesn't seem help. hard me come specific code, here goes -- perhaps help // client side var models = new array(); for(var in selectedmodels) { var item = selectedmodels[i]; if(typeof(item) != 'function') { models.push(item); } } $.ajax({ type: "post", data: { mymodels: models, name: ...

How to check if a String contains another String in a case insensitive manner in Java? -

say have 2 strings, string s1 = "abbacca"; string s2 = "bac"; i want perform check returning s2 contained within s1 . can with: return s1.contains(s2); i pretty sure contains() case sensitive, can't determine sure reading documentation. if suppose best method like: return s1.tolowercase().contains(s2.tolowercase()); all aside, there (possibly better) way accomplish without caring case-sensitivity? yes, contains case sensitive. can use java.util.regex.pattern case_insensitive flag case insensitive matching: pattern.compile(pattern.quote(s2), pattern.case_insensitive).matcher(s1).find(); edit: if s2 contains regex special characters (of there many) it's important quote first. i've corrected answer since first 1 people see, vote matt quail's since pointed out.

user interface - Game UI HUD -

what tools , techniques making in game ui? i'm looking things artists-types create , animate game hud (heads display) ui , can added game engine real time playback. if working middleware environment torque or unity3d, include gui framework build on. flash ideal tool, use in other flash or shockwave3d game need purchase scaleform too, expensive , isn't easy hold of indie developers. wpf , silverlight promising purpose, far haven't been set game integration. unfortunately, many developers solution roll own ui components scratch.

vba - Extracting Macros in a Word Document to a text file from c# -

i need extract vba code word 2007 document in c# without using office automation. what have done far open word document structured storage file in c#, , receive list of following streams: macros vba dir ( stream ) module1 ( stream ) thisdocument ( stream ) _vba_project_ ( stream ) .... i gather source stored in 1 of streams, have no idea how parse them. can help? probably documentation of vba file format you. can download free microsoft: [ms-ovba]: office vba file format structure specification

linux - How to compile/install node.js(could not configure a cxx compiler!) (Ubuntu). -

how can compile/install node.js on ubuntu? failed error cxx compiler . one-liner install needed dependencies(curl , git not needed, useful , needed if install via nvm). sudo apt-get install build-essential libssl-dev curl git-core last 2 dependencies not needed, installing them usefull anyway , need later anyway. to install cxx compiler sudo apt-get install build-essential if openssl missing sudo apt-get install libssl-dev

wxpython - What are the existing open-source Python WxWidgets designers? -

what usable tools? aware of wxformbuilder , wxglade, none of them seems complete yet. here few of popular wxpython related gui builders: boa constructor (mostly dead) wxglade wxformbuilder xrced wxdesigner (not foss) dabo - 1 of videos shows way interactively design app... i use python ide hand code applications. current favorite ide wing.

c# - How to NOT automatically convert my single quotes to &#39; -

hi have hyperlink in asp.net want dynamically create. add additional attributes onmouseover call javascript function. problem instead of setting attribute onmouseover="myjsfunc('param')" it converts onmouseover="myjsfunc(&#39;param&#39;)". any ideas how work in asp.net c#? thanks! ryan edit: these controls in repeater. have in code behind; hypnav.attributes.add("onmouseover", "myjsfunc('" + divnav.clientid + "')"); seems .net 4.0 issue. check out .

SQL Trying to select only the first record out of several returned -

i have query returns students , roommates. idea have show in first column , column 2 , 3 have each roommate. column 3 blank, columns 1 , 2 have results. my query returning correct data exception of when there 3 people in room, more 1 record. such below. _roommate1 roommate2 roommate3 room1_ _roommate1 roommate3 roommate2 room1_ _roommate2 roommate1 roommate3 room1_ _roommate2 roommate3 roommate1 room1_ _roommate3 roommate1 roommate2 room1_ _roommate3 roommate2 roommate1 room1_ all want keep first instance of each row when field appears in column 1. so reduce output to: _roommate1 roommate2 roommate3 room1_ _roommate2 roommate1 roommate3 room1_ _roommate3 roommate1 roommate2 room1_ the intent send form letter each person in column 1 tell them names of roommates. since can use distinct on row , not on field, @ temporary loss how might able this. able if worked is: select (distinct column1), column2, column3 first instance of e...

Font size in CSS - % or em? -

when setting size of fonts in css, should using percent value ( % ) or em ? can explain advantage? there's article on web typography on a list apart . their conclusion: sizing text , line-height in ems, percentage specified on body (and optional caveat safari 2), shown provide accurate, resizable text across browsers in common use today. technique can put in kit bag , use best practice sizing text in css satisfies both designers , readers.

javascript - Please show me a more elegant way to do this -

to me, obvious way this: given start point , end point, tell me if end point / down / left / upleft / downright... etc of start point. heres core of logic : function getsector() { var y = starty - endy; var x = startx - endx; var angle = math.atan2(y,x) * 57.29578;//~57 deg per radian //atan2(y,x) returns num between -pi , pi, represents angle in radians console.log("angle:" + angle); if( (angle > -22.5) && (angle < 22.5) ) attackdir = "left"; if( (angle > 22.5) && (angle < 67.5) ) attackdir = "upleft"; if( (angle > 67.5) && (angle < 112.5) ) attackdir = "up"; if( (angle > 112.5) && (angle < 157.5) ) attackdir = "upright"; if( (angle > 157.5) && (angle <= 180) ) attackdir = "right"; if( (angle > -179) && (angle <= -157) ) attackdir = "right"; if( (angle > -157) && (angle...

command line - SQL 2005 Express Edition - Install new instance -

looking way programatically, or otherwise, add new instance of sql 2005 express edition system has instance installed. traditionally, run micrsoft's installer in command line below , trick. executing command in installer not issue, it's more matter of dragging around 40 mbs of ms-sql installer don't need if have sql express installed. installer executes: sqlexpr32.exe /qb addlocal=all instancename=<instancename> securitymode=sql sapwd=<password> sqlautostart=1 disablenetworkprotocols=0 i don't need assistance launching command, rather appropriate way add new instance of sql 2005 express without running full installer again. i'd go great detail why want i'd bore everyone. suffice say, having ability create new instance without time takes reinstall sql express etc. assist me deployment of application , it's installer. if makes difference anyone, i'm using combination of nsis , advanced installer installation project. it ...

Evaluating OPF3 (ORM framework for .NET) -

is using or has evaluated opf3 orm (.net)? how stack against entityspaces or subsonic? one thing opf3 in evaluation far is easy customize. since binds database fields object members using attributes, not need use code generation tool. means can create own classes, , add opf3 data binding on top of that. <persistent("users")> _ public class user <field("userid", autonumber:=true, identifier:=true, allowdbnull:=false)> _ public property id() long <field("name", allowdbnull:=false)> _ public property name() string end class they have generation tool, , 1 thing don't demo not output classes, can't see really going do. on plus side again, appears when buy tool, source well. we using opf3 @ company , until works great, except it's having more functionality needed. watch out how u construct classes, creating new item add child objectsetholder can tricky. new items don't have informatio obj...

c# - How do I properly clean up Excel interop objects? -

i'm using excel interop in c# ( applicationclass ) , have placed following code in clause: while (system.runtime.interopservices.marshal.releasecomobject(excelsheet) != 0) { } excelsheet = null; gc.collect(); gc.waitforpendingfinalizers(); although kind of works, excel.exe process still in background after close excel. released once application manually closed. what doing wrong, or there alternative ensure interop objects disposed of? excel not quit because application still holding references com objects. i guess you're invoking @ least 1 member of com object without assigning variable. for me excelapp.worksheets object directly used without assigning variable: worksheet sheet = excelapp.worksheets.open(...); ... marshal.releasecomobject(sheet); i didn't know internally c# created wrapper worksheets com object didn't released code (because wasn't aware of it) , cause why excel not unloaded. i found solution problem on this page , has...

iphone - can TTURLMap from three20 map to a xib-file? -

ive made app iphone , wanted make work on ipad too. navigation used three20. views viewcontrollers xib´s. for later developement, wanted make xibs in bigger format new skin , let background-programm same, in end each viewcontroller have 2 xib´s skins. so, three20´s urlmap can link class-files. how can link xib ? i wanted in appdelegate make urlmap depending on device, programm self can stay url-calls. ok, used overwrite initwithnibname in combination [uidevice currentdevice].model let viewcontroller check, on device loads

ssms - SSAS Cube Browsing not working after SQL 2008 CTP uninstall -

i've had sql 2005 & 2008 ctp installed side-by-side no problems. recently uninstalled ctp after expired , whenever try browse analysis services cube in ssms 2005 or vs 2005, follwoing error: retrieving com class factory component clsid {c4f9b80b-89f7-4800-9c26-504d6e692b2c} failed due following error: 80040154. i've tried re-installing office web components it's made no difference. i've installed sql 2008 ssms rtm , has made no difference vs or ssms 2005. when try browse ssms 2008 rtm error: invalid class string (exception hresult: 0x800401f3 (co_e_classstring)) anyone have ideas? thanks mike this error plagued me weeks, searched registry backup , restored these: windows registry editor version 5.00 [hkey_local_machine\software\classes\clsid{c4f9b80b-89f7-4800-9c26-504d6e692b2c}] @="marshalledtoistreamdataobject class" "appid"="{b2463dc8-b3fa-4bec-945e-60219dcc6fd8}" [hkey_local_machine\software\classes...

python - How do I watch a file for changes? -

i have log file being written process want watch changes. each time change occurs i'd read new data in processing on it. what's best way this? hoping there'd sort of hook pywin32 library. i've found win32file.findnextchangenotification function have no idea how ask watch specific file. if anyone's done i'd grateful hear how... [edit] should have mentioned after solution doesn't require polling. [edit] curses! seems doesn't work on mapped network drive. i'm guessing windows doesn't 'hear' updates file way on local disk. have looked @ documentation available on http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html ? if need work under windows 2nd example seems want (if exchange path of directory 1 of file want watch). otherwise, polling platform-independent option. note: haven't tried of these solutions.

c# - How to detect application activation -

i need perform action when application receives focus. i've tried hooking both gotfocus- , enter-events, trigger when focus changes within application. scenario application detects problem must resolved elsewhere, , check again when user goes application. i try overriding form.onactivated (or handling form.activated event) in application form.

c# - How can you get a ComboBox child of a DataGridView to process all keys, including "."? -

i have same problem described in posts listed below. is, keys don't work @ when type them combobox until first hit spacebar. 1 of keys ".", letter "q", , there others: "$", "%". http://forums.microsoft.com/msdn/showpost.aspx?postid=659716&siteid=1 http://forums.microsoft.com/msdn/showpost.aspx?postid=2909173&siteid=1&pageid=0 http://bytes.com/forum/thread548399.html i've tried lot of things far. latest failure based on theory maybe datagridview using win32 api wndproc subclassing intercept messages, wrote logic save old wndproc , restore after adding datagridview's control collection. didn't work. messina - reminding me spy++. letter "a", edit window sends en_update combobox parent. but, not "q". that's strange. i have convinced myself datagridview not subclassing combo , edit, because check address of wndprocs after creation , before adding them grid's collecti...

java - How do I get a platform-dependent new line character? -

how platform-dependent newline in java? can’t use "\n" everywhere. in addition line.separator property, if using java 1.5 or later , string.format (or other formatting methods) can use %n in calendar c = ...; string s = string.format("duke's birthday: %1$tm %1$te,%1$ty%n", c); //note `%n` @ end of line ^^ string s2 = string.format("use %%n platform independent newline.%n"); // %% becomes % ^^ // , `%n` becomes newline ^^ see java 1.8 api formatter more details.

How do I print debug messages in the Google Chrome JavaScript Console? -

how print debug messages in google chrome javascript console? please note javascript console not same javascript debugger; have different syntaxes afaik, print command in javascript debugger not work here. in javascript console, print() send parameter printer. executing following code browser address bar: javascript: console.log(2); successfully prints message "javascript console" in google chrome.

grails - What is the best method to generating ranking lists for my website homepage? -

what best way generate , maintain several ranking lists home page of website/webapp? e.g. hot posts, recent posts, comments, consecutive wins etc. currently, i'm thinking using cron job scheduler run queries gather statistics, run algorithm on statistics , generate ranking lists saved temporary table in mysql. however, i'm not sure if efficient way go this. i'd imagine use of caching well. note: i'm using grails web application framework. thanks. you might want consider using quartz plugin schedule tasks. http://grails.org/quartz+plugin

php - strtotime to convert both date and time -

can advise how convert date "tuesday, 22 june, 2010 00:00" unix timestamp using strtotime()? need store hours , minutes , it's not clear if best done using strtotime. help! due second , , strtotime() not understand date/time format (remove , work properly). if have static format date, using strptime() or datetime::createfromformat() more reliable, , allow other non-datetime strings in date present long you've defined them. echo datetime::createfromformat("l, j f, y h:i","tuesday, 22 june, 2010 00:00")->format("c");

.net - Microsoft.SqlServer.Management.Smo and its brothers works on SQL2000? -

as title, need run import script generated sql server db publishing tool. work on sql2000 server too? have seen ppl reporting missing library issues related gac, libraries precisely need include if not controlling deployment server? to know how thing works can check here in msdn forum. http://forums.microsoft.com/msdn/showpost.aspx?postid=3947420&siteid=1 i tested , indeed works in devbox sql2005 express installed. yes, smo works on sql server 2000: smo , sql server 7.0

html - How can I make a link from a <td> table cell -

i have following: <td> text <div>a div</div> </td> i'd make entire <td>...</td> hyperlink. i'd prefer without use of javascript. possible? yes, that's possible, albeit not literally <td> , what's in it. simple trick is, make sure content extends borders of cell (it won't include borders though). as explained, isn't semantically correct. a element inline element , should not used block-level element. however, here's example (but javascript plus td:hover css style neater) works in browsers: <td> <a href="http://example.com"> <div style="height:100%;width:100%"> hello world </div> </a> </td> ps: it's neater change a in block-level element using css explained in solution in thread . won't work in ie6 though, that's no news ;) alternative (non-advised) solution if world internet explorer (rare, nowadays...

java - Convert html to pdf with linked documents inline -

i need convert bundle of static html documents single pdf file programmatically on server side on java/j2ee platform using batch process preferably. pdf files distributed site users offline browsing of web pages. the major points of requirements are: the banner @ top should not present in final pdf document. the navigation bar on left should transformed pdf bookmarks html hyperlinks. all hyperlinked contents (html/pdf/doc/docx etc.) present in web pages should part of final pdf document pdf bookmarks. is there standard open source way of doing this? try apache fop . used convert xml pdf , think can same html/dom. website has a whole section on running fop in java application , there's example code dom pdf .

iphone - How to "refresh" UIView -

i have data being refreshed in modalviewcontroller , when data gets refreshed, parent controller needs refresh data well. tried doing [tableview reloaddata]; didn't work since actual array values aren't being refreshed. there way me reload controller without user seeing animation? thanks help! are refreshing data off main thread? if so, need call reloaddata method using following method: - (void)performselectoronmainthread:(sel)aselector withobject:(id)arg waituntildone:(bool)wait so tableview like: [tableview performselectoronmainthread:@selector(reloaddata) withobject:nil waituntildone:no];

delphi - Antivirus False positive in my executable -

i ran annoying problem. avira antivir started flag 1 executable software being virus. as default action user click ok , avira suggests put virus in quarantine, of users deleting executable. well, let's not arrogant , check if i'm not infected indeed. posted file http://www.virustotal.com , anti virus avira flags infected. furthermore scanned computer 2 different anti viruses , clean. i posted mail users explaining happening overhead support don't want. ok, question is: there way avoid kind of behavior? can't think way else signing files, (don't know if solve) let's see if have creative idea. it surprisingly common delphi applications reported (potentially) harmful av applications. happened me while ago, using delphi 2009, see http://en.wikipedia.org/wiki/wikipedia:reference_desk/archives/computing/2010_march_20#delphi.2favg_issue . at so, have virus in delphi 7 accidentally created virus? and many more. it might actual ind...

MAX & MIN values on array using PHP -

does knows how can max , min value of 2nd , 3rd columns in php? $ar = array(array(1, 10, 9.0, 'hello'), array(1, 11, 12.9, 'hello'), array(3, 12, 10.9, 'hello')); output should like: max(12.9) min(10) <?php $ar = array(array(1, 10, 9.0, 'hello'), array(1, 11, 12.9, 'hello'), array(3, 12, 10.9, 'hello')); function col($tbl,$col){ $ret = array(); foreach ($tbl $row){ $ret[count($ret)+1] = $row[$col]; } return $ret; } print (max(col($ar,2))."\n"); print (min(col($ar,1))."\n"); ?> is for? guess not efficient way.

hibernate - How do I sort a linked list in hql? -

same question this , i'd in hibernate (using grails if matters). so domain class looks this class linkedelement { linkedelement precedingelement string somedata } and i'd query elements in linked order (where first linkedelement has null precedingelement). possible in efficient way? you can find out @ front of line (i.e. preceding element null). unfortunately, means you're in n+1 query territory whole list. query 1 - who's in front query 2 - who's behind 1 query 3 - who's behind 2 .... query n - who's behind n-1 query n+1 - who's behind n -> no 1 behind n, must @ end referring question mentioned, don't mistake efficient syntactically concise. because dbms give convenient syntax still solving same problem either a.) performing same inefficient algorithm simplified syntax or b.) indexing things ahead of time dbms has access data efficiently though didn't model way. so, if absolutely have solve problem specified dat...

Html builder in .net 1.1? -

i'm doing maintenance on existing .net 1.1 vb code creates htlm code. consists of bunch of stringbuilder.append("<table>") . isn't there cleaner way create html tags? htmltextwriter should in .net 1.1. thank cleanest way using .net 1.1 types.

tdd - Asserting that a method is called exactly one time -

i want assert method called 1 time. i'm using rhinomocks 3.5. here's thought work: [test] public void just_once() { var key = "id_of_something"; var source = mockrepository.generatestub<isomedatasource>(); source.expect(x => x.getsomethingthattakesalotofresources(key)) .return(new something()) .repeat.once(); var client = new client(soure); // first call expect client use source client.getmemything(key); // second call result should cached // , source not used client.getmemything(key); } i want test fail if second invocation of getmemything() calls source.getsomethingthattakesalotofresources() . here's how i'd verify method called once. [test] public void just_once() { // arrange var = mockrepository.generatemock<isomedatasource>(); a.expect(x => x.getsomethingthattakesalotofresources()).return(new something()).repeat.once(); a.stub(x => x.get...