Rhythmbox Startup Script

Background Knowledge


I will explain how to create a script that will run Rhythmbox Music Player at startup, enqueue a playlist and then begin playing.

Note: I have only verified this method to work on Ubuntu v10.04.

Solution


  1. Using your favorite text editor copy and paste the following code below.
  2. You may need to replace “–play” with “–play-pause” depending your environment.
  3. Replace the following “/home/foo/playlist.pls” to where the playlist is saved (previously created).
  4. Save the script to a safe location such as a user directory (e.g. /home/foo/.rhythmbox-startup.sh).
  5. Using the “Terminal” under “Applications -> “Accessories” type the following without double quotes, “sudo chmod +x /home/foo/.rhythmbox-startup.sh” to grant the file execute permissions.
  6. Close the “Terminal”.
  7. Go to the menu “System” -> “Preferences” -> “Startup Applications” and then click on “Add”.
  8. Enter the following into the corresponding dialog fields without double quotes, Name: “Rhythmbox”, Command: “/home/foo/.rhythmbox-startup.sh” and Comment: “Runs Rhythmbox with a playlist”.
  9. Click “Add” and then “Close” buttons.
1
2
3
4
5
6
#!/bin/bash
sleep 10 &&
rhythmbox-client --hide &&
sleep 5 &&
rhythmbox-client --enqueue /home/foo/playlist.pls &&
rhythmbox-client --play

Source: Rhythmbox Startup Script for Ubuntu
Source: Rhythmbox – Community Ubuntu Documentation

Words To Live By

These speeches are nothing but amazing but truly nothing can describe these two motivating speeches below other than to listen to each one and then reflect what was just said.

Thank you to those that made these videos possible and providing the opportunity to allow these great innovative business leaders the opportunity to speak.

Steve Jobs at Stanford (2005)

Jeff Bezos at Princeton (2010)

Source: Words to Live By: 5 of the Best Commencement Speeches Ever

How To – Convert MSSQL Timestamp/Datetime to Unix Timestamp

Background Knowledge


I will explain how to convert a DATETIME (data type) value in Microsoft SQL Server to Unix timestamp and how to convert Unix timestamp to DATETIME. A Unix timestamp is a integer value of seconds since January 1, 1970 at midnight. For further explanation of Unix timestamps refer to Wikiepedia, UnixTimestamp.com or http://unixtimesta.mp/.

Note: This solution only work on dates prior to 2038-01-19 at 3:14:08 AM, where the delta in seconds exceeds the limit of the INT data type (integer is used as the result of DATEDIFF). See source for further details as I have not verified a solution to this problem.

Solutions


Convert Datetime Value to Unix Timestamp (today)

1
SELECT DATEDIFF(s, '19700101', GETDATE());

Result: 1305630800

Convert Datetime Value to Unix Timestamp from two Values

1
SELECT DATEDIFF(s, StartTime, EndTime) AS Duration FROM Programs

Result: 3600

Convert Unix Timestamp Value to Datetime Value

1
SELECT DATEADD(s, 123456789, '19700101');

Result: 1973-11-29 21:33:09.000

Source: How do I convert a SQL Server DATETIME value to a Unix timestamp?
Source: DATEADD (Transact-SQL)
Source: DATEADD
Source: DATEDIFF (Transact-SQL)
Source: DATEDIFF