Archive for July, 2009

Google tricks

Google is powerful, outstanding service, which besides the standard search, has a huge number of dopolniteni advanced search capabilities by using specific commands, codes and characters.
If you want to directly browse certain types of files, try these tricks:

Method 1

“parent directory ” MP3 -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
“parent directory ” DVDRip -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
“parent directory ” Xvid -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
“parent directory ” Gamez -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
“parent directory ” -xxx -html -htm -php -shtml -opendivx -md5 -md5sums

You may notice that the only change is the type of file you’re looking after “parent directory”, so you can try with any type of files.

Method 2

If you want to find a MP3, enter:
?intitle:index.of? mp3 (tupe name/atrist)
Example:
?intitle:index.of? mp3 tose proeski

It can do any type of file.

Method 3

“index of/” ” tose proeski” .mp3

Method 4

inurl:tose proeski filetype:mp3

Method 5

http://www.google.com/ie?q=parent-directory+”TIP”+exe+OR+zip+OR+rar+OR+gzip+OR+tar +OR+bzip&num=100
Replace the word TIP with  Games, MP3, Software…

To request an electronic book type the following:
+(“index of”) +(“/ebooks”|”/name of the book”) +(chm|pdf|zip|rar) +apache
Or you can try this:
allinurl: +(rar|chm|zip|pdf|tgz) title

These are just some of the Google search engine we have to offer. In the future will present, and others. Good luck searching.

Read From File in C++

This is tutorial for reading from file in C++.
Here is the code.

int main()
{
	ifstream in;
	in.open("file.txt");

	char line[300];

	while(in.getline(line, 300))
	cout <

Here we read the file line by line, and write its content to the console.
We have one char variable where we will store that lines, it will be long 300 characters. We are using the ifstream class, and creating an object from it, opening the file, do our work, and in the end we are closing the handle from our application to the file we read.

Write To File in C++

This is tutorial for writing to file in C++.
Here is the code.

#include 

using namespace std;

int main()
{
	ofstream fw;
	fw.open("file.txt");
	fw <<"You text here!"<< endl;
	fw <<"text in other line\n..."<

We include the fstream library, it contains the ofstream and ifstream classes. They are used for writting and reading to/from files.
Then, in the main function we create an object from ofstream class, and with function open we tell the object that we will write in the file "file.txt".

This will be written in the file

You text here!
text in other line
...

Enable Folder and Icon Refresh

This reg file Enables Folder and Icon Refresh.

1. Copy the following (everything in the box) into notepdad.
QUOTEWindows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] “NoNetCrawling”=dword:00000000

2. Save the file as disablerefreshundo.reg3. Double click the file to import into your registry.

NOTE: If your anti-virus software warns you of a “malicious” script, this is normal if you have “Script Safe” or similar technology enabled.

Disclaimer: Modifying these settings can cause serious problems that may require you to reinstall your operating system. We cannot guarantee that problems resulting from these modifications to the settings listed above can be solved. Use the information provided at your own risk.

Disabling the “Send Error Report” feature

To disable the feature in WinXP which tries to send a report to microsoft every time a program crashes you will have to do this:

Open Control Panel > Click on Preformance and Maintenance. Click on System. Then click on the Advanced tab > Click on the error reporting button on the bottom of the windows. Select Disable error reporting. Click OK

Save Your Word Docs to Windows Azure Blobs!

So Mohit and I were at WPC last week, and while we were hanging in the booth, a customer came up with a very interesting problem.

Essentially, the customer needed to be able to have their Word documents saved to Windows Azure, in a format that could be opened in Word, but also consumed by a legacy Java application.

I promised I would see how hard it would be, and so while waiting for Yil to cook Sunday lunch, I had a quick crack at it.

First step, I created my own ribbon in Office, using the new Office Add-in projects in VS 2010.

image

Added in a ribbon visual designer.

image

Which ended up looking like this.

image

The code was very easy, essentially on the click event, I saved the contents of the doc to a blob.

image

The key part is to call the WordOpenXML method on the ActiveDocument.Content property, to get the OpenXML version of the doc.

A quick test.

image

And… you little bewdy. Now, I’ve set the content-type to the docx content type for dramatic effect, as otherwise the XML would just load in my browser, and not let me save it. When I save it to my desktop, I save it as xxx.xml, and when I double click on it, it loads in Word.

The next step for this would be to create a Web Role to list the documents that have been saved to the blob store, to make it nicer to view, but in terms of proving this little bit of functionality, I’m pretty happy.

Here is a link to the code in case you’re interested.

Enjoy :)

Syndicated via RSS From: http://blogs.msdn.com/b/davidlem/

WPC09 – My Windows Azure Session

Here is my session from the WPC09 in New Orleans:


Lap around Windows Azure, Business Edition

Big thanks to Eilert Hanoa from Mamut ASA for his help with the session, and to everyone who attended. :)

Hope everyone enjoyed WPC! :)

Technorati Tags: ,

Syndicated via RSS From: http://blogs.msdn.com/b/davidlem/

Windows Azure Project Attire!

So one of my favorite parts of working in the Windows Azure team is the camaraderie that grows when you take a bunch of really smart people and apply them to a big problem. I’m very fortunate to be part of three extremely interesting Windows Azure v-teams (teams assembled for a particular project or work stream); our TAP team (I’ll explain a little more about that in a later post), our billing team, and our deployments team.

