Archive for November, 2011
Moving Internet Explorer Favorites to the Network
I’ve been using this little trick ever since my early XP days and still using it with Windows 7, and was surprised that this wasn’t a more common tip/trick
This registry hack moves your IE Favorites off to the network (your home drive) and allows you to have your favorites follow you no matter which computer you are sitting at
The H:\ Drive is my network drive. Move your Favorites folder from your Profile and to the Network drive, then change the registry keys bellow.
1 2 3 4 5 6 7 |
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders] "Favorites"="H:\\Favorites" [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders] "Favorites"="H:\\Favorites" |
That’s it, any computer you log into, you must also edit the same keys to point to the network drive, but then again, you will never have to email yourself links. (I’ve never tried this using Dropbox, but I bet it would work)
Yeah this post is not going to win any awards for innovation, but hey, who knows, it might just help someone out.
How To Factory Reset Samsung Galaxy S2 SkyRocket
Just a quick post for those looking for the same thing….
I had to factory reset my new Galaxy S2 SR, I tweaked something that made the device completely unstable, and the instructions for the regular Samsung Galaxy S2 dont work.
- Turn off the Phone (or Pull the battery)
- Hold down the Vol + AND the Vol – keys AND the Power Key until the First Samsung Splash Screen comes up and quickly let go of the keys
- This will bring you to the Android recovery menu
- Use the Vol + and Vol – keys to move up and down the menu, and use the Home key (the one under the “SAM” in the Samsung logo at the bottom of the phone) to select the menu options
- Pick the Factory Reset Option
- Next Menu will have a bunch of No’s and one Yes, Scroll down to the Yes
- Hit the Home Key
- After the Reset, Pick Reboot Phone
Done, Nice and Clean
And yes, I know the Settings menu has a reset option, but the phone wouldn’t even work well enough to get to the menu
Set the FROM Email when using the Linux MAIL command
The Linux / Unix command line has a command called “mail”. The problem with mail is that all the emails will come from root@localhost or whatever user you are using to run the “mail” command.
In order to override the from email, you must invoke the “sendmail options, which is done by doing a double dash (–) and then the -f command like so
1 |
mail -s "yoursubject" yourrecipients -- -f "yourfromemail@email.com" |
That’s all there is to it, the -f is the sendmail option for “From” which will get set when the email goes out
Converting Julian Date to Gregorian Date
So if you work with JD Edwards Enterprise One, you know that the dates in the database are saved as Julian Date. Probably not a big deal, until someone requires that you create some sort of view or report based on the database tables for JDE. Well, in order to convert the fantastic Julian date to Gregorian (the dates we are used mm/dd/yyyy) so it’s human readable, then you have have to use a formula or stored procedure, or, you can use the following SQL
1 |
<span style="color: #ff00ff;">dateadd</span>(d,(<span style="color: #ff00ff;">convert</span>(<span style="color: #0000ff;">int</span>,JlnDate) % 1000)-1,<span style="color: #ff00ff;">convert</span>(<span style="color: #0000ff;">datetime</span>,(<span style="color: #ff00ff;">convert</span>(varchar,<span style="color: #ff00ff;">convert</span>(<span style="color: #0000ff;">int</span>,JlnDate) /1000 + 1900) + '/1/1'))) as GrgDate |
Now you can quit reading right here if you are happy with just the formula, or you can keep reading and read my explanation on how the SQL works!!
Ok so you decided to keep reading…Now Lets assume that we have a table, and the table is structured like so
ID | Name | Unit | Description | JlnDate |
Now In order to query that table, we can use a simple Select Query, but then again, the field named “JlnDate” has the Julian date value, and that’s what we want to convert, so we modify our query from this
1 |
Select ID, Name, Unit, Description, JlnDate from SQLTable |
to this
1 |
Select ID, Name, Unit, Description, <span style="color: #ff00ff;">dateadd</span>(d,(<span style="color: #ff00ff;">convert</span>(<span style="color: #0000ff;">int</span>,JlnDate) % 1000)-1,<span style="color: #ff00ff;">convert</span>(<span style="color: #0000ff;">datetime</span>,(<span style="color: #ff00ff;">convert</span>(varchar,<span style="color: #ff00ff;">convert</span>(<span style="color: #0000ff;">int</span>,JlnDate) /1000 + 1900) + '/1/1'))) as GrgDate from SQLTable |
And here is the break down of what exactly the SQL is doing…
Lets assume our JlnDate field has a value of 111089
dateadd(d,(convert(int,JlnDate) % 1000)-1,convert(datetime,(convert(varchar,convert(int,JlnDate) /1000 + 1900) + ‘/1/1’))) as GrgDate | This Part takes the Julian Date Column and Divides it by 1000 then Adds 1900 to the result
Sample: 111089 / 1000 = 111.089 but since its an Interger, It becomes 111, so 1900 + 111 Final Value 2011 |
dateadd(d,(convert(int,JlnDate) % 1000)-1,convert(datetime,(convert(varchar,‘2011’ + ‘/1/1’))) as GrgDate | This Part takes 2011 as a String and Adds /1/1 making it a valid SQL Date String (2011/1/1) ie Jan 1, 2011 |
dateadd(d,(convert(int,JlnDate) % 1000)-1,convert(datetime,’2011/1/1′)) as GrgDate | This Part turns the Date String to an Actualy Date Time (‘2011/1/1 00:00:00’) |
dateadd(d,(convert(int,JlnDate) % 1000)-1,‘2011/1/1 00:00:00’) as GrgDate | This part takes the Julian Date Column which is 111089 and does something called MOD or “remainder” (that’s what the % stands for) so it will return 111089 % 1000 = 89 |
dateadd(d,(89)-1,’2011/1/1 00:00:00′) as GrgDate | Now Finally, the DateAdd function will Add (89-1) days (d) to ‘2011/1/1’
The reason for the Minus (-) one is because you cant have a date of zero (0) so the 89th day of the year is actually 88 days after Jan 1st |
3/31/2011 | And Finally we come up with March 31st, 2011 |
Thats it. Now you not only have working SQL code to convert Julian Date, but you also know exactly how it works.