Categories
Blog Blogger.com Google Linux Twitter Windows

Twitter Guide: How To Do Interesting Things With Twitter

Twitter Guide: Learn some interesting tips and tricks for Twitter.

Q: I am a blogger and want to cross-post articles from my blog into Twitter?
A: Go to FeedBlitz, type the address of the feed in the Subscribe box and choose Twitter from the subscription options. The other option is Twitter Feed but that requires you to have an OpenID.

Q: I know that TwitPic allows me to post pictures on Twitter but I want to use my existing Flick account with Twitter.
A: Go to TwitterGram and associate your Flickr name with your Twitter account. Now assign a special tag (say Twitter) and any picture that you post on Flickr with that Tag will automatically get posted in your Twitter account as well.

Q: I just ordered a laptop on eBay and the owner shipped it via UPS. I want to track this package on Twitter.
A: Follow TrackThis on Twitter and send this bot a Direct Message with your Airway Bill Number. You’ll be notified each time your package changes location. Works with FedEx, UPS, DHL and USPS.

Q. I want to add events in my Google Calendar using Twitter?
A: Go to Twittercal, add gCal as your virtual friend on Twitter and add events by simply sending direct messages to your new Twitter friend.

Q: I am a blogger. How can I add “tweet this” links to all my blog post?
A: See detailed instructions on how to add ‘Tweet This’ to Blogger or WordPress blogs. The permalinks are shortened automatically in the tweet.

Q: Oh! I just saw a spam profile on Twitter that is using my picture and tweets. I want to report impersonation on Twitter.
A: Send a message to Twitter spam watch team at @spam with the suspicious user name.

Q: My Twitter friend just sent me a tweet in French. I want to translate his message into English.
A: Follow twanslate and send a direct message with the text you want to get translated along with the language code of the target language (en for English, fr from French, etc.).

Q: I want to use Twitter as a Gmail Notifier.
A: Create a new Twitter account and set the status of updates as “Protected” so that the updates don’t appear in a public timeline. Now subscribe to your Gmail RSS feed using FeedBlitz and become mutual friends.

Q: I want to use Twitter as an alarm clock to remind me that I have to pick my daughter from school in 30 minutes.
A: Follow timer – send a direct message with the reminder time and it will ping you at that time. For instance “d timer 30 pick daughter”.

Q: I want to use Twitter for ego surfing.
A: Go to tweetbeep and set up alerts for certain keywords and web URLs. You’ll get an email notification as soon as someone mentions you or your brand or your blog posts in their tweets.

Q: While I like the default Twitter search engine, I want to know about other alternatives.
A: Try Tweet Scan and Monitter. Unlike Summize, you don’t have to refresh the Monitter page each time there’s a new result matching your search query. And it support multi-column search so may track multiple keywords on the same screen.

Q: I want to conduct a quick and simple poll on Twitter. Is it possible?
A: Go to StrawPoll and create a poll. Your Twitter contacts can participate in the poll by simply sending an @reply message.

Categories
Blog Linux Remote Desktop Windows Windows Vista

Terminal Services slow from Vista client

Remote Desktop 6.0 leverages a new feature called auto-tuning for the TCP/IP receive window that could be causing the trouble. What is auto-tuning for the TCP/IP receive window? Well, the new Microsoft TCP/IP stack supports Receive Window Auto-Tuning. Receive Window Auto-Tuning continually determines the optimal receive window size by measuring the bandwidth-delay product and the application retrieve rate, and adjusts the maximum receive window size based on changing network conditions.

In Vista, Receive Window Auto-Tuning enables TCP window scaling by default, allowing up to a 16 MB window size. As the data flows over the connection, the TCP/IP stack monitors the connection, measures the current bandwidth-delay product for the connection and the application receive rate, and adjusts the receive window size to optimize throughput. The new TCP/IP stack no longer uses the TCPWindowSize registry values which many third-party utilities used to “tweak”.

Receive Window Auto-Tuning has a number of benefits. It automatically determines the optimal receive window size on a per-connection basis. In Windows XP, the TCPWindowSize registry value applies to all connections. Applications no longer need to specify TCP window sizes through Windows Sockets options. And IT administrators no longer need to manually configure a TCP receive window size for specific computers.

