Pages

Tuesday, January 5, 2016

Books on OpenStack

Its been forever since I have updated anything on this blog. So what was I doing in all that time ?

I thought, i would introduce myself to the world of writing a bit more professionally, so I wrote a book on Learning OpenStack

The book is available on Amazon or the Publishers website (eBook $5 - Limited Time)

https://www.packtpub.com/virtualization-and-cloud/learning-openstack

I hope you enjoy it. Please let me know if you do have questions on the book and i will attempt to answer them here in the comments


The next book on learning trove will soon be out, so keep your fingers crossed


Update:

The next one is also out - I hope you enjoy it

http://www.amazon.com/OpenStack-Trove-Essentials-Alok-Shrivastwa/dp/1785285610




Wednesday, April 29, 2015

Kaise Tumhare Dar Hum Aaye

We have been engrossed so much in the material world that without His grace there is no way of pulling ourselves up. A song dedicated to this feeling ….

Kaise tumhare dar hum aaye
Kis vidhi tere darshan paye
Kai janmo se aas lagaye
Aan milo hari daras dikahye

Kaise tumhare dar hum aaye
Kis vidhi tere darshan paye

Prabhu Pankaj tum Keechad jaise
milenge tumko bolo kaise
Duniye aise prashn uthaye
laj rakho prabhu ab ur aaye

Kaise tumhare dar hum aaye
Kis vidhi tere darshan paye

janam janam se daag lagaye
aham dambh hum tyaag na paye
nirmal karo hume apnaye
tere bina nahi koi sahaye

Kaise tumhare dar hum aaye

Monday, April 13, 2015

Exposing a SQL DB through a WCF Service using Entity Framework

Its been a long time since I have written a blog. I had to implement a SQL database for an application and we needed to have exposed as a WCF endpoint. While there are several tutorial on how to do this, i thought it will be a good idea to show the simple and the quick way that we followed

Things needed

  • SQL Server
  • Microsoft Visual Studio 2012

This are two parts, creating the service and then the Client DLL.

Part 1 : Creating the WCF Service

Step 1: Create the Database

Create a SQL database, its tables, its relationships as you normally would.If there are any tables with binary columns, then please be informed that it should be excluded from the WCF service.

Step 2: Creating the EDMX file

Create a new ASP.NET Empty Web Application in a new solution, call it what you like, I am it the TestDataModel

Once this is done, its time to add the EDMX file. In order to do so Right click and add new item.

image

Choose ADO.NET Entity Data model and give it the name TestDataModel.edmx

Select Generate from Database

Fill in the DB details

image

You can change the name of the entities, we are leaving it as it is

image

Choose the tables you want to expose using the WCF

image

You can please note the Model Namespace, or change it. Once you finish the step will be done

 

Step 2: Add a Nuget Package.

In order to create the WCF, just add the entity framework nuget package. Right click on references, and Click on manage Nuget Packages

 

Download and install the WCF Data Services Server

image

This will install all the OData Components needs by our project

image

Step 3: Create the Data Service

Right Click the Project Name –> Add –> WCF Data Service

image

Give it a name – I am calling it AzMgmtDataService (as my database is called AZMGMT)

image 

This will create a file and open it

image

There are 2 main changes that we will do

image

1. Put the Name of the data source class – in this case azmgmtEntities and setting the rights – I am going to give rights to every one for the sake of simplicity.

image

Notice the two lines that are written. First one gives the rights to all users, off course you can fine tune this line. The second line is optional, i leave it on for testing so that I can check the entity framework errors from the client. In production environment, please set the line to false

 

That’s it, the WCF service is ready, you can deploy it in a manner you choose fit. Run a debug and it should open a browser.

It may show a 404 not found or a forbidden page, please ensure the service name (WCF service name is provided in the URI)

image

In my case, I added /AzmgmtDataService.svc

image

This shows that the WCF service is working. You can use Linqpad to test it.

image

 

Part 2: Creating the Client DLL

This is an optional step, but I recommend it as it makes the client applications easy to use.

We will use a visual studio utility (DataSvcUtil.exe)to generate a client class

Open a Visual Studio command prompt and execute

DataSvcUtil.exe /out:ClientClass.cs /uri:”http://localhost:57125/AzMgmtDataService.svc”

image

 

You should get a clientclass.cs file created

The File should look like this

image

Add a new project to the solution of the type Class Library. Call it AzmgmtDataModelClient

