Search This Blog

Wednesday, 14 May 2014

Professional tips that better channelize your career

Although I normally ignore posts like "n tips to..." such as 10 ways to successful management, 7 tips to loosing weight, 5 mistakes made by job seekers.... so on and so forth, I found this particular "n tips to..." kind of post quite interesting on yahoo. So this post is courtesy [https://in.finance.yahoo.com/photos/20-time-management-lessons-everyone-should-know-slideshow/20-time-management-lessons-everyone-should-know-photo-1400045701986.html].. Not my original discovery.

But I'd like to say, most of the tips mentioned here are the ones that I've myself learnt as a professional. Hence I'd like to archive this in my blog list.


  1. When you're just starting your career, you need all the help you can get managing your time. Even when you're working hard, you could be wasting a tremendous amount of time either by trying to multitask or by focusing too much on minute details. Montreal-based designer Étienne Garbugli has struggled with all of that. But as he's gotten older, he's learned how to manage his time and workload more effectively. Today, he's a consultant and entrepreneur, and recently published his first book, "Lean B2B: Build Products Businesses Want."
  2. There's always time. Time is priorities.You never "run out of time." If you didn't finish something by the time it was due, it's because you didn't consider it urgent or enjoyable enough to prioritize ahead of whatever else you were doing.
  3. Days always fill up faster than you'd expect.Build in some buffer time. As the founder of Ruby on Rails and Basecamp, David Heinemeier Hanssonsaid, "Only plan on four to five hours of real work per day."
  4. Work more when you're in the zone. Relax when you're not.Some days you'll be off your game, and other times you'll be able to maintain your focus for 12 hours straight. Take advantage of those days.
  5. Stop multitasking. It kills your focus.There have been academic studies that found the brain expends energy as it readjusts its focus from one item to the next. If you're spending your day multitasking, you're exhausting your brain. There may be "n" tasks in your bucket, but prioritize and focus on one at a time. Working on more than one items at a time doesn't let you focus on even one of it.
  6. We're always more focused and productive with limited time.Work always seems to find a way of filling the space allotted for it, so set shorter time limits for each task.Work is the best way to get working. Start with small tasks to get the ball rolling.The business plan you need to finish may be intimidating at 8 in the morning. Get your mind on the right path with easy tasks, such as answering important work emails.
  7. Work iteratively. Expectations to do things perfectly are stifling.Gen. George S. Patton once said, "A good plan executed now is better than a perfect plan executed next week."
  8. More work hours doesn't mean more productivity. Use constraints as opportunities.Don't kid yourself into thinking that sitting at your desk will somehow extract work from you. Do whatever you can to finish your current task by the end of regular work hours instead of working into the night.
  9. Separate brainless and strategic tasks to become more productive.Ideally, you can brainstorm your ideas and then execute them. If you're constantly stopping your flow of work to rethink something, you're slowing yourself down.
  10. Organize important meetings early in the day. Time leading up to an event is often wasted.If you have an important meeting scheduled for 4 p.m., it's easy for anxiety to set in and keep that meeting at the front of your mind. Try to get them over with early so you can work without worrying about them.
  11. Schedule meetings and communication by email or phone back-to-back to create blocks of uninterrupted work.You'll disrupt your flow if you're reaching out to people throughout the day.
  12. Work around procrastination. Procrastinate between intense sprints of work.Try Francesco Cirillo's "Pomodoro Technique." "Pomodoro" is Italian for "tomato," and it refers to the tomato-shaped cooking timer Cirillo used to break his work into 25-minute increments with 5-minute breaks in between. You can use the same idea with your own increments, as long as they inspire bursts of hard work.
  13. Break down a massive task into manageable blocks.No two tasks ever hold the same importance. Always prioritize. Be really careful with to-do lists.Daily to-do lists are effective ways of scheduling your day. Just do what you can to keep bullet points from making "clean desk" on par with "file taxes."
  14. Always know the one thing you really need to get done during the day.To help prioritize, determine what task in front of you is most important, and focus your energy into getting that done as soon as possible.
  15. Delegate, and learn to make use of other people.To be truly efficient, get over the fear of handing work off to someone else. "If something can be done 80% as well by someone else, delegate!"
  16. Turn the page on yesterday. Only ever think about today and tomorrow.Don't distract yourself with either the successes or failures of the past. Focus instead on what's in front of you.
  17. Set deadlines for everything. Don't let tasks go on indefinitely.Spending too much time on a project or keeping it on the backburner for too long will lead to stagnation. Get things done and move on.
  18. Always take notes.Don't assume you'll remember every good idea that comes into your head during the day. It doesn't matter if it's a notebook, whiteboard, or an app like Evernote — just write stuff down. I do this on the go in my mobile.
  19. Write down any unrelated thoughts that pop up when you're in the zone, so that they don't linger as distractions.You'll get them out of the way without losing them.

Wednesday, 7 May 2014

VM Error (Solved): This virtual machine appears to be in use. press the "Take Ownership" button to obtain ownership of it.

How did I bump into it?
Windows updates were done and my system restarted. The connected VMs crashed during the reboot.

This is common, and will happen whenever the system is abruptly shutdown or the host machine crashes.
When you attempt to re-connect to your VM after restart, an error message is thrown as below

This virtual machine appears to be in use.If this virtual machine is already in use, press the "Cancel" button to avoid damaging it. If this virtual machine is not in use, press the "Take Ownership" button to obtain ownership of it.
Solution: (Windows) 
  1. Locate your virtual machine files (.vmdk) there would be a folder for lock files. Lock files have the extension .lck.
  2. Delete the lck file. Try starting the VM.
Significance of lock files [Thanks to info on www.vmware.com]
  • When a VM is started lock files are created. These files are created so that consistency is maintained on virtual disks considering the case of multiple VMs and hence multiple reads and writes.
  • When a VM is powered off in a routine manner the lock files are also deleted. In case it is not powered off properly, a stale lock will be maintained to protect the VMDK file. When the VM is started / resumed again, the stale lock will be removed.
  • To make sure no other VM is accessing the lock file, the following conditions are checked.
  • The lock was created on the same host where the VM is running
  • The process that created the lock is not running
  • If the above conditions are satisfied, the stale lock is safely removed. But if one of the conditions is false, an error dialog is displayed saying the VM cannot be powered on / resumed.
  • In such cases, if one is sure, the lock file can be deleted, to resume the VM.
Hope this helps.


Friday, 18 April 2014

Hashing Passwords - Salting

While building a secure signin framework, We tend to use hashing, double hashing and hashing using multiple algorithms, assuming that the above techniques can make the process of cracking a password slower. That is not really true!

We need to bear in mind that,


  • Cracking of passwords is not done by brute force always. 
  • There are algorithms which guess the password with the use of special dedicated harware and pre-computed list of common passwords which keeps growing. 
  • The GPUs and hardware available now can compute billions of hashes per second.


Some very simple techniques can make cracking passwords extremely difficult. One of them which I'd like to highlight again is salting. It is simple to implement and difficult for the attacker to guess.

"Salting of Passwords" is a simple yet powerful technique in which a random string is prepended / appended to the password  and hashed. This makes each password unique after hashing as well. Unless the salt value is known to the attacker and the salt is long enough brute force or look-up tables would also not be helpful in cracking passwords.
It is important to understand that the salt must always be unique per user per password.
If two users have the same passwords they would not be getting computed to the same hashes after adding the salt. Salting must be practiced correctly in combination with the right algorithm. Some algorithms are weak and can cause hashing collisions which means two strings generating the same hash.

In the case of salting,
Saving the password to the database

  1. Once the user keys in the password, hash it.
  2. Generate the unique salt value.
  3. Save the hashed password and the salt value in the database.


The salt value should be different for every change of password.

Validating the password

  1. Hash the password keyed in by the user at the time of sign in. The algorithm used for hashing must be the same as used while saving the password.
  2. Retrieve the value from the database for the keyed in username and hashed password.
  3. Pre-pend or Append the salt value and hash it. Please note, it is not mandatory that the salt value must be pre-pended or appended. It is up to the developer. The logic for retrieval and save has to use the same technique.
  4. If the values match, the authentication is successful.


I have found a link that could be of good use to those who want to understand this technique better with code level details and faqs.
https://crackstation.net/hashing-security.htm

Tuesday, 24 September 2013

RDP Clipboard not working - Solution

I've often faced this situation where my RDP settings have clipboard enabled to facilitate copy-paste feature while remotely connecting to a server but the functionality stops working all of a sudden.
I have often encountered this when the connection was lost during the copy-paste operations.

Why we face this issue is another topic, so I'd like to redirect you to this msdn link

Hope couple of you would have also faced similar situations.

Note: The clipboard redirection should be enabled for the server you are remotely connecting to. If the redirection is not enabled the following steps will not be of help. You will need to enable it through terminal services configuration.

First of all, always check your RDP settings to have clipboard checkbox ticked.


The process responsible for facilitating clipboard functionality while doing a remote desktop is rdpclip.exe.
This process might be unresponsive sometimes.

The way out is, to end this process and start it again as follows

In the Task manager of the RD connected server,

1. Open up task manager -> Processes tab -> Search for rdpclip.exe. Right-click and end this process.



2. Restart this process



Although this is a workaround to the problem, it does solve it.
I've still not able to get an exact reason for this issue though.


Although this should not happen frequently, but if it does happen every time then, 
you may want to create a .bat file with the command to kill the process and restart it.

1. Create a rdpclipboard.txt file
2. Add the following commands on separate lines
    Taskkill.exe /im rdpclip.exe
    rdpclip.exe
3. Save the file.
4. Change the extension of the file to rdpclipboard.bat.

You can have it on the quick lauch bar or the desktop. Double-click this bat file, to execute it.
Hope this helps.

Wednesday, 31 July 2013

Using Windows Services to simulate a workflow

There are technologies that support workflows for software systems like,
Windows Workflow Engine (WWF),
JBPM (in the open source. Tough learning curve though!)
but what if you wanted to do the same without any of the above technologies?

The options I could think of were,
  1. To use a design pattern like the state machine
  2. To use Windows services
The approach is what I would like to highlight here more than code.

Of-course the choice of technology would depend on the kind of project, the complexity of the workflows being handled and so on. But normally every software system does have some workflow associated.

For instance, say an Exit and Clearance Approval system for a small to mid-sized software company. It must be approved by the manager first, then goes for the clearance by the IT department, the Admin Department, then HR. It is important that the approval must go in the above sequence and should be tracked through software.

This is one of the simplest examples I could think of. But in a more complex scenario like a VFx company; which apparently works on a shot that passes from department to department, would use a much complex workflow.

  • State machine pattern can get complex with complex workflows. 
  • I have also worked on complex VFx workflows where we opted for Workflow Foundation (anyways we had to customize it a lot actually)
  • JBPM is one other technology which fascinated us because it was an open source.
Though I must confess to have opted for Windows services, which was simple traceable and has worked for a couple of years and for about 30+ customers now.

Firstly, if you are new to Windows Services, please refer to this link on Code Project for a step by step walk-through. Steps are pretty much the same for whatever versions of Visual Studio used above VS 2005 also.

A simple approval system which consists of multiple levels of approval and sharing of content in the form of files is shown below
  • A workflow processes an input and produces one or more outputs.
  • Input / Output could be some content in the form of files dropped into a folder which is watched by a windows service. This folder can be called a watch folder.
  • Input / Output could also be a database tables which are looked into for particular status or pre-conditions.


The Process
Say this is a case for the approval of VFx shot changes. The artist makes the changes, the supervisor reviews it approves / rejects it. The input to the next level of approval is the VFx shot (content) in a folder and a database approval status update.

  1. The user uploads his shot changes through the web portal.This triggers a database update. Status = Uploaded
  2. A windows service in the background keeps watching the database for records with Status=Uploaded. Once a matching record is found, it will trigger underlying business logic and put the content into a folder (watch folder) and also update the status in the database. Status = Approved By Supervisor
  3. A windows service in the background would be watching the folder (watch folder) in which the shot changes exist and the database tables for the Status = Approved By Supervisor to trigger the next set of operations and put the content and update the status for processing by the next windows service in line.
The steps in this workflow could be as many as possible.

Tips

  • It is recommended that a base framework is written to handle logging and error handling to track the workflow properly. 
  • At every step of the service, a text file should be created as a log of steps of the service. This can help in the event of support issues. This is important, as it is not possible to debug a windows service by doing a F5, and it would be a nightmare issues happen in production environment.

          Eg: [Fri 5 JUL 2013 1:10:00:00]Moving the file to destination folder E:\NextDeptWatch\ShotFile.m2t
                [Fri 5 JUL 2013 1:10:00:00]File moved to destination successfully


  • In case of issues, the log file with messages like above would be useful for the developer to trace where the code has failed and the entire stack trace of the the exception that occurred.


  • The OnStart() and OnStop() need to be handled to process the content of the watch folders or database table contents.

Hope this helps while making a choice of architecture and technology to be used for your projects.

Thursday, 9 May 2013

Image Protection Techniques

For a long time now, I was wondering of protecting images especially as the world comes online with social networks offering extensive sharing and multimedia editing options.

We are all aware of image thefts and morphing. There are a few techniques like Divs + Css, copyright, watermarking and robots.txt which I could think of and a few more, thanks to Google :)

  • Watermarking 
          In this technique the image can be added with text over the image    
          indicating the ownership. There are tools like Photoshop and a combination 
          of html and css can also do the magic.
  • Using Low Res Images 
          This is also one of the preferred techniques. If an image needs to be              
          tampered with it should have color profiles defined and should have high 
          resolution. Several websites adopt the low resolution technique for basic 
          viewing. Eg. Flicker re-sizes images to as low as 500 pixels (in the longest dimension) for basic viewing
  • Preventing Image Download: There are a few ways to do this.
          1.   Disallow Right-Click: This is not a nice option in my opinion. It will 
                annoy users and is not effective as screen capture will defeat the 
                purpose of image protection.

           2.  <Div> + CSS: This technique can be adopted for a start. But if used in 
                combination with Low Res Technique with watermark or copyrights 
                attached can offer better protection. This can be done in more than one 
                ways.
                 a. Single Div with transparent image and css. 
                     Styles are added inline for reference purposes only. They should be added to a separate css file. 
                    <html>
                       <style>
                             #OuterDiv
                                   {
                                     background-image: url('tulips.jpg');
                                     height: 50%;
                                     -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -o- 
                                     user-select: none; user-select: none; 
                                     }
                        </style>

                        <div id="OuterDiv">
                          <img src="transparent.jpg"/>
                        </div>
                       </html>

                 b. Single Div with CSS

                     This will not let the user download the image. The styles should be 
                     put into a separate css file. Styles are added inline for reference purposes only.
                     <html>

                       <style>
                             #OuterDiv
                                   {
                                     background-image: url('tulips.jpg');
                                     height: 50%;
                                     -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -o- 
                                     user-select: none; user-select: none; 
                                     }
                        </style>

                        <div id="OuterDiv">                          
                        </div>
                       </html>

                 c. Two Divs with Css
                     This technique will dim-out the underlying image on hover by adding an extra div to 
                     add contrast. If the user tries to make a screen capture while 

                     hovering over the image, the image will be dimmed out, so that the user does not
                     get a clear image. The drawback of this technique is the image is 
                     dimmed only when the user hovers the mouse pointer over it. The 
                     work around for this would be to use javascript to capture keycodes 
                     that are used to make a screen capture and produce a dim image. 
                     Eg: In Windows, Print Screen key or Windows + S key and so on. I 
                           cannot add it all to the following sample as it would make the 
                           sample code too large.
                     <html>

                       <style>
                             #OuterDiv
                                   {
                                     background-image: url('tulips.jpg');
                                     height: 50%;
                                     -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -o- 
                                     user-select: none; user-select: none; 
                                     }

                             #InnerDiv
                                     {
                                       background-color: transparent;
                                       height:100%;
                                       -webkit-user-select: none; -khtml-user-select: none; -
                                       moz-user-select: none; -o-user-select: none; user-select: none; 
                                       position:relative;
                                      }


                              #InnerDiv:hover, #OuterDiv:hover
                                     {
                                        background-color: rgba(65, 65, 61, 0.91);

                                     }
                        </style>

                        <div id="OuterDiv">
                            <div id="InnerDiv"/></div>                          
                        </div>
                       </html>
                   
                 d. Using <Table> tag and Css
                     <html>
                       <style>
                             #OuterDiv
                                   {
                                     background-image: url('tulips.jpg');
                                     height: 50%;
                                     -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -o- 
                                     user-select: none; user-select: none; 
                                     }
                        </style>

                        <table id="OuterDiv">
                           <tr>
                               <td>Some text here. Just to view the table with its background image</td>

                          </tr>
                        </table>
                       </html>

             I'm sure many more combinations are possible. The css image url can be encoded for additional protection. 
             I have not tried this way, but would like to give it a go.

  • Prevent search engines from indexing images on your website
          You can add a specification in the meta-tags to prevent search bots 
          from crawling images in your site. We made use of this and 
          robots.txt in our BE project while implementing a Web Crawler and mini 
          search engine. Robots.txt understanding is not in current scope as it is a 
          separate topic in itself. In short, robots.txt tells a crawler which pages and 
          what content of your site can / should not be indexed. 
          1. Using meta-tags
             <meta name="robots" content="noimageindex"></meta>

          2. Using Robots.txt
              Add the following in Robots.txt
              User-Agent:*
              Disallow:/images/
              Disallow:/tulips.jpg

  • Copyrights
          You can copyright your content. This is one of the most common ways used.
          Ofcourse, image theft still occurs where you need to take curative measures. I find
          WHOIS particularly useful. There may be other resources as well to detect copyright infringes.

The most important fact is, the above techniques (there could be many more) should always be used in combination. Using a single technique will do little to help you from image thefts

Friday, 22 February 2013

"Add Web Reference" option not appearing in the solution Explorer

Folks, just came accross a weird issue. I'm not sure how many of you guys have hit it.

My projects target different versions of the .Net framework.
Each of them use both the conventional asmx webservices and the WCF.

One of the issues I stumbled upon today, was not able to find the "Add Web Reference" option in the context menu in the solution explorer.

My target framework is 3.5.
If any of you have faced similar issues, you can try out the following.

  • Right-Click on the project in Solution Explorer. Select Add Service Reference.
  • Click the "Advanced" button as shown below
          
          
          

Here you can find the conventional dialog to add web references.

If you face the reverse case, that is Not able to find the "Add Service Reference" option, you need to check that your project targets .Net Framework 3.0 or above. (Right-click your project -> Select Properties)