instruction stringlengths 0 30k ⌀ |
|---|
The .NET Framework uses Windows default encoding for storing strings, which turns out to be UTF-16. If you don't specify an encoding when you use most text I/O classes, you will write UTF-8 with no BOM and read by first checking for a BOM then assuming UTF-8 (I know for sure <code>StreamReader</code> and <code>StreamW... |
Tooltips in html are the contents of the _alt_ text for image tags. But if you're setting this using CSS you probably have a _background:url(...);_ style instead of an image. |
You want a "title" tag. I'm not sure if this is necessary anymore, but I usually add both alt and title tags to make sure all browsers display the tool tip the same. |
The following code works (thank you John). With no full screen and a large "always on top" window.
But I still don't know why windows caused this stranged behavior...
private Window initFullScreenWindow() {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gds = ge.... |
Test Cases AND assertion statements |
|defensive-programming| |
The code in [this question][1] made me think
assert(value>0); //Precondition
if (value>0)
{
//Doit
}
I never write the if-statement. Asserting is enough/all you *can* do.
"Crash early, crash often"
[CodeComplete][2] states:
- The assert-statement makes the application Correct ... |
VMWare? No. However, qemu has an x86_64 system target that you can use. You likely won't be able to use a vmware image directly (IIRC, there's no conversion tool), but you can install the OS and such yourself and work inside it. QEmu can be a bit of a PITA to get up and running, but it tends to work quite nicely. |
The problem with trusting just Asserts, is that they may be turned off in a production environment. To quote the wikipedia article:
> Most languages allow assertions to be
> enabled or disabled globally, and
> sometimes independently. Assertions
> are often enabled during development
> and disabled during final ... |
|language-agnostic|user-interface|documentation| |
Start by switching away from VSS to something more reliable & feature-rich. See [How to convince a company to switch their Source Control][1]
Then apply known-good practices:
- [Check in often][2]
- Pick up others' changes often, to simplify merging
- Use fast [unit tests][3] to make sure each change meets a m... |
Embed the query. You take the top x when sorted in ascending order (i.e. the oldest) and then re-sort those in descending order ...
select *
from
(
SELECT top X Id, Title, Comments, CreatedDate
FROM MyTable
WHERE CreatedDate > @OlderThanDate
ORDER BY CreatedDate
... |
In addition to the technical points given in other answers, there may be non-technical reasons lurking that you should be prepared to respond to:
You should investigate whether your company has any sort of policy against (or misguided fear of) open source software. If the company or its lawyers don’t understand the... |
Some good answers here.
I want to re-iterate the suggestion to use a separate computer to host the source control server, although it doesn't have to be a *dedicated* machine. It could be your Windows Home Server box, or some other server you're already running. Or it could be a virtual machine hosted on some ot... |
You can help reduce fragmentation by reducing the amount you allocate deallocate.
eg say for a web server running a server side script, it may create a string to output the page to. Instead of allocating and deallocting these strings for every page request, just maintain a pool of them, so your only allocating when ... |
I use FF so never noticed this, but the link does in fact appear in the status bar in IE..
I dont think you can overwrite it :( I initially thought maybe setting the ToolTip (al la "title") property might do it.. Seems it does not..
Looking at the source, what appears is nowhere to be found, so I would say this i... |
I use FF so never noticed this, but the link does in fact appear in the status bar in IE..
I dont think you can overwrite it :( I initially thought maybe setting the ToolTip (al la "title") property might do it.. Seems it does not..
Looking at the source, what appears is nowhere to be found, so I would say this i... |
I use FF so never noticed this, but the link does in fact appear in the status bar in IE..
I dont think you can overwrite it :( I initially thought maybe setting the ToolTip (al la "title") property might do it.. Seems it does not..
Looking at the source, what appears is nowhere to be found, so I would say this i... |
Usually by reverse engineering the code. There might be legal issues in some countries, though. |
Usually by reverse engineering the code. There might be legal issues in some countries, though.
- [Reverse Engineering][1]
- [Reverse engineering Windows USB device drivers for the purpose of
creating compatible device drivers for Linux][2]
- [Nvidia cracks down on third party driver development][3]
... |
Use "alt" on the images, and "title" on the links. |
I think you can use [Array.Copy][1] for this. It takes a source index and destination index so you should be able to append the one array to the other. If you need to go more complex than just appending one to the other, this may not be the right tool for you.
[1]: http://msdn.microsoft.com/en-us/library/y5s0whf... |
How do i find duplicate values in a table in Oracle? |
|sql|oracle-database|duplicate-data| |
What's the simplest SQL statement that will return the duplicate values for a given column and the count of their occurrences in an Oracle database table?
For example: I have a `JOBS` table with the column `JOB_NUMBER` - how can I find out if I have any duplicate `JOB_NUMBER`s, and how many times they're duplicate... |
What is the most useful multi-purpose open-source library? |
|java|open-source| |
Are there any open-source libraries that all programmers should know about? I'm thinking
something general, a sort of extension to the standard `java.util` that contains basic functions that are useful for all kinds of application. |
What is the most useful multi-purpose open-source library for java? |
In my experience IE doesn't work well with pseudo-classes. I think the most universal way to handle this is to use Javascript to apply the CSS class to the element.
CSS:
.standard_border
{
border: 1px solid grey;
padding: 3px;
}
.hover_border
{
border: 3px solid blue;
padding: 1px;
}
In... |
In my experience IE doesn't work well with pseudo-classes. I think the most universal way to handle this is to use Javascript to apply the CSS class to the element.
CSS:
.standard_border
{
border: 1px solid grey;
padding: 3px;
}
.hover_border
{
border: 3px solid... |
[PLT Scheme][1] (DrScheme) is one of the best IDEs out there, especially for Scheme. The package you get when downloading it contains all you need for developing Scheme code - libraries, documentation, examples, and so on. Highly recommended.
[1]: http://plt-scheme.org/ |
Officially, <i /> and <b /> are "presentational" and shouldn't be used. While many developers think that <em /> and <strong /> are presentational, they are not. They are generally italicized and bolded resopectively, but the CSS can (and should, when appropriate) change how the emphasis and stro... |
* Apache Commons
* Log4j
* Google collections |
The [Google Collections API][1] is pretty handy if you use lots of, well, Collections...
[1]: http://code.google.com/p/google-collections/ |
My favorite way to go for really simple apps is Apache VelocityTools (VelocityLayoutServlet) with Velosurf (http://velosurf.sourceforge.net).
For more complex apps, Spring MVC or Struts 2. |
Warnings fatal on Windows |
|mysql| |
While working between a Windows MySQL server and a Debian MySQL server, I noticed that warnings were fatal on Windows, but silently ignored on Debian. I'd like to make the warnings fatal on both servers while I'm doing development, but I wasn't able to find a setting that effected this behavior. Anyone have any ideas? |
Why not just use a subquery?
<pre><code>
SELECT T1.*
FROM
(SELECT TOP X Id, Title, Comments, CreatedDate
FROM MyTable
WHERE CreatedDate > @OlderThanDate
ORDER BY CreatedDate) T1
ORDER BY CreatedDate DESC
</code></pre> |
Why not just use a subquery?
<pre><code>SELECT T1.*
FROM
(SELECT TOP X Id, Title, Comments, CreatedDate
FROM MyTable
WHERE CreatedDate > @OlderThanDate
ORDER BY CreatedDate) T1
ORDER BY CreatedDate DESC
</code></pre> |
Can I document Python code with doxygen (and does it make sense)? |
|python|doxygen| |
I like doxygen to create documentation of C or PHP code. I have an upcoming Python project and I think I remember that Python doesn't have /* .. */ comments and also has its own self-documentation facility which seems to be the pythonian way to document.
Can I just use doxygen? Anything particular to be aware of?
... |
|python|doxygen|docstring| |
|python|documentation|doxygen|sphinx|docstring| |
Do you mean that the path names are the same, and only one directory name changes ("a" becomes "another")? In that case:
cd ${PWD/a/another}
will switch to the other directory. `$PWD` holds your current directory, and `${var/foo/bar}` gives you `$var` with the string 'foo' replaced by 'bar'.
|
WHS is such a quick, simple, robust way to get your stuff backed up. Plug it in to the network; install the client software; done. I'd hate to live without it.
However, as a programmer, I also set up scripts to run each night and back up my pending changes to another machine. For example, when using TFS, I run 't... |
##Maintainable Perl 5.10 version
/
(?:
(?<month> (?&mon_29)) [\/] (?<day>(?&day_29))
| (?<month> (?&mon_30)) [\/] (?<day>(?&day_30))
| (?<month> (?&mon_31)) [\/] (?<day>(?&day_31))
)
[\/]
(?<year> \d{4})
(?(DEFINE)
(?<day_29> [0-2]?... |
@nsaners - I'm pretty sure the problem is down to memory fragmentation. We've analyzed [minidumps][1] that point to a problem when a large (5-10mb) chunk of memory is being allocated. We've also monitored the process (on-site and in development) to check for memory leaks - none were detected (the memory footprint is ... |
ASP.NET Convert Invalid String to Null |
Refactoring HTML is new and relatively good, you can guess what it covers :)
Other than that the two books you mention are the two I've used most, but [Agile Principles][1] is also very good.
[1]: http://www.amazon.co.uk/Principles-Patterns-Practices-Robert-Martin/dp/0131857258/ref=sr_1_1?ie=UTF8&s=books&qid=... |
A problem with assertions is that they can (and usually will) be compiled out of the code, so you need to add both walls in case one gets thrown away by the compiler. |
I tend to use named pipes or Unix sockets (depending on whether I'm targetting MS.NET or Mono -- I have a class that abstracts it away) since it's easy to use, portable, and allows me to easily interoperate with unmanaged code. That said, if you're only dealing with managed code, go with WCF or remoting -- the latter ... |
Text deleted, while in insert mode, doesn't go into default register. |
<a href="http://www.mono-project.com/Microsoft.Build">xbuild</a> is not yet complete (it works quite well with VS2005 .csproj files, has problems with VS2008 .csproj and does not handle .sln). Mono 2.1 plans to merge the code base of mdtool (MonoDevelop command line build engine) into it, but currently <a href="http://... |
<a href="http://www.mono-project.com/Microsoft.Build">xbuild</a> is not yet complete (it works quite well with VS2005 .csproj files, has problems with VS2008 .csproj and does not handle .sln). Mono 2.1 plans to merge the code base of mdtool (MonoDevelop command line build engine) into it, but currently <a href="http://... |
Don't forget that most languages allow you to turn off assertions... Personally, if I was prepared to write if tests to protect against **all** ranges of invalid input, I wouldn't bother with the assertion in the first place.
If, on the other hand you don't write logic to handle all cases (possibly because it's not... |
I like to use double quotes around strings that are used for interpolation or that are natural language messages, and single quotes for small symbol-like strings, but will break the rules if the strings contain quotes, or if I forget. I use triple double quotes for docstrings and raw string literals for regular express... |
Simple answer: Open IIS Manager. In navigation pane, find the .NET2 web site and right click on it. Select "Properties". Then select "ASP.NET" tab. First dropdown on that screen gives you option to select a different version of .NET.
Please be aware -- when I did this, all of the web sites on the web server sto... |
Refocusing on difficult, unforeseen requirements is the constant bane of the programmer. Test-driven development forces you to focus on the already-known, mundane requirements, and limits your imagination to what has already been imagined.
Think about it, you are likely to end up designing to specific test cases, so... |
Refocusing on difficult, unforeseen requirements is the constant bane of the programmer. Test-driven development forces you to focus on the already-known, mundane requirements, and limits your development to what has already been imagined.
Think about it, you are likely to end up designing to specific test cases, so... |
If you are referring to using a custom image bullet for your list this is the code you'll want to use, it will be vertically centered. I'm assuming here that the bullet image is 12px by 12px.
ul li {
background: transparent url(/link/to/custom/bullet.gif) no-repeat 0 50%;
padding-left: 18px;
... |
I'm in the same boat; VMware on a MBP, doing .NET development (and a little Mono, but that's a different beast). I would recommend updating to the Fusion 2.0 betas if you haven't yet; they're faster and offer some great new features (multiple snapshots! application linking!) and, in my experience, are just as stable as... |
Perhaps it was the transaction volume that brought down the exchange.
While many examples given thus far are good, they are just large websites. (You hate me for saying "just") They dole out pages and the occasional application (ie. scrabulous) to users. A stock exchange processes buys/sells and matches buyers/sell... |
> the RichTextBox control
So you want to use Markdown but you want the user not to know it? This might not be an achievable goal. I think the point of Markdown is that it is geared toward writers that are willing to learn a little bit of fairly natural syntax and edit everything in plain text (like Wikipedia? are th... |
jQuery "after" selector question |
|jquery|css-selectors| |
Using the event binding and command method might not be the right thing to use.
What exactly will this command do?
You might want to consider using a Databinding to a string field in your VM. This way you can make a call to a command or function from there rather than having the UI care at all.
<TextBox Text... |
Cross platform .Net? |
|cross-platform|.net| |
If you where to write an application to be cross platform, can you do it with .Net, what tools would you recommend?
I was considering Java as it would be relatively easy to pick up due to its C# similarity and then I could use the JVM. |
|.net|cross-platform| |
If you where to write an GUI application that runs locally and calls a webservice, to be cross platform, can you do it with .Net, what tools would you recommend?
I was considering Java as it would be relatively easy to pick up due to its C# similarity and then I could use the JVM. |
If you were to write an GUI application that runs locally and calls a webservice, to be cross platform, can you do it with .Net, what tools would you recommend?
I was considering Java as it would be relatively easy to pick up due to its C# similarity and then I could use the JVM. |
Locking would not solve this problem. Locking stops others from editing the file. This is a third party application which gets run as part of the build process that tries to write to a file - changing it - which breaks the build process. Therefore we need to stop the program from changing the file which is simply marki... |
I would disagree with this statement:
> Only the caller knows what "a valid
> input value" is for your function, and
> he must check its validity before he
> calls your function.
Caller might *think* that he know that input value is correct. Only method author knows how it suppose to work. Programmer's best goal... |
How to obtain Vista Edition programmatically? |
|windows-vista|edition| |
How to obtain Vista Edition programmatically, that is Home Basic, Home Premium, Business or Ultimate ?
|
As a programmer/hacker, `Get-Member` and `Get-Command` are the ones I use more than any others, but the ones I use to show off are `Select-Control` and `Send-Keys` from [WASP](http://CodePlex.com/WASP), the [PowerGadgets](http://PowerGadgets.com), and some of my own stuff written in WPF against CTP2 or [PoshConsole](ht... |
There are [different obfuscation methods][1] that tools can use. There are the simple rename methods that should not affect performance in any way. Other methods might change the flow of the code. That could have a negative impact on performance. You might want to check out other obfuscators and try out different setti... |
Convert from scientific notation string to float in C# |
|c#|floating-point|scientific-notation| |
What's the proper way to convert from a scientific notation string such as "1.234567E-06" to a floating point variable using C#?
|
AssemblyInformationalVersion and AssemblyFileVersion are displayed when you view the "Version" information on a file through Windows Explorer by viewing the file properties. These attributes actually get compiled in to a VERSION_INFO resource that is created by the compiler.
AssemblyInformationVersion is the "Produc... |
Use DateTime.Now or DateTime.Today. These are entirely managed and shouldn't throw security exceptions. |
Use `DateTime.Now` or `DateTime.Today`. These are entirely managed and shouldn't throw security exceptions.
The old VB6 functions, such as Len(), Left(), Right(), Open, FreeFile() are all present in the .NET Framework in the Microsoft.VisualBasic DLL. To maintain backwards compatibility, they all call the old func... |
Use `DateTime.Now` or `DateTime.Today`. These are entirely managed and shouldn't throw security exceptions.
The old VB6 functions, such as `Len()`, `Left()`, `Right()`, `OpenFile()`, `FreeFile()` are all present in the .NET Framework in the Microsoft.VisualBasic DLL. To maintain backwards compatibility, they all c... |
You could create a limited user for the support team, and then either write stored procedures or views with the nolock-hint. Then only give access to those and not direct table select access. |
Wait a couple of months for [Learning Rails by Simon St. Laurent, Edd Dumbill][1] to come out in November. That series of books is stupendous, and this book will cover the latest version of Rails.
[1]: http://oreilly.com/catalog/9780596518776/?CMP=AFC-ak_book&ATT=Learning+Rails |
So you have input like
A B C D
D E F G
C B A D
and you need to detect that the first and third lines are identical? |
When to create a new app (with startapp) in Django? |
|python|django| |
I've googled around for this, but I still have trouble relating to what Django defines as "apps".
Should I create a new app for each piece of functionality in a site, even though it uses models from the main project?
Do you guys have good rule of thumb of when to split off a new app, and when to keep functional... |
I think you mean the system icon, not the site icon as someone else thought. On a Mac, you can hold-Click -> Get Info on Firefox.app, then drag or paste an image on top of the icon.
I'm not sure about Windows, but I think you may need to compile from source to change it. |
If you're talking about the application icon (which under Windows is typically located in the top-left corner of the application's window), then... no... and yes.
Like most windows apps, the icon you see there is probably a resource compiled into the application itself, so you can't change it.
There may be add-i... |
It uses the style from the grid, because it's in it. If you want to change it's style, change the style of the control. What do you want it to do? |
If you don't want to bother with the EscapeTool, you can do this:
#set( $H = '#' )
$H$H |
Consider using a **case** statement:
for i in $(ls $1/resources); do
case $i in
database.db|tiles|map.pdf|map.png)
;;
*)
svn export -q $1/resources/$i ../MyProject/Resources/$i;;
esac
done
|