Copy paste the contents to the Class1.cs – Rename the class1.cs as AzmgmtDataModelClient.cs

 

Add the references

 

image

Build the Client Project. You will have got the DLL file to use it in your applications

 

FINAL (Optional)

The below shows how to use the client in other applications. So we create a test console application to do this

Add a new project of the type Console application. Add the references (All the microsoft Odata references that we added in the client class and additionally the client dll)

We will add two lines of code

image

Please remember that your entities name, URL and the object name will be different. In my case, I have a table called BusinessUnit in the DB that I want to use.I can use a LINQ query in order to filter my results

 

Setting up multiple projects for debug: Please remember that the Web Project needs to run so that the client DLL can access it. so, we need to run both projects simultaneously, so, right click on the solution and select properties

 

image

In my case, i want to debug only my test application. The client generation project doesnt need to be debugged at all.

Click on the debug button and you will see a webpage and a console open. Since I have set a breakpoint in my console application its waiting for me

image

As you can see the application is working as intended.

 

 

I hope this has been the easiest way to expose a database using the WCF service. If you have any questions do let me know.

Saturday, September 27, 2014

Outlook 2010 – Add Conference Details to Appointments

Are you a project manager. Do you use Outlook to create meetings every day and have Teleconferencing info and Web Conference Details. I am sure you do a lot of copy pasting and are always eager to ensure that you have sent the correct details.

Well, good news ! I created an Outlook Add-In for it (I have tested it for Outlook 2010 – If you are interested,Leave a comment I will post the Outlook 2013 version and you can test it for me ).

Please download it from HERE

The Add-In should be fairly easy to install once you download it.

Here are some instructions

  • Unzip and Click on the Setup.exe, The installation should be fairly quick
  • Once you have installed , Please restart your Outlook.exe (If already running, If not, just start it)
  • Try and create a new appointment / calendar invite
  • You will see a new Tab in the ribbon called the “My Teleconference” (if you don’t see this, ensure you have restarted the Outlook. If it still doesn’t work, it might not have installed properly

image 

  • Please click on Configure/Change – You will get the settings window. Fill in the details and click on Save Settings

image

  • After you are done, you can from then on use the Fill Telecon Details on any Calendar appointment and it will fill the details

NOTE: Please be advised, that the body will be added to and not replaced, so you don’t loose what you were typing. However, if you click multiple times, the conference details will also be added multiple times

The below shows the output

image

I hope this is helpful. If you would like more features, do leave it in the comments.

Till next time ….

Tuesday, June 3, 2014

VMware vCAC Dynamic Property Dictionaries

 

Hello, Its been a long time since I have blogged about some thing, so I thought, I would make up for it with a small goodie. If you have used vCAC, I am sure you have used property dictionaries. Now for the un-initiated, property dictionaries in vCAC (version 5.1 – 6.0.1) have all a single purpose, in order to get an input from the user while requesting a machine.

This is by far one of the most helpful OOB (Out of Box features) for customizing the front end form. I wouldn’t take much time by explaining what this is – There have been enough blogs for that

Please read

http://www.virtualjad.com/2013/05/vcac-property-dictionary-customize.html to understand what I am talking about.

When you get to the part of creating an XML, continue reading the blog

However, I have written a quick utility for you to download and generate the XML using a CSV file. I am sure the CSV file will be much easier to understand, manage, etc.

Download the XML Generator from HERE

Once you have downloaded, and started the software (You will need .Net 4.0 – No features are being used of .Net, however, my VS defaulted to that :) – In a planned upgrade, I will let you connect to your vCAC instance and even apply the configuration – This will then be upgraded to .NET 4.5 for vCAC 5.2 and vCAC 6.0)

For now, here is how you would use it.

image image

Create an CSV file (You could use Excel to do that)

image

The if you don’t have a format of the CSV, you could click on the tools Download Sample CSV to get the file. Off course, for the values, you can either put them one per line or use a pipe (“|”) as a delimiter to put in more than one values (The pipe will be considered as a delimiter), thus giving you the freedom, the XML will however be generated.

Once you have saved your CSV

Select the Input file and give a name for the Output. (Please remember the output file will be saved in the same location as the input file)

image

Once you click on Generate, you will get the XML file. Please remember you cannot use this XML file directly – This is only for you to see. (And potentially backup)

image

In order to generate a XML file directly, Please check the “Single Line” Checkbox and generate. Voila … You get a single line XML, which you can use in vCAC system directly

