instruction stringlengths 0 30k ⌀ |
|---|
What Java library would you say is the best for consuming and parsing feeds? Requirements:
- Embeddable
- Supports Atom & RSS
- Has caching architecture
- Should be able to deal with any feed format the same way |
What Java library would you say is the best for consuming and parsing feeds? Requirements:
- Embeddable
- Supports Atom & RSS
- Has caching architecture
- Should be able to deal with any feed format the same way
(Please: _one_ suggestion per answer.) |
I think your best bet is to use an ORM-tool that includes database migration like [SubSonic][1]:
<http://subsonicproject.com/2-1-pakala/subsonic-using-migrations/>
[1]: http://subsonicproject.com/ |
A class is a template, it allows you to create a blueprint, you can then have multiple instances of a class each with different numbers, like so.
class dog(object):
def __init__(self, height, width, lenght):
self.height = height
self.width = width
self.length = length
def revert(self):
self... |
The [asList][1] method in `java.util.Arrays` allows a nice combination of varargs, generic methods and autoboxing:
List<Integer> ints = Arrays.asList(1,2,3);
[1]: http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arrays.html#asList(T...) |
We ended up making update scripts each time we changed the database. So there's a script from version 10 to 11, from 11 to 12, etc.. Then we can run any consecutive set of scripts to skip from some existing version to the new version. We stored the existing version in the database so we could detect this upon startup... |
On SQL Server you can use the `Truncate Table` command which is faster than a regular delete and also uses less resources. It will reset any identity fields back to the seed value as well.
The drawbacks of truncate are that it can't be used on tables that are referenced by foreign keys and it won't fire any triggers... |
On SQL Server you can use the `Truncate Table` command which is faster than a regular delete and also uses less resources. It will reset any identity fields back to the seed value as well.
The drawbacks of truncate are that it can't be used on tables that are referenced by foreign keys and it won't fire any triggers... |
private void UpdateFont()
{
//Change cell font
foreach(DataGridViewColumn c in dgAssets.Columns)
{
c.DefaultCellStyle.Font = new Font("Arial", 8.5F, GraphicsUnit.Pixel);
}
} |
If the biggest problem is that it doesn't account for the position of the bytes, you could fix it like this:
Private Function HashCode(Key As String) As Long
On Error GoTo ErrorGoTo
Dim lastEl As Long, i As Long
' copy ansi codes into an array of long'
lastEl = (Len(Key) - 1) \ 4
... |
In vim, how do I go back to where I was before a search? |
|vim|vi| |
Programming in vim I often go search for something, yank it, then go back to where I was, insert it, modify it.
The problem is that after I search and find, I need to MANUALLY find my way back to where I was.
Is there an automatic way to go back to where I was when I initiated my last search? |
One thing that @binil missed, you are not closing the result set in the case of an exception. Depending on the driver implementation this may cause the connection to stay open. Move the result.close() call to the finally block. |
How can I lay images out in a grid using XSL-FO? |
|xslt|xsl-fo| |
I'm trying to produce sheets of photographs with captions arranged in a grid using XSLT and XSL-FO. The photo URLs and captions are produced using a FOR XML query against an SQL Server database, and the number of photos returned varies from sheet to sheet. I want to lay the photos out in four columns, filling the grid ... |
What determines the monitor my app runs on? |
|multiple-monitors| |
I am using Windows, and I have two monitors.
Some applications will *always* start on my primary monitor, no matter where they were when I closed them.
Others will always start on the *secondary* monitor, no matter where they were when I closed them.
Is there a registry setting buried somewhere, which I can ma... |
I am using Windows, and I have two monitors.
Some applications will *always* start on my primary monitor, no matter where they were when I closed them.
Others will always start on the *secondary* monitor, no matter where they were when I closed them.
Is there a registry setting buried somewhere, which I can ma... |
You can use streams, iterators, and the copy algorithm to do this fairly directly.
#include <string>
#include <vector>
#include <iostream>
#include <istream>
#include <ostream>
#include <iterator>
#include <sstream>
#include <algorithm>
int main()
{
std::stri... |
In WPF you can use FindName method.
XAML:
<ComboBox Name="combo">
<ComboBoxItem Name="item1" >1</ComboBoxItem>
<ComboBoxItem Name="item2">2</ComboBoxItem>
<ComboBoxItem Name="item3">3</ComboBoxItem>
</ComboBox>
Code-behind file
item1.Content = "... |
Where can I find and submit bug reports on Google's Chrome browser? |
|chrome|bugtracking| |
It will be important for developers wanting to develop for the chrome browser to be able to review existing bugs (to avoid too much pulling-out of hair), and to add new ones (to improve the thing). Yet I can't seem to find the bug tracking for this project. It *is* open source, right? |
|chrome|bug-tracking| |
|google-chrome|bug-tracking| |
There is an Open Source Audio API called [PortAudio][1] that has a method you could use. I think the method is called Pa_GetDeviceInfo() or something.
[1]: http://www.portaudio.com/ |
Tips / Resources for building a Google Chrome plugin |
|chrome| |
After test driving Google Chrome for 30 minutes or so, I like it, even if it seems bare-bones at the moment. The obvious way to add a few things I can't live without would be through plugins. Does anyone have any links to resources on how to get started building a plugin/addon for Chrome? Thanks. |
|google-chrome| |
The second option is much quicker if you have multiple items.
* `Any()` returns as soon as 1 item is found.
* `Count()` has to keep going through the entire list.
For instance suppose the enumeration had 1000 items.
* `Any()` would check the first one, then return true.
* `Count()` would return 1000 after ... |
The second option is much quicker if you have multiple items.
* `Any()` returns as soon as 1 item is found.
* `Count()` has to keep going through the entire list.
For instance suppose the enumeration had 1000 items.
* `Any()` would check the first one, then return true.
* `Count()` would return 1000 after ... |
There is definitely a hook script that checks case sensitivity - Sourceforge have it as one of their options. A quick google turns up: http://www.subversionary.org/howto/using-check-case-insensitive-py-on-windows and http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/case-insensitive.py
The issue will have a... |
Stop system entering 'standby'.. |
|c++|winapi|standards| |
How can i stop the host machine entering 'standby' mode while my application is running?
Is there any win32 api call to do this?
|
I use double quotes in general, but not for any specific reason - Probably just out of habit from Java.
I guess you're also more likely to want apostrophes in an inline literal string than you are to want double quotes. |
Don't use the ATL performance monitor classes. I know they are easy to add and they have a wizard and all, but they are hopelessly bugged. I added them to one of my development apps at work, then had to go through and rip the code out 6 months later. All in all about 3 weeks work lost to that noise. |
Best way to insert timestamp in Vim? |
|vim|vi| |
EditPad Lite has a nice feature (CTRL-E, CTRL-I) which inserts a time stamp e.g. "2008-09-11 10:34:53" into your code.
What is the best way to get this functionality in Vim?
(I am using Vim 6.1 on a Linux server via SSH. In the current situation a number of us share a login so I don't want to create abbreviations... |
You can also implement a equal($other) function like
<pre>
<?php
class Foo {
public function equals($o) {
return ($o instanceof 'Foo') && $o.firstName()==$this.firstName();
}
}
</pre>
or use foreach to iterate over the public properties (this behaviour might be overwritten) of one object a... |
From php.net:
$res=pg_query("SELECT nextval('foo_key_seq') as key");
$row=pg_fetch_array($res, 0);
$key=$row['key'];
// now we have the serial value in $key, let's do the insert
pg_query("INSERT INTO foo (key, foo) VALUES ($key, 'blah blah')");
This should always provide unique key, becaus... |
When I press F5 in Visual Studio 2008, I want Google Chrome launched as the browser that my ASP.NET app runs in. May I know how this can be done? |
SmartSVN - [http://www.syntevo.com/smartsvn/index.html][1]
[1]: http://www.syntevo.com/smartsvn/index.html |
You can use a `sms:[target phone number]` URL to open the SMS application, but there are no indications on how to prefill a SMS body with text. |
Right click on an .aspx file and click "Browse with..." then select Chrome and click "Set as Default"
You can actually select more than one browser in the list if you want. |
Found out why it happened in that machine only. It was the only one where I actually logged into with that user, then the domain controller set the regional settings as spanish for it. |
Since I read the Joel article and some other I18n articles I always kept a close eye to my character encoding; And it actually works if you do it consistantly. If you work in a company where it is standard to use UTF-8 and everybody knows this / does this it will work.
Here some interesting articles (besides Joel's ... |
Since I read the Joel article and some other I18n articles I always kept a close eye to my character encoding; And it actually works if you do it consistantly. If you work in a company where it is standard to use UTF-8 and everybody knows this / does this it will work.
Here some interesting articles (besides Joel's ... |
_A quick answer, just to add a little more knowledge to this topic:_
You must definitely check out [NetBeans](http://www.netbeans.org/features/cpp/). Netbeans 6.1 uses has the following features:
- C/C++ Projects and Templates: Supports syntax highlighting,
automatic code completion, automatic indentatio... |
This is a problem I have given up on. With a lot of hacking and (mostly) praying, you can get a solution that works at a given time on a given machine. But in general there seems to be no decent way to do this.
You will have to obtain the stack position and size from outside your program (on Linux you might get it f... |
The simplest way is to set a mark, with `m[letter]`, then go back to it with `'[letter]` |
Ctrl+O takes me to the previous location. Don't know about location before the search.
Edit: Also, **`.** will take you to the last change you made. |
You can use [df][1] as a cross-platform way. It is a part of [GNU core utilities][2]. These are the core utilities which are expected to exist on every operating system. However, they are not installed on Windows by default (Here, [GetGnuWin32][3] comes in handy).
_df_ is a command-line utility, therefore a wrapper ... |
You can use [df][1] as a cross-platform way. It is a part of [GNU core utilities][2]. These are the core utilities which are expected to exist on every operating system. However, they are not installed on Windows by default (Here, [GetGnuWin32][3] comes in handy).
_df_ is a command-line utility, therefore a wrapper ... |
It's a bit of a strain, but if you had a java applet or a flash application that was embedded and authentication was done through that you could make it so that they had to authenticate in, erm, 'real-time' with the server everytime they wanted to view the information.
Using this you could also encrypt any informati... |
For starters, the second enum, AutoSizeMode is declared in System.Windows.Forms. So that might cause the designer some issues.
Secondly, you might find the following page on MSDN useful:
http://msdn.microsoft.com/en-us/library/tk67c2t8.aspx |
You might want to try and find out where it comes from using the debug\_print\_backtrace() function. ([http://nl.php.net/manual/en/function.debug-print-backtrace.php][1]
[1]: http://nl.php.net/manual/en/function.debug-print-backtrace.php |
Looking for better End-to-End Comms with Flex, .NET and DBMS |
|.net|apache-flex|orm| |
We're reviewing some of our practices at work - and the specific thing we're looking at right now is the best method for doing Comms with Flex based clients, and .NET web services.
Our typical approach is to first model the interactions based on requirements, mock up some XML messages and sanity check them, turn th... |
<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js" type="text/javascript"></script>
<![endif]-->
put that in your header, should fix some of the ie bugs. |
I also discovered some SQLite software for Visual Studio at http://sqlite.phxsoftware.com/ which allows you to use the Visual Studio Server Explorer to create connections to SQLite databases. |
On Windows, files are case-insensitive, but case-preserving. You can rename a file, changing the case and Windows will preserve the change. The problem occurs when Subversion tries to create the second file. Windows reports that the file already exists.
If you wanted to merge the two files into a single copy, ins... |
Google [says][1] the following should work:
path: \"\"
[1]: http://groups.google.com/group/ruby-talk-google/browse_thread/thread/f8b1635528665a85 |
What kind of application? If it's server-type application without GUI, then there is a good chance it will run on [Mono][1] out-of-the-box (assuming you're not going to use any of the latest C# 3.0 features).
If you're into GUI application, then you better write it using some cross-platform toolkit. Most likely you ... |
What kind of application? If it's server-type application without GUI, then there is a good chance it will run on [Mono][1] out-of-the-box (assuming you're not going to use any of the latest C# 3.0 features).
If you're into GUI application, then you better write it using some cross-platform toolkit. Most likely you ... |
You better write it using some cross-platform toolkit. Most likely you won't be able to use nice visual designer (really this depends on what toolkit you choose), but writing UI by hand is not really that difficult. HTML guys do it all the time and it's quite common practice in non-MS world too.
**Some cross-platfor... |
As a shell extension, I guess it's not technically a stand-alone application, but +1 for TortoiseSVN, nevertheless. |
If you can do the changes yourself and the class you use is custom, you might want to add a setProgress:(float) f method to your class and use CA to animate it, then modify the desired properties as needed as a function of f.
Just do a
[[someObject animator] setValue:[NSNumber numberWithFloat:1.0] forKeyPath:... |
I'd recommend [TortoiseSVN][1] to get started with (basically, it adds SVN related contextual menus to explorer), but it can be shockingly memory hungry.
I generally use it when I need to, but also make use of the very clean and usable command line tools subversion comes with and Subclipse as part of Eclipse.
... |
How do you delcare a Predicate Delegate inline? |
|c#|delegates| |
I'm using C#.
So I have an object which has some fields, doesn't really matter what.
I have a generic list of these objects.
List<MyObject> myObjects = new List<MyObject>();
myObjects.Add(myObject1);
myObjects.Add(myObject2);
myObjects.Add(myObject3);
So I want to remove objects from my ... |
How do you declare a Predicate Delegate inline? |
There's two options, an explicit delegate or a delegate disguised as a lamba construct:
explicit delegate
myObjects.RemoveAll(delegate (MyObject m) { return m.X >= 10; });
lambda
myObjects.RemoveAll(m => m.X >= 10);
----------
Addition:
Performance wise both are equal. As a matter of fact, bo... |
I would suggest:
1. Put all strings in either the database or resource files.
2. Allow extra space for translated text, as some (e.g. German) are wordier. |
The lambda C# 3.0 way:
myObjects.RemoveAll(m => m.x >= 10);
The anonymous delegate C# 2.0 way:
myObjects.RemoveAll(delegate (MyObject m) {
return m.x >= 10;
});
And, for the VB guys, the VB 9.0 lambda way:
myObjects.RemoveAll(Function(m) m.x >= 10)
Unfortunately, VB doesn't su... |
I'm always on the lookout for ways to use objects to solve my programming problems. I hope this means that I'm more OO than when I was only using functions to solve problems, but that remains to be seen.
In C#:
interface ITemperature
{
CelciusTemperature ToCelcius();
FarenheitTempera... |
SharePoint: Using RichHTML field type in a custom content type |
|sharepoint|content-type| |
I'd like to use the field type RichHTML in a custom content type that I'm making. However, I think that the RichHTML type comes with MOSS Publishing so I'm unsure how to add it to my content type. Right now I've tried with this:
<Field ID="{7F55A8F0-4555-46BC-B24C-222240B862AF}" Type="RichHTML" Name="NewsBodyFie... |
I've noticed that if I put a shortcut on my desktop on one screen the launched application may appear on that screen (***if*** that app doesn't reposition itself).
This also applies to running things from Windows Explorer - if Explorer is on one screen the launched application will pick that monitor to use.
Again... |
Try [ImageConverter Plus][1]
[1]: http://www.imageconverterplus.com/ |
[Image Magick][1] contains a tool called convert, that will convert from [just about anything][2] to EMF files. You can either use this as a separate application, or interface to it using [an API][3] that is available in several different languages.
[1]: http://www.imagemagick.org
[2]: http://www.imagemagick... |
We also added multiple core support for doing multi-threaded builds on the command line for those of you with a lot of projects and long build times. Enabling multiple core support requires only a few new properties, and MSBuild manages all of the work to schedule projects efficiently and effectively. The MSBuild tea... |
Is there a tool that can convert common image formats (.bmp, jpg,..) to .emf files? |
|image| |
I'm using the GoDiagrams suite which seems to recommend .emf files for node images since they scale better on resizing. Bitmaps get all blurry.
Google doesn't show up any good tools that seem to do this... So to reiterate I'm looking for a image converter (preferably free) that converts an image (in one of the comm... |
[blooberry.com][1] is a great HTML/CSS reference site.
[1]: http://blooberry.com |
Double buffering won't help here since that only double buffers paint operations, the flickering the OP is seeing is the result of multiple paint operations:
* Clear control contents -> repaint
* Clear columns -> repaint
* Populate new columns -> repaint
* Add rows -> repaint
so that's four repaints to update ... |
Set the redirectErrorStream property on ProcessBuilder to send stderr output to stdout:
ProcessBuilder builder = new ProcessBuilder(command);
builder.redirectErrorStream(true);
You should then create a thread to deal with the process stream, something like the following:
Process p = builder.start(... |
Many Python IDEs and generally-capable text/source editors can handle the whitespace for you.
However, it is best to just "let go" and enjoy the whitespace rules of Python. With some practice, they won't get into your way at all, and you will find they have many merits, the most important of which are:
1. Becaus... |
Some things to try (designer mode in VS2005 I have found to be somewhat flaky):
1. Open your web.config and add: batch="false" to your `<compilation>` tag.
2. Try setting defaults to your enums:
public enum VerticalControlAlign
{
Center = 0,
Top = 1,
Bottom = 2
}
|
This *looks* good, but unfortunately it's being licensed under GPLv3, so I'm actually a bit afraid to start looking at that code. The framework I either need to find, or develop if needs be, must be able to be used as part of a commercial program, without having to license the entire program different. Commercial libra... |
When you say "10Gb C drive", do you mean it's a 10-gig disk or a partition? If the former, you should really be looking at replacing the drive - it's *old*, and I'd be starting to worry about how much longer it has to live.
If the latter, then assuming that the C: drive restriction can't easily be worked around, the... |