If you are looking for some more .NET bloggers to subscribe to, check out my .NET Programming RSS Feeds. It’s a exported bundle from my Google Reader. I’ve subscribed to these feeds over several years so I am sure many of the blogs are no longer active.
But if you have kids and have the Thermos aluminum straw Bottles such as the Thermos Funtainer or Foogo Straw bottles, you can get replacement straws directly from Thermos for $1 a piece. My kids like to bite the straws and they get destroyed pretty quickly. If you need just the top part of the straw, that would be $0.50.
Apparently, people are reselling these straws on Ebay and other sites for $7-$10 a piece! So Thermos is limiting each order to 5 straws. I am putting this out there to hopefully direct people to the source.
Call Thermos directly at 1-800-831-9242 to order your replacement straws. If outside the US, try 1-847-439-7821.
I was looking for the most efficient way to remove excess white space from a string and wrote the following benchmark. Guess which algorithm is faster?
const int iterations = 200000;
const string expr = " Hello world! Why are so many spaces? Testing One two three four five.";
// Remove excess space using Regex
var doRegex = new Action(() =>
{
for (int i = 0; i < iterations; i++)
{
var newStr = Regex.Replace(expr, @"\s{2,}", " ");
}
});
// Remove excess space using Split/Join
var doSplit = new Action(() =>
{
for (int i = 0; i < iterations; i++)
{
var newStr = String.Join(" ", expr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));
}
});
var benchMark = new Func<string, Action, long>((name, a) => {
var sw = Stopwatch.StartNew();
a();
sw.Stop();
Console.WriteLine(name + ": " + sw.ElapsedMilliseconds);
return sw.ElapsedMilliseconds;
});
// Warming up
Console.WriteLine("Warming up.");
doRegex();
doSplit();
// Run benchmark
long regexElapsed = benchMark("Regex", doRegex);
long splitElapsed = benchMark("Split", doSplit);
On my PC, the Split method is about 7.5 times faster than Regex.
I enjoy making taking and making short videos. My kids are usually featured in the videos in one way or another. Last year we went on a month-long vacation to Vietnam and I recorded a huge number of raw videos. With so many raw takes to work with, using Windows Explorer and browsing around without some system of tagging, keyword searching, etc. becomes extremely tedious and unmanageable.
So I started to look for a way to manage/categorize all of these raw videos and I think I’ve found a pretty good and free solution: Picasa (from Google).
The current version of Picasa for Windows (version 3.8) allows you to specify titles for images and videos, as well as assigning various tags to them. The user interface is very user-friendly. And the actual searches are typical Google-lighting-fast.
What I do is I go through each raw video take, give it a title and assign some tags. Then later I am able to very quickly search for videos. For example, if I need a take involving a dolly pan to the right, I just type “dolly pan” into Picasa and instantly the takes with those keywords come up.
The little known WBR tag is great for formatting HTML tables. Add it to specific places in your table cell values to give the browser the option to add a line break there. This is very useful when displaying tables with long strings that would otherwise cause horizontal scrolling.
Here’s a sample table, displaying some info. Since the values in the tables do not have spaces or tabs, the browser is forced to display the values on one line:
Key
Value
ChinhDo.TestApp.TestClass.ExampleKey1
this.is.an.example.of.a.very.long.string
Here’s the same table, with <wbr/> tags inserted where periods are:
From my code snippets, here’s a function that will return the starting day of the week for any date:
/// <summary>
/// Gets the start of the week that contains the specified date.
/// </summary>
/// <param name="date">The date.</param>
/// <param name="weekStartsOn">The day that each week starts on.</param>
/// <returns>The start date of the week.</returns>
public static DateTime GetStartOfWeek(DateTime date, DayOfWeek weekStartsOn)
{
int days = date.DayOfWeek - weekStartsOn;
DateTime startOfWeek = days>=0 ? date.AddDays(-days) : date.AddDays(-7 - days);
return startOfWeek;
}
Knowing only the Vietnamese version, I had a hard time finding the original song. I hate that most “foreign” songs translated to Vietnamese simply have this in the credit line: “Nhạc Ngoại” (foreign song). If you are going to translate/record the song in Vietnamese, at least give proper credit to the original performer/composer.
Here’s the vietnamese lyrics to this song to help you googlers out there:
Í o à, í o a ê … Í o à, í o a ề …
Chiều lắng xuống, rừng vang tiếng ca mừng Lửa bốc cháy rực lên nhg tiếng ân tình, Thiết tha ôi ngàn lời ca đắm say ngập trời ngất ngây
Này má thắm, này môi mắt đa tình Làm say mê, làm ngây ngất ân tình Trái tim theo nhịp vang vang đắm say triền miên thiết tha
Hãy vui đêm nay, nét môi thơm nồng ái ân !
( nhạc….. )
Hãy cho tim non đắm say mơ mộng vòng tay ân ái, Hát lên muôn ngàn câu hát ngất ngây tình yêu đắm say !
Í o a, í o a ê … Í o a, í o a ề … Í o a, í o a ê … Í o a, í o a ề … u u u u u ….
Này má thắm, này môi mắt đa tình Làm say mê, làm ngây ngất ân tình Trái tim theo nhịp vang vang đắm say triền miên thiết tha
It’s my first open source project! I’ve gone open source with my Transactional File Manager. Check out the CodePlex link here.
Use any file system as a transactional file system! Transactional File Manager is a .NET API that supports including file system operations such as file copy, move, delete in a transaction. It’s an implementation of System.Transaction.IEnlistmentNotification (works with System.Transactions.TransactionScope).
More on Transactional File Manager in my original blog post on it. If you are interested in contributing to the project, let me know.