Anyway of invoking the Edit Advanced Format Document" VS command automatically when switching away from a document / routinely with a timer / on entering a document?
Its really irritating Ctrl+E+D'ing everytime you want to prettify your code.
In "Perl Best Practices" the very first line in the section on AUTOLOAD is:
Don't use AUTOLOAD
However all the cases he describes are dealing with OO or Modules.
I have a stand alone script in which some command line switches control which versions of particular functions get defined. Now I know I could just take the conditionals and the…
I've been looking at using resharper and from the reviews I've seen, people who start using it never go back.
I'm wondering if using resharper helps you pick up errors when looking at code without resharper, or does it decrease this ability becaues you get use to relying on resharper to identify problems?
I've recently created these two (unrelated) methods to replace lots of boiler-plate code in my winforms application. As far as I can tell, they work ok, but I need some reassurance/advice on whether there are some problems I might be missing.
(from memory)
static class SafeInvoker
{
//Utility to avoid boiler-plate InvokeRequired code
…
I have conditional logic that requires pre-processing that is common to each of the conditions (instantiating objects, database lookups etc). I can think of 3 possible ways to do this, but each has a flaw:
Option 1
if A
prepare processing
do A logic
else if B
prepare processing
do B logic
else if C
prepare processing
do C…
Hello,
Having namespaces in PHP is great. Having '\' as namespace separator is a little bit ... awkward (but if there is someone who thinks that is cool & sexy, I am adding tag "rant" to this post. ;) .
So, here goes the question:
Are you using in your code NAMESPACE_SEPARATOR constant? As in code below:
<?php
if…
By favorite I mean the one that gets your goat the most, not the one you enjoy using the most.
I'm fairly new to the concept of anti patterns and I'd like a list of do not do's. An explanation of why it's an antipattern and what problems it causes would be good too.
When I bind a control to an NSArrayController using Interface Builder, there are a variety of options under the "Controller Key" field in the bindings inspector.
I understand what "arrangedObjects" is, and I semi-understand what "selection" is, but I'd love to see a really nice explanation of all the options and when to use…
What industry known software safety standards has anyone had experience in having to adhere to while developing software that is involved in controlling a device/system that has potential to harm the individuals using it?
I'm currently altering a widely used class to move as much of the expensive initialization from the class constructor into Lazy Initialized properties. Below is an example (in c#):
Before:
public class ClassA
{
public readonly ClassB B;
public void ClassA()
{
B = new ClassB();
}
}
After:
public…
I need serious help diving the positive numbers and the negative numbers.
I am to accumulate the total of the negative values and separately accumulate the total of the positive values. After the loop, you are then to display the sum of the negative values and the sum of the positive values.
The data is suppose to look…
I've tried checking other answers, but I'm still confused--especially after seeing W3schools HTML 5 reference.
I thought HTML 4.01 was supposed to "allow" single-tags to just be <img> and <br>. Then XHTML came along with <img /> and <br /> (where someone said that the space is there for older…
I try to be as minimalist as possible. Repetition is a problem. I hate it. When is it really a problem?
what is static-overuse?
what is field-method overuse?
what is class-overuse?
are there more types of overuse?
Problem A: when it is too much to use of static?
private static class Data
{
…
Hi,
I have a python class which reads a config file using ConfigParser:
Config file:
[geography]
Xmin=6.6
Xmax=18.6
Ymin=36.6
YMax=47.1
Python code:
class Slicer:
def __init__(self, config_file_name):
config = ConfigParser.ConfigParser()
config.read(config_file_name)
# Rad the…
I usually use
if (i == 2)
in preference to
if (2 == i)
On occasion, I would switch things around when writing xUnit-type tests from scratch so as to follow the assertion convention of "expected" preceding "actual".
When adding to existing unit tests, I always follow the style I find.
No matter what, I…
I'm kinda new to programming and got a question on what is a good practice.
I created a class that represents a ball and it has a function Jump() that use 2 timers and get the ball up and down.
I know that in Winforms you got to call Invalidate() every time you want to repaint the screen, or part of it. I…
The standard method to send data on a stream socket has always been to call send with a chunk of data to write, check the return value to see if all data was sent and then keep calling send again until the whole message has been accepted.
For example this is a simple example of a common scheme:
int…
Hi,
I'm curious to know, how many spaces of indentation do you prefer in PHP code?
function one()
{
$one;
function space()
{
$space;
}
}
function two()
{
$two;
function spaces()
{
$spaces;
}
}
function three()
{
$three;
function spaces()
{
$spaces;
}
}
function…
In most examples that you find on the web when explicitly not using "using", the pattern looks something like:
SqlConnection c = new SqlConnection(@"...");
try {
c.Open();
...
} finally {
if (c != null) //<== check for null
c.Dispose();
}
If you do use "using" and look at…
I am using phpbb on a site for a client, and the client has requested that each different forum page have a different background color.
Such functionality is not built into phpbb (from what I can tell), so how should I go about doing this? Can I modify the code of phpbb directly?
My other thought…
I'm preparing a talk on SSL to our local Java user group, and I would like to introduce it with some story on how NOT to use it. I've searched through the DailyWTF archives but couldn't find anything really good.
Do you know such a story, or do you have some pointers where I could go looking for…
Would you write something like:
enum XYZ_TYPE {X=1, Y=2, Z=3};
I saw it and the suffix _TYPE confuses me in the enum context. There is a strong prospect that it is because I am not bright.