instruction stringlengths 0 30k ⌀ |
|---|
|.net| |
How much should one DataSet represent? Using the example of an ordering system: While showing your order I also show a list of items similar to one of yours as well as a list of our most popular items.
While your items are tangled in a web of relationships involving you and your past orders, preferred suppliers, and ... |
The one time I wrote a singleton in Python I used a class where all the member functions had the classmethod decorator.
class foo:
x = 1
@classmethod
increment(cls, y = 1)
cls.x += y |
Scaffoling in pylons |
|python|pylons| |
Is there anything similar to rails' scaffolding fo pylons? I've been poking around google, but fofund only this thing caled dbsprockets, which is fine, although probably way to much for my needs. What i really need is a basic CRUD thas is based on the SQLAlchemy model. |
Scaffolding in pylons |
I've been using [Prototype][1] + [Scriptaculous][2].
They have good API documentation and work great for me! The biggest benefits are:
- Cleans up messy javascript code
- Cross browser compatibility
- Simplifies AJAX handling
- Smooth UI effects
[1]: http://www.prototypejs.org/
[2]: http://s... |
Is the Modal Window popped up using the IE Modal window? Or is it a DIV that you are showing?
If it is an IE Modal Pop up you need to ensure you have
<base target="_self" />
To make sure the post back are to the modal page.
If it is a DIV make sure you have your XHTML correct or it might not know ... |
Scrum: Resistance is (not) futile |
|scrum|agile|xp| |
I'm the second dev and a recent hire here at a PHP/MySQL shop. I was hired mostly due to my experience in wrangling some sort of process out of a chaotic mess. At least, that's what I did at my last company. ;)
Since I've been here (a few months now), I've brought on board my boss, my product manager and several o... |
|agile|scrum|xp|development-practice| |
Here is the method I've used in the past with good success:
/trunk - bleeding edge. Next major release of the code. May or may not work at any given time.
/branches/1.0, 1.1, etc. Stable maintenance branches of the code. Used to fix bugs, stabilize new releases. If a maintenance branch, it should compile (if... |
We seem to be in the golden age of version control, with a ton of choices, all of which have their pros and cons.
Here are the ones I see most used:
- svn - currently the most popular open source?
- git - very hot since Linus switched to it
- mercurial - some smart people I know swear by it
- cvs - the one eve... |
"How do you go from an arithmetic expression (e.g. in a string) such as "2 + (2)" to an expression tree using polymorphism?" (Amazon Interview Question ala Steve Yegge) |
|polymorphism|oop|binary-tree|recursion| |
How do you go from an arithmetic expression (e.g. in a string) such as "2 + (2)" to an expression tree using polymorphism? |
|oop|polymorphism|recursion|binary-tree| |
Expression Evaluation and Tree Walking using polymorphism? |
|oop|polymorphism|binary-tree|recursion| |
Expression Evaluation and Tree Walking using polymorphism? (ala Steve Yegge) |
|oop|recursion|polymorphism|binary-tree| |
This morning, I was reading [Steve Yegge's: When Polymorphism Fails][1], when I came across a question that a co-worker of his used to ask potential employees when they came for their interview at Amazon.
> As an example of polymorphism in
> action, let's look at the classic
> "eval" interview question, which (... |
> At least in the intranet scenario, I
> think Active Directory (or similar) is
> still one of the best options.
Yep, in any case, Active Directory is behind the curtains of the OpenId Server Provider.
In order to develop a SSO solution within an Intranet there are commercial options such as Access Manager (for... |
As for the ID's on server-controls: You can find the actually ID that is going to be written to the browser by accessing ClientID. That way you can combine server-side og client-side scripting and still dont have to hardcode _id="ct100_nav"_
I always try to use the included controls instead of "hacking" HTML, becau... |
JSON is Javascript Object Notation, so if you are using Javascript you are already there!
Have a look at these links, they give examples of how to create Javascript objects from JSON:
http://www.hunlock.com/blogs/Mastering_JSON_(_JavaScript_Object_Notation_)
http://betterexplained.com/articles/using-json-to-exch... |
I have a fairly natural way of coding. The key is to treat the page like a document or an article. If you think of it like this the following becomes logically clear:
1. The page title is a top level heading
* Whether you make the site title or actual page title the h1 is up to you - personally I'd make About U... |
I have a fairly natural way of coding. The key is to treat the page like a document or an article. If you think of it like this the following becomes logically clear:
1. The page title is a top level heading
* Whether you make the site title or actual page title the h1 is up to you - personally I'd make About U... |
It depends on what the thin WCF service does. If it's really thin and there's no interesting code there, don't bother unit testing it. Don't be afraid to not unit test something if there's no real code there. If the test cannot be at least one level simpler then the code under the test, don't bother. If the code is dum... |
We've certainly used gcov to get coverage information on our multi-threaded application.
You want to compile with gcc 4.3 which can do coverage on dynamic code.
You compile with the -fprofile-arcs -ftest-coverage options, and the code will generate .gcda files which gcov can then process.
We do a separate buil... |
Maybe you should use another jdk version.
For your "puzzling one", there is a bug entry for 1.5.0_08. A memory leak is reported (I do not know, if this is related to your problem):
<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6469701>
Also you could get the source code and look, what happens at line 1... |
I have been using Proggy Clean TT with Visual Studio for a couple of years now. I like the ability to choose a zero slashed font so when management decides to program instead of manage they don't confuse 0101 with 0101(zeros).
http://www.proggyfonts.com/ |
You cannot use OpenSSL with Indy version 10.5 that shippes with Delphi 2007. You have to download version 10,6 from http://www.indyproject.org/ and install it into the IDE.
Note that other packages might use Indy, like RemObjects, and therefore they have to be re-compiled too and this can be tricky due to cross-refe... |
VMware or Hyper-V for Developers |
|vmware|virtualization|hyper-v| |
I'm looking to replace a couple of machines in the office with a more powerful multi-processor machine running either VMware or Microsoft's Hyper-V with a view to hosting a mix of Windows Server 2003, Windows Server 2008 and Linux operating systems. The machines are used mainly for testing ASP.Net or Perl web sites. I ... |
I have not used gcov for multi-threaded coverage work. However, on MacOS the Shark tool from Apple handles multiple threads. It's primarily a profiler, but can do coverage info too.
http://developer.apple.com/tools/sharkoptimize.html |
I am not sure is it 100% what your looking for, **but check out the built in example that comes packaged with NetBeans 6.1**. It uses JSF/EJB3/ApacheDerby. I played around with it for like 20 minutes and thought it was pretty cool as a simple/starter JavaEE application to learn from. |
@monjardin
The main reason we use it is because of the re-factoring/search tools provided through Visual Assist X (by Whole Tomato). Although there are a number of other nice to haves like Intelli-sense. We are also investigating integrations with our other tools AccuRev, Bugzilla and Totalview to complete the env... |
Yeah, attributes cannot have anything but constants in them, so you cannot use reflection to get the version number. The WebServiceAttribute class is sealed too, so you cannot inherit it and do what you want from there.
A solution might be to use some kind of placeholder text as the Name, and set up an MsBuild task ... |
Hm, where I work we have all our projects in the same repository. I really don't see the benefit of separating them, doesn't that just create a lot of extra work -creating new repositories, granting access to people, etc? I guess separate repositories makes sense if the projects are completely unrelated, and you have, ... |
Another solution would be to wrap the call to the server and have it always return an array to simplify the rest of your life:
sub call_to_service
{
my $returnValue = service::call();
if (ref($returnValue) eq "ARRAY")
{
return($returnValue);
}
else... |
css2 offers:
@font-face { font-family:Garamond; src:url(garamond.eot), url(garamond.pfr); }
|
I never realized how much that annoyed me as well! I haven't been able to find a setting, but in `Options > Environment > Keyboard` you can bind a shortcut to `Window.CloseAllDocuments`. `ALT+X` was unbound for me so I just used that. I'm interested if there's some hidden setting to automatically do this on solution ex... |
> Note that a responsible web developer does not use fonts that are only available on Windows (and especially ones that are only available on Vista), nor do they use a technology that isn't supported by at least the majority of browsers.
Well… You can, as long as you know how it will render on non-Vista/non-Windows ... |
Safari and to a lesser extent Firefox 3 have support for @font-face in CSS which lets you use custom fonts. You need to have the appropriate licence to distribute the font files though. These articles explain it in more detail:
- [http://www.css3.info/preview/web-fonts-with-font-face/][1]
- [http://www.alistapa... |
>Is the device running out of memory and therefore gives up the ghost when it requires the additional memory to stop at the breakpoint?
No, there's over a gig of RAM to go, and even more of virtual memory. |
I'm not sure I quite understand what you are getting at, but here's a few things I can suggest you can try...
1. This behaviour changes between different versions of Delphi. I'd suggest that this is due to the hoops they jumped through to support Windows Vista in Delphi 2007.
2. If you are using Delphi 2007, try ... |
What is /dev/ttys# (notice the little s)? |
|linux|serial|serial-port| |
I'm working on linux, trying to get the serial port to work. I know /dev/ttyS0 is a serial port, but what is /dev/ttys0? |
If the ID's prefix added by ASP.NET is an issue for you to access them later using JS or something... you have the .ClientID property server side.
If the overhead added by ASP.NET you should consider ASP.NET MVC (still preview) where you have full control over the emitted html.
I'm moving to MVC because I don't l... |
Try these links for a start.
http://www.ilog.com/products/ganttnet/
http://www.netronic.com/products-for-developers/gantt-charts.html?gclid=COLdutasoZUCFQunQwodoWOPkw |
@Brian,
Yup! You can pretty much control all the behaviour.. Consider looking into creating Custom Controls (there are three types). I recently gave an overview of them in my question [here](http://stackoverflow.com/questions/17532/aspnet-custom-controls-composites).
I would _strongly_ recommend checking them out, ... |
If I won't edit the property I'll use a `get_property()` public method unless it's a special occasion such as a MySQLi object inside another object in which case I'll just public the property and refer to it as `$obj->object_property`.
Inside the object it's always $this->property for me. |
Personally,
I think the standard ASP.NET controls are fine for inhouse stuff - quick and dirty is good in that scenario. But, I once worked with a web developer who was also a designer and he refused to use the ASP.NET controls and only code in HTML and add runat="server" tags when needed. This was more because he ... |
It's not exactly hidden, but reflection is incredibly useful and powerful. It is great to use a simple Class.forName("...").newInstance() where the class type is configurable. It's easy to write this sort of factory implementation. |
There's something about it on [Google c++ coding style document][1].
[1]: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Preincrement_and_Predecrement#Preincrement_and_Predecrement |
If you have lastupdate columns you can check for the writes, there is really no easy way to check for reads. You could run profiler, save the trace to a table and check in there
What I usually do is rename the table by prefixing it with an underscrore, when people start to scream I just rename it back |
On your source repository : use hooks before each commits (pre-commit hook for SVN for example)
In that hook, check for the existence of at least one use case for each method. Use a convention for unit test organisation that you could easily enforce via a pre-commit hook.
On an integration server compile everythi... |
The **core** attribute isn't used anymore.
From [Brian Rosner's Blog](http://oebfare.com/blog/2008/jul/20/newforms-admin-migration-and-screencast/):
> You can safely just remove any and all core arguments. They are no longer used. newforms-admin now provides a nice delete checkbox for exisiting instances in inlin... |
I looked into it by checking out my file associations.
It seems that a .reg file is just called as the first parameter to the `regedit.exe` executable on Windows.
So you can just say `regedit.exe "mytest.reg"`. What I'm not sure of is how to get rid of the dialog box that pops up that asks for your confirmation. |
Simple. Don't talk about scrum. Don't use scrum on her. Instead take the underlying principles of scrum (e.g. the purpose as opposed to the application) and create different approaches that accommodate her way of working but have subtle tints of scrum.
All humans are different and a lot of programmers dislike scrum.... |
If by not used, you mean your application has no more references to the tables in question and you are using dynamic sql, you could do a search for the table names in your app, if they don't exist blow them away.
I've also outputted all sprocs, functions, etc. to a text file and done a search for the table names. I... |
wikipedia's Definition
Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed. ...
http://en.wikipedia.org/wiki/Lazy%20loading |
Gmail's SMTP-server requires a very specific configuration.
From [Gmail help][1]:
Outgoing Mail (SMTP) Server (requires TLS)
- smtp.gmail.com
- Use Authentication: Yes
- Use STARTTLS: Yes (some clients call this SSL)
- Port: 465 or 587
Account Name: your full email address (incl... |
The DataSet is vastly overrated and overused. Use strongly-typed collections (thank you, generics and automatic properties!). As icing on the cake, you can now even do cool query things against your custom objects with LINQ.
Good Esposito article on datasets versus custom objects:
<http://msdn.microsoft.com/en-u... |
This is why I don't use datasets. If you use strongly-typed datasets you benefit from the strong typing but you pay for it in terms of the time it takes to create one even if you're just using part of it and its extensibility in terms of the code base. If you want to modify an existing one and you modify a row definiti... |
Lazy Loading is a programming practice in which you only load or initialize an object when you first need it. This can potentially give you a big performance boost, especially if you have a lot of components in your application.
As usual, [Wikipedia][1] has more details.
[1]: http://en.wikipedia.org/wiki/Lazy... |
One good way to do this is via fixtures, particularly the `initial_data` fixtures.
A fixture is a collection of files that contain the serialized contents of the database. So it's like having a backup of the database but as it's something Django is aware of it's easier to use and will have additional benefits when ... |
The primary tool I've also used was FitNesse. I've used it at several companies, with very good results. We did have test cases numbering in the many thousands, and we had to be very disciplined in how we organized and used them.
I've tried some other tools, including writing my own DSL (domain-specific language) an... |
When I write unit tests I limit the scope of the code being tested to the class I am currently writing by mocking dependencies. If I am writing a Sentence class, and Sentence has a dependency on Word, I will use a mock Word. By mocking Word I can focus only on its interface and test the various behaviors of my Senten... |
Hyper-V works quite well and even supports Linux VM's. The main advantage is that if you are already running Windows server 2008 it comes along for free whereas you have to pay for VMWare separately. I think that VM ware provides better system management tools, but that isn't really a big benefit in this particular cas... |
I believe I've found the answer. It seems that Microsoft, in all their infinite wisdom, has blocked batch files from being executed by IIS in Windows Server 2003. Brenden Tompkins has a work-around here:
http://codebetter.com/blogs/brendan.tompkins/archive/2004/05/13/13484.aspx
That won't work for me, because my ... |
VMware did recently release a free version of ESXi recently.
VMware has a few advantages:
1. VMware virtual machines are portable across different types of hardware. IIRC, Hyper-V uses the drivers from the Host OS.
2. VMware virtual machines are portable across different VMware products (although you may need... |
[see this][1]
[1]: http://www.linuxselfhelp.com/HOWTO/Text-Terminal-HOWTO-6.html
> For a pseudo terminal pair such as
> ptyp3 and ttyp3, the pty... is the
> master or controlling terminal and the
> tty... is the slave. There are only 16
> ttyp's: ttyp0-ttypf (f is a
> hexadecimal digit). **To get more
>... |
Using Regex to generate Strings rather than match them |
|java|regex| |
I am writing a Java utility which helps me to generate loads of data for performance testing. It would be *really* cool to be able to specify a regex for Strings so that my generator spits out things which match this. Is there something out there already baked which I can use to do this? Or is there a library which ... |
And this: [http://lists.opensuse.org/archive/opensuse/2003-12/msg02404.html][1]
[1]: http://lists.opensuse.org/archive/opensuse/2003-12/msg02404.html |
In the Linux devices.txt file in the kernel docs it says:
3 char Pseudo-TTY slaves
0 = /dev/ttyp0 First PTY slave
1 = /dev/ttyp1 Second PTY slave
...
255 = /dev/ttyef 256th PTY slave
These are the old-style (BSD) PTY devices; Unix98
devi... |
Credit due to @Blorgbeard for sharing his script. I'll certainly bookmark it in case I need it.
Yes, you can "right click" on the table and script the `CREATE TABLE` script, but:
- The a script will contain **loads** of cruft (interested in the extended properties anyone?)
- If you have 200+ tables in your ... |
From [Wikipedia](http://en.wikipedia.org/wiki/Flash_video)
>>**Embedded in an SWF file** using the Flash authoring tool (supported in Flash Player 6 and later). The entire file must be transferred before playback can begin. Changing the video requires rebuilding the SWF file.[citation needed]
>>**Progressive down... |
We use the wild, wild, west style of git-branches. We have some branches that have well-known names defined by convention, but in our case, tags are actually more important for us to meet our corporate process policy requirements.
I saw below that you use Subversion, so I'm thinking you probably should check out th... |
Perl has a taint option which considers all user input "tainted" until it's been checked with a regular expression. Tainted data can be used and passed around, but it taints any data that it comes in contact with until untainted. For instance, if user input is appended to another string, the new string is also tainte... |
Use the Win32 API function ShellExecute() or ShellExecuteEx(). If the comment is 'open' it should merge the .reg file. I haven't tested it, but it should work. |
"Out of the box" there is not a way to do this. You can create one by deriving your own Dictionary class and implementing the restrictions you need. |
MSSQL2000 won't give you that kind of information. But a way you can identify what tables ARE used (and then deduce which ones are not) is to use the SQL Profiler, to save all the queries that go to a certain database. Configure the profiler to record the results to a new table, and then check the queries saved there t... |
I have to put in another vote for [jQuery][1]. It is dead-simple to use and makes your javascript much cleaner.
As an example, if you want to add an onclick event to all the divs inside an element with id "clickdivs", you just do this:
function clickedme(event) {
alert('Someone clicked me!');
}
... |
You might want to look at [DropThings][1] on [Codeplex][2].
[1]: http://www.codeplex.com/dropthings
[2]: http://www.codeplex.com |
You can use the `svn:keywords` property to enable the `Rev` keyword.
You can then use `$Rev$` in your code and SVN will expand it automatically when updating to `$Rev: 256 $` which can then parse...
[More info on the Subversion manual](http://svnbook.red-bean.com/en/1.0/ch07s02.html#svn-ch-7-sect-2.3.4) |
Doesn't the %c parameter pass in the command issued (including the files being committed)?
|
> A DBA has no freedom to make changes
> to the data model without forcing you
> to change your compiled code. With
> stored procedures, you can hide these
> sorts of changes to an extent, since
> the parameter list and results set(s)
> returned from a procedure represent
> its contract, and the innards can be
... |
Dim returnXDoc As New XmlDocument(xDoc.NameTable)
returnXDoc = xDoc.Clone()
The first line here is redundant - you are creating an instance of an XmlDocument, then reassigning the variable:
Dim returnXDoc As XmlDocument = xDoc.Clone()
This does the same.
Seeing as you appear to be inserting eac... |
pretty sure Money maps to System.Decimal
[Check here][1]
[1]: http://msdn.microsoft.com/en-us/library/bb386947.aspx |
You could try:
static bool HasNet35()
{
try
{
AppDomain.CurrentDomain.Load(
"System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
return true;
}
catch
{
return false;
}
}
HTH |
You could try:
static bool HasNet35()
{
try
{
AppDomain.CurrentDomain.Load(
"System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
return true;
}
catch
{
return false;
}
}
@[Nick][1]: Good question, I'll try... |
Personally I would log it to either a log file or the event log depending on the issue. I think storing it using a users permissions would be a bad idea, what happens if that user does not have the correct rights? or worse still they get elevated permissions by browsing the list in explorer view?
The log file woul... |
At a previous job, I used a Java obfuscator that as well as obfuscating the code, also removed classes and methods that weren't being used. If you were doing "Class.byName" or any other type of reflection stuff, you needed to tell the obfuscator because it couldn't tell by inspecting the code what classes or methods c... |