instruction stringlengths 0 30k ⌀ |
|---|
|c++|linker|cli|mixed-mode| |
What is a good free library for editing MP3s/FLACs? |
|audio|free| |
What is a good free library for editing MP3s/FLACs.
By editing I mean:
- Cutting audio file into multiple parts
- Joining multiple audio files together
- Increase playback speed of file without affecting the pitch (eg. podcasts up to 1.3x)
- Re-encoding audio file from Flac -> MP3 or vice versa |
|audio|free| |
What is a good free library for editing MP3s/FLACs.
By editing I mean:
- Cutting audio file into multiple parts
- Joining multiple audio files together
- Increase playback speed of file without affecting the pitch (eg. podcasts up to 1.3x)
- Re-encoding audio file from Flac -> MP3 or vice versa
I d... |
Very odd. You're using ASP.NET server controls and custom controls, but you're not using web controls? And you're calling __doPostBack manually?
Do you like to do things the hard way?
If I was still using the server control model rather than MVC, I would slap ASP.NET Ajax controls on that sucker and call it a d... |
**Disclosure: I work for Sun** (but as an engineer in client software).
You don't necesarily need multithreaded code to make use of these machines. Having multiple processes will make use of multiple hardware threads on multiple cores.
The old T1 processors (T1000 and T2000 boxes) did have only a single FPU, and ... |
As I can't accept two answers, I'm going to merge [Christ Upchurch's][1] and [17 of 26's][2] answers in my own post. I think, these two together pretty much sum up what I wanted to know. Thanks guys!
[1]: http://stackoverflow.com/questions/52140/what-are-the-technical-pros-and-cons-of-flash-vs-ajaxjs#52150
[2]: htt... |
Rectangle functions in emacs |
|emacs| |
I've read in several places that the rectangle functions in emacs are very useful. I've read a bit about them, and I can't quite figure why. I mean, when you want to kill a paragraph, you mark the first row/column and then the last one, and that's actually a rectangle, right? But you can still use the normal kill...
... |
Hmm, I think I misunderstand the question but I'm going to risk it. What's wrong with the straightforward following method?
public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) {
foreach (DirectoryInfo dir in source.GetDirectories())
CopyFilesRecursively(dir, ... |
Hmm, I think I misunderstand the question but I'm going to risk it. What's wrong with the following straightforward method?
public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) {
foreach (DirectoryInfo dir in source.GetDirectories())
CopyFilesRecursively(dir, ... |
That would be Tools > Options
Text Editor > All Languages > Line Numbers (at the bottom right) |
Tools -> Options -> Text Editor -> All languages. Near the bottom. |
I need some software to explore and modify some SQLite databases. Does anything similar to SQL Server Management Studio or MySQLAdmin exist for it? |
Well at the very basic level you should be handling the HttpApplication.Error event in the Global.asax file. This should log any exception that occurs to a single place so you can review the stack trace of the exception.
Apart from this basic level you should ideally be handling exceptions where you know you can rec... |
I've used Codeweavers Crossover product for doing this from time to time.
[http://www.codeweavers.com/products/cxmac/][1]
[1]: http://www.codeweavers.com/products/cxmac/
It's a different option to virtualisation, and gives you a little more control than some of the hosted solutions. That said, it's based ... |
For this particular case, BeautifulSoup is harder to write than a regex, but it is much more robust... I'm just contributing with the BeeautifulSoup example, given that you already know which regexp to use :-)
from BeautifulSoup import BeautifulSoup
#Or retrieve it from the web, etc.
html_data =... |
For this particular case, BeautifulSoup is harder to write than a regex, but it is much more robust... I'm just contributing with the BeautifulSoup example, given that you already know which regexp to use :-)
from BeautifulSoup import BeautifulSoup
#Or retrieve it from the web, etc.
html_data = ... |
I recently was tasked with creating a simple histogram control for one of our thin client apps (C#). The images that I was analyzing were about 1200x1200 and I had to go the same route. I could make the thing draw itself once with no problem, but the control needed to be re-sizable. I tried to avoid it, but I had to... |
[As a Firefox plugin][1] (aimed mainly at gears, but should work)
[As a (sucky) web based app][2]
And [a big list of management tools][3]
[1]: https://addons.mozilla.org/en-US/firefox/addon/5817
[2]: http://www.sqlitemanager.org
[3]: http://www.sqlite.org/cvstrac/wiki?p=ManagementTools |
Thanks Michael, after trying out many things in JCE, I finally settled for bouncycastle.
JCE supports AES for encryption and PBE for password based encryption but it does not support combination of both. I wanted the same thing and that I found in bouncycastle.
The example is at : http://forums.sun.com/thread.js... |
CSS2 Attribute Selectors with Regex |
|css|css-selectors| |
[CSS Attribute selectors](http://www.w3.org/TR/REC-CSS2/selector.html#attribute-selectors) allow the selection of elements based on attribute values. Unfortunately, I've not used them in years (mainly because they're not supported by all modern browsers). However, I remember distinctly that I was able to use them to ad... |
Ok so I finally solved this: You need to call Page_ClientValidate() in your Save javascript method and If it returns true continue with the save, the Page_ClientValidate() initiates the client side validators, See code below:
function Save()
{
var clientValidationPassed =Page_ClientValidate();
if(cl... |
When we want to prepare for the release of, say, version 3.1, we create a branches/3.1-Release branch, and merge individual commits from trunk as we seem fit (our release-branches usually only receive the most critical fixes from the main development branch).
Typically, this release branch lives through the alpha- a... |
Check out Rotor 2 (http://research.microsoft.com/sscli/) or use reflector (http://www.red-gate.com/products/reflector/) too see how Microsoft did it!!! |
We already use tags, although we have the one-big-project structure rather than the many-small-projects you have outlined.
In this case, we need to tag, e.g. 1.0.0, but also branch, e.g. 1.0. My concern is mixing project branches and release branches together, e.g.
branches
this-project
that... |
|c#|performance|memory|profiler| |
Does anyone know of a way to find out how much memory an instance of an object is taking?
For example, if I have an instance of the following object:
TestClass tc = new TestClass();
Is there a way to find out how much memory the instance "tc" is taking?
The reason for asking, is that although C# has built i... |
I try hard to make each "commit" operation represent a single, cohesive change. Sometimes it's a whole bug fix or whole feature, and sometimes it's a single small refactoring on the way to something bigger. There's no simple way to decide what a unit is here, just by gut feel. I also ask (beg!) my teammates to do th... |
Can anyone recommend a Silverlight 2 book? |
|silverlight| |
Even though Silverlight2 is still in it's infancy, can anyone recommend a book to get started with? One that has more of a developer focus than a designer one? |
I recommend you start by adding a good error page that catches all exceptions and prints a slightly less unfriendly message to the user. Be sure to log all details available of the exception and revise that. Let the user know that you have done this, and give him a link back to a page that will (probably) work.
Now,... |
Microsoft's Patterns & Practices team did a good job gathering best practices of exception management into Enterprise Library [Exception Handling Application Block][1]
[1]: http://msdn.microsoft.com/en-us/library/cc511522.aspx |
Microsoft's [Patterns & Practices team][1] did a good job incorporating best practices of exception management into Enterprise Library [Exception Handling Application Block][2]
Event if wouldn't use Enterprise Library, I *highly* recommend you to read their documentation. P&P team describes common scenarios and best... |
if (!(foo is bar)) {
} |
There is no specific keyword
if (!(foo is bar)) ...
if (foo.GetType() != bar.GetType()) .. // foo & bar should be on the same level of type hierarchy
|
The golden rule with exception handling is:
> "Only catch what you know how to handle"
I've seen too many try-catch blocks where the catch does nothing but rethrow the exception. This adds no value. Just because you call a method that has the potential to throw an exception doesn't mean you have to deal with the ... |
Did you enable trace logging in SharePoint? You can activate it by going to the Central Administration website > Operations > Diagnostic Logging > Trace Logging. Perhaps we can get a more detailed error from there... |
How to prevent a hyperlink from linking. |
|asp.net|css| |
Is it possible to prevent an asp.net Hyperlink control from linking, i.e. so that it appears as a label, without actually having to replace the control with a label? Maybe using CSS or setting an attribute?
I know that marking it as disabled works but then it gets displayed differently (greyed out). |
Is it possible to prevent an asp.net Hyperlink control from linking, i.e. so that it appears as a label, without actually having to replace the control with a label? Maybe using CSS or setting an attribute?
I know that marking it as disabled works but then it gets displayed differently (greyed out).
To clarify my... |
A Hyperlink control will render as a "a" "/a" tag no matter what settings you do. You can customize a CSS class to make the link look like a normal label.
Alternatively you can build a custom control that inherits from System.Web.UI.WebControls.HyperLink, and override the Render method
protected override voi... |
What are the preferred conventions in naming attributes, methods and classes in different languages? |
|programming-languages|naming| |
Are the naming conventions similar in different languages? If not, what are the differences? |
ASP.NET MVC is sparsely documented at present -- and of course it depends on your background. If you don't know ASP.NET yet, I wouldn't recommend jumping into it with ASP.NET MVC, too many layers of learning at once. |
No matter what you do, it can be 'decompiled'. Heck, you can just disassemble it. Or look at a memory dump to find your constants. You see, the computer needs to know them, so your code will need to too.
What to do about this?
Try not to ship the key as a hardcoded constant in your code: Keep it as a per-user set... |
Might be more about exception handling in general than ASP.NET speific but:
- Try to catch exceptions as close to
the cause as possible so that you
can record (log) as much information
about the exception as possible.
- Include some form of catch all, last
resort exception handler at the
... |
I believe a `const` value is the same for all objects (and must be initialized with a literal expression), whereas `readonly` can be different for each instantiation... |
You can also use the [as operator][1].
> The as operator is used to perform
> conversions between compatible types.
bar aBar = foo as bar; // aBar is null if foo is not bar
[1]: http://msdn.microsoft.com/en-us/library/cscsdfbt(VS.71).aspx |
Check out the [RETURNING optional clause][1] for an INSERT statement. (Link to official PostgreSQL documentation)
But basically, you do:
INSERT INTO table (col1, col2) VALUES (1, 2) RETURNING pkey_col
and the INSERT statement itself returns the id of the affected row.
[1]: http://www.postgresql.org/do... |
Check out the [RETURNING optional clause][1] for an INSERT statement. (Link to official PostgreSQL documentation)
But basically, you do:
INSERT INTO table (col1, col2) VALUES (1, 2) RETURNING pkey_col
and the INSERT statement itself returns the id (or whatever expression you specify) of the affected row.
... |
A const is a compile-time constant whereas readonly allows a value to be calculated at run-time and set in the constructor or field initializer. So, a 'const' is always constant but 'readonly' is read-only once it is assigned.
[Eric Lippert][1] of the C# team has more information on different types of immutability
... |
I must admit, I would normally agree with @Peter - I conditionally drop and then unconditionally recreate every time. I've been caught out too many times in the past when trying to second-guess the schema differences between databases, with or without any form of version control.
Having said that, your own suggestio... |
There is a gotcha with consts! If you reference constant from other assembly it's value will be compiled right into calling assembly. That way when you update constant in referenced assembly it won't change in calling assembly! |
The most common one I think is to allow people to change revision comments after comitting.
You need to enable the 'pre-revprop-change' hook script to allow that. The example provided, if enabled allows editing only the comment property and only be the original comitter. Great for correcting typos. |
In this way you can obtain the list of the ten oldest processes:
<pre>ps -elf | sort -r -k12 | head -n 10</pre> |
Call me crazy, but why not put plus and minus buttons at either side of the TextBox control and simply prevent the TextBox from receiving cursor focus, thereby creating your own cheap NumericUpDown control? |
There are some other idea's also. You can always use impersonation. Also, you can use the Enterprise Library's (Common Library).
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary... |
Look at the URI specification. That could help you a lot. And as far as performance goes, you can pretty much extract all the HTTP links in a modest web page. When I say modest I definitely do not mean one page all encompassing HTML manuals like that of ELisp manual. Also performance is a touchy topic. My advice would ... |
McDowell,
You are correct that when using the single '&' operator that both sides of the expression evaluate. However, when using the '&&' operator (at least in C#) then the first expression to return false is the last expression evaluated. This makes putting the evaulation before the FOR statement just as good as... |
.NET supports encryption on config values like this. You could leave it in a config file, but encrypted. |
I've had to do this before. The only real way to do it is to manually match up the various locations. Use your database's console interface and grouping select statements. First, add your "Company Name" field. Then:
SELECT count(*) AS repcount, "Location Name" FROM mytable
WHERE "Company Name" IS NULL
... |
@Daren Thomas
Implementation of your algorithm (O(N) in time, O(1) in space) in D (Digital Mars):
#!/usr/bin/dmd -run
/**
* to compile & run:
* $ dmd -run reverse_words.d
* to optimize:
* $ dmd -O -inline -release reverse_words.d
*/
import std.algorithm: reverse;
... |
@Daren Thomas
Implementation of your algorithm (O(N) in time, O(1) in space) in D (Digital Mars):
#!/usr/bin/dmd -run
/**
* to compile & run:
* $ dmd -run reverse_words.d
* to optimize:
* $ dmd -O -inline -release reverse_words.d
*/
import std.algorithm: reverse;
... |
@Daren Thomas
Implementation of your algorithm (O(N) in time, O(1) in space) in D (Digital Mars):
#!/usr/bin/dmd -run
/**
* to compile & run:
* $ dmd -run reverse_words.d
* to optimize:
* $ dmd -O -inline -release reverse_words.d
*/
import std.algorithm: reverse;
... |
To add to pauliephonic's comment:
**Helper**: functions to make creating the view easier. For example, if you're always iterating over a list of widgets to display their price, put it into a helper (along with a partial for the actual display). Or if you have a piece of rjs that you don't want cluttering up the vi... |
I'm currently working my way through [Introducing Microsoft Silverlight 2][1], so far so good.
It's a typical Microsoft book serving up the **koolaid**, but gives a good introduction. I saw the guy speak at one of the local .NET User Groups in the Metro Detroit area and was impressed.
![alt text][2]
[1]... |
I would suggest something like:-
bool nonEmptyDataSet = dataSet != null && dataSet.Tables.Count > 0 && dataSet.Tables.All( t => t.Rows.Count > 0);
Little bit ugly bet gets the job done. |
I would suggest something like:-
bool nonEmptyDataSet = dataSet != null && dataSet.Tables.Count > 0 &&
(from DataTable t in dataSet.Tables select t).All(d => d.Rows.Count > 0);
Little bit ugly bet gets the job done. |
I would suggest something like:-
bool nonEmptyDataSet = dataSet != null && dataSet.Tables.Count > 0 &&
(from DataTable t in dataSet.Tables select t).All(d => d.Rows.Count > 0);
Little bit ugly but gets the job done. |
I would suggest something like:-
bool nonEmptyDataSet = dataSet != null && dataSet.Tables.Count > 0 &&
(from DataTable t in dataSet.Tables select t).All(d => d.Rows.Count > 0);
Little bit ugly but gets the job done.
**Edit:** - This code assumes any table being empty implies the dataset is empty... |
I would suggest something like:-
bool nonEmptyDataSet = dataSet != null &&
(from DataTable t in dataSet.Tables where t.Rows.Count > 0 select t).Any();
**Edits:** I have significantly cleaned up the code after due consideration, I think this is much cleaner. Many thanks to [Keith](#48547) for the i... |
I would suggest something like:-
bool nonEmptyDataSet = dataSet != null &&
(from DataTable t in dataSet.Tables where t.Rows.Count > 0 select t).Any();
**Edits:** I have significantly cleaned up the code after due consideration, I think this is much cleaner. Many thanks to [Keith](#48547) for the i... |
I would suggest something like:-
bool nonEmptyDataSet = dataSet != null &&
(from DataTable t in dataSet.Tables where t.Rows.Count > 0 select t).Any();
**Edits:** I have significantly cleaned up the code after due consideration, I think this is much cleaner. Many thanks to [Keith](#48547) for the i... |
I know this isn't strictly an answer to the question you're asking **but if your table is thousands rather than millions of rows**, then a FULLTEXT solution might be the best way to go here.
In MySQL when you use MATCH on your indexed column, each keyword you supply will be given a relevance score (calculated roughl... |
.NET serialization class design problem |
|class-design|serialization|.net| |
We have a rather large object graph that needs to be serialized and deserialized in a lot of different ways (modes). In some modes we want certain properties to be deserialized and in some we don't. The problem is now how we implement these modes.
**Apporach A (use deseriliazation constructor and ISerializable.GetO... |
|.net|serialization|class-design| |
We have a rather large object graph that needs to be serialized and deserialized in a lot of different ways (modes). In some modes we want certain properties to be deserialized and in some we don't. The problem is now how we implement these modes.
**Approach A (use deserialization constructor and ISerializable.GetO... |
I have good experiences with [MemProfiler][1]. It gives you stack traces of when the object was created and all the graphs of why the object is still not garbage collected.
[1]: http://memprofiler.com/ |
I doubt it. Even the compiler automatically inlines some functions for optimization. |
If you are not trying to do it in code itself, which I'm assuming based on your ANTS reference, try taking a look at CLRProfiler (currently v2.0). It's free and if you don't mind the rather simplistic UI, it can provide valuable information. It will give you a in-depth overview of all kinds of stats. I used it a while ... |
Define an interface that is sufficient for your application's graphic output demands. Then implement this interface for every renderer you want to support.
class IRenderer {
public:
virtual ~IRenderer() {}
virtual void RenderModel(CModel* model) = 0;
virtual void DrawScreenQuad(... |
Define an interface that is sufficient for your application's graphic output demands. Then implement this interface for every renderer you want to support.
class IRenderer {
public:
virtual ~IRenderer() {}
virtual void RenderModel(CModel* model) = 0;
virtual void DrawScreenQuad(... |
Here is the deal.
$ gem --version
> 1.1.0
$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
> Bulk updating Gem source index for:
> http://gems.rubyforge.org/ ERROR:
> could not find mysql locally or in a
> repository
$ sudo gem update
> Updating installed gems Bul... |
Here is the deal.
$ gem --version
> 1.1.0
$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
> Bulk updating Gem source index for:
> http://gems.rubyforge.org/ ERROR:
> could not find mysql locally or in a
> repository
$ sudo gem update
> Updating installed gems Bul... |
Here is the deal.
$ gem --version
> 1.1.0
$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
> Bulk updating Gem source index for:
> http://gems.rubyforge.org/ ERROR:
> could not find mysql locally or in a
> repository
$ sudo gem update
> Updating installed gems Bul... |
We have a rather large object graph that needs to be serialized and deserialized in a lot of different ways (modes). In some modes we want certain properties to be deserialized and in some we don't. In future modes it might also be possible that there are more options for properties than yes or no. The problem is now h... |
IDLE provides Emacs keybindings without having to install other software.
1. Open up the menu item Options -> Configure IDLE...
2. Go to Keys tab
3. In the drop down menu on the right
side of the dialog change the select
to "IDLE Classic Unix"
It's not the true emacs key bindings but you get the b... |
I use [Bitstream Vera Sans Mono][1], but you need to activate ClearType to get it readable .
I like the 'Illegal1 = O0' readablility test, mentioned earlier in this thread, thanks for that.
[1]: http://www.bitstream.com/font_rendering/products/dev_fonts/vera.html |
Single quotes vs. double quotes in Python |