Note: This guide applies to the Xbox Dashboard version 2.0.13599.0 (System Settings -> Console Settings -> System Info)
First, decide which IP you want to statically assign to your xbox. This should be a number outside of the range that your router will automatically issue DHCP addresses.
Next, in your Xbox UI, navigate to: My Xbox -> System Settings -> Network Settings -> (Either Wired or Wireless, depending on how your xbox is connected) -> Configure Network -> Basic Settings
Finally, you can configure your router to port forward the xbox live traffic to your statically IP'd xbox console. The ports to map are as follows:
Troubleshooting
When I initially configured my static IP for the xbox, I didn't specify a DNS server, since I had just assumed the router or the xbox itself would figure that out. However, after restarting the xbox, I noticed that it would no longer automatically sign in to xbox live. After some googling, I found mention of someone else running into a similar problem, and for them manually specifying a DNS server solved their problem. Once I manually specified a DNS server, my xbox has automatically logged into xbox live every time.
As seen from this stack overflow question all versions of IE appear to have a "bug" that will not persist or retrieve cookies when set on a specific path that does not include a trailing slash. For example, if using the jquery cookie plugin:
$.cookie("CookieId", "StoredCookieValue", { path: "/MyController/" });
However, by default, ASP.NET MVC doesn't add the trailing slash, so if I'm requesting the Index action of my controller, (e.g. http://somedomain.com/MyController) I don't get the trailing slash, and IE won't retrieve the cookies stored at "/MyController/".
To work around this issue, I found another stack over flow question that provides functionality to automatically add trailing slashes to the virtual route paths created by MVC. As seen in the question, one can map routes with the trailing slash for a specific controller:
routes.MapRouteTrailingSlash("MyControllerRoute", "MyController/{action}/{id}", new { controller = "MyController", action = "Index", id = "" });
or change the default MapRoute to MapRouteTrailingSlash:
routes.MapRouteTrailingSlash(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Title", action = "Index", id = "" } // Parameter defaults
);
If your user name is a member of the securityadmin SQL server role, you have access to run a magic undocumented stored procedure: xp_readerrorlog. This proc reads the log file from the SQL server and outputs the results in a table within MS Management studio. This allows for scripting access to the file, without needing direct access to the server's file system, or having to open the log tree in SQL Server Management Studio and wait for the UI.
Once we have the output of this proc, we can insert the contents into a table variable, then sort / filter the contents any way we like. We can also take this one step further and put this script into a console C# application and run it on a schedule to search for specific error strings if we like. (in my case, I'm scanning for deadlocks)
Below is a SQL script that I run daily to view the log file from within a SQL Server management studio window
declare @temp table (LogDate DATETIME, ProcessInfo VARCHAR(50), MessageText VARCHAR(MAX))
--exec sp_enumerrorlogs
insert into @Temp
exec xp_readerrorlog
select *
from (
select top 100 * from @Temp
order by LogDate desc
) t
order by LogDate
Line 1 of this script simply creates a table variable to hold the log fields stored in the SQL log file.
Lines 5 and 6 run the proc and output the entire file into the @Temp table variable
Line 7-12 essentially runs the "tail" (from unix) command on the file. Since the output from the proc is in chronological order, I run the inner query to order the entries in reverse date order to find the 100 most recent entries, then the main query orders the log entries chronologically
If you have a pattern or a specific error you need to search to search on, one can easily add a where clause and filter on any of the fields as desired
While getting to know I mac, I ran into an issue with moving the text editing caret in Terminal. It turns out, that by default the Ctrl+Left Arrow, Ctrl+Right Arrow, Home and End keys do NOT by default move the caret by one word or to the beginning or end of line respectively. I did, however, find some helpful links on what the default mappings are.
What wasn't immediately obvious to me at the time, was that in the preferences for Terminal, I could change the "Action" drop down to "send to shell" and type in the key combination as indicated in the links above that map to the action desired. For example, one would type in "Esc-b" into the Control Cursor Left key combination to map the Esc-b key combination to control cursor left, which in effect generates the same behavior I'm used to with putty and linux terminal apps.
Tech Specs
Model: MC373LL/A
CPU: Core i7 2.66 GHZ
RAM: 4 GB (max 8GB)
Hard Drive: 500 GB SATA 5400 RPM
Video: NVIDIA GeForce GT 330M with 512MB memory
Screen: 15" Hi-res (1680x1050) screen with the anti-glare (Matte) finish.
The cost before tax (which Apple does charge) was $2,349.00.
After I bought $130 for 8 GB of Ram (2 x 4GB SO-DIMMS) my total cost was $2,479. (if you don't include the time it took me to install the RAM)
Hopefully this blog post will serve as a nice "look-back" post to see how far we will have come in 5 years when this brand new laptop right now will be antiquated and "quaint". For now though, I've got a lot to learn about Mac to start to be as productive on Mac as I was on Windows.
Why Mac? Certainly not due to all of their marketing materials, which are ridiculous. Here are some of my reasons for choosing a Macbook Pro:
Update: 2/27/2011
Based on the comment added below, I realized that one can simply use the "Repository Explorer" option to view this same information. If you don't see this menu option when you right click a file, you can move it to your top-level context menu via the "Explorer Extension Settings." You can see this option if you right click in an empty area of the explorer window, and navigating to TortoiseHg -> Explorer Extension Settings. Then Adding "Repository Explorer" to your "Top menu items".
Using the "Open With Notepad" context menu registry change from the How to Geek, I added an "HGtk Log" command that is useful for displaying the log information of a file in your Mercurial repository.
Step 1, locate your TortoiseHG install directory, for me it is: "C:\Program Files (x86)\TortoiseHG\"
Step 2, Add a couple keys to your registry, from the How To Geek article, Navigate in the Registry to:
HKEY_CLASSES_ROOT\*\shell
Right-click on “shell” and choose to create a new key, calling it “whatever”. Create a new key below that one called “command”. Double-click on the (Default) value in the right-hand pane and enter in the following:
C:\Program Files (x86)\TortoiseHG\hgtk.exe log --nofork "%1"
EDIT: Adding the "--nofork" option to the hgtk.exe call. For some reason the hgtk program would not load files that had spaces in the path name if I didn't use the --nofork option.
I replaced "whatever" with "HG Log".
When complete, your registry should look like this:
And your Context menu should have a new entry like this:

And clicking on that will open the hgtk.exe Log window:
If you need to toggle between using Tabs or spaces in your Visual Studio projects and files, you can use this simple Macro from within VS to toggle between tabs vs. no tabs:
1. Open the Macro Editor via Tools -> Macros -> Macros IDE (Alt+F11)
2. Paste in the following VBA code:
Public Sub ToggleTabs()
Dim currentSetting As Boolean = DTE.Properties("TextEditor", "CSharp").Item("InsertTabs").Value
DTE.Properties("TextEditor", "CSharp").Item("InsertTabs").Value = Not currentSetting
End Sub
3. Open the Macro Editor via Tools -> Macros -> Macro Explorer (Alt+F8)
4. Run the "ToggleTabs" macro
For more information on other settings that can be utilized via macros, see the MSDN page
Or, see how one can use Settings files to achieve the same goal, but I think the Macro is a little easier / faster to switch between them.
EDIT:
Here is a more complete script that I use that will toggle the tabs of C#, SQL, HTML, and javascript, but only when you are editing a file of that language's:
Public Sub ToggleTabs()
If DTE.ActiveDocument.Language = "CSharp" Then
Dim currentSetting As Boolean = DTE.Properties("TextEditor", "CSharp").Item("InsertTabs").Value
DTE.Properties("TextEditor", "CSharp").Item("InsertTabs").Value = Not currentSetting
End If
If DTE.ActiveDocument.Language = "SQL" Then
Dim currentSQLSetting As Boolean = DTE.Properties("TextEditor", "SQL").Item("InsertTabs").Value
DTE.Properties("TextEditor", "SQL").Item("InsertTabs").Value = Not currentSQLSetting
End If
If DTE.ActiveDocument.Language = "HTML" Then
Dim currentHTMLSetting As Boolean = DTE.Properties("TextEditor", "HTML").Item("InsertTabs").Value
DTE.Properties("TextEditor", "HTML").Item("InsertTabs").Value = Not currentHTMLSetting
End If
If DTE.ActiveDocument.Language = "JScript" Then
Dim currentJScriptSetting As Boolean = DTE.Properties("TextEditor", "JScript").Item("InsertTabs").Value
DTE.Properties("TextEditor", "JScript").Item("InsertTabs").Value = Not currentJScriptSetting
End If
End Sub
I ran across an interesting “feature” of Windows today. Several other people have noticed this same behavior in Windows. This has apparently existed since Windows XP SP 1, and was changed after Windows 2000. Specifically, I ran into this issue when trying to find a file in a folder in which the file names were incremented hex named files. For example, you can download my example files or just create your own empty text files named similarly to the below, to reproduce this effect.
How I expected the files to be sorted, is in ASCII order, as it is when viewed via the “dir” command, or in the “ls” in Linux:
yanigisawa@chompers:~/Dropbox/test$ ls -l total 0 -rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:49 00100.txt -rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:48 0010A.txt -rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:48 001A0.txt -rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:48 00A10.txt -rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:47 0101A.txt -rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:47 0A100.txt -rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:49 0A101.txt -rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 22:10 A001.txt -rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 22:09 A010.txt -rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 22:10 A100.txt -rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:47 A101.txt
OR in the Linux PCmanFM file manager that is default in the CrunchBang Linux:
However, in Windows, the files are ordered in a numerical order, when a number is contained within the file name:
Though I don’t own a Mac, I had a friend test this there as well, and Mac OS 10 (I believe) also sorted these files the way that Windows did, that is, in numerical order, rather than ASCII order.
So, my choices are either:
1. When the file names contain numbers, expect the files to be sorted in numerical order, rather than ASCII order
2. OR, apply the registry fix mentioned in the knowledge base article I linked to earlier.
At this point, I decided to live with it, since I now at least understand why these files are sorted this way, even though I don’t really agree with it.
Disclaimer: If I may steal a quote from Alan Stevens that he mentioned during his Indianapolis NDA meeting this past Thursday, I’m an enthusiast, not an expert. I’m writing this post merely to try and organize all of these thoughts and especially all of the relevant Linux commands into one post for later reference.
There are two main kinds of hard drive RAID, (Redundant Array of Independent Discs) hardware RAID and software RAID. A hardware RAID assumes that there is a RAID controller card that one plugs all of the discs into and with some configuration the controller cards does all of the heavy lifting with maintaining the RAID. This usually implies that the discs plugged into it are the same brand, and same size. I don’t have any experience with hardware RAID devices, so more modern RAID cards may be more sophisticated and can handle these variables better.
This post will focus on creating a software RAID using Linux, Ubuntu server edition in my case, and some configuration of JBOD. (just a bunch of discs) Since there is no dependency on how these drives are connected, they can be all inside your case, external USB devices, or in my case, in an external eSATA enclosure.
Another important distinction I should make very quickly regarding RAID configurations is that some are for speed of read/write access, and others are merely for reundant data storage. This post will focus on the latter configuration, and will create a mirror RAID with two large hard drives.
After you have attached your drives, a good place to start is by viewing all discs using:
fdisk -l Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x8d8eaf83 Device Boot Start End Blocks Id System /dev/sda1 * 1 4863 39062016 83 Linux /dev/sda2 4864 14946 80991697+ 5 Extended /dev/sda5 14713 14946 1879573+ 82 Linux swap / Solaris /dev/sda6 4864 14712 79112029+ 83 Linux Partition table entries are not in disk order Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes 255 heads, 63 sectors/track, 182401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x2148bf56 Device Boot Start End Blocks Id System /dev/sdb1 1 182401 1465136001 83 Linux Disk /dev/sdc: 2000.3 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x49522ce0 Device Boot Start End Blocks Id System /dev/sdc1 1 243201 1953512001 83 Linux
In my case, I have one main drive (/dev/sda) where the OS is installed, is partitioned into several different chunks, and two large drives for redundant data storage. (/dev/sdb and /dev/sdc) You'll notice here that /dev/sdb is only a 1.5TB drive, and /dev/sdc is a 2TB drive. I was curious if this was going to be an issue when creating the RAID, and the only thing I've run into so far is a warning message that the size difference between the two partitions I'm interested in creating a mirror RAID between is greater than 1% size difference. After accepting this error message, the system proceeded to create a 1.5TB mirror RAID, since that is the smallest single partition size that can be mirrored.
A step that I skipped was to use the fdisk partitioning tool to create a partition on each disc you are using. The fdisk utility is fairly straight forward, and has a help menu ('m') that shows the basic commands, and each command walks you through creating partitions. In my current setup, my partitions are of different sizes. To optimize your disc utilization, you can create partition on each drive of the same size and add the same sized partitions to the RAID.
Next, make sure you have the mdadm tool installed:
# apt-cache search mdadm mdadm - tool to administer Linux MD arrays (software RAID) # apt-get install mdadm
Once installed, you can use the following command to create a mirror raid configuration:
# mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/sdb1 /dev/sdc1
If you receive an error, such as:
"mdadm: RUN_ARRAY failed: Invalid argument"
make sure your kernel supports (either via a module or by being directly compiled in) the raid mode you are trying to utilize.
To add RAID device md0 to /etc/mdadm/mdadm.conf so that it is recognized the next time you boot.
#mdadm -Es | grep md0 >>/etc/mdadm.conf
View the status of a multi disc array.
# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90
Creation Time : Thu Jul 8 01:54:50 2010
Raid Level : raid1
Array Size : 1465135936 (1397.26 GiB 1500.30 GB)
Used Dev Size : 1465135936 (1397.26 GiB 1500.30 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Thu Jul 8 01:57:03 2010
State : active, resyncing
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Rebuild Status : 97% complete
UUID : 03edd7d5:39473b96:8e924374:3018c162 (local to host svnbot)
Events : 0.3
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 33 1 active sync /dev/sdc1
OR
# mdadm -D /dev/md0
View the status of all multi disc arrays.
# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdc1[1] sdb1[0]
1465135936 blocks [2/2] [UU]
[===================>.] resync = 97.2% (1425329920/1465135936) finish=67.6min speed=9808K/sec
unused devices:
When you are initially building the raid (i.e. immediately after running the --create option above) it is nice to be able to watch the status of the mdstat file above. You can do so using the following command:
# watch cat /proc/mdstat
Something interesting to note: since my drives were a minimum of 1.5TB in size, and were connected externally via some very round-about (read: hacked together) means, my drive connection speed was limited to 9MB / sec. At this speed, it took about 42 hours to completely build the RAID array. Just something to consider when building your own.
If you have internally connected devices, and you're experiencing slow RAID build speeds, take a look at the following commands. The first will view the upper and lower bounds of the RAID speed build limits
cat /proc/sys/dev/raid/speed_limit_max 200000 cat /proc/sys/dev/raid/speed_limit_min 1000
In the system logs you can see something similar to:
md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc. md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for reconstruction.
This means that the minimum guaranteed speed of the rebuild of the array is approx 1MB/s. The actual speed will be higher and will depend on the system load and what other processes are running at that time.
In case you want to increase this minimum speed you need to enter a higher value in speed_limit_min. For example to set this to approx 50 megabytes per second as minimum use:
echo 50000 >/proc/sys/dev/raid/speed_limit_min
The results are instant… you can return to the watch window to see it running, and hope that this will finish a little faster (this will really depend on the system you are running, the HDDs, controllers, etc.)
Now that we have a device, we can format the device as if it were a standard hard drive partition:
# mkfs.ext3 /dev/md0
Then we can mount the md device like any other partition
# mount -t ext3 /dev/md0 /mnt/raid/location/you/choose
The relevant /etc/fstab entry would look like the following: (simply append this to the end of the file)
/dev/md0 /mnt/raid/location/you/choose ext3 relatime 0 2
Now you can reference your mounted location like anyother location in the file system
# ls /mnt/raid/location/you/choose
To setup an alert when a drive fails, or a system alert is fired, use the following:
# mdadm --monitor -f /dev/md0 -m myname@myisp.com
The --monitor mode will keep track and monitor the device specified. The -f option tells mdadm to "fork" or to run as a daemon in the background. Otherwise the program will run until halted. (i.e. Ctrl+c is pressed)
You can test that messages get sent successfully using: -t
# mdadm --monitor -1 /dev/md0 -m myname@myisp.com -t
The "-1" means run once.
Alternatively, if you'd rather run this process as a cron job periodically rather than as a damon, add it to your crontab: (this will perform a scan of all md devices every 20 minutes)
0,20,40 * * * * mdadm --monitor -1 -m yourname@yourisp.com -scan
A couple more useful switches are to manually "fail" a device (--fail /dev/sdb1), and to add a new device if you have a hard drive failure and need to replace the drive:
# mdadm /dev/md0 --fail /dev/sdb1 #mdadm /dev/md0 --add /dev/sde1
Note: adding new devices will cause the array to be rebuilt, (monitor progress once again with 'cat /proc/mdstat') so in my case, this would be another 42 hours of building out the array. Drive sizes and RAID configurations will cause this time to vary greatly I'm sure.
Hope this Helps!
My favorite input device by far is the keyboard. In most cases, with several exceptions, it is far faster to get things done than by using the mouse, and I am forever searching for a keyboard shortcut to do just about every single task I do on the computer.
A few months ago, I made the jump from Windows XP to Windows 7 on my work machine. One of the biggest differences between these two operating systems is the lack of a Quick Launch bar. At work we have a lot of custom tools that we’ve written to help us automatically change user permissions (custom permissions for our application), manage our Windows Workflow Foundation (WWF) rule sets, plus I keep shortcuts for our current production build version plus the current development version of our WinForms application. In Windows XP, I created multiple shortcuts in the Quick Launch bar that pointed to each build of these separate tools. Windows 7 by default does not display the Quick Launch bar, so I had the following options:
1. Create Shortcuts on the Taskbar directly – This would have really cluttered up my task bar, and I would have had to find different icons for each, since I had my quick launch bar sized such that my core applications were shown, and all my custom apps I had to expand the menu and I had the name of the shortcut next to the icon.
2. Create Shortcuts on the Desktop – Again, this creates a lot of clutter, and to make it usable, I’d need to come up with different icons for each app.
3. Enable the Quick Launch bar in Windows 7 – This seems like punting, and not even trying to find a Windows 7 way of doing things
4. Create Shortcuts, but place them in a folder such that typing in the Start Menu search box would find them and launch them. – Bingo, we have a winner!
Since all of one’s installed applications can be searched on via the start menu, all we have to do is find the current location of one of the shortcuts for our installed applications, and place our custom shortcuts in the same parent directory. Do find the current Start Menu’s shortcut locations, I right clicked on one, selected properties, and looked at the physical location of the shortcut itself, not Target application:
Once I knew this, all I had to do was to create shortcuts to my custom applications (I use Right-Click –> Send To –> Desktop (Create Shortcut)) then copy the shortcut into a directory under:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\
I create a directory called "ShortCuts" or "ManualTools" from this location, then the name of the short cut becomes what I can type into the Start Menu to launch that application.
Note, I’ve never used Windows Vista for any length of time, so I’m not sure if this same directory will work, but I know the Start Menu search feature started with Vista, so it stands to reason that it would exist there as well. Enjoy!