instruction stringlengths 0 30k ⌀ |
|---|
You could have a mail sent to you at each commit... Look into the [CVS Book](http://cvsbook.red-bean.com/cvsbook.html#Commit%20Emails). |
When is this VB6 member variable destroyed? |
|vb6| |
Suppose I have a class module `clsMyClass` with an object as a member variable. Listed below are two complete implementations of this very simple class.
Implementation 1:
Dim oObj As New clsObject
Implementation 2:
Dim oObj As clsObject
Private Sub Class_Initialize()
Set oObj = ... |
Testing.
It's often quicker and easier to test your C#/Java application by using a dynamic language. You can do exploratory testing at the interactive prompt and quickly create automated test scripts. |
I had the same banging-my-head-against-the-wall experience you did, and ended up writing a custom authentication provider that does an LDAP query against the Active Directory server.
So my security-related beans are:
<beans:bean id="contextSource"
class="org.springframework.security.ldap.DefaultSpringSecurity... |
AS already been said, I'd rather catch the exception, but using [XmlParserContext][1], you could try to parse "manually" and intercept any anomaly; however, unless you're parsing 100 xml fragments per second, why not catching the exception?
[1]: http://msdn.microsoft.com/en-us/library/system.xml.xmlparserco... |
Sorry, this doesn't help with CVS, but I'd recommend switching to subversion, which is designed to be a CVS replacement. Then you can use [trac][1] to follow checkins, as well as manage change tickets and documentation. It was well worth the effort in my own projects.
But if you have to use CVS, there's always [CVS... |
Another approach is using WMI (you'll need to add a reference to the System.Management assembly):
public static string GetDefaultPrinterName()
{
var query = new ObjectQuery("SELECT * FROM Win32_Printer");
var searcher = new ManagementObjectSearcher(query);
foreach (Managemen... |
I like Eclipse's VisualEditor, sometime ago I've tried to switch to
another editor, but found it impossible. Visual editor has this
feature that it generates manageable, readable, editable, and easy to
understand code. Unlike both mentioned earlier NetBeans editor and
WidnowBuilder it uses lazy initialization patte... |
Can you let us know that technology you are using as there are some intresting bits out there around this stuff and some short cuts... i.e. WSE2 is complex beast and something that I dont like getting wrong!
I dont like developers doing this and there are WSE2 accelorators out there like SSL Accelorates as the pro... |
> yield, var, lambda syntax, anon types
> and initialisers are all compiler
> cleverness. The IL they produce is
> cross-compatible.
Minor nit-picking point, but yield was a 2.0 feature anyway. |
There are a couple of free ebooks on the subject. Try:
Subversion Version Control (PDF): <http://www.informit.com/content/images/0131855182/downloads/Nagel_book.pdf>
Version Control With Subversion (Though the site seems to be down at time of writing, I have read and would heartily recommend it. Hopefully it w... |
There are a couple of free ebooks on the subject. Try:
Version Control With Subversion: <http://svnbook.red-bean.com/>
Subversion Version Control (PDF): <http://www.informit.com/content/images/0131855182/downloads/Nagel_book.pdf>
I have read and would recommend the former. Haven't read "Subversion Version C... |
FogBugz is free for up to 2 users by the way. As far I know this is the only tool that does it.
See here <http://www.workhappy.net/2008/06/get-fogbugz-for.html>
|
FogBugz is free for up to 2 users by the way. As far I know this is the only tool that does EBS.
See here <http://www.workhappy.net/2008/06/get-fogbugz-for.html>
|
On the basis that this thread should be entitled "*things you didn't know about C# until recently despite thinking you already knew everything*", my personal feature is asynchronous delegates.
Until I read Jeff Richter's C#/CLR book (excellent book, everyone doing .NET should read it) I didn't know that you could ca... |
I also, like you, never really felt a 100% comfortable with SVN or SourceSafe.
Check out [Mercurial][1]. [Quickstart][2] and [Cheatsheets][3]
also a great [cheat sheet from DongWoo Lee][4] (his site seems down so I scanned it and uploaded onto mine)
With Mercurial everything seemed a lot more smooth and easy ... |
Have you tried [Automatic Makefile Generator](http://www.robertnz.net/genmake.htm#Details)?
It supports for
<table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="40%"><b>Compiler</b></td>
<td width="15%"><b>Option</... |
You could display a message to people who have logged in saying "the site will be down for maintenance in xxx minutes" then run a service to log everyone out after xxx minutes. Then set a flag somewhere that every page can access, and at the top of every page(or just the template page) you test if that flag is set, if ... |
Primarily, it makes it very easy to create testable websites with well defined separations of responsibility. Its also much easier to create valid XHTML UIs using the new MVC framework.
I've used the 2nd CTP (I think they're on five now) to start work on a website and, having created a few web applications before, ... |
Have you looked at [Boo][1]? While Boo doesn't have macros, it has an open compiler pipeline, which is a good alternative to macros for syntactic metaprogramming.
[1]: http://Boo.CodeHaus.Org/ |
Oh yes. It's going to blow web forms out of the water - we've already seen how valuable a true MVC framework can be in the Java world. In the MS world - it's really been a void that has needed to be filled.
As a former Java/Struts dude - I find it pretty frustrating doing current work in web forms - because I know... |
IMHO its sweet. Most objects are newed up with the default constructor, and must have some properties set before they are ready to run; so the object initializers make it easier to code against most objects out there. |
Try setting the width and/or height of the rootpanel to 100% before adding your widget. |
After doing some more research here I'm pretty convinced this isn't possible with the current implementation of JSF. There just isn't an opportunity to transform the value.
[http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/f/selectItem.html][1]
[1]: http://java.sun.com/javaee/javaserverfaces/1.2/docs... |
The "offline.html" page won't work if the user was already navigating within the site, or if he's accessing the site from a bookmark/external link to a specific page.
The solution I use is to create a second web site with the same address (ip or host header(s)), but have it disabled by default. When the website is ... |
I use [Applied Innovations](http://www.appliedi.net/) for my .NET hosting. They seem to have cheap VPS as well.
I've never noticed a downtime,and their billing and support has been reliable. |
In Java, Statements (not Resultsets) correlate to Cursors in Oracle. It is best to close the resources that you open as unexpected behavior can occur in regards to the JVM and system resources.
Additionally, some JDBC pooling frameworks pool Statements and Connections, so not closing them might not mark those objec... |
Maximum # of Results in a Sitecore Droplink field? |
|asp.net|sitecore| |
In Sitecore 6, one of my templates contains a "Droplink" field bound to the results of a particular sitecore query. This query currently returns approximately 200 items.
When I look at an item that implements this template in the content editor, I can only see the first 50 items in the field's dropdown list.
How ... |
One problem with ONLY closing the connection and not the result set, is that if your connection management code is using connection pooling, the connection.close would just put the connection back in the pool. Additionally, some database have a cursor resource on the server that will not be freed properly unless it is... |
The documentation for [DecoratorPanel][1] says:
> If you set the width or height of the DecoratorPanel, you need to set the height and width of the middleCenter cell to 100% so that the middleCenter cell takes up all of the available space. If you do not set the width and height of the DecoratorPanel, it will wrap i... |
I realize that cost isn't a problem but a nice free solution that wouldn't involve checking in and out would be to host the code within [Dropbox][1] by doing this you'd instantly get versioning and backup which are the main features that a single developer system would provide.
[1]: http://getdropbox.com |
Keep in mind that if you do as Theo said and reference it with the correct type it will compile that class in both swfs, even if you're not using it in the first one. Unfortunately the fl.* classes don't implement any interfaces so you can't type them to the interface instead of the implementation. If you could, only t... |
"Off" is case-sensitive.
Check if the "O" is in uppercase in your web.config file, I've suffered that a few times (as simple as it sounds) |
that helps?
/^[^\s\.]+(?:\.[^\s\.]+)*$/
or, in extended format, with comments (ruby-style)
/
^ # start of line
[^\s\.]+ # one or more non-space non-dot
(?: # non-capturing group
\. # dot something
[^\s\.]+ # one or more non-space non-d... |
You can do the same things in both C# or VB.NET. In the end it'd be a choice of which is easier to port to.
Keeping in mind that you shouldn't (IMHO) port directly ASP to ASP.NET, since you'd loose much of the features in .NET, this would include a fair amount of rewrite anyway. So I'd go with C# since I think it's ... |
I love AutoHotkey (small k...) too, but beside its odd syntax, it has the same lack of debugging tools...
Basically, that's "show msgbox alerts, send strings to file or debugview, trace". Which is OK for most cases, since you rarely write long and complex applications with these tools.
In both tools, and probably a... |
I use this one all the time, usually for quick access to the MySQL command line.
[http://lifehacker.com/software/featured-windows-download/make-a-quake+style-command-prompt-with-autohotkey-297607.php][1]
[1]: http://lifehacker.com/software/featured-windows-download/make-a-quake+style-command-prompt-with-autoh... |
There are a few features in C# 3.5 that aren't supported in Visual Basic but language choice is always preference from the team and what you guys feel most productive in. |
Slightly off-topic: What's the point of the encryption/obfuscation in the first place? An attacker having access to your database will be able to obtain the plaintext -- finding the above stored procedure will enable the attacker to perform the decryption. |
It's learning .Net (framework) that takes the time.
The specific language doesn't matter and is more a matter of taste. I'd normally recommend trying a few play projects in both languages (and any others that may take your fancy), and then decide which one you're more comfortable with (or have more success with!) |
I have a [C++ ftplugin for vim][1] that is able is check and report unmatched functions -- vimmers, the ftplugin suite is not yet straightforward to install. The ftplugin is based on ctags results (hence its [heuristic][2] could be easily adapted to other environments), sometimes there are false positives in the case o... |
You don't need to worry about keeping a reference to the originally registered delegate, and you will not start a "nasty memory pool".
When you call "OnStuff -= new StuffEventHandler(this.Handle);" the removal code does *not* compare the delegate you are removing by reference: it checks for equality by comparing ref... |
- Talk to other programmers every step of the way. The more eyes there are on the design, the more likely an overcomplicated aspect is revealed early, before it becomes too ossified in the codebase.
- Constantly ask yourself how you will use whatever you are currently working on. If the answer is that you're not... |
This is a delicate balancing act: on the one hand you don't want something that takes too long to design and implement, on the other hand you don't want a hack that isn't complicated enough to deal with next week's problem, or even worse requires rewriting to adapt.
A couple of techniques I find helpful:
If somet... |
Accepted answer does not work on MSSQL, cannot use page.name in the select clause when it does not appear in the group clause,
Here's another solution using sub-querying.
SELECT
p.name,
(
SELECT COUNT(*) FROM [page-attachment] pa
WHERE pa.[PAGE-ID] = p.id
) as attachment... |
If catching is too much for you, then you might want to validate the XML beforehand, using an XML Schema, to make sure that the XML is ok, But that will probably be worse than catching. |
If in implementation 1 the declaration is inside the class and not a sub, yes the scope is the same for both examples. |
If this is a tray app, and not a true service, be wary of how you set up your communications if using pipes or TCP/IP. If multiple users are logged into a machine (Citrix, Remote Desktop), and each user launches a tray app "service", then you can run into a situation where you have multiple processes trying to use the... |
My recommendation would be to introduce more abstractions. I find it confusing that a BItem has a DecodeFile() which returns a BDictionary. This may be a reasonable thing to do in the torrent domain, I don't know.
However, I would find an api like the following more reasonable:
BFile torrent = BFile.DecodeFil... |
I don't think so. The purpose and the goal of both solutions are different, and APS.NET Web Forms is more like a platform while MVC is architecture framework, so the question is a bit odd. In my opinion MVC in combination with good AJAX support and correct server side model structure could be the more convenient way t... |
If you don't have a backup of the database, you're out of luck. *Drop*ing a database is permanent. |
Good for making an exact recursive copy/backup of a directory including symlinks (rather than following them or ignoring them like cp):
$ mkdir new_dir
$ cd old_dir
$ tar cf - . | ( cd ../old_dir; tar xf - ) |
I think that eventually, MVC will have a 100% share of the MS-web-market. It's just better. |
I think overall it is useful, especially when used with automatic properties.
It can be confusing when properties are doing more than get/set.
Hopefully this will lead to more methods, and reduce the abuse of properties.
|
VxWorks has 256 priority levels (0 is highest, 255 is lowest). At any given time, the highest priority task runs on the CPU. Each priority level conceptually has a queue where multiple tasks queue up for execution.
We have 3 tasks at the same priority A, B, C. Assume A is executing.
When A blocks (taskDelay, Sem... |
I'm a fan of the `!$`, `!^` and `!*` expandos, returning, from the most recent submitted command line: the last item, first non-command item, and all non-command items. To wit:
$ echo foo bar baz
foo bar baz
$ echo bang-dollar: !$ bang-hat: !^ bang-star: !*
echo bang-dollar: baz bang-hat: foo bang... |
I'm a fan of the `!$`, `!^` and `!*` expandos, returning, from the most recent submitted command line: the last item, first non-command item, and all non-command items. To wit (Note that the shell prints out the command first):
$ echo foo bar baz
foo bar baz
$ echo bang-dollar: !$ bang-hat: !^ bang-sta... |
The original regex can be made to work with very little effort:
<(?>/?)(?!p).+?>
The problem was that the /? (or \\?) gave up what it matched when the assertion after it failed. Using a non-backtracking group (?>...) around it takes care that it never releases the matched slash, so the (?!p) assertion is alw... |
It is included with .NET (not sure if only in the SDK). |
The "official" default shell for Solaris is actually `sh`, the original Bourne shell (see [Chapter 10 of the Advanced User Guide](http://docsun.cites.uiuc.edu/sun_docs/C/solaris_9/SUNWabe/ADVOSUG/p34.html) for Solaris for more info). If you'd like to change it to `csh` or `tcsh`—and you're not `root` (it's generally co... |
DirectoryInfo.GetDirectories() and attributes |
|getdirectories|directoryinfo|attributes| |
I am using DirectoryInfo.GetDirectories() recursively to find the all the sub-directories under a given path.
How ever I want to exclude the System folders and there is no clear way for that.
In FindFirstFile/FindNextFile things were clearer with the attributes.
Thanks in advanced.
|
|.net|file-io|attributes|directoryinfo|getdirectories| |
I would choose the language with the syntax you are most comfortable with as there is very little difference in functionality, although some say there is something of a culture difference between VB and c# developers. Another option is to learn both, the biggest obstacle moving to .net in my opinion is learning the hug... |
Why is if not someobj: better than if someobj == None: in Python? |
|python| |
I seen several examples of code like this:
if not someobj:
#do something
But I'm wondering why not do:
if someobj == None:
#do something
Is there any difference? Does one have an advantage over the other? |
What Prevents a Thread in C# from being Collected? |
|.net|multithreading|garbage-collection| |
In .NET, after this code, what mechanism stops the Thread object from being garbage collected?
new Thread(Foo).Start();
GC.Collect(); |
In .NET, after this code, what mechanism stops the Thread object from being garbage collected?
new Thread(Foo).Start();
GC.Collect();
Yes, it's safe to assume **something** has a reference to the thread, I was just wandering what exactly. For some reason Reflector doesn't show me System.Threading, so I c... |
that helps?
/^[^\s\.]+(?:\.[^\s\.]+)*$/
or, in extended format, with comments (ruby-style)
/
^ # start of line
[^\s\.]+ # one or more non-space non-dot
(?: # non-capturing group
\. # dot something
[^\s\.]+ # one or more non-space non-d... |
that helps?
/^[^\s\.]+(?:\.[^\s\.]+)*$/
or, in extended format, with comments (ruby-style)
/
^ # start of line
[^\s\.]+ # one or more non-space non-dot
(?: # non-capturing group
\. # dot something
[^\s\.]+ # one or more non-space non-d... |
that helps?
/^[^\s\.]+(?:\.[^\s\.]+)*$/
or, in extended format, with comments (ruby-style)
/
^ # start of line
[^\s\.]+ # one or more non-space non-dot
(?: # non-capturing group
\. # dot something
[^\s\.]+ # one or more non-space non-d... |
RapidVPS offers windows hosting. $29,99/month
https://www.rapidvps.com/index.php?page=Hosting.Windows.Specs
I am a customer of their linux vps hosting and have had zero problems. |
Will moving that portion to a separate iframe work? then if they scroll to the bottom, issue a get request for a small image file..forgot the name of the technique.. |
Will moving that portion to a separate iframe work? then if they scroll to the bottom, issue a get request for a small image file..forgot the name of the technique..
Update: It is called [Web Bug][1]..A Web bug is an object that is embedded in a web page or e-mail and is usually invisible to the user but allows chec... |
And here's a trivial version in Python:
items = ['Toby', 'Tiny', 'Tory', 'Tily']
tuples = sorted(x for item in items for x in enumerate(item))
print [x[0] for x in itertools.groupby(tuples) if len(list(x[1])) == len(items)]
Which prints:
[(0, 'T'), (3, 'y')] |
At login, most shells execute a login script, which you can use to execute your custom script. The login script the shell executes depends, of course, upon the shell:
- bash: .bash_profile, .bash_login, .profile (for backwards compabitibility)
- sh: .profile
- tcsh and csh: .login
- zsh: .zshrc
You c... |
Whitespace is your friend ....
but, then again, I like:
if (foo)
{
Console.WriteLine("Foobar");
} |
I find this:
if( true ) {
DoSomething();
} else {
DoSomethingElse();
}
better than this:
if( true )
DoSomething();
else
DoSomethingElse();
This way, if I (or someone else) comes back to this code later to add more code to one of the branches, I won'... |
you might get some good mileage out of using a language-specific external tool as a Vim filter. for example, if you can write a [Perltidy](http://perltidy.sf.net) config file to generate the formatting you want (it looks like you would want the **-lp -vtc=2** flags), you can then pipe your existing Vim buffer through ... |
I always use
if(x)
{
print "x is true";
}
leaving out the braces can result in someone maintaining the code mistakenly thinking they are adding to the if clause if they add a line after the current line. |
Remember, use the timeit module to test which of small snipps of code is faster!
$ python -m timeit 'for i in range(1000000):' ' pass'
10 loops, best of 3: 90.5 msec per loop
$ python -m timeit 'for i in xrange(1000000):' ' pass'
10 loops, best of 3: 51.1 msec per loop
Personally, I always use ... |
if
{
// code
}
else
{
// else code
}
because i like when blocks of code line up (including their braces). |
What are the advantages and disadvantages of DTO's from a website performance perspective? |
|performance|jakarta-ee|ejb|rpc|dto-mapping| |
What are the advantages and disadvantages of DTO's from a website performance perspective? (I'm talking in the case where the database is accessed on a different app server to the webserver - and the webserver could access the database directly.) |
From: [Google: visual basic 6 logical operator precedence](http://www.google.ca/search?q=visual+basic+6+logical+operator+precedence) to [Sams Teach Yourself Visual Basic 6 in 24 Hours > Appendix A. Operator Precedence](http://www.informit.com/library/content.aspx?b=STY_VB6_24hours&seqNum=247)
1. Not
2. And
3. O... |
I can't think of a rationale for why you're wanting h2's to display inline. In fact, why would you want two headers to read together? Think of the way it should be read. Do you want it to read:
"Header one header two"
or:
"Header One"
"Header Two"
If it's the first way, then it's probably your HTML that'... |
I have always used a struct when I wanted to group together a few values for passing things back from a method call, but I won't need to use it for anything after I have read those values. Just as a way to keep things clean. I tend to view things in a struct as "throwaway" and things in a class as more useful and "fu... |
You can **use [Windows Media Services 2008][1]**. It enables you to actually stream WMV to Silverlight interface.
[1]: http://www.microsoft.com/windows/windowsmedia/forpros/server/version.aspx |
We have eclipse manage things the way it wants, and use ant4eclipse (a set of ant tasks) for continuous builds. Works great! |
File Replication Solutions |
|replication|filesystems|file|copy|xcopy| |