instruction stringlengths 0 30k ⌀ |
|---|
You could save a temporary .eml file, and Desktop.getDesktop().open(emlFile) |
You could save a temporary .eml file, and Desktop.getDesktop().open(emlFile)
**Edit:** As you point out, this will unfortunately open outlook express instead of outlook.
However if you have Windows Live Mail installed, it will use that. |
I've just tried this simple app that worked ok
using System;
using System.Management;
namespace WmiPlay
{
class Program
{
static void Main(string[] args)
{
try
{
ManagementScope cimv2 = new Man... |
It would be more normal to be using an NSTextField than an NSTextView for a single line of text.
With NSTextField, just do the following:
[textField setFont:myFont];
[textField sizeToFit]; |
It would be more normal to be using an NSTextField than an NSTextView for a single line of text.
With NSTextField, just do the following:
[textField setFont:myFont];
[textField sizeToFit];
Oh, and there is no built-in 'current default font'. If an application has such a concept, it needs to track it ... |
VB.Net has a different syntax depending on whether or not you want it to short circuit or not. Because of legacy reasons, the default behaviour is to not short circuit. The syntax is as follows
Non Short Circuit
IF A And B THEN
...
END IF
Short Circuit
IF A AndAlso B THEN
... |
VB.Net has a different syntax depending on whether or not you want it to short circuit or not. Because of legacy reasons, the default behaviour is to not short circuit. The syntax is as follows
Non Short Circuit
IF A And B THEN
...
END IF
Short Circuit
IF A AndAlso B THEN
... |
*ALL* the cross browser Javascript libraries out there? You do realize that there are <a href="http://ntt.cc/2008/02/13/the-most-complete-ajax-framework-and-javascript-libraries-list.html">well over 100 libraries</a> out there, so you should narrow this down a little, imo.
A good place to start is with Wikipedia's <... |
Don't tell your employer that you want to learn Ruby. Tell him you want to learn about the state-of-the-art in web framework technologies. it just happens that the hottest ones are Django and Ruby on Rails. |
Taking perl as an example, you can write perl scripts or perl applications.
A script would imply a single file or a single namespace. (e.g. updateFile.pl).
An application would be something made up of a collection of files or namespaces/classes (e.g. an OO-designed perl application with many .pm module files). |
Script to me implies line-by-line interpretation of the code. You can open a script and view its programmer-readable contents. An application implies a stand-alone compiled executable. |
Yes, that's correct as far as I can tell. It would have been easier if you used the same variable names (e.g. symbols instead of hard register names).
Why haven't you simply compiled the c-code and took a look at the list-file or assembly-output? I always do that when in doubt.
|
I think a way to approach this is to use analytic functions...
I set up your test case using:
create table employee_job (
emp_id integer,
job_id integer,
status varchar2(1 char),
eff_date date
);
insert into employee_job values (1,10,'A',to_date('1... |
As the [MySQL documentation][1] says,
SELECT * FROM foo GROUP BY bar
is equivalent to
SELECT * FROM foo GROUP BY bar ORDER BY bar
Default behaviour can not be changed, but you can use
SELECT * FROM foo GROUP BY bar ORDER BY bar DESC
without experiencing any speed penalties as the sorting... |
One function I've come to appreciate is string.translate. Its very fast at what it does, and useful anywhere you want to alter or remove characters in a string. I've just used it in a seemingly inapplicable [problem](http://stackoverflow.com/questions/89909/in-python-how-to-i-verify-that-a-string-only-contains-letters... |
How can I get the current exception in a WinForms TraceListener |
|winforms|exception| |
I am modifying an existing WinForms app which is setup with a custom TraceListener which logs any unhandled errors that occur in the app. It seems to me like the TraceListener gets the message part of the exception (which is what gets logged), but not the other exception information. I would like to be able to get at ... |
Another tool that you might want to check out is [Gant][1] if ant isn't meeting your needs. It adds full blown scripting support to ant but allows you to re-use your ant tasks as needed. It really depends on what you don't like about ant.
[1]: http://gant.codehaus.org/ |
try
StackTraceElement[] stack = Thread.currentThread().getStackTrace();
then you can iterate over the collection to show the top x stack elements you're interested in. |
Depending on which language or framework you're using, it may be straightforward to start up a locally-running HTTP server which serves up the resources you want. |
re-rendering of combox store in Gwt-Ext |
|forms|gwt-ext|box|panel|combo| |
i've created a Form Panel, and i'm rendering couple of Combo Boxes in the panel with a store which is populated via an response handler.
the problem if i want to render the panel again it renders the combo boxes without the store, though i'm re-constructing the panel.
i tried to debug to figure out the cause and surp... |
A few suggestions:
* Use [Compensating transactions][1]. Basically, you make it possible to undo the transaction you did earlier. The hard part is figuring out which transactions to rollback.
* Commit the data of applications A and B to the database using a flag indicating that it is only temporary. Then, after e... |
Behold, **[merb_facebooker][1]**.
In addition, if you want to use Facebooker directly (like for a desktop app,) just install the gem:
gem install facebooker
[1]: http://github.com/vanpelt/merb_facebooker/tree/master |
There are a number of methods depending on your needs. Some details are given in [the application developer requirements for UAC][1].
1. Include a UAC manifest that causes your program to require administrator privileges at startup.
2. Use one of the suggested methods for invoking an elevation to run out of pro... |
This question is so old that it makes me weep with nostalgia for the dotcom days!
That's right, Date.getYear() returns the number of years since 1900, just like Perl's localtime(). One wonders why a language designed in the 1990s wouldn't account for the century turnover, but what can I say? You had to be there.... |
There is an inbuilt post function that allows you to change the summary - though only to a hard coded value.
If you wanted to modify the current summary, you will need to create a post function as mentioned.
If you have a commercial license, you should have access to the JIRA source. Check out the code in: src/j... |
A script generally runs as part of a larger application inside a scripting engine
eg. JavaScript -> Browser
This is in contrast to both traditional static typed compiled languages and to dynamic languages, where the code is intended to form the main part of the application. |
I've use the Jenkins hash to write a Bloom filter library, it has great performance.
Details and code are available here: [http://burtleburtle.net/bob/c/lookup3.c][1]
This is what Perl uses for its hashing operation, fwiw.
[1]: http://burtleburtle.net/bob/c/lookup3.c |
You could use <a href="http://www.portablepython.com/">Portable Python</a> and <a href="http://bazaar-vcs.org/">Bazaar</a> (Bazaar is a Python app). I like to use Bazaar for my own personal projects because of it's extreme simplicity. Plus, it can be portable because Python can be portable. You will just need to ins... |
You could use <a href="http://www.portablepython.com/">Portable Python</a> and <a href="http://bazaar-vcs.org/">Bazaar</a> (Bazaar is a Python app). I like to use Bazaar for my own personal projects because of its extreme simplicity. Plus, it can be portable because Python can be portable. You will just need to inst... |
Usually, it is "script" versus "program".
I am with you that this distinction is mostly "compiled language snobbery", or to quote Larry Wall and take the other side of the fence, "a script is what the actors have, a programme is given to the audience".
|
this is a knowledge base article which describes how to render report output to an aspx page in a particular file format.
http://support.microsoft.com/kb/875447/en-us |
If you want some hand-on examples, [PyPy's Getting Started](http://codespeak.net/pypy/dist/pypy/doc/getting-started.html) document has a section titled "Trying out the translator". |
It requires flash and isn't free (thought inexpensive), [amcharts][1].
I've used it successfully and like it. I evaluated a number of options a while back and chose it. At the time, however, Google Charts wasn't as mature as it seems to be now. I would consider that first if I were to re-evaluate now.
[1]:... |
Any answers about efficiency will depend on the exact implementation of your STL. The only way to know for sure is to benchmark it both ways. I'd guess that the difference is unlikely to be significant, so decide based on the style you prefer. |
http://www.west-wind.com/Weblog/posts/10491.aspx
And i know one other blog where the author was developing a parser for qfx/qif... lemme look it up... googling hasnt helped yet :(
Update: Found one more:
http://blogs.msdn.com/lucabol/archive/2007/08/31/parsing-qif-quicken-files-in-c.aspx
|
Help Writing a Regular Expression |
|regex| |
I have the following string:
cn=abcd,cn=groups,dc=domain,dc=com
Can a regular expression be used here to extract the string after the first "cn=" and before the first ","? In the example above the answer would be "abcd".
Thanks. |
While it appears your question only addresses one method, I'd be happy to give my input on style. Personally, for style reasons, I prefer the former. Most IDEs will pop up the type signature of functions for you. |
It sounds like you are looking for a protection or obfuscation tool. While there isn't a silver bullet, the protection tool I recommend is [smartassembly][1]. Some alternatives are [Salamander Obfuscator][2], [dotfuscator][3], and [Xenocode][4].
Unfortunately, if you give your bytes to someone to be read... if the... |
There is no such thing: I recommend to write it for yourself and use it whenever you need. |
Python livbraries ;) FOr example [BeautifulSoup][1] - a HTML parser that accepts uncorrect markup. AFAIK there is no similiar pura Java lib.
[1]: http://www.crummy.com/software/BeautifulSoup/ |
Python libraries ;) For example [BeautifulSoup][1] - an HTML parser that accepts incorrect markup. AFAIK there is no similar pure Java lib.
[1]: http://www.crummy.com/software/BeautifulSoup/ |
You mean InputBox? Just look in the Microsoft.VisualBasic namespace.
C# and VB.Net share a common library. If one language can use it, so can the other.
|
Which software to use for continuous integration of a Java web project |
Lightweight Search Indexing API/Lbrary |
|search|indexing| |
I'm looking for an open source search indexing library. It will be used for embedded web application so it should have a small code size. Preferably, written in C, C++ or PHP and does not require any database in storing indexes. I tried to look on some famous search libraries such as xapian and clucene, they're good bu... |
I'm looking for an open source search indexing library. It will be used for embedded web application so it should have a small code size. Preferably, written in C, C++ or PHP and does not require any database to be installed for storing indexes. Indexes should be stored on a file instead (e.g., xml, txt). I tried to lo... |
I'm looking for an open source search indexing library. It will be used for embedded web application so it should have a small code size. Preferably, written in C, C++ or PHP and does not require any database to be installed for storing indexes. Indexes should be stored on a file instead (e.g., xml, txt). I tried to lo... |
If you want to capture mouse/keyboard events outside of your application you will need [Low-level Hooks][1].
A nice beginners article about installing a mouse hook in Delphi is [How to Hook the Mouse to Catch Events Outside of your application][2] on About.com written by Zarko Gajic.
The user which starts your ap... |
There are a few ways:
- `$0` is the currently executing script as provided by POSIX, relative to the current working directory if the script is at or below the CWD
- Additionally, `cwd()`, `getcwd()` and `abs_path()` are provided by the `Cwd` module and tell you where the script is being run from
- The modul... |
The other option is to link the file to each individual project/class library. This will get over the need for a wrapper function.
<Compile Include="path to shared file usually relative">
<Link>filename for Visual Studio To Dispaly.resx</Link>
</Compile>
add that code to the complile item ... |
I have used this solution before to share a assembley info.cs file across all projects in a solution I would presume the same would work fro a resource file.
Create a linked file to each individual project/class library. There will be only one copy and every project will have a reference to the code via a linked fi... |
The traditional secure replacement for FTP is [SFTP](http://en.wikipedia.org/wiki/SSH_file_transfer_protocol), but if you have enough control over both endpoints, you might consider [rsync](http://en.wikipedia.org/wiki/SSH_file_transfer_protocol) instead: it is highly configurable, secure just by telling it to use ssh,... |
Some good answers so far, also worth pointing out a couple of PHP specifics:
The file open functions use [wrappers][1] to support different protocols. This includes the ability to open files over a local windows network, HTTP and FTP, amongst others. Thus in a default configuration, the code in the original question... |
Some good answers so far, also worth pointing out a couple of PHP specifics:
The file open functions use [wrappers][1] to support different protocols. This includes the ability to open files over a local windows network, HTTP and FTP, amongst others. Thus in a default configuration, the code in the original question... |
I've been using the following snipplet to parse UTC date strings:
private function parseUTCDate( str : String ) : Date {
var matches : Array = str.match(/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)Z/);
var d : Date = new Date();
d.setUTCFullYear(int(matches[1]), int(matches... |
I've been using the following snipplet to parse UTC date strings:
private function parseUTCDate( str : String ) : Date {
var matches : Array = str.match(/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)Z/);
var d : Date = new Date();
d.setUTCFullYear(int(matches[1]), int(matches... |
Animation in javascript, a starting point |
|javascript|animation| |
I understand how JS is run and I think I understand most of the DOM but I've no idea about animation. Does anybody here know of a good guide that can explain to me how it's done in Javascript?
In addition, should I even consider Javascript for animation? Should I instead be looking to learn flash? |
I didn't see a native way for WCF to do compression when doing a WCF project recently. I just used the System.IO.Compression namespace and made a quick compressor. Here's the code i used
public static class CompressedSerializer
{
/// <summary>
/// Decompresses the specified compressed data... |
I had a similar requirement recently and eventually found this in he MSDN.
[CSharp Samples for Visual Studio 2008][1]
The classes included in the DynamicQuery sample of the download allow you to create dynamic queries at runtime in the following format:
var query =
db.Customers.
Where("City = @0 an... |
Notepad++ is probably the one I use the most, though I use GVIM whenever I need to do repetitive changes.
We got a company license for UltraEdit recently, and it seems to work quite well as well. I've been using that for doing quick edits to java or C++ code when I didn't have the full IDE running and didn't want t... |
The <a href="http://www.codinghorror.com/blog/archives/001147.html" title="Coding Horror">Coding Horror</a> article actual got me thinking about this as well.
Generally, I large classes I will put a region around the member variables, constants, and properties to reduce the amount of text I have to scroll through an... |
How to organize dataset queries to improve performance |
|asp.net|database|performance| |
I don't know when to add to a dataset a tableadapter or a query from toolbox. Does it make any difference?
I also dont know where to create instances of the adapters.
- Should I do it in the Page_Load?
- Should I just do it when I'm going to use it?
- Am I opening a new connection when I create ... |
Whiteboard for the first 35 or 40 drafts. UML is nice after that, but not particularly necessary. The best documentation after you've hashed out the details is clean code. |
I'll second Qt. It's cross platform, and I found it *much* easier to work with than the built in Visual Studio GUI stuff. It's dual-licensed, so if you don't want your code to be GPL you could purchase a license instead. |
@Thomas Owens
> But do people really line comments up
> like that? ... I never try to
> line up declarations or comments or
> anything, and the only place I've ever
> seen that is in textbooks.
Yes people do line up comments and declarations and all sorts of things. Consistently well formatted code is easier t... |
**How to get the DATE portion of a DATETIME field in MS SQL Server:**
One of the quickest and neatest ways to do this is using
DATEADD(dd, DATEDIFF( dd, 0, @DAY ), 0)
It avoids the CPU busting "convert the date into a string without the time and then converting it back again" logic.
It also does not exp... |
You can use [Gant][1] to script your build with [groovy][2] to do what you want or have a look at the [groovy ant task][3].
[1]: http://gant.codehaus.org/
[2]: http://groovy.codehaus.org
[3]: http://groovy.codehaus.org/The+groovy+Ant+Task |
The password character is probably a bullet. On a Mac, option-8 will insert one wherever you are typing. The Character Palette says it is Unicode **2022** and UTF8 **E2 80 A2**. |
Use <http://ccache.samba.org> to speed up compiles where only a few files have changed in a larger project,
and when large changes have been made, leverage <http://en.opensuse.org/Icecream> at the same time for shared distributed compiling.
That should probably quicken your compile-edit-run-cycle significantly. |
Yegor, you can store the hash when a user account is created/updated, then whenever a login is initiated, you hash the data posted to the server and compare against what was stored in the database for that one username.
(Off the top of my head in loose php - treat as pseudo code):
$usernameFromPostDbsafe =... |
Yegor, you can store the hash when a user account is created/updated, then whenever a login is initiated, you hash the data posted to the server and compare against what was stored in the database for that one username.
(Off the top of my head in loose php - treat as pseudo code):
$usernameFromPostDbsafe =... |
# Common Lisp: Lisp as God intended it to be used (that is, with LOOP)
(defun fact (n)
(loop for i from 1 to n
for acc = 1 then (* acc i)
finally (return acc)))
Now, if someone can come up with a version based on FORMAT... |
Best way of getting notifications in SQL Server Reporting Services |
|sql-server|notificationservices|reporting-services| |
Is it possible to get notifications using [SQL Server Reporting Services][1]? Say for example I have a report that I want by mail if has for example suddenly shows more than 10 rows or if a specific value drop below 100 000. Do I need to tie Notification Services into it and how do I do that?
Please provide as much ... |
Some good answers so far, also worth pointing out a couple of PHP specifics:
The file open functions use [wrappers][1] to support different protocols. This includes the ability to open files over a local windows network, HTTP and FTP, amongst others. Thus in a default configuration, the code in the original question... |
Try [dummynet][1].
You will find lots of resources on the web, including this [tutorial][2].
[1]: http://info.iet.unipi.it/~luigi/ip_dummynet/
[2]: http://www.scalabledesign.com/articles/dummynet.html |
I am using Tortoise SVN for ASP.NET development. The binary DLLs are generated by a manual compile step. Whilst it doesn't make a lot of sense to have these source-code versioned in theory, it certainly makes it convenient to ensure they are correctly mirrored from the development environment onto the production system... |
I am using Tortoise SVN for small system ASP.NET development. Most code is interpreted ASPX, but there are around a dozen binary DLLs generated by a manual compile step. Whilst it doesn't make a lot of sense to have these source-code versioned in theory, it certainly makes it convenient to ensure they are correctly mir... |
The usual generic Unix answer to this is 'PAM'. If you want plain old OpenSSH SSHD to handle your SFTP, you need something plugged in to SSHD's PAM stack (/etc/pam.d/sshd) that does what you need and leaves out what you don't need. This might be a general-purpose directory server (probably LDAP) that maps all your virt... |
The most common way to convert files to a pdf is to print them to print them to a pdf printer driver. There are a number of such drivers, one that i know of that will do the job is [Black Ice][1].
Another is to use Adobe Acrobat's SDK. from memory its very expensive.
Its been a while since i have actually done a... |
|java|continuous-integration| |
We're in an early stage of a new web project. The project will grow and become complex over time. From the beginning we will have unit and integration tests using JUnit and system tests using HtmlUnit. We might also add some static code analysis tools to the build process if they prove to be of value to us.
If you'r... |
Yeah, using perl/java syntax `cn=([^,]*),`. You'd then get the 1st group. |
I was able to find my answer on the [MooTools Group at Google][1].
[1]: http://groups.google.com/group/mootools-users/browse_thread/thread/7ade43ef51c91922 |
<pre><code>/^cn=([^,]+),/</code></pre> |
What is the C# version of VB.net's InputDialog? |
|c#| |
What is the C# version of VB.net's InputDialog? |