Monday, June 19, 2023

What is success?

The journey of life takes us through varied experiences like landing an admission at a prestigious college, earning a degree, getting hired, being promoted at work, becoming a parent, buying a house, winning a championship and so on. 


With each experience being so different and with each one of us at a unique stage in our journey, it may seem difficult to define success. But if we look closely, a common thing that each experience shares is that it makes us more wiser, more stronger or more kinder than we were before that experience. And this is how I prefer to look at success. No matter what the outcome of an experience was or will be - in my favor or not in my favor - as long as I make a conscious choice to emerge more wiser, more stronger or more kinder at the end of that experience, I have succeeded.

Adopt this outlook daily and you will always succeed!!  

Sunday, April 24, 2016

Converting exponential number to numeric T-SQL

Following query can be used to convert an exponential number to numeric format.

SELECT convert(numeric(38,0),cast('4.102e+011' AS float))

Wednesday, February 24, 2016

Fixing "The ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine."

If you have 64-bit Excel installed on 64-bit Windows 10 and are trying to import Excel data into 64-bit SQL Server, you may run into this error message

"The ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine."

To resolve this issue, you will need to download "Microsoft Access Database Engine 2010 Redistributable"

After running the installer, the import operation should work.

Reference
http://blog.codefluententities.com/2011/01/20/microsoft-access-database-engine-2010-redistributable/
http://blogs.msdn.com/b/farukcelik/archive/2010/06/04/accessing-excel-files-on-a-x64-machine.aspx

Monday, November 3, 2014

Getting Hive metastore to work with HDInsight Emulator.

For some reason, Hive metastore.exe (which runs as a service) did not create the metastore db that is required for Hive to store table definitions. 

Hive reported the following exception at startup in the log files. 
"set_ugi() not successful, Likely cause: new client talking to old server. Continuing without it.
org.apache.thrift.transport.TTransportException: java.net.SocketTimeoutException: Read timed out"


Because of this error, "Show databases" command did not work and I could not use Hive with HDInsight emulator. 

After hours of investigation, I made the following edits to "C:\hdp\hive-0.13.0.2.1.3.0-1981\conf\hive-site.xml". As you can see, I changed the settings to EmbeddedDriver instead of ClientDriver. 

  javax.jdo.option.ConnectionURL
 
  jdbc:derby:;databaseName=metastore_db;create=true
  JDBC connect string for a JDBC metastore

  javax.jdo.option.ConnectionDriverName
 
  org.apache.derby.jdbc.EmbeddedDriver
  Driver class name for a JDBC metastore

Then I stopped the default metastore.exe service. 
And used the following command to start metastore
"Hive.cmd --service metastore" 

with the initial directory set to hive home.

This created a folder named "metadata_db" and finally hive started successfully!! 

By default, the metastore service listens for requests on port 9083.
You can confirm that the service is running, by executing netstat command as shown below.  
netstat -ano | find "9083"

Tuesday, September 2, 2014

Not running in a hosted service or the Development Fabric

Runtime Exception:
Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.

{"Not running in a hosted service or the Development Fabric."}

Fix:
I accidentally had set the Web Role project as the startup project. Setting the cloud service project in the solution as the Startup project helped me get past this exception.

Metaprogramming with T4

Recently, I learnt how to generate code using T4 text templates. The requirement was to read data from a CSV file and create in-memory objects based on the data representation in the CSV file. So if my CSV file had records with 4 columns, the code had to read the file and create in-memory objects such that each object has 4 fields mapped to the 4 columns. There were multiple CSV files of different record types and manually creating a class for each record type was tedious. After doing commonality/variability analysis, it was apparent that I could use T4 to generate the CSV file reader for each record type by reading metadata about the CSV file.
As my understanding of T4 evolves, I will share my learning here. For reference, posting some good links that provide some guidelines on code generation and when to use it.

Code Generation good or evil
Code Generation Pros and Cons of T4 template
MSDN Code Generation and T4 templates

Wednesday, March 6, 2013

Specified blob does not exist

When calling the DownloadByteArray method of the CloubBlob object, I got the error "Specified Blob does not exist". This was my first attempt at serious Cloud programming. I was baffled. Spent the next half an hour looking for clues, replacing \ with / and finally came on to a post on MSDN that stated "Blob names are case sensitive". This was it. I was not using the right case for the blob names and even though the blob existed the method complained that it did not exist.

The context is not currently tracking the entity

My code had a call to the Save method on CloudStorageAccount object after updating a TableServiceEntity object. This resulted in the error: "The context is not currently tracking this entity".
Turns out that this exception was a result of setting the MergeOption on the CloudStorageAccount object to "MergeOption.NoTracking". Changing the code to not use this option resolved the issue.

Tuesday, May 8, 2012

Importing Visio diagram to PowerPoint

If you try to copy paste a Visio diagram (for eg: Organization chart, Timeline or Workflow) into PowerPoint, you will notice that it gets copied as an image. You can only resize this image in PowerPoint and cannot do any editing operations on it - like modifying the text in the image or changing the shapes in it.

To get around this limitation, make use of the Windows Metafile format. Here's how...
1. In Visio, select the page containing your diagram. 
2. Click File > Save As and save the diagram as a Windows Metafile (wmf).
3. In your PowerPoint file, click Insert ribbon tab and select Picture
4. Browse to the folder containing the wmf file saved in step 2 and select it. The image will now show up on the slide. 
5. Select the image and go to Format ribbon tab. Select Group > Ungroup option. 
6. Now if you click at any place on the image, you will be able to edit the text or make changes to the shapes in it. 

This does not give you a lot of control on the editing, but it is definitely a good work around if you ever need to share your Visio diagrams in a PowerPoint file and keep the text in the diagram editable. 

PowerPoint slide shows for wider screens.

According to recent statistics at http://www.screenresolution.org/year-2012/, compared to 2011, significant number of people are on screen resolutions above 1024.
Around 14% use screen width of 1366, 22% use screen width of 1280 and 16% use screen width of 1024.

When prototyping and designing a mockup for new websites, if you are using PowerPoint, a hidden feature in it is the ability to setup the page size so that the slides occupy the full screen width. You can access this feature by going to Design Tab and selecting Page Setup. By default, the slides are sized for 4:3 display size which works great for 1024 x 768 screen resolution. However, if you are preparing a presentation or storyboard for a wide screen device, change the resolution accordingly. On my 1366 x 768 screen size, I prefer to go with 16:9. 

What is success?

The journey of life takes us through varied experiences like landing an admission at a prestigious college, earning a degree, getting hired,...