image

image

 

This is a quick tool i wrote, and is not extensively bug checked. If you face any issues, Please let me know in comments.

If you have any more comments / questions, do let me know

Till next time – Be Curious.

 

Monday, February 17, 2014

Exporting Contacts out of Blackberry with Windows Contacts

So, you are trying to get your contacts out of your blackberry and sync it to your Android / iPhone / Windows Phone, or just want to sync it to your Google account for backup purposes. Here are a few tips that will get you started – I have just enumerated some methods.

Option 1: Use Blackberry Desktop 6 (Manual)

(Not the most updated software) – It can directly export out your contacts out in the CSV Format. Please read the official How-To here

Option 2: Using Blackberry Desktop 7 (Manual)

If you have a Blackberry Desktop 7 – Which most likely you may end up having, here is how you can do it – For people who don’t want to use the sync (Option 3)

Step 1: Backup BB Contacts to Windows Contacts

  • Connect your Phone to your Windows (Assuming you have Windows 7/8/8.1)
  • Click On Organizer
    • image
  • Select Configure

image

image

  • Select “One-Way to Your Computer and Windows Contacts (You may Sync it to your outlook, but that’s not covered in this blog)

image

  • Click on Sync Organizer (Sync All) on the bottom right of window.

This step is now complete – The Contacts will now be in your windows contacts folder in windows 7 /8 /8.1 and Outlook Express (Address Book) in the prior version of windows

Step 2: Export Windows 7/8 Contacts to CSV

This is the next step in the process. Please open the contacts folder

  • Press Windows Key + R (To open Run window)
  • Type in the run window (Without the quotes) “%SYSTEMDRIVE%\Users\%USERNAME%\Contacts”
  • This will open your contacts directory

image

  • Click on the “>>” on the top pane and click on export to CSV

image image

  • Save the CSV file as backup of your Contacts

 

Step 3: Import the Contacts in G-Mail

image

  • Choose the CSV file

image

Hit Import and in a few moments, your  contacts will be in your Google account. Now, the contacts will be synced any where you configure to do so, in your Windows Phone, iPhone or Android or simply can act as a backup of your contacts.

 

Option 3. Automatic Google Contact Sync

 

I hope this has been informative, and would help you back your contacts up. Thanks for reading. Do leave comments if you face any issues.

 

 

Wednesday, December 25, 2013

Installing 64 Bit software with Guest Agent in vCAC 5.2