One thing that I have noticed during the course of this year as we work towards PDC2009, is that each team has it’s own dynamic, it’s own challenges and issues, and most of all, it’s own in-jokes. Along the ship path, as the pressure increases, it’s easy to forget to have fun, so the other day, I jumped onto Zazzle, and captured some of the more interesting moments on our road to PDC09 so far.

Filing Bugs Is Free!

My first one comes from what we call a ship room, which essentially is a regular meeting (we hold ours twice a week for an hour) where everyone involved in shipping the next release (in our case, billing) attends to triage bugs from the previous release, and discuss blocking issues for the upcoming release. Everyone attends; developers, testers, program managers, release managers, everyone. As the billing team is relatively new, not everyone had worked together. Now, as every dev/test knows, filing bugs is not a trivial task, there is a tension between overfiling (carelessly filing bugs which adds work to the triage team and can cause wasted effort) and underfiling (not wanting to file bugs because it may make the developer look bad, however has the effect of giving an incorrect representation of how solid the codebase is). It’s a tension that exists in every project, and there is no right or wrong balance, you have to take a position that suits your objective. Entering billing ship room, there was definitely a tendency to underfile, but given the importance of billing, we decided that it was better to overfile, wear the cost of triage, to ensure we didn’t miss any bugs, than underfile to optimize for speed of delivery. Hence, the shirt below!

image image

My Rack’s Too Fat for Singapore!

The second one comes from my experience in our infrastructure deployments team. This team is responsible for deploying all new Windows Azure capacity to support the cloud, which includes selecting hardware/network gear, designing the deployment topology/config, rolling out and setting up the physical assets, and wiring it all up to the Windows Azure grid, both from a wire and software point of view. As you can imagine, it’s a pretty fast paced environment, and I can only imagine, is akin to landing planes; you need to get lots of iron and copper on the ground, in different countries, very very quickly, in quick succession. The other aspect is that we don’t use your standard enterprise configurations, which means are racks tend to be tall, heavy, and many. So it some times happens that a datacenter location may not be able to support our deployments, which was the case with a location we were looking at in Singapore. I couldn’t resist capturing that little moment, in a very literal way in the shirt I’m wearing today!

image image

So keep this in mind, next time your sitting with your project crew, toiling through the hurdles and issues, and that little moment pops up that makes everyone have a laugh and relax, capture it in some way, shape or form. It’s a great way to remind everyone that we do this stuff because we love it, and it also helps keep those moments alive down the path, where trust me, you’ll need them! ;)

Enjoy! :)

Technorati Tags:

Syndicated via RSS From: http://blogs.msdn.com/b/davidlem/

Looking Inside Windows Azure!

So I’ve been working on a proof of concept this past week, and one of the biggest issues I’ve had has been trying to see what has been going on with my “container” when I deploy my app to Windows Azure. It’s not that the logs aren’t good enough, but sometimes I need to try interactive commands to see the state of the environment or test something out.

First, let’s recap a little Windows Azure 101; when you deploy your application, we spin up a VM and deploy your app into that VM. That VM has some policies set, which restrict what you’re able to do compared to your local machine or dev server.

So how do you see what your VM is doing? Well, since we don’t really provide any option to TS (remote admin) into your VM instances, I had to come up with a slightly different approach. The first step was to flick on a little known setting, but very powerful one:

image

Enabling Native Code Execution turns off the partial trust policy in Windows Azure, allowing you to run a bunch of functions that you were previously able to run in the old Nov CTP 2008 days.

My next task was to code up a little page that would allow me to run commands in the VM environment, kind of like a remote console, so I could see what was happening when I was trying to run my app.

The main bit of code is quite simple, and uses the System.Diagnostics.Process to create a new command window to run my commands, and capture the output back into my ASP.NET page. Here is the code to create the command process and get the return data:

  1. newProc.StartInfo.UseShellExecute = false;
  2. newProc.StartInfo.RedirectStandardOutput = true;
  3. newProc.StartInfo.FileName = "cmd";
  4. newProc.StartInfo.Arguments = "/c " + txtCommand.Text;
  5. newProc.EnableRaisingEvents = false;
  6. newProc.Start();
  7. sr = newProc.StandardOutput;
  8. txtStatus.Text += String.Format("{0}\r\n", sr.ReadToEnd());
  9. newProc.Close();

So I have a simple page now, where I can enter commands, and see what is returned when run within the VM:

image

Oh the things one finds out about their VM! :) For example, I can run commands like:

SET

image

NETSTAT

image

TASKLIST

image

This type of insight is really important, for example, in my task, I was trying to start a new process (Apache Tomcat), but couldn’t get a response from the default address that Tomcat binds to (http://127.0.0.1:8080), and couldn’t work out why it worked on my local dev fabric and not in the cloud. I then ran NETSTAT and saw that the 8080 port was already bound to a virtual address, hence why it wouldn’t work for me.

Anyway, there is a wealth of information that can help you as a developer, when trying to debug/troubleshoot an issue, that can only be gleaned from the live environment, so tuck in!

Enjoy! :)

Technorati Tags:

Syndicated via RSS From: http://blogs.msdn.com/b/davidlem/