instruction
stringlengths
0
30k
|html|email|.net|c#|
Does anyone know of a .NET library that will process HTML e-mails and can be used to trim out the reply-chain? It needs to be able to accept HTML -or- text mails and then trim out everything but the actual response, removing the trail of messages that are not original content. I don't expect it to be able to handle r...
.NET library for processing HTML e-mails & stripping previous responses
|c#|.net|html|email|
DotNetNuke out of the box contains a lot of features, content management, link management, documents list modules, forum modules, and items of that nature. There is also a very good third-party module and skin market out there for getting the enhancements needed to really get a full solution implemented. With a lit...
The following snibblet of code should do ya': PreparedStatement stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); This is known to work on the following databases - Derby - MySQL - SQL Server For databases where it doesn't work (HSQLDB, Oracle, PostgreSQL, etc), you will need t...
The following snibblet of code should do ya': PreparedStatement stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); // ... ResultSet res = stmt.getGeneratedKeys(); while (res.next()) System.out.println("Generated key: " + res.getInt...
The following snibblet of code should do ya': PreparedStatement stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); // ... ResultSet res = stmt.getGeneratedKeys(); while (res.next()) System.out.println("Generated key: " + res.getInt...
Working with char* requires you to work with C functions. In your case, what you really need is to copy the strings around. To help you, you have the strndup function. Then you'll have to write something like: void RegisterName(const char* name) { // loop to see if name already registered snipped ...
Using: const char **registeredNames = new const char * [numberOfNames]; will allow you to assign a "const * char const" to an element of the array. Just out of curiosity, why does "work mandates that none of the most handy C++ constructs can be used"? Skizz
Why can't you use the STL? Anyway, I would suggest that you implement a simple string class and list templates of your own. That way you can use the same techniques as you normally would and keep the pointer and memory management confined to those classes. If you mimic the STL, it would be even better.
You might want to look at [OGNL](http://www.ognl.org/) which is the kind of library you are after. OGNL can be reasonably powerful, and is the expression language used in the [WebWork](http://www.opensymphony.com/webwork/) web framework.
Have you seen [this][1] technique using [fitnesse][2] and [selenium][3]? Can't vouch for how easy it is to set up, we've looked at selenium a little and one of our test analysts is keen to integrate something like FIT/Fitnesse into our automated testing but we're not there yet. [1]: http://gojko.net/2007/05/2...
Take care with directories with a lot of files! It could take a some time to evaluate the "ls" command. IMO the best solution is the one that uses "find /some/dir/ -maxdepth 0 -empty"
// Set the background to a predefined colour MyListBox.BackColor = Color.Red; // OR: Set parts of a color. MyListBox.BackColor.R = 255; MyListBox.BackColor.G = 0; MyListBox.BackColor.B = 0; If what you mean by setting multiple background colors is setting a different background color for...
You can convert directly via the [String(byte[], String)][1] constructor and getBytes(String) method. Java exposes available character sets via the [Charset][2] class. The JDK documentation [lists supported encodings][3]. 90% of the time, such conversions are performed on streams, so you'd use the [Reader][4]/[Write...
It is possible to do as you request see the code below. // Construct an array containing ints that has a length of 10 and a lower bound of 1 Array lowerBoundArray = Array.CreateInstance(typeof(int), new int[1] { 10 }, new int[1] { 1 }); // insert 1 into position 1 lowerBoundArray.SetValue(1,...
If you are only looking to point to a different location for you identity file, the you can modify your ~/.ssh/config file with the following entry: IdentityFile ~/.foo/identity <code>man ssh_config</code> to find other config options.
The *id* attribute is used for elements to uniquely identify them within the document, whereas the *class* attribute can have the same value shared by many elements in the same document. So, really, if there's only one element per document that's going to use the style (e.g., #title), then go with *id*. If multiple ...
Converting an integer to a hexadecimal string in Ruby
|ruby|hex|base-conversion|
Is there a built in way to convert an integer in Ruby into its hexadecimal equivalent. The opposite of "0A".to_i(16) =>10 or "0A".hex =>10 I know how to roll my own, but it's probably more efficient to use a built in ruby function
XSLT performance: call-template vs apply-template
|xslt|
in XSLT processing, is there a performance difference between apply-template and call-template? In my stylesheets there are many instances where I can use either, which is the best choice?
Im not sure if this is what you are looking for, but we write our main application with Java at the small company I work for, but have used python to write smaller scripts quickly. Backup software, temporary scripts to manipulate data and push out results. It just seems easier sometimes to sit down with python and wr...
I think in your original example, you just need to to query.UniqueResult<int>(); the count will return an integer.
I would say it is best to use a class whenever you think a style element is going to be repeated on a page. Items like HeaderImage, FooterBar and the like go well as an ID since you'll only be using it once and it'll help prevent you from accidentally duplicating it, since some editors will alert you when you have dupl...
Write the function inline, and the interpreter is smart enough to know you're writing a function. Do it like this, and it assumes it's just a string (which it technically is).
sed -r -e "s/^.*[,:]([^,:]+@[^,:]+).*$/\1/g" /etc/passwd Will do the trick
When you've made a list of the threads you're using and defined a priority order for them which makes sense in terms of the work they do. If you nudge threads up here and there in order to bodge your way out of a problem, eventually they'll all be high priority and you're back where you started. Don't assume you can...
When you've made a list of the threads you're using and defined a priority order for them which makes sense in terms of the work they do. If you nudge threads up here and there in order to bodge your way out of a problem, eventually they'll all be high priority and you're back where you started. Don't assume you can...
Is there any place a developer can go besides Google to learn what it is they need to learn?
Edit: I guess I misunderstood your question. There is no constness problem in this code I'm aware of. I'm doing this from my head but it should be about right: static int lastIndex = 0; static char **registeredNames = new char*[numberOfNames]; void RegisterName(const * char const name) { ...
Edit: I guess I misunderstood your question. There is no constness problem in this code I'm aware of. I'm doing this from my head but it should be about right: static int lastIndex = 0; static char **registeredNames = new char*[numberOfNames]; void RegisterName(const * char const name) { ...
To answer your specific question: no, there's no library function to do what you want to do, but then there's no library function for parsing dates on the ISO format, on the German format, on the Swedish format, dates where the years are in roman numerals etc. Why not use regular expressions? That's what they are fo...
There is something similar : in PHP you can change the error reporting level. It's a best practice to set it to maximum in a dev environnement. To do so : Add in your PHP.ini: error_reporting = E_ALL Or you can just add this at the top of the file your are working on : error_reporting(E_ALL); ...
As with the other posters, I strongly recommend looking at C++ toolkits. GTK will work on Windows and the Mac OS, but will only give you truly good results on Linux. And even some of the GTK maintainers are inventing their their own [object-oriented C dialect][1] to avoid writing GUIs against the native GTK API. As ...
How to remove all event handlers from a control
|c#|.net|
To create a new event handler on a control you can do this c.Click += new EventHandler(mainFormButton_Click); or this c.Click += mainFormButton_Click; and to remove an event handler you can do this c.Click -= mainFormButton_Click; But how do you remove all event handlers from a control? ...
|training|
I'm not really asking about how programmers learn how to program. More about specific technologies. If I wanted to learn Hibernate, how do I know what I should know prior to Hibernate? Should I learn JPA before, during or after Hibernate? Is there a better solution to Hibernate? (And I'm not really looking for inf...
Try: render :json => var_containing_my_json, :content_type => 'text/x-json'
.NET property generating "must declare a body because it is not marked abstract or extern" compilation error
|c#|properties|compilation|
I have a .NET 3.5 (target framework) web application. I have some code that looks like this: public string LogPath { get; private set; } public string ErrorMsg { get; private set; } It's giving me this compilation error for these lines: "must declare a body because it is not marked abstract or ex...
|c#|compilation|properties|
I have a .NET 3.5 (target framework) web application. I have some code that looks like this: public string LogPath { get; private set; } public string ErrorMsg { get; private set; } It's giving me this compilation error for these lines: "must declare a body because it is not marked abstract or ex...
Best web front-end for SVN?
|version-control|svn|
I'm researching SVN repository browsers, and it's a tiresome task given how many are out there (I started [here][1]) The "ideal" system would - Run on linux - Be easy to use, even for non-developer types - Look nice (have a decent skin) - Either have built-in access control, or be written in PHP so tha...
OK, I just found a solution myself: payment_date = MID(payment_date,4,3) & LEFT(payment_date,3) & MID(payment_date,7)
EJB2-style beans should still work in the 4.2 release. What interface do you want to cast to? Maybe that particular interface was renamed or moved. You should try not to use container-specific classes.
How can I delete duplicate rows in a table
|sql|sql-server|database|
I have a table with say 3 columns. There's no primary key so there can be duplicate rows. I need to just keep one and delete the others. Any idea how to do this is Sql Server?
About the stringmatching: it was one of the reqs in the question to not do it through stringmatching. The dictionary is an approach I will use when I put this entire serialization algorithm in its own library. As for now I will first try the typeCode as my case only uses basic types. If that doesn't work I will go...
If its always in that format you could use split d = split(".","dd.mm.yyyy") s = d(1) & "." & d(0) & "." & d(2) this would allow for dates like 1.2.99 as well
What about returning the len by the query already, but don't show that column, only use it as your original column's sortexpression? I don't think that your idea is supported by default.
>> Steven Noble: > which won't work because js takes advantage of the \ in its string interpretation as an escape so it never makes it into the regex interpreter I intended to use \ as an escape because I'm really looking for a $ in the element name.
You can create a unit test project for each library in your source tree in a subdirectory of that library. You end up with a test driver application for each library, which makes it easier to run a single suite of tests. By putting them in a subdirectory, it keeps your code base clean, but also keeps the tests close ...
Grep and Sed Equivalent for XML Command Line Processing
|xml|command-line|scripting|
When doing shell scripting, typically data will be in files of single line records like csv. It's really simple to handle this data with `grep` and `sed`. But I have to deal with XML often, so I'd really like a way to script access to that XML data via the command line. What are the best tools?
Add an identity column to act as a surrogate primary key, and use this to identify two of the three rows to be deleted. I would consider leaving the identity column in place afterwards, or if this is some kind of link table, create a compound primary key on the other columns.
I always use aliases when writing queries. Generally I try and abbreviate the table name to 1 or 2 representative letters. So Users becomes u and debtor_transactions becomes dt etc... It saves on typing and still carries some meaning. The shorter names makes it more readable to me as well.
Use a subrange of [\u0000-\uFFFF] for what you want.
Use a subrange of [\u0000-\uFFFF] for what you want. You can also use the re.UNICODE compile flag. [The docs](http://docs.python.org/lib/re-syntax.html) say that if UNICODE is set, \w will match the characters [0-9_] plus whatever is classified as alphanumeric in the Unicode character properties database. See al...
\X seems to be available as a generic word-character in some languages, it allows you to match a single character disregarding of how many bytes it takes up. Might be useful.
GLUT exit redefinition error
|opengl|glut|
In my simple OpenGL program I get the following error about exit redefinition: 1>c:\program files\microsoft visual studio 8\vc\include\stdlib.h(406) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs 1> c:\program files\microsoft visual studio 8\vc\platformsdk\include\gl\glut.h(146) :...
**Cause:** The **stdlib.h** which ships with the recent versions of Visual Studio has a different (and conflicting) definition of the **exit()** function. It clashes with the definition in **glut.h**. **Solution:** Override the definition in glut.h with that in stdlib.h. Place the stdlib.h line above the glut....
SVN is great for binaries, too. If you're afraid you can't compare revisions, I can tell you that it is possible for Word docs, using Tortoise. But I do not know, what you mean with "expanding the versioning". SVN is no document management system.
SVN is great for binaries, too. If you're afraid you can't compare revisions, I can tell you that it is possible for Word docs, using Tortoise. But I do not know, what you mean with "expanding the versioning". SVN is no document management system. Edit: >but I feel it might be a bit overkill for our purposes ...
This is all described in [The Adobe Flex 3 Programming ActionScript 3 PDF][1] on page 550 (Chapter 27: Flash Player Security / Cross-scripting): > If two SWF files written with ActionScript 3.0 are served from different domains—for example, http://siteA.com/swfA.swf and http://siteB.com/swfB.swf—then, by default, Fl...
I don't see your problem it works as designed: $ ssh remotehost 'ls nosuchfile; ls /etc/passwd' >/tmp/stdout 2>/tmp/stderr $ cat /tmp/stdout /etc/passwd $ cat /tmp/stderr nosuchfile not found
Is it legal to pass a newly constructed object by reference to a function?
|c++|
Specifically, is the following legal C++? <pre>class A{}; void foo(A*); void bar(const A&); int main(void) { foo(&A()); // 1 bar(A()); // 2 }</pre> It appears to work correctly, but that doesn't mean it's necessarily legal. Is it? <i>Edit - changed <code>A&</code> to <code>const A&</code>...
Buy a [Happy Hacking Keyboard](http://pfuca-store.stores.yahoo.net/haphackeylit1.html) which has Ctrl in The Right Place (Caps Lock is moved elsewhere). It has excellent response and is configurable via DIP switches for maximum integration on Mac, Windows, and Linux (for example, you can switch what is Alt and what is...
Try exuberant-ctags with the -x option and tell it to generate all of its kinds. Exuberant CTAGS is the default ctags on many linux distros. You might try: exuberant-ctags -x --c-kinds=cdefglmnpstuvx --language-force=c filename will even work if filename doesn't have .c extension. You can use exuberant-ctags...
If this is just a one-off exercise, as an easier alternative, you could apply filters to your source data, and then copy and paste the filtered rows into your new worksheet?
You can simply run the batch file which sets the variables yourself. In VS08 it's located at:- C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat
The theory behind the request is basically the ability to cycle through web page dashboards for various systems from a "kiosk" PC. I oversee a data center and we have several monitor systems that allow me view dashboards for temps, system up time, etc etc. The idea is load a page that would cycle from dashboard to da...
You can have each job set NDC or MDC and then write an appender that varies the name based on the NDC or MDC value. Creating a new appender isn't too hard. There may also be a appender that will fit the bill in the log4j sandbox. Start looking in [http://svn.apache.org/viewvc/logging/log4j/trunk/contribs/][1] ...
I primarily program in Java and C# but use dynamic languages (ruby/perl) to support smoother deployment, kicking off OS tasks, automated reporting, some log parsing, etc. After a short time learning and experimenting with ruby or perl you should be able to write some regex manipulating scripts that can alter data fo...
Two tables. If you try to cram everything into one table then you break normalization (if you care about that). Here are examples: <pre> LIST --------------- LIST_ID (PK) NAME DESCR LIST_OPTION ---------------------------- LIST_OPTION_ID (PK) LIST_ID (FK) OPTION_NAME OPTION_VALUE MANUAL_SORT </pre...
Two tables. If you try to cram everything into one table then you break normalization (if you care about that). Here are examples: <pre> LIST --------------- LIST_ID (PK) NAME DESCR LIST_OPTION ---------------------------- LIST_OPTION_ID (PK) LIST_ID (FK) OPTION_NAME OPTION_VALUE MANUAL_SORT </pre...
eval isn't always evil. There are times where it's perfectly appropriate. However, eval is currently and historically massively over-used by people who don't know what they're doing. That includes people writing JavaScript tutorials, unfortunately, and in some cases this can indeed have security consequences - or, m...
You can do this in any programming language using the following steps: 1. Multiply and Divide by 10^x where x is the power of 10 required to make sure that the number has no decimal places remaining. Example: Multiply 0.33 by 10^2 = 100 to make it 33 and divide it by the same to get 33/100 2. Reduce the numerator...
I don't believe you can, as table variables are created in memory not in tempdb.
Use [PGP][1] / [GPG][2] and transfer the gpg-ed file directly via ftp or any other method. [1]: http://en.wikipedia.org/wiki/Pretty_Good_Privacy [2]: http://www.gnupg.org/
I use Wikipedia to compare various technologies to copmlete a task, although it can be incomplete with regards to commercial closed-source frameworks (probably because fewer people have access to them).
Security is also an issue; values in the query string or form fields can be trivially changed by the user. User authentication should be saved either in an encrypted or tamper-evident cookie or in the server-side session. Keeping track of values passed in a form as a user completes a process, like a site sign-up, well,...
If it's the content of the CView that you want, then yes, that should be right one. If it's the content of the whole screen (at least the content, without the toolbar(s) and status bar), then you should pass it the CMainFrame (that's the default name which may have been changed, the one that is derived from CMDIFrameWn...
go to sites like Coding Horror, Slashdot, Techcrunch etc and find out what people are talking about. Usually if something is popular it's probably something you might want to talk a look at.
Trac.( <http://trac.edgewall.org/> ) Its not wonderful, but from what I've seen, for SVN its the best. With Access control to boot. I managed to set up a rig with even per-directory permissions for various trac users ( they just didn't appear ) . Been a while tho. Default Skin looks pretty good, and is...
What is the best way to present data from a very large resultset?