Here is what you need to do if you have the same issue:

– Run a command prompt (cmd.exe) as an Administrator
– Type: netsh interface tcp set global autotuninglevel=disabled

If you want to to re-enable it:
– Type: netsh interface tcp set global autotuninglevel=normal

In some cases you may need to use this command in addition to the above, but I didn’t have to:
– Type: netsh interface tcp set global rss=disabled

Original article:http://blog.tmcnet.com/blog/tom-keating/microsoft/remote-desktop-slow-problem-solved.asp

Categories
Blog Linux VPN Windows Windows 2003

TCP Optimization for Windows

I have recently been creating nasty batch files to alter default and non-existing networking settings to improve performance on file transfers for replication and came across this awesome tool that is free and does a great job.

We set our MTU to 1350 to take in to account firewall overhead in the vpn mesh. TCP Optimizer is the only tool you need, no installation necessary you just get the .exe to run and it can show you all the settings it is going to change. Highly recommended.

Find your optimum MTU by trying different non-fragmentable pings with specific sizes e.g. ping -f -l 1322 may work where ping -f -l -1323 may not. The highest value you get without an error is what you can use. Don’t rely on Wireshark results as it can’t tell if your firewall breaks up the packet into small chunks or not when looking at your server’s packet trace.

There is a related hotfix for local file copy issues: http://support.microsoft.com/default.aspx?scid=kb;EN-US;920739 for large file (500MB) and greater. This problem occurs when you copy large files locally from a fast disk to a slow disk. For example, this problem can occur when you copy large files from a cluster disk to local system disk.

PSSQL team blog has a nice performance implication of the scalable networking pack that shows it can hinder SQL server performance. http://blogs.msdn.com/psssql/archive/2008/10/01/windows-scalable-networking-pack-possible-performance-and-concurrency-impacts-to-sql-server-workloads.aspx
They mention you will need to disable SNP also which in in this Windows Server 2003 patch http://support.microsoft.com/default.aspx?scid=kb;EN-US;948496 or you can disable EnableTCPChimney, EnableRSS and EnableTCPA.

I found a good article on disabling TCP offloading at a NIC card manufacturer: http://www.alacritech.com/Support/FAQs/DisableOffload.aspx Test to see if helps for large file transfers and you need Windows 2003 SP2 or higher OS. Reboot is not required for this change.  I have attached a vb script that will update the interfaces window size and MTU (1350).  Just for your reference, you could manually find correct NIC interface use this command line to get value from command line:

reg query HKLMSYSTEMCurrentControlSetServicesTcpipParametersInterfaces /f AddressType /s

It creates:

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParametersInterfaces{Some Random GUID Value Here to Identify your NIC}]"MTU"=dword:00000546

My .reg file I use (Descriptions of options are found in this KB: http://support.microsoft.com/kb/314053):

Windows Registry Editor Version 5.00
REM Run this from command line: netsh int ip set chimney disabled
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters]"Tcp1323Opts"=dword:00000001"GlobalMaxTcpWindowSize"=dword:3fffffff"TcpWindowSize"=dword:0000ffff"EnablePMTUDiscovery"=dword:00000001
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesLanmanServerParameters]"SizReqBuf"=dword:0000ffff
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesNetbtParameters]"NodeType"=dword:8
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesNetbtParameters]"UseDnsOnlyForNameResolutions"=dword:1

Download: Interfaces.vbs.txt (1.29 KB)

Categories
Blog Linux Passwords SSH Windows Windows 2003

Cygwin SSHd on a Windows 2003 AMI Within Amazon EC2

Recently, I needed to configure a Windows 2003 AMI in EC2 to run a ssh server. I would have expected this to be a simple job, with a variety of choices for making this work, but in the end it was far more time consuming, complicated, and frustrating than I would have guessed. Here is a quick road map of what I did.

My initial thought was that there must be a free, native port of openssh for Windows that installs as a service and otherwise conforms to the Windows environment…wrong! I can’t tell you why this is the case — maybe ssh is just not a microsofty way of doing remote terminals and file transfers — but I couldn’t find anything resembling a free, functional port of openssh for Windows. I found a few blog posts that mentioned that people had tried this, but ultimately they gave up when faced with the integration between openssh’s user/group namespace functions and Windows’ user/group concepts (to say nothing of the differences between the Windows command prompt and the UNIX shells). And these blog posts ultimately suggested that it was easier to run sshd via cygwin than it would be to port sshd to run natively. So….cygwin time!

