Blogging this as a “memory” note for myself
I was putting together a report for work and needed one of the pages in the word document to be in landscape mode, instead of the regular portrait mode. I thought it was a simple thing of adding a page break and applying the “landscape” layout in the page setup. But ended up either having all pages in landscape mode or in portrait mode. A bit of googling finally helped out . Looks like the trick is to use section breaks instead of page breaks.
Here are the steps to do it in Microsoft Word 2010
- Add the content you want into word. In this example, I created two paragraphs, test landscape and test portrait
- At the place you want to split the page format, insert a section break, by going to Page Layout –> Breaks –> Section Breaks –> Next Page
- Now change the page orientation by going to Page Layout -> Orientation –> Landscape. This will only change the orientation for the current section.
- And voila you document now has two different page orientations
I attended a session organized by aditi regarding Microsoft Azure and Windows 8, called “Go Cloud 8″ today. One of the speakers in the event was Deepak Rao, Microsoft’ Director of Cloud Computing. He shared some interesting numbers about the infrastructure running Microsoft Azure
- 8 carrier grade data centers around the world. “Carrier” grade because of the sheer size of them.
- The data center in Chicago houses more than 350,000 servers and is supported by only 30 FTEs (which makes me think about the number of contractors they have there )
- 1 in 4 x86 servers produced were bought by Microsoft. Not sure if it was in 2011 or 2012!!
Deepak also gave an real world example of how one of their customers used Azure.
BPro Inc provides software to counties and states for helping report election results. They run their backend on the Azure platform. During normal periods, they run ~10 instances of compute nodes. But during the election day (11/6) this week, BPro spun up 8600 compute nodes in less than 15 minutes at 4:00 PM EST, to help support the load created by the demand for election results and than again shutdown all of them at around 1:00 AM EST when the demand decreased. Using the “list” pricing of $0.12/hr/compute node, that massive increase in capacity cost them ~$8K!!.
That is pretty impressive and I usually don’t use the work impressive in the same sentence as Microsoft
For my records, syntax for running a simple for loop in command prompt
for %i in (SERVER1 SERVER2) do nslookup %i
- Looks like the variable can only be single characters. i.e you cannot name the variable %server
- For using the same syntax in a batch file, you have to add another % to the variable. i.e. %i becomes %%i
Wildcard SSL certificates allow you to use one certificate for all sub domains (up to one level) of a host. Say I got a wildcard SSL certificate for *.kudithipudi.org, I would be able to use it to provide SSL on blah.kudithipudi.org, ssltest.kudithipudi.org, youcannotbeserious.kudithipudi.org and the clients won’t complaint about it.
For some reason though, Windows Mobile phones don’t like wildcard certs. So if you are ever scratching your head, why every other client works, but windows mobile devices don’t..stop scratching and get a regular SSL certificate for your website/application.
Apparently, this is the case with
- Windows CE
- Windows Mobile 5.0
- Windows Mobile 6.0
- Windows Mobile 7.0
Don’t you get the feeling that someone keeps using the same library and never bothered to check/fix it? And searching on MSDN or any other Microsoft resource won’t provide you this information. This is my own deduction after beating my head against the wall for more than 3 days .
netcat is a swiss army tool for network/security professionals. You can use it to listen on certain ports or connect to certain ports. For example, say, you configured your firewall to allow TCP 80 traffic to your web server. But your web server is not built yet and you want to validate the rule. You can run netcat on your workstation to listen on port 80, assign the IP address of the web server to your workstation and test the rule.
If I am not mistaken, nc comes as a default tool in most of the Linux distros. You can download the windows port of the tool at http://www.securityfocus.com/tools/139
The command to have netcat listen on a specific port is “nc -l PORT_NUMBER”. If you run this on a Windows 7 machine, you will get this dreaded message “local listen fuxored: INVAL”. The fix is to run it with a -L option. So the command would like this
nc -L -p 80
The -L means “listen harder, re-listen on socket close” .. Have to dig deeper and see what it really means though. I will leave that for another blog post.
And if you want to validate that netcat is indeed listening on that port, you can connect to that port from another workstation by using nmap.
Jhanvi asked me to help with editing a text file recently. She had a file in the format
and needed to convert it into the format below
INSERT INTO BLAH VALUE ('512');
INSERT INTO BLAH VALUE ('345');
INSERT INTO BLAH VALUE ('876');
There are multiple ways, one can do this. Here is how I did this using Notepad++, an open source text editor. I used the regular expression capability of Notepad++ it’s search and replace function.
- Press “Ctrl + h” to bring up the search and replace window.
- Replace the single quote at the beginning of the line by using ” ^’ “
- Replace the single quote at the end of the line by using ” ‘$ “
Screenshots from the operation
The data in it’s original format
Replacing the first quote mark
Data after the first search and replace operation
Replacing the second quote mark
Data in the final format
[UPDATE] Wireshark works without any issues as of version 1.2.3. This release includes WinPcap 4.1.1, which has support for Windows 7 and 2008. Looks like the issue was with the drivers not being signed digitally.
I recently upgraded my laptop to Windows 7 RC from the beta version I was testing earlier. As part of installing my standard set of tools, I tried to install Wireshark (open source network capture tool), and ran into an error due to the UAC security settings. Essentially, Windows was blocking the install of WinPcap (network capture driver). I solved it by enabling compatibility mode on the install executable. Here are the steps to install Wireshark on Windows 7.
- Download the install file from http://www.wireshark.org/download.html
- Right click on the install file (I happened to download the 64 bit install) and click on properties
- In the properties window, click on the compatibility tab and change the option for “Run this program in compatibility mode for” to “Windows Vista (Service Pack 2)” and click on OK. Here’s a screenshot for reference
- Right click on the install and click on “Run as Administrator”
- Make sure you choose the option to install the NPF as a service during the install prompts. This will allow all users on the machine to use Wireshark without admin privileges.
P.S : WinPCap is apparently going to come out with a new version soon that is compatible with Windows 7.
Adding the following options to the [Global] section in the samba (open source software providing windows compatible file sharing for *nix operating systems) will most likely speed your throughput
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_SNDBUF=8192 SO_RCVBUF=8192
The receive and send buffer seem to do the trick.
I ran into a challengeÂ recently, when I tried to connect to my IM services (Yahoo, MSN, AOL, GTalk) using Pidgin in a secured network. For some reason, the network administrator thought that he/she should make life hell for people trying to log into IM. I will have a whole new rant about companies trying to lock down networks thinking they are making the employees productive..
Here’s what I did to connect to my IM services.
- Configure Putty/SSH to act as a SOCKS proxy.
- Most people might not be aware, but a typical SSH client can act as a SOCKS proxy. So I decided to leverage this functionality.
- You will need access to a SSH server and Putty (Opensource Windows SSH client)
- Launch Putty
- Setup a new server connection profile. I used FREE_MY_IP as the profile name in this screen shot, but you can name it anything you want
- Expand the SSH option in the left column and click on Tunnels
- Choose any port higher than 1024 as source port (unless you are running some kind of server software on your workstation, it is safe to use any port above 8000) and enter the SSH server in the Destination field. Then choose the “Dynamic” option and click on Add.. the screen shot below shows the options I used
- The tunnel will show up as below
- Click on Open and establish the SSH tunnel
- Configure Pidgin (open source IM client) to use the SOCKS proxy
- Launch Pidgin
- Click on Tools -> Preferences in the menu
- Click on the network tab
- Choose SOCKS4 as the proxy type and enter localhost in the host field. In the port field enter the port you selected when setting up the tunnel in Putty.
- Connect to your IM services.. chat away and be unproductive
Ran into an interesting issue at work today and wanted to document it. We had a rouge process in one of our applicatoins and it was trying to send e-mails via one of our mail gateways at an alarming rate..There was no customer impact, since the mail server was rejecting all the connections. But the high number of connections were causing a strain on our firewalls..
If this was Linux, we would have done something simple like adding a route to point all the traffic destined to mail server to /dev/null by running “
route add IP_ADDRESS_OF_MAIL_SERVER MASK /dev/null”
A search on Google showed that you can achieve similar results by doing the following “
route ADD IP_ADDRESS_OF_MAIL_SERVER MASK 255.255.255.255 127.0.0.1“. 127.0.0.1 being the IP address of the loopback interface in this case. But when we ran the command, we got an error “incorrect gateway 127.0.0.1″.. So there is NO way to route traffic in Microsoft Windows to a null device..
Finaly, we figured out a round about way to achieve this.. Since the main aim was to reduce the load on the firewall, we identifid an un used IP in the same network as the application server and added a static route to point all traffic going to the mail server to this IP. We ran the following command “
route ADD IP_ADDRESS_OF_MAIL_SERVER MASK 255.255.255.255 UN_USED_IP_ADDRESS”
For example, if you application server is in the range 192.168.1.0/24, the mail server is 192.168.2.20.. and an unused IP in the application server range is 192.168.1.10.. the command would look like this “
route ADD 192.168.2.20 MASK 255.255.255.255 192.168.1.10“.. You will see a lot of SYN_SENT status in the network connections, since the application is trying to connect t othe mail server via an IP address that doesn’t exist..
Might not be the smartest way to achive this.. but it did the trick.