instruction stringlengths 0 30k ⌀ |
|---|
Here's an example using just HTML and CSS to achieve what I think you're looking for:
[http://www.shrutigupta.com/index.php/2005/12/12/how-to-create-table-with-first-column-frozen/][1]
[1]: http://www.shrutigupta.com/index.php/2005/12/12/how-to-create-table-with-first-column-frozen/ |
In WPF:
<Window.ContextMenu FontSize="36">
<!-- ... -->
</Window.ContextMenu
In WinForms:
contextMenuStrip1.Font = new System.Drawing.Font("Segoe UI", 24F);
|
Library naming conventions |
|naming-conventions| |
There are two popular naming conventions:
1. vc90/win64/debug/foo.dll
2. foo-vc90-win64-debug.dll
Please discuss the problems/benefits associated with either approach.
I am also wondering if it is possible to expose meta-data (i.e. compiler, platform, build-type) in approach #1 in an easy to use, cross-platfo... |
The "Usort" function is your answer.
[http://si.php.net/manual/en/function.usort.php][1]
[1]: http://si.php.net/manual/en/function.usort.php |
Korn Shell code to send attachments with mailx and uuencode? |
|ksh|korn|shell|solaris|scripting| |
I need to attach a file with mailx but at the moment I'm not having a lot of success.
Here's my code:
subject="Something happened"
to="somebody@somewhere.com"
body="Attachment Test"
uuencode /path/to/somefile.csv | mailx -s "$subject" "$to" << EOF
The message is ready to be sent with the... |
I am trying to use directory services to add a directory entry to an openldap server. The examples I have seen look pretty simple, but I keep getting the error "There is an naming violation". What does this message mean? How do I resolve it?
I have included the code, ldif file used to create the person container.
... |
Maybe [this][1] would help:
from the site:
char szPrinterName[255];
unsigned long lPrinterNameLentgth;
GetDefaultPrinter( szPrinterName, &lPrinterNameLength );
HDC hPrinterDC;
hPrinterDC = CreateDC("WINSPOOL\0", szPrinterName, NULL, NULL);
In the future instead of googling "unmanaged" t... |
Try out [Sysinternals Process Explorer][1]. It has an column of "% time in JIT". If that number is large you could run ngen on your application. If it's not it's likely to be a slow network connection.
[1]: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx |
Try out [Sysinternals Process Explorer][1]. It has an column of "% time in JIT". If that number is large you could run [ngen][3] on your application. If it's not it's likely to be a slow network connection. CodeGuru has a tutorial on [usage of ngen][2].
[1]: http://technet.microsoft.com/en-us/sysinternals/bb8... |
You could use Watin: [http://watin.sourceforge.net/][1]
[1]: http://watin.sourceforge.net/ |
|c++|winapi|service| |
Any implementation of TCP/IP will reserve the address 127.0.0.1 to refer to the local machine. However, the mapping of the name "localhost" to that address is generally dependent on the system `hosts` file. If you were to remove the localhost entry from `hosts`, then the localhost name may no longer resolve properly at... |
Any correct implementation of TCP/IP will reserve the address 127.0.0.1 to refer to the local machine. However, the mapping of the name "localhost" to that address is generally dependent on the system `hosts` file. If you were to remove the localhost entry from `hosts`, then the localhost name may no longer resolve pro... |
Click the down-arrow in the package explorer (next to the editor linker). Then you just change the filters. Unmark the box that says '.*' resources. |
No, you don't need to have Finalize unless you have unmanaged resources to clean up.
In most cases the reason a class is disposable is because it keeps references to other managed IDisposable objects. In this case no Finalize method is necessary or desirable. |
No.
For a start `localhost` is a convention rather than a rule. Mostly it's set by default, but there's nothing to mandate it.
Secondly, there's nothing to say that you can always ping 127.0.0.1.
As an example (on a unix system) try the following:
`sudo ifconfig lo down`
`ping 127.0.0.1`
As [cruizer][1] sai... |
How do I determine the value of a generic parameter on my class instance |
|c#|generics|reflection| |
I have a marker interface defined as
public interface IExtender<T>
{
}
I have a class that implements IExtender
public class UserExtender : IExtender<User>
At runtime I recieve the UserExtender type as a parameter to my evaluating method
public Type Evaluate(Type type) // type == ty... |
It sounds as if you actually have two different, conflicting requirements, as to timing and identity.
1. Run as each logged in user
2. Run automatically even if no user is logged in.
No way to do this trivially, instead consider wrapping your program in a service; the program will run normally on startup for e... |
A symbol table is added to the executable which maps function/variable names to data locations, so that debuggers can report back meaningful information, rather than just pointers. This doesn't effect the speed of your program, and you can remove the symbol table with the 'strip' command. |
I write explicit tests for everything except simple getters and setters.
If the getter or setter only contains a return blah; or this.blah = blah; I don't think there is much value. The majority of times these are generated and I feel the time putting the tests together could be better spent elsewhere. |
I doubt you'll find an open source or free emulator for this terminal type. While IBM has contributed to open source communities, they are also very interested in protecting their intellectual property. Hummingbird licenses are certainly expensive. We ran into issues with that when I worked for IBM!
That said, I nev... |
How do you remove the default title and body fields in a CCK generated Drupal content-type? |
|content-management-system|drupal|cck| |
When you create a new content type in Drupal using the Content Creation Kit, you automatically get Title and Body fields in the generated form. Is there a way to remove them? |
The error location 0x00486752 seems really small to me, before where executable code usually lives. I agree with Daniel, it looks like a wild pointer to me. |
-g adds debugging information in the executable, such as the names of variables, the names of functions, and line numbers. This allows a debugger, such as gdb to step through code line by line, set breakpoints, and inspect the values of variables. Because of this additional information using -g increases the size of ... |
If you're connecting to a named instance and UDP is not available when connecting to it then you may need to specify the protocol as well.
Example:
tcp:192.168.1.21\SQL2K5,1443 |
MSVC uses a very heavyweight implementation of checked iterators in debug builds, which others have already discussed, so I won't repeat it (but start there)
One other thing that might be of interest to you is that your "debug build" and "release build" probably involves changing (at least) 4 settings which are only... |
I found the answer:
Point clientPos = this.PointToClient(Form.MousePosition);
Control control = this.GetChildAtPoint(clientPos);
This should give the underlying control that was clicked on the Form, or null if the click was on the gray area. So we just need to test for the type of the control on the Open... |
Try this:
\d+ tablename
See [this link][1] for more info.
[1]: http://archives.postgresql.org/pgsql-novice/2005-10/msg00116.php |
Not sure if there's any limitation.. But there was a memory leak bug in XmlSerialization in .NET 1.1, you sort of had to create a cache serializer object to get around with this issue... In fact, Im not sure if this issue has been fixed in .net 2.0 or newer... |
In addition to the PostgreSQL way (\d 'something' or \dt 'table' or \ds 'sequence' and so on)
The SQL standard way, as shown [here][1]:
select column_name from INFORMATION_SCHEMA.COLUMNS where table_name = 'table';
It's supported by many db engines.
[1]: http://stackoverflow.com/questions/10050... |
There is a good overview of different paging techniques at [http://www.codeproject.com/KB/aspnet/PagingLarge.aspx][1]
I've used ROWCOUNT method quite often mostly with SQL Server 2000 (will work with 2k5 & 2k8 too, just measure performance compared to ROW_NUMBER), it's lightning fast, but you need to make sure that ... |
The approach I used when faced with this problem was to add the signer of the temporary certificate to the trusted authorities list on the computer in question.
I normally do testing with certificates created with <a href="www.cacert.org">CACERT</a>, and adding them to my trusted authorities list worked swimmingly.
... |
[Audible][1] - Self Development, Business and Education sections!
[1]: http://www.audible.com |
All possible uses for the Application.SysCmd Method |
|ms-access|vba|methods| |
Is there a place to find all possible uses of the syscmd method in MS Access? I know Microsoft has a [developer reference][1], but I have found there are many other uses for this method that are not listed here.
[1]: http://msdn.microsoft.com/en-us/library/bb214117.aspx |
In Ruby 1.9, the `!` operator is actually also a method and can be overriden. This only leaves `&&` and `||` and their low-precedence counterparts `and` and `or`.
There's also some other "combined operators" that cannot be overriden, e.g. `a != b` is actually `!(a == b)` and `a += b` is actually `a = a+b`. |
Actually this is debatable whether or not this is the best practice way to do events. There is the school of thought that as events are intended to decouple two segments of code, the fact that the event handler gets the sender, and has to know what type to cast the sender into in order to do anything with it. |
Treating these security questions as something actually being two-factor authentication is totally misleading. From spurious items read before, when certain (banks) sites were required to have "two-factor authentication" they started implementing this as a *cheap* way to do it. Bruce Schneier talked about this a [whi... |
What's a good alternative to security questions? |
|security|passwords|authentication| |
> From [Wired][1] magazine:
>
> ...the Palin hack didn't require any
> real skill. Instead, the hacker simply
> reset Palin's password using her
> birthdate, ZIP code and information
> about where she met her spouse -- the
> security question on her Yahoo
> account, which was answered (Wasilla
> High) by a ... |
|security|authentication|passwords| |
> From [Wired][1] magazine:
>
> ...the Palin hack didn't require any
> real skill. Instead, the hacker simply
> reset Palin's password using her
> birthdate, ZIP code and information
> about where she met her spouse -- the
> security question on her Yahoo
> account, which was answered (Wasilla
> High) by a si... |
Use the standard C# / .NET registry classes and enumerate over the result of GetSubKeyNames().
See [here](http://www.java2s.com/Code/CSharp/Development-Class/EnumeratingRegistryKeys.htm) for an example. |
You're not going to like this but what makes you think that catching the exception is going to be slower?
How many failed attempts to parse a GUID are you expecting in comparison with successful ones?
My advice is use the function you've just created and profile your code. If you find that this function is truely... |
Editable JTable Tutorial |
|java|swing|jtable|tutorial| |
Are there any good books or website that go over creating a JTable? I want to make one column editable. I would like to actually put a inherited JCheckBox component (that we created here) into one of the table columns instead of just having the table put JCheckBox in based on it being an editable boolean field.
I h... |
Tell them to leave it alone.
It works, what is the benefit of changing it other than prettying it up (and the potential cost is high) so you just need to explain the cost/benefit analysis.
I would hope your developers would be smart enough to understand this and, if not, you can use your source code control syste... |
Yes, if you're referencing it like this:
// F is-a E,
// E is-a D and so on
A* aObject = new F();
aObject->CallAVirtual();
Then you're working with a pointer to an A type object. Given you're calling a function that is virtual, it has to look up the function table (vtable) to get the... |
Calling a virtual function is slightly slower than calling a nonvirtual function. However, I don't think it matters how deep your inheritance tree is.
But this is not a difference that you should normally be worried about. |
In Python you can use the entry-point system provided by `setuptools` and `pkg_resources`. Each entry point should be a function that returns information about the plugin -- name, author, setup and teardown functions, etc. |
While I'm not completely sure, I think that unless you're using virtual methods, the compiler should be able to optimize it well enough that inheritance shouldn't matter too much.
However, if you're calling up to functions in the base class which call functions in its base class, and so on, a lot, it could impact pe... |
There are some great tips and trips and shortcuts on [Sara Ford's blog][1].
[1]: http://blogs.msdn.com/saraford/default.aspx |
[Deep inheritance hierarchies] greatly increases the maintenance burden by adding unnecessary complexity, forcing users to learn the interfaces of many classes even when all they want to do is use a specific derived class. It can also have an impact on memory use and program performance by adding unnecessary vtables an... |
Most of the things that I learned about .NET, I learned when I was reviewing it to be able to train newbie devs. So yes, speaking on software helps a whole lot. |
I personally use [HTTP_Upload][1] from PEAR. It works pretty well for our purposes (uplaoding media files into a development system and uploading arbitrary files for an educational system)
[1]: http://pear.php.net/package/HTTP_Upload |
A simple plugin architecture can define a plugin interface with all the methods the plugin ought to implement. The plugin handles event from the application, and can use the application's standard code, model objects, etc. to get things done. Basically the same as an ASP.NET Form does, except that you're overriding r... |
What's the relationship between margin, padding and width in different browsers? |
|css| |
CSS width value = display width of inside?
or
CSS width value = display width of inside + CSS margin-left + CSS margin-right?
|
All you need is a reference. It's not really a simple problem that I can give some one-line solution to (other than a simple ugly global that would probably break something else), but one of program structure. You don't magically get access to a variable that was created on another instance of another class. You have t... |
You can't declare an instance of an undefined class but you can declare a **pointer** to one:
class A; // Declare that we have a class A without defining it yet.
class B
{
public:
A *itemA;
};
class A
{
public:
B *itemB;
};
|
there's a maxlength attribute
<input type="textbox" name="textboxname" maxlength="100" />
|
there's a maxlength attribute
<input type="text" name="textboxname" maxlength="100" />
|
In addition to the above, I would like to point out that client-side validation (HTML code, javascript, etc.) is never enough. Also check the length server-side, or just don't check at all (if it's not so important that people can be allowed to get around it, then it's not important enough to really warrant any steps t... |
Is this close to what you want: The first class contains the second class, but the second class (that is to be created first) just has a reference to the first class? |
You can't do something like this:
class A {
B b;
};
class B {
A a;
};
The most obvious problem is the compiler doesn't know how to large it needs to make class A, because the size of B depends on the size of A!
You can, however, do this:
class B; // this is a "forwar... |
Default database IDs; system and user values |
|database| |
As part of our current database work, we are looking at a dealing with the process of updating databases.
A point which has been brought up recurrently, is that of dealing with system vs. user values; in our project user and system vals are stored together. For example...
We have a list of templates.
1, <s... |
"I guess you could use your favourite image editor and pick the colors from a screen grab."
This is essentially what I'm doing at the moment, and I've defined a list of constants from which I pull out the colours. Doesn't seem very elegant though! |
Is accessing a variable in C# an atomic operation? |
|c#|multithreading| |
I've been raised to believe that if multiple threads can access a variable, then all reads from and writes to that variable must be protected by synchronization code, such as a "lock" statement, because the processor might switch to another thread halfway through a write.
However, I was looking through System.Web.Se... |
Like Matt (3 above), I prefer:
if (x)
{
...statement1
...statement2
}
and
if (x)
...statement
else
...statement
I think its pretty strange to think that someone may come along later and NOT realise they have to add the braces to form a multi-line i... |
How do I determine darker or lighter color variant of a given color? |
|c#|colors| |
Given a source color of any hue by the system or user, I'd like a simple algorithm I can use to work out a lighter or darker variants of the selected color. Similar to effects used on Windows Live Messenger for styling the user interface.
Language is C# with .net 3.5. |
Given a source color of any hue by the system or user, I'd like a simple algorithm I can use to work out a lighter or darker variants of the selected color. Similar to effects used on Windows Live Messenger for styling the user interface.
Language is C# with .net 3.5.
Responding to comment: Color format is (Alpha... |
Given a source color of any hue by the system or user, I'd like a simple algorithm I can use to work out a lighter or darker variants of the selected color. Similar to effects used on Windows Live Messenger for styling the user interface.
Language is C# with .net 3.5.
**Responding to comment:** Color format is (A... |
Asterisk AGI framework for IVR; Adhearsion alternative? |
|ruby|asterisk|ivr|agi| |
I am trying to get started writing scalable, telecom-grade applications with Asterisk and Ruby. I had originally intended to use the Adhearsion framework for this, but it does not have the required maturity and its documentation is severely lacking. AsteriskRuby seems to be a good alternative, as it's well documented... |
I dislike using braces when they're not required. I feel like it bloats the number of lines in a method and makes it unreadable. So I almost always go for the following:
if (x)
print "x is true"
for (int i=0; i<10; i++)
print "y is true"
And so forth. If someone needs to add another state... |
It depends on how the App is structured. If logic and GUI code is separated (MVC) then testing the logic is easy. Take a look at Michael Feathers ["Humble Dialog Box"][1] (PDF).
[1]: http://www.objectmentor.com/resources/articles/TheHumbleDialogBox.pdf "Humble Dialog Box" |
It depends on how the App is structured. If logic and GUI code is separated (MVC) then testing the logic is easy. Take a look at Michael Feathers ["Humble Dialog Box"][1] (PDF).
EDIT: If you think about it: You should very carefully refactor if the App is not structured that way. There is no other technique for test... |
[Safari Books Online][1] has a corporate subscription service which companies appreciate.
[1]: http://www.safaribooksonline.com/whysafari/try-safari.php |
Are you using MyISAM? Are you planning to store more than a couple of gigabytes? Watch out for MAX_ROWS and AVG_ROW_LENGTH.
Jeremy Zawodny has an [excellent write-up](http://jeremy.zawodny.com/blog/archives/000796.html) on how to solve this problem.
|
Let's say you have some string constants in your code, which is a pretty common need. It's better to define these as C strings than as C++ objects -- more lightweight, portable, etc. Now, if you're going to be passing these strings to various functions, it's nice if these functions accept a C string instead of requirin... |
Safari Books Online.. By far..
http://techbus.safaribooksonline.com:80/
|