UNIX is my OS of choice, and I’ve had cygwin on every Windows box I have ever had, so it was a quick jump to download the cygwin installer and install the packages I needed on a freshly started Windows 2003 instance in EC2 (incidentally, I am running the 64-bit, large EC2 instance AMI of Windows 2003 Server with SQL Server Express and no Authentication Services). The openssh package comes with a simple script — ssh-host-config — to generate the server host keys and create the users needed for privilege separation, so it was a nice, simple, relatively painless install. There are a few things that the config script misses, however, which requires you to run it several times before it ultimately succeeds (although it is nice enough to point out the problem each time and prompt you to fix it). After playing with it, I came up with the following actions to perform before running ssh-host-config in order to make it succeed the first time without errors:

0) Add the following line to /cygwin.bat:
set CYGWIN=binmode tty ntsec


1) Run a new cygwin bash shell (after the edit of cygwin.bat) and enter:
mount -s --change-cygdrive-prefix /
chmod +r /etc/passwd /etc/group
chmod 755 /var



2) Run a new cygwin bash shell (to pick up the cygdrive prefix change) and enter:
ssh-host-config
-- yes for privilege separation
-- "binmode tty ntsec" for CYGWIN environment variable setting for the service
-- enter your password of choice for the cyg_server account



3) Enter the following to start sshd:
net start sshd


4) Open the Windows Firewall editor, and add an exception for TCP traffic on port 22 for sshd.

5) If you haven’t already done so, open up port 22 for your EC2 instance group (assuming you are running your instance in the default group):
ec2-authorize -p 22 default


If everything went well, sshd is running and available on port 22, and you can login normally via ssh from other machines. All that is left to do is bundle up a new AMI to capture the cygwin installation…and that should be a piece of cake, right? The updated EC2 API has a new method — ec2-bundle-instance — that kicks off an AMI bundling job for an EC2 instance running Windows, so it should be as simple as calling this method and then grabbing a beer to wait for it to complete. If only it were that simple…

Unlike the AMI bundling scripts for Linux-based EC2 instances, which are ultimately just packaging up the existing file system, the Windows AMI bundling mechanism needs to perform several Windows-specific functions that are ultimately a real pain in the neck. First and foremost is sysprep. Sysprep is Microsoft’s answer to the problem of Windows virtualization; apparently the simple cloning of a Windows installation is not acceptable, and a new Windows SID should be generated for each new instantiation of a Windows virtual image. Sysprep does some other things, too (search for sysprep on Microsoft’s support web site for a more complete description — I am certainly not an expert on it), but ultimately the SID generation is the one that causes problems for a lot of installed software…like cygwin. After bundling a new AMI and starting a new instance with it, I found that sshd is hosed for no apparent reason. Attempts to start sshd via “net start sshd” produce the following cryptic error message:

The CYGWIN sshd service is starting.
The CYGWIN sshd service could not be started.
The service did not report an error.More help is available by typing NET HELPMSG 3534.



WTF?
After several time-consuming iterations of start new instance -> install cygwin -> bundle new AMI -> start new AMI instance -> wonder why sshd is hosed, I found something in the HKEY_USERS tree of the Windows registry that changes after the bundling step. Prior to bundling, with a functioning cygwin/sshd, I see the following in the registry:

[HKEY_USERSS-1-5-21-2574196159-1727499900-3384088469-1013SoftwareCygnus Solutions]
[HKEY_USERSS-1-5-21-2574196159-1727499900-3384088469-1013SoftwareCygnus SolutionsCygwin]
[HKEY_USERSS-1-5-21-2574196159-1727499900-3384088469-1013SoftwareCygnus SolutionsCygwinmounts v2]
[HKEY_USERSS-1-5-21-2574196159-1727499900-3384088469-1013SoftwareCygnus SolutionsCygwinProgram Options]
[HKEY_USERSS-1-5-21-2574196159-1727499900-3384088469-500SoftwareCygnus Solutions]
[HKEY_USERSS-1-5-21-2574196159-1727499900-3384088469-500SoftwareCygnus SolutionsCygwin]
[HKEY_USERSS-1-5-21-2574196159-1727499900-3384088469-500SoftwareCygnus SolutionsCygwinmounts v2]
[HKEY_USERSS-1-5-21-2574196159-1727499900-3384088469-500SoftwareCygnus SolutionsCygwinProgram Options]

