Want the Audio from a Youtube Video?
Blogged on 27 December, 2008 at 5:46 PM by AndrewIf you ever wanted to obtain the audio from a youtube video as MP3 on your hard disk, there is this efficient and convenient tool:
http://www.listentoyoutube.com/index.php
Fast and simple to use, with a few easy steps:
- Paste the youtube url in the textbox below "Enter YouTube URL"
- Click GO
- Click 'Download MP3' below when the processing completes.
Bus Tour 2008
Blogged on 03 December, 2008 at 7:20 AM by AndrewAn Endless Ride
Blogged on 28 November, 2008 at 10:40 PM by AndrewThe beautiful sun and the clear sky now gone,
One last cold swim and November's ending.
Cold winds and wet roads now there is,
Black clouds gather and December's coming.
A child rides his bike along a thoughtful road,
Away from the cars and along the shore.
In that silence and at the pace of his cycle,
He thinks of his memories, wishes and more.
But the whistling winds against the flapping sails,
And the whispering of leaves and tightening of ropes.
They pull the child from oh such deep thoughts,
The child loses grip, so scaringly from the hopes.
So the child rides faster, and the trees fly past,
Straight ahead, a quick turn and an uphill.
The child cycles ahead uncertain of his way,
But he is focused with a long trip to fulfill.
It is only too soon that the child is tired,
Breathing heavily after so much he fought.
He stops and rests, certainly a merited break,
But only gains, the sorrow of a recurring thought.
Quickly the child gets back on his bike,
Tired he continues to cycle against the blow,
Hope makes one so vulnerable and so weak,
But deep inside, he fears letting it go.
C# - Converting String to Enumeration
Blogged on 31 October, 2008 at 2:21 PM by AndrewSometimes it is useful to convert a string to a value of an enumeration. It's extremely easy to convert an enumeration value to a string of course, with the ToString() method, however doing the vice versa of it doesn't seem as easy.
Searching on the net, you will find that most people create their own function, in which they will loop through all values in the enumeration, compare their string equivalent with a given string and if they are equal, the enumeration value is returned. But why do this when a method is there waiting for you on a sunbed? It is the static method Enum.Parse() which has 2 overloads.
The first overload takes the type of the enumeration and the string value, returning an object, which may often need to be cast to the type of enumeration.
Example:
enum Days {Sun, Mon, Tue, Wed, Thur, Fri, Sat };
private void main() {
string s = "Mon";
Days day = (Days)Enum.Parse( typeof( Days ), s );
}
The day variable will contain the enumeration value Mon.If the given string does not exist in the enumerations, the method will raise an ArgumentException. If the string is null, the method will raise an ArgumentNullException.
Now what if in the above code, s was equal to "mon" instead of "Mon"? By default, the casing is regarded and thus, that would raise an ArgumentException. However you may use the second overload, which takes an extra boolean parameter to specify whether casing should be regarded or not.
private void main() {
string s = "mon";
Days day = (Days)Enum.Parse( typeof( Days ), s, true );
}
The third parameter specifies that the casing should be ignored, and thus that code is raise no exception.All's well.
Biological Visit
Blogged on 07 October, 2008 at 3:51 PM by AndrewToday we enjoyed the last of summer (which actually ended long ago) with a nice short swim in St. George's Bay. The next hours followed with unexpectedly heavy rain, so we sheltered until it stopped. At that point, we went back to the beach, simply to be the only persons on that sandy beach.
However, we definitely were not the only living things on the beach. Here are a list of existences that reigned on the bay:
Camouflaged Frog:
Small cockroach-looking bug:
Bigger cockroach-looking bug:
Biggest cockroach-looking bug:
Homo sapiens:
Austria - Photos
Blogged on 30 September, 2008 at 3:41 PM by AndrewFinally I've uploaded selected photos of Austria. Unfortunately, there are no photos of our 3rd day (17.09.08) due to problems with the camera, but there still are two photos that were taken by a camera in the salt mines.
Austria (14/09/08 - 21/09/08) |
Mozart
Blogged on 25 September, 2008 at 6:27 PM by AndrewRemember I had promised you a little talk about Mozart? Here it is.
Having returned from my vacation in Austria, I'll describe something interesting about Salzburg and Mozart. I’ll assume I have gone to Austria without the least knowledge on this person, Mozart (which I hope is not the case with any of you readers). Well, after having walked through the streets of Salzburg and having visited a number of shops, I can proudly say to have learned that this man, so adored by the Austrians, is the one to have created or invented a kind of...chocolates. But really, everywhere you went, you'd see these chocolates nicely packed in boxes displaying Mozart’s face, or Mozart holding the box of chocolates. How can you think otherwise? You can see for yourselves:
And while discussing this, I can also mention that I’ve seen a book called: ‘The Sound of Cooking’.
Ratatouille!
Blogged on 22 September, 2008 at 8:15 PM by AndrewSalzburg, Austria - Day 6 & 7
Blogged on 21 September, 2008 at 12:26 AM by Andrew19th – 20th September
Hellbrun & the End
The next day, Friday the 20th of September was practically our last day in Austria. We decided to forget the ice caves for this vacation, and be a little relaxed on this last day (also because we had no chance of waking up early after the beer from the day before, which were followed by a complimentary round of red wine liquor). We simply visited some shops in St. Johann, then later headed to Salzburg, moving about the city. In the evening, for the third consecutive time, we dined at that same restaurant, most of us ordering the same kind of beer, the same kind of dish and the same kind of dessert. We surely are going to miss this restaurant.
Wish us a safe trip back. Good night to all :)
Salzburg, Austria - Day 5
Blogged on 19 September, 2008 at 10:46 PM by Andrew18th September
Welfen
Hey, I couldn’t quite smile at that moment.
I can’t thank my brother enough for being so helpful with his encouraging words.
“That cut you got is so deep.”
“You’ve really ripped your skin there...”
Salzburg, Austria - Day 4
Blogged on at 9:07 AM by Andrew17th September
Hallein
After leaving the salt mines, we walked to a nearby old Celtic village that was connected to the salt mines in history. At the top of the hill, we took a nice photo of us all again:
That’s all for the day and I hope you enjoy reading these as much as I do writing them.
Salzburg, Austria - Day 3
Blogged on 17 September, 2008 at 8:59 PM by Andrew16th September
Liechtensteinklamm (Liechtenstein Gorge)
<-- Spazierweg zur Liechtensteinklamm
--> Wanderweg zur Liechtensteinklamm
At last we arrived at this gorge. Certainly, there were a few magnificent views of the waterfalls, with the water powerfully flowing through it. Passing in between the extremely high rocks of the mountains, along with hearing the constant flow of water as well as (and especially) watching the plunging waves made it all an unforgettable experience.
‘Onlyinmalta.com’ is not only in Malta after all.
Oh and by the way, maybe this is a good time to show you one photo of us all:
Salzburg, Austria - Day 2
Blogged on 16 September, 2008 at 9:47 PM by Andrew15th September
Salzburg City
The first notable sightseeing location we’ve been too was the Mirabell Gardens and the palace of Mirabell. This is one of the spots used in the popular Sound of Music. Personally, I don’t have much to say on this place, but the photos will speak for themselves.
Going back to our vacation, as we continued along the streets, we were amazed at one particular shop. Indeed it was a little early thinking for Christmas decorations, but this shop boasted of numerous painted eggs. There must have been hundreds of them, all painted in different styles, colors and themes. All the eggs were hollow. We thought that these guys must have had eggs for breakfast, lunch and dinner since their childhood. Here’s a photo of one small area of the whole shop:
...I told you it was a bit random.
Conversation 1:
Passer-by 1: Uh?
Dad: The train station?
Passer-by 1: Um...
Dad: Bahnof?
Passer-by 1: Oh! Left, straight, right and straight again.
Conversation 2:
Dad: Where’s the train station please?
Passer-by 2: Wuh?
Dad: The train station...
Passer-by 2: *stares quietly*
Dad: Bahnof...
Passer-by 2: Ah, right, down the tunnel and right again.
______________________________________
*With an exception to foreigners – and this is no insult, but they are excused from knowing events regarding Malta and its history.
Salzburg, Austria - Day 1
Blogged on at 8:32 AM by Andrew14th September
Departure from Malta
This day is the day of travelling. I must admit it started out quite well upon seeing the efficiency of Air Malta’s new feature – Web Check-in. Everything’s going online now. The check-in is mostly done on the web, choosing the seats yourself, printing the boarding tickets yourself, (or better, “tickets”, as it is a little unusual to see boarding tickets on a piece of normal paper, black and white), and no needs to wait in long queues at the airport. What can I say? Air Malta is a serious company.
Air Malta took us to Vienna in Austria, were we had to wait for about three or four hours before our next plane leaves to Salzburg. After careful analysis and exhaustive thinking, we decided to remain at the airport before the next flight. At that, I chose to take a look at some cameras, in hopes of finding one that is relatively good and that’s not any more expensive than €200...it turned out that the cheapest one was €235. Pity.
Past those four hours, we headed for the next plane, which was a propeller plane. During the course on this plane, I can say that I have learned something. Air hostesses offering hot coffee during a flight on such a plane have a good sense of humour. It must have been the laugh of the day watching my mum spilling coffee all over her (logically, due to the shakiness of the plane). I’m also assuming that the pilot was just dumped by his girlfriend. You’d understand if you experienced the landing yourselves, or if you had the honour (which I had) of seeing the aircraft’s wheel smashing onto the ground.
Finally we arrived in Salzburg. It was a strange feeling after having been swimming just the day before, and now shivering in the cold. It must have been around 11°C at that time (in contrast to the 30°C and higher in Malta). After 50 minutes on the taxi, we arrived at our dear Alpenland Sport Hotel, at around 11:30pm. We thought our room was 137, and we spent about 10 minutes inserting the card repeatedly, each time being rejected. In fact, it was not our room. I can imagine the people inside there, shivering in fear after hearing weird noises at the door at that time of the night. But anyhow, we then made it into our (correct) room, and had a good night sleep.
The Infamous Chuck Norris
Blogged on 10 September, 2008 at 3:14 PM by Andrew- Chuck Norris never retreats. He fights in the opposite direction.
- Chuck Norris was able to win Connect 4 in three moves.
- Chuck Norris can punch a cyclops between the eye.
C# - Coordinates to Col/Row index
Blogged on 28 August, 2008 at 5:06 PM by AndrewWhen using a DataGrid or a DataGridView control, have you ever had mouse events such as MouseDown or MouseClick, where you wanted to know in which cell (or part of the table) is the pointer pointing to? You have the X and Y coordinates passed in the MouseEventArgs parameter, but how would you translate them to column and row indices?
One way is to apply a long formula involving those coordinates, the size of the table, sizes of cells, headers, etc... But obviously, that's tedious for a C# developer. That's the primitive way (or the C way) of handling it.
Thanks to a workmate, I discovered the magic of the HitTestInfo class. An instance of this class will give you the row and column indexes amongst other information. To create the object, say in a MouseDown event, you do the following:
private void dataGridView1_MouseDown( object sender, MouseEventArgs e )
{
System.Windows.Forms.DataGridView.HitTestInfo h = dataGridView1.HitTest( e.X, e.Y );
}
A DataGridView object contains the method HitTest(), which, given the x and y coordinates, returns an object of type HitTestInfo with all the information you need. Note the namespace of the class: System.Windows.Forms.DataGridView. If you are using a DataGrid, the class would be System.Windows.Forms.DataGrid.HitTestInfo (2 different classes).
With our object created, we can get various useful information (much more useful than x and y).
HitTestInfo.Type gets what part of the table is at the coordinates (Ex. column header, cell, etc...)
HitTestInfo.ColumnIndex & HitTestInfo.RowIndex are self explanatory.
if ( h.Type == System.Windows.Forms.DataGridViewHitTestType.ColumnHeader )
MessageBox.Show( "You clicked on a column header." );
else
MessageBox.Show( h.Type.ToString() + '(' + h.ColumnIndex + ',' + h.RowIndex + ')' );
Note that if you are using a DataGrid, the HitTestInfo.Type returns an element from the enumeration System.Windows.Forms.DataGrid.HitTestType.