instruction
stringlengths
0
30k
Cruise Control .Net vs Team Foundation Build
|cruisecontrol.net|tfs|build|build-automation|continuous-integration|
Our team is setting up nightly and continuous integration builds. We own Team Foundation Server and could use Team Foundation Build. I'm more familiar with CC.Net and lean that way but management sees all the money spent on TFS and wants to use it. Some things I like better about CC.Net is the flexibility of notif...
The point of mysql_real_escape_string isn't to protect against injection attacks, it's to ensure your data is accurately stored in the database. Thus, it should be called on ANY string going into the database, regardless of its source. You should, however, *also* be using parameterized queries (via mysqli or PDO) to...
Data binding is a bad idea?
|bestpractices|data-binding|
Another discussion (we've been having a lot of them these days!) in our work is whether data binding is a bad idea or not. Personally, I think it is A BAD THING. My reasons are thrice: 1) It circumvents my well architectured MVP framework - with databinding, the view communicates bi-directionally with a model....
|data-binding|
Is data binding a bad idea?
For a lightweight ORM that performs well and only requires a single assembly why not try out [Lightspeed][1] from Mindscape. It's not open-source, however source is available and it's reasonably priced - the risk with most ORM's that aren't well adopted is of course quality and level of support, and there are very few...
in linux, something like ps -p somepid --no-headers -o state should work, alternately you can look for the info in proc with grep ^State: /proc/somepid/status
I found this on MSDN: *If you are writing a 32-bit application to list all the files in a directory and the application may be run on a 64-bit computer, you should call the Wow64DisableWow64FsRedirectionfunction before calling FindFirstFile and call Wow64RevertWow64FsRedirection after the last call to FindNextFile. ...
Set the existing TotalLogins property as either private or protected and remove the readonly attribute. You may also want to rename it e.g. InternalTotalLogins. Then create a new property by hand in the partial class that exposes it publically as a read-only property: Public ReadOnly Property TotalLogins() As...
Is the firewall turned off?
The storage class specifier controls the *storage* and the *linkage* of your variables. These are two concepts that are different. C specifies the following specifiers for variables: auto, extern, register, static. **Storage** The storage duration determines how long your variable will live in ram. There are ...
You can find some information about troubleshooting this kind of problem at [this blog entry][1]. Her blog is generally a good debugging resource. [1]: http://blogs.msdn.com/tess/archive/2008/05/21/debugdiag-1-1-or-windbg-which-one-should-i-use-and-how-do-i-gather-memory-dumps.aspx
I have [an article about debugging ASP.NET in production](http://www.codinghorror.com/blog/archives/000015.html) which may provide some pointers.
For me, the big win with the naming convention of prepending an underscore to private members has to do with Intellisense. Since underscore precedes any letter in the alphabet, when I do a ctrl-space to bring up Intellisense, there are all of my _privateMembers, right at the top. Controls, though, are a different s...
Double check that it is indeed a derivation of the UserControl class, not the WebControl one. This one has had me by surprise many times. If you need to use WebControl for the styling, you need to let your control implement INamingContainer. (Don't worry, its a marker interface) So.. public class MyControl...
C#3 and .Net 3.5 adds new assemblies, but the IL is unchanged. This means that with .Net 2 assemblies you can compile and use C#3, as long as you don't use Linq or anything else that references System.Linq or System.Core `yield`, `var`, lambda syntax, anon types and initialisers are all compiler cleverness. The I...
I never use underscores in my variable names. I've found that anything besides alpha (sometimes alphanumeric) characters is excessive unless demanded by the language.
One of those instances that you need to edit the WSDL. For a start a useful tool [http://codeplex.com/storm][1] [1]: http://codeplex.com/storm
A hook to notify the bug/issue management system of changes to repository. Ie. the commit message has issue:546 or similar tag in it that is parsed and fed to the bug management system.
Usually you'll use an HTTP Handler for this. Given a request for... > http://www.yoursite.com/sitemap.axd ...your handler will respond with a formatted XML sitemap. Whether that sitemap is generated on the fly, from a database, or some other method is up to the HTTP Handler implementation. Here's roughly what ...
If you're building a hash table in which to store your vertices, I can think of a couple of ways to avoid collisions: 1. Generate IDs directly from the input data without throwing any bits away, and use a hash table that is large enough to hold all possible IDs. With 64-bit IDs, the latter will be extremely problem...
Best reference on the Internet for all those **bit hacks** - [bit twiddling hacks][1] [1]: http://graphics.stanford.edu/~seander/bithacks.html
It's already mentioned, it's hard to give decent advise without knowing your database schema etc, however, I would lean towards creating the 70+ models, (one for each of your tables.) You may be able to get away with ditching some model, but for the cost (negliable) you may as well have them there. You don't nee...
It's already mentioned, it's hard to give decent advice without knowing your database schema etc, however, I would lean towards creating the 70+ models, (one for each of your tables.) You may be able to get away with ditching some model, but for the cost (negliable) you may as well have them there. You don't nee...
That is actually a very nice feature in VC++ (and I believe other compilers) because it allows you to see un-allocated memory for a pointer in the debugger. I will think twice before disabling that functionality. When you delete an object in C++ you should set the pointer to NULL in case something later tries to delete...
Briefly, it is the mapping of the name you assign a variable to its address in memory, including metadata like type, scope, and size. It is used by the compiler. That's in general, not just C[++]*. Technically, it doesn't always include direct memory address. It depends on what language, platform, etc. the compiler ...
A trivial one is to ask them to code up a breadth-first search of a tree from scratch. Yeah, if you know what you're doing it is trivial. But a lot of programmers don't know how to tackle it. One that I find more useful still is as follows. I've given this in a number of languages, here is a Perl version. First ...
A trivial one is to ask them to code up a breadth-first search of a tree from scratch. Yeah, if you know what you're doing it is trivial. But a lot of programmers don't know how to tackle it. One that I find more useful still is as follows. I've given this in a number of languages, here is a Perl version. First ...
|tfs|continuous-integration|build-automation|cruisecontrol.net|build|
Our team is setting up nightly and continuous integration builds. We own Team Foundation Server and could use Team Foundation Build. I'm more familiar with CC.Net and lean that way but management sees all the money spent on TFS and wants to use it. Some things I like better about CC.Net is the flexibility of notif...
log4net is open source, fairly easy to learn, and can be configured to log to multiple sources (file, email, db, eventlog) very easily.
Hibernate Query By Example and Projections
|java|hibernate|criteria|projection|
To make it short: hibernate doesn't support projections and query by example? I found this post: The code is this: User usr = new User(); usr.setCity = 'TEST'; getCurrentSession().createCriteria(User.class) .setProjection( Projections.distinct( Projections.projectionList() .add( Projection...
Something for other commenters to note - the question is about PL/SQL, not about SQL. Some of the answers have obviously been about SQL, not PL/SQL. PL/SQL is a fully functional database language, and it's mature as well. There are some shortcomings, but for the type of thing the poster wants to do, it's very good.
[CALM](http://www.nov8r.com/calm.aspx) does this and more. It's not free or open source, but it is inexpensive and comprehensive. caveat: I am the author of CALM
An additional benefit to using an ID is the ability to target it in an anchor tag: <h2 id="CurrentSale">Product I'm selling</h2> Will allow you to in some other place link directly to that spot on the page: <a href="#CurrentSale">the Current Sale</a> A common use for this would be to give each headl...
The storage class specifier controls the *storage* and the *linkage* of your variables. These are two concepts that are different. C specifies the following specifiers for variables: auto, extern, register, static. **Storage** The storage duration determines how long your variable will live in ram. There are ...
Partial site SSL using asp.net login control
|asp.net|ssl|authentication|
I'm attempting to convert a home-grown login system to the standard asp.net login control included in .net. I want all communication on the website for a user not logged in to be in clear text, but lock everything in SSL once the user logs in - including the transmission of the username and password. I had this wor...
Planning is your best friend. Figure out what your needs truly are. Loading Data: Is every computer going to have the same models and graphics, and just names and locations are moved over the net. If every player can customize their character or other items, you will have to move this data around. Cheating: do yo...
You cannot do this in one step, as groups are also separate AD entries with properties. So in the first run you should get the group names a user is in and fill them in a list of some kind. The second step is to go through all of the group names and query them one by one to get the group properties (like distingu...
<a href="http://stackoverflow.com/questions/88558/c-derived-class-problems#88620">Curt</a> is absolutely correct, but I'd just like to throw a little more information at it. This problem (storing base-class objects, rather than pointers) is sometimes called "slicing". Also, I tend to make use of the following mac...
I feel that in many frameworks, data binding is just an excuse to do things the easy way. It often results, as does almost any designer-generated code, in too much code which is too complicated and can't be easily tweaked. I've never come across a task I couldn't do just as well (if not better) and, in most cases, just...
Tables are valid when you have a table of data. I've seen interactive grid widgets where they go out of their way to use a bunch of divs to avoid the dreaded table tag. When it's tabular data, make it a table. A more controversial view of mine is that when you have problems dealing with vertical layout issues in CSS...
Anything in the inner exception? Is this a 64-bit application? The OLEDB providers don't work in 64-bit. You have to have your application target x86. Found this when getting an error trying to open access DB on my 64-bit computer.
I have done this, but I don't have any ready-written instructions. My builds are also rather minimal as I haven't needed support for eg. PNG and SVG files, I just used it to render generated vector graphics to memory buffers. But what I did was read through the `config.h` and other files for the UNIX/GNU build syste...
You can try and invoke the Page_ClientValidate() method directly through the clientscript instead of clicking the button, let me dig up an example. Using MSHTML mshtml.IHTMLWindow2 myBroserWindow = (mshtml.IHTMLWindow2)MyWebBrowser.Document.Window.DomWindow; myBroserWindow.execScript("Page_ClientValidate...
var btn = document.getElementById(btnName); if (btn) btn.click();
newid() i believe is very resource intensive. i recall trying that method on a table of a few million records and the performance wasn't nearly as good as rand().
There is an example of how to submit the form using InvokeMember here. <http://msdn.microsoft.com/en-us/library/ms171716.aspx>
Setting the DBML serialization mode to unidirectional will decorate the classes and a number of the members with the required attributes however it will ignore some of the associations to avoid circular references that were a problem prior to SP1. If you want those too check out my [LINQ to SQL T4 template][1] that ...
Using 'openAndWait' in place of 'open' will do the trick. From the [website][1]: > Many Actions can be called with the "AndWait" suffix, e.g. "clickAndWait". This suffix tells Selenium that the action will cause the browser to make a call to the server, and that Selenium should wait for a new page to load. ...
Got it: [http://msdn.microsoft.com/en-gb/library/aa384187(VS.85).aspx][1] [1]: http://msdn.microsoft.com/en-gb/library/aa384187(VS.85).aspx When a 32-bit application reads from one of these folders on a 64-bit OS: %windir%\system32\catroot %windir%\system32\catroot2 %windir%\system32\dri...
When navigating between two separate directories and copying files back and forth, I do this: cd /some/where/long src=`pwd` cd /other/where/long dest=`pwd` cp $src/foo $dest command completion will work by expanding the variable, so you can use tab completion to specify a file...
Neal Deakin has an [article on manipulating the clipboard][1] in xulrunner. I'm not sure if it answers your question specifically, but it's definitely worth checking out. [1]: http://developer.mozilla.org/en/Using_the_Clipboard
My suggestion would be to find the rare pages that do not require an import of other JSPs, or have very few imports. Treat each JSP imported as a black box, and refactor these pages around them (iteratively, testing each change and making sure it works before continuing). Once these are cleaned up, you can continue f...
So? Dedicate a server to your Access databases. Now you have the benefit of some sort of usage tracking, and also the ability to pay more attention to some of the important decentralised data that is stored in these apps. This is what you were going to do anyway, only you wanted to use a different database engin...
Check out the [Symbol Table][1] wikipedia entry. /Allan [1]: http://en.wikipedia.org/wiki/Symbol_table
Declare the parent method virtual, override it in the child classes and call base.checkReadyness(sender, e); (or derevation thereof) from within the child class. This allows for future design evolution say if you want to do some specific error checking code before calling the parent event handler. One thing t...
Declare the parent method virtual, override it in the child classes and call base.checkReadyness(sender, e); (or derevation thereof) from within the child class. This allows for future design evolution say if you want to do some specific error checking code before calling the parent event handler. You might n...
Inheriting Event Handlers in C#
|c#|events|inheritance|
I've kind of backed myself into a corner here. I have a series of UserControls that inherit from a parent, which contains a couple of methods and events to simplify things so I don't have to write lines and lines of near-identical code. As you do. What I want to do is just have one event handler, in the parent Us...
I've kind of backed myself into a corner here. I have a series of UserControls that inherit from a parent, which contains a couple of methods and events to simplify things so I don't have to write lines and lines of near-identical code. As you do. The parent contains no other controls. What I want to do is just h...
In a Windows C++ DLL, all global objects (including static members of classes) will be constructed just before the calling of the DllMain with DLL\_PROCESS\_ATTACH, and they will be destroyed just after the call of the DllMain with DLL\_PROCESS\_DETACH. Now, you must consider two problems: 0 - Of course, global n...
In a Windows C++ DLL, all global objects (including static members of classes) will be constructed just before the calling of the DllMain with DLL\_PROCESS\_ATTACH, and they will be destroyed just after the call of the DllMain with DLL\_PROCESS\_DETACH. Now, you must consider three problems: 0 - Of course, global...
How can I find the response time of a HTTP request through a Socket
|java|http|
I'm using a Java socket, connected to a server. If I send a HEADER http request, how can I measure the response time from the server? Must I use some provided timer, or is there a better way?
I'm using a Java socket, connected to a server. If I send a HEADER http request, how can I measure the response time from the server? Must I use a provided java timer, or is there an easier way? I'm looking for a short answer, I don't want to use other protocols etc.
I'm using a Java socket, connected to a server. If I send a HEADER http request, how can I measure the response time from the server? Must I use a provided java timer, or is there an easier way? I'm looking for a short answer, I don't want to use other protocols etc. Obviously do I neither want to have a solution ...
For one, instead of *16 do a bitshift << 4 Also don't use the stl string, instead just create a buffer on the heap and then delete it. It will be more efficient than the object destruction that is needed from the string.
SaaS database design - Multiple Databases? Split?
|c#|database|architecture|saas|
I've seen SaaS applications hosted in many different ways. Is it a good idea to split features and modules across multiple databases? For example, putting things like the User table on one DB and feature/app specific tables on another DB and perhaps other commonly shared tables in another DB?
decouple the interaction rules from the Unit and Terrain classes; interaction rules are more general than that. For example a hash table might be used with the key being a pair of interacting types and the value being an 'effector' method operating on objects of those types. when two objects must interact, find ALL ...
To debug a problem in COM with C++ where an object's (C++) destructor is not being called, the best approach is to focus on how the COM object's refcounts are being incremented or decremented. What is probably happening is that somebody is incrementing the refcount one too many times, and then not decrementing it the ...
In the DB tied to whatever you're using for sessions (db/memcache sessions, signed cookies) or to an authenticated user.
The trunk development version (set to become version 1.1) of <a href="http://www.viewvc.org/>ViewVC</a> supports access control. ViewVC is featureful as a repository viewer, and intuitive to use, without any unnecessary extras.
Does [Debugging An Authorization Plug-In With Xcode][1] help? [1]: http://developer.apple.com/technotes/tn2008/tn2108.html
Is there any WYSIWYG html editing tool or component that allows Format Copying from a paragraph to another?
|html|wysiwyg|
I believe the question says it all ... (I'll update if needed)
Tables are supported even in crusty old HTML v1.0 browsers. If your target market includes people using embedded browsers in mobile phones from the 1990s, that might be a good reason to go with tables. Lots of existing auto-generated HTML uses tables. If your code needs to interact with or include those tables, it'd...
you should wrap the TextBlock with a Border.. something like this: <Border BorderBrush="Purple" BorderThickness="2"> <TextBlock>My fancy TextBlock</TextBlock> </Border>
you should wrap the TextBlock with a Border.. something like this: <Border BorderBrush="Purple" BorderThickness="2"> <TextBlock>My fancy TextBlock</TextBlock> </Border> in the off chance you are asking how to put a stroke around the actual letters (and not the whole TextBlock) you ma...
have you taken a look here? http://office.microsoft.com/en-us/excel/HA011265551033.aspx if you are using sql server and excel, you want the "Excel Add-in for SQL Server Analysis Services" and you can perform writeback to the cubes. Might not be exactly what you want, but it is the closest I have come across. "What-i...
We use perforce extensively in the company, including branching for very large projects, development on Sun Solaris and Windows, and more than 120 users. It is very fast, and the Windows GUI (P4V) is very nice. The Explorer integration is acceptable. I've disabled the VS integration, and use macros (calling e.g. <co...
In a Windows C++ DLL, all global objects (including static members of classes) will be constructed just before the calling of the DllMain with DLL\_PROCESS\_ATTACH, and they will be destroyed just after the call of the DllMain with DLL\_PROCESS\_DETACH. Now, you must consider three problems: 0 - Of course, global...
Many stored procedures are application independent but there may be a few that are application dependent. For example, the CRUD (Create, Select, Update, Delete) stored procedures can go across applications. In particular you can throw in auditing logic (sometimes done in triggers but there is a limit to how complicat...
I've kind of backed myself into a corner here. I have a series of UserControls that inherit from a parent, which contains a couple of methods and events to simplify things so I don't have to write lines and lines of near-identical code. As you do. The parent contains no other controls. What I want to do is just h...
Actually, since you're using nginx, you're already in great shape and don't need Apache. You can run PHP through fastcgi (there are examples of how to do this in the nginx wiki), and use a URL-matching pattern in your nginx configuration to direct some URLs to Rails and others to PHP. Here's an example nginx conf...
Actually, since you're using Nginx, you're already in great shape and don't need Apache. You can run PHP through fastcgi (there are examples of how to do this [in the Nginx wiki][1]), and use a URL-matching pattern in your Nginx configuration to direct some URLs to Rails and others to PHP. Here's an example Nginx...
Operate on 32 bits at a time (4 chars), then deal with the tail if needed. When I did this exercise with urlencoding a full table lookup for each char was slightly faster than logic constructs, so you may want to test this in context as well to take caching issues into account. /Allan