After bundling, in a new instance in which sshd is hosed, I see the following in the registry:

[HKEY_USERSS-1-5-21-4261372910-2505678249-1238160980-500SoftwareCygnus Solutions][HKEY_USERSS-1-5-21-4261372910-2505678249-1238160980-500SoftwareCygnus SolutionsCygwin]
[HKEY_USERSS-1-5-21-4261372910-2505678249-1238160980-500SoftwareCygnus SolutionsCygwinmounts v2]
[HKEY_USERSS-1-5-21-4261372910-2505678249-1238160980-500SoftwareCygnus SolutionsCygwinProgram Options]

All of the other registry entries related to cygwin remain the same before and after the bundling step, so my guess is that the loss of entries in the bundled instance is the source of the trouble. But what exactly are those entries?

Again, I’m no windows expert, but the entries in question appear to have the windows SID followed by a user identifier (e.g. in S-1-5-21-4261372910-2505678249-1238160980-500, S-1-5-21-4261372910-2505678249-1238160980 is the SID, and 500 is the user id). Looking at the /etc/passwd file for cygwin, the user id 500 corresponds to the Administrator account, and user id 1013 corresponds to the cyg_server account, used by sshd as a privileged account for switching effective user ids during login. So, my hypothesis is that the privileges for the cyg_server account are somehow lost by sysprep during the bundling step, and sshd is hosed without them in the new bundled AMI instance.To test my hypothesis, I decided to configure the AMI bundling step to skip sysprep. The base Windows EC2 AMIs come with an application in the start menu called “ec2Service Setting” that has a check box to enable/disable sysprep during AMI bundling, so it is easy enough to test this. However, I have no idea what happens to Windows if I disable sysprep during bundling, and I was not able to find a satisfactory answer via internet searches. The closest I got to an answer was to see several of the Amazon admins on the EC2 forum comment that it was not a good idea to disable sysprep if you were going to instantate multiple instances. I also found several documents online that discussed how sysprep was used to sanitize a Windows installation, generate a new SID, and make it generic for installation on any type of hardware. Since the virtual hardware of EC2 is, roughly speaking, identical (given that it is using Xen underneath the hood), I’m not too worried about the hardware issue. I have no idea about “sanitizing” the Windows instance or SID generation, though, so bundling without sysprep might mortally wound Windows (again…I’m no Windows expert). And I do want to run multiple instances from the bundled AMI, so that might be a non-starter as well. So I guess I will try the ready-shoot-aim approach of seeing what happens when I turn it off…

Compressing time, I started with a fresh Windows instance, installed cygwin and configured sshd like before, turned off sysprep and bundled it, started a new instance from the new bundled AMI, and…sshd still works. The new instance retains the SID that it had prior to bundling, and the registry entries are still there for the cyg_server account. Windows also appears to be working in all respects, but I’m not sure I could detect problems that might result internally from the omission of sysprep in the bundling. I guess I can run one more test, starting a bunch of instances at once, to see if having the same SID causes them to interfere with one another. I started four instances, running concurrently, and they each seem to be working fine. Or at least I can’t detect any problems.

So, in closing, it looks like I may have a solution: turn off sysprep if you want to use cygwin sshd in a bundled Windows AMI. Someone with more Microsoft kung-fu might be able to figure out how to make sysprep retain the registry entries for the cyg_server account, or maybe they would write a script to insert them directly into the registry at restart if they are missing…who knows. But for me, disabling sysprep seems to be the way to go. I found lots of other complaints on the internet about sysprep and what it does to installed software when the SID changes, so I’m guessing that there will be a lot of bundled AMIs in EC2 that are created with sysprep disabled. If there are, in fact, issues with multiple instances using the same SID, then I expect we will be reading about it in the EC2 forums, since everyone who creates a new AMI from the base Windows AMIs without sysprep will have the same base SID in their AMIs, and so on….