So you have set up your vCloud Automation Centre, followed the guide, put in multiple hours creating the enterprise groups, provisioning groups, reservations, blueprints, etc. Heck you have even customized / created some of the vCAC’s workflows and now, you just want to install some software after the machine is provisioned, you decide to use the Guest agent on windows. You followed some guides (i.e. The Operating guide) or this blog
You have edited the InstallSoftware.js file (detailed in the above mentioned link) So for so good … You have for the testing purposes created a set of custom properties like given in sample and you are able to create the “Hello World “ Batch file (some thing that’s described here )
Now, you walk up to your boss and say, hey its ready! The system can now be used, your boss smiles at you happily and says, Excellent! please create a script that installs IIS 7 on the Windows 2008R2 server, we need to start with those. You happily write a Powershell script to do so and put that in the software0.install property, etc and when you run … BAM!! it fails!
You try, then retry and then try again. It fails all the times, you modify the script several times, you test that the script works when you execute by hand, but some thing goes wrong when the system try’s to invoke it, you are certain this gets invoked (you log that ), but it doesnt work, you are bewildered and Googling for help, and may be then you come across this blog ;)
Ok, I know the above was a little too melodramatic, however, the fact of the matter is this. If you try to invoke any 64 bit program using the vCAC Guest agent, it will FAIL :)
Please note that this is true in vCAC 5.2, hopefully they will fix it in vCAC 6. But, if you are using it and its failing, look no further, you are very close to the solution … Read On …
The Reason
vCAC Guest Agent is a scripting agent, which means what ever you throw at it, it will execute without rhyme and reason (The only reason being that, you as an administrator told it to do so). Also, its worth noting that the agent itself is written in C++ and compiled as 32 bit. Any command that you invoke using a 32 bit software will also be 32 bit. So when you launch powershell using the guest agent to install IIS, it launches the 32 bit version of powershell and that wont be able to load the 64 bit server manager module. Hence the entire problem. Now, there is no way to change this default behaviour, because of the WOW64 (Windows On Windows), I am sure you guys have seen this folder. Please remember that when a 32 bit application makes a call, the WOW system intercepts it and invokes the executables in the %SystemDrive%Windows\SysWow64 rather than the %SystemDrive%Windows\System32 folder (which is used when you using 64 bit applications). It is marvelous that windows does this, but that prohibits us from being able to launch 64 bit applications.
Ok, now you know the problem and the reason, now for the solution. The solution is in fact is very simple. I wrote a code which i call posh64.exe, which can be invoked from 32 bit / 64 bit but will run the 64bit powershell. I am going to give you the download link of the exe in this blog, but as this blog is for the curious, here is how I wrote it
Writing Posh 64
Open Visual Studio, Select New Project –> Windows Console Application (C#)–> Choose framework (I chose framework 2, which will be available by default on most windows machines) and I wrote this in the code
   1:  using System;
   2:  using System.Diagnostics;
   3:   
   4:  class Program
   5:  {
   6:      static int Main(string[] args)
   7:      {
   8:          var p = new Process();
   9:          p.StartInfo = new ProcessStartInfo("PowerShell.exe", String.Join(" ", args))
  10:          {
  11:              UseShellExecute = false
  12:          };
  13:   
  14:          p.Start();
  15:          p.WaitForExit();
  16:   
  17:   
  18:          return p.ExitCode;
  19:      }
  20:  }





20 lines of code (Actually less). So what does this do, just starts powershell.exe with the parameters that you pass to this application. Please note there is no error check or correction, as this is just meant to be a wrapper. If you want to put those, then its fine, feel free, how ever, this is not where the magic happens. If you just compile the above with default settings you will be again left with the same problem.

Open the build property and choose the platform target as x64 (default will be Any CPU)

image

Now you can execute the code, and this will ONLY invoke 64 bit applications. You can bake the posh64.exe in your template and then use it like this

Invoke a Powershell script (64 bit)

posh64.exe <powershell script name> < powershell script arguments>

Invoke a Command Prompt (64 bit)

posh64.exe cmd.exe /c <what ever you want to invoke at the command line>

Invoke a Powershell Script (32 bit) – I am not sure why would any one want to do this

posh64.exe cmd.exe /c c:\windows\syswow64\powershell.exe <powershell script name > <powershell script arguments>

You get the picture!

Enjoy

For people who don’t want to write this, here is the link to the posh.exe

I hope you like it. Also, please let me know in the comments if you have questions! Merry Christmas !

Sunday, October 27, 2013

HOW-TO: Selectively Enable or Disable RSA Secure ID Integration in Cisco VPN Client

If your company uses Cisco ASA firewall and allow remote access through it (Using Cisco VPN Client). Also, If your company uses 2FA (Two Factor Authentication), using RSA Secure ID and have given you a Soft token, they are now integrated, which means when you try to connect you are only prompted for the PIN of the RSA Token and not the entire Pass code (Look at the below, prompting for PIN and Not Pass code)

image

Neat isn’t it ? But consider this, You are a consultant working for more than one company, and just two or more companies, one using the RSA, and the other NOT using it. Or both using RSA, but different How do you take care of that ?

Cause, normally, it will pick one token and just blast away the pass-code with the pin you enter. Which means you can login to one company but not the others. This is a problem isn't it ?

Fortunately for us, there is a solution

You need to remember the following

SDIUseHardwareToken (Enables a connection entry to avoid using RSA soft token.)

0 = Yes, use RSA SoftID (default)
1 = No, ignore RSA SoftID software installed on the PC.

RadiusSDI (Tell the VPN client to assume Radius SDI is being used for extended authentication (XAuth).)

0 = No (default)
1 = Yes

Ok, now you know the above, Now what

 

First, if you have multiple companies, all using, RSA, and by default the PIN works for one of them, you can leave that as is or you can just disable the PIN function all together and yourself enter the passcode.

Open the PCF file (It will be in the installation folder). Since I use a 32 Bit client, the Location was

c:\Program Files(x86)\Cisco Systems\VPN Client\Profiles

image

Open the PCF Files in a Notepad and edit or add the lines in the PCF (If the lines already exist, just change the values ) in the file and save it

image

To Ignore the RSA Integration

RadiusSDI=0
SDIUseHardwareToken=1

To Use the RSA Integration

RadiusSDI=1
SDIUseHardwareToken=0

Once you set it to be ignoring the RSA, the prompt will change back to passcode.

image

Hope this has been helpful and thanks for reading. Dop let me know if you have any questions in the comments section

 

 

Thursday, October 17, 2013

Teri Yadon Ne Rulaya

Another bhajan, depicting the persons quest to reach back …

Teri yaadon ne rulaya, par ye samjh na aaya
Ki tu jo hai khudaya, mere dil mein kabse aaya
Taqdeer ka farishta jab humpe muskuraya
Us waqt humko teri yadoon ne phir sataaya

Teri yaadon ne rulaya, par ye samjh na aaya
Ki tu jo hai khudaya, mere dil mein kabse aaya

Hum tumse poochte rahe.....
Hum tumse poochte rahe, kya humne ki khataya
Teri yaad bhi humein gayi chod ya khudaya

Teri yaadon ne rulaya, par ye samjh na aaya
Ki tu jo hai khudaya, mere dil mein kabse aaya

Jab yaadoin ke samndar mein,ho gaya akela
Tab phir se tune aakar haas ke yehi tha bola
Ki naata tera mera, yeh sab se hai purana, jitna bhi door jaye, hai mere paas aana
Ki bande tu kabhi mujhe se juda ho na paya, jitna bhi tune meri yadoon ko thukraya

Teri yaadon ne rulaya, par ye samjh na aaya
Ki tu jo hai khudaya, mere dil mein kabse aaya

mere dil ke aiyene mein....
mere dil ke aiyene mein, jab maine aaj jhaanka
tera aks us mein paaya ab samajh mujhe aaya
Teri yaadon ne rulaya, par ye samjh na aaya
Ki tu jo hai khudaya, mere dil mein kabse aaya


Translation (Literal) in English ... 

Your memories have made me cry, I did not understand just one thing ...
That lord, When did you get into my heart ...  --- Para 1

It was only when good fortune that smiled on me,
that again your memories came to me

 --- Para 1 Line 1 ---

We kept asking you ... What mistake did I do
That even your memories left me ...

--- Para 1 Line 1 ---

When I was lost "alone" in the sea of memories ...
Then again, you came, smiled and told me ...
You said that your and my relation is the oldest of all ... However far you try to go, you will have come to me ...
You were never able to truly forget me, how much ever you tried to ignore my memories ...

--- Para 1 Line 1 ---

When finally today I saw in my hearts mirror, I saw your reflection and I understood what you said myself .

--- Para 1 Line 1 ---



The tune that I created for this is at https://soundcloud.com/alok-shrivastwa/teri-yaadon-ne






Monday, October 14, 2013

Har Saans Mein …


Here is another bhajan which you may like.

Har saans mein tera naam liya … Gar yeh na kiya to khaak jiya …
Oh Murali vale yeh to bata … Iske siva ab mujhe kaam hai kya …
Kyun tune banaiyi yeh duniya … Jisme humein tumne daal diya …
Ki ro ro kar karein ek sada .. Tere naam ka de do phir aasara...
Tera naam amar, Aasav lagata ...Jo pee lay isko ek dafa ...
Woh khud se bhi ho jaye juda ...Duniya ki usey ho kya parvaah ..
Mahima is naam ki kaun kahe... Isey lekar papi bhi hai tarein
Jo bhi is naam ke sang chale... Bhav sagaar sindhu se voh na darein...
Ab karo kripa itni hum par ... ki bhatke hum na dar dar par ..
Teri dar par humein swikaar karo ... Prabhu humari naiyya paar karo ..

I hope you like it …

Translation in English 
I have gotten some requests for translation, so here is the translation (Mostly literal), leave your comments with your views.

I take your name in every breath ... If I don't do this then what is my life after all
Oh the one with the flute (Lord Krishna) please tell me this ... Is there any other work for me ...

Why did you create this world ... And put us in it .....
That we keep crying and request for just one thing ... give us the shelter of your name ....

Your name is immortal, it is also feels like the drug, the person who drinks this once ...
He will seperate from himself (his physical self) .. what concern may he have about the world ...

Who can sing the praise of thy name ... taking this even the biggest sinners have attained salvation
Who ever stays and walks with the name ... gets rid of this mundane ocean of existance ...

Please I request you to grace me with this ... that we don't keep getting lost between places ...
Please accept us at your door ... God, please get my boat across the worldly ocean ...


The tune for this that i created is at https://soundcloud.com/alok-shrivastwa/har-saans-mein