Saturday, November 18, 2017

Conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value

Solution:
"The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value" with Entity Framework when calling SaveChanges.

Go into your EDMX file, select the field that is causing the error and set StoreGeneratedPattern to Computed.








Add the DatabaseGenerated attribute if you are using EF Code First:

[DatabaseGenerated(DatabaseGeneratedOption.Computed)]

public Nullable<System.DateTime> Created { get; set; }

Tuesday, November 14, 2017

Clearing Your Browser Cache

Notes:
If you don't see instructions below for your specific version or browser, search your browser's Help menu for "clear cache". If you're unsure what browser version you're using, from the Help menu, select About [browser name]. In Internet Explorer and Firefox, if you don't see the menu bar, press and release Alt.
When troubleshooting issues with any web site, after clearing your browser's cache and cookies, exit your browser completely before attempting to access the site again. In Windows, close all your browser windows; in Mac OS X, quit (Command-q) your browser.

On this page:

About cache, cookies, and history
Android
Chrome
Firefox
Internet Explorer 9 and 8
Mobile Safari for iPhone OS (iPhone, iPod touch, iPad)
Safari

About cache, cookies, and history

Each time you access a file through your web browser, the browser caches (i.e., stores) it. By doing this, the browser doesn't have to retrieve files and images from the web site each time you click Back or Forward.

A cookie is a file created by a web browser, at the request of a web site, that is then stored on your computer. These files typically store user-specific information such as selections in a form, shopping cart contents, or authentication data.

A browser's history is a log of sites that you visit. When you press a browser's Back button, you are moving back one entry in the history log.

Android

Start your browser.
Tap Menu, and then tap More.
Select Settings.
Under "Privacy settings", select Clear cache, Clear history, or Clear all cookie data as appropriate, and then tap OK to accept (or Cancel to cancel) the deletion.

Chrome

In the browser bar, enter: chrome://settings/clearBrowserData
Select the items you want to clear (e.g., Clear browsing history, Clear download history, Empty the cache, Delete cookies and other site and plug-in data).
From the Obliterate the following items from: drop-down menu, you can choose the period of time for which you want to clear cached information. To clear your entire cache, select the beginning of time.
Click Clear browsing data.

Firefox

From the Tools or History menu, select Clear Recent History.
If the menu bar is hidden, press Alt to make it visible.
From the Time range to clear: drop-down menu, select the desired range; to clear your entire cache, select Everything.
Click the down arrow next to "Details" to choose which elements of the history to clear.
Click Clear Now.

Internet Explorer 9 and 8

Click Tools, and select Delete Browsing History... .
Deselect Preserve Favorites website data, and select Temporary Internet files, Cookies, and History.
Click Delete.

Mobile Safari for iPhone OS (iPhone, iPod touch, iPad)

To clear cache and cookies:
From the home screen, tap Settings, and then tap Safari.
At the bottom of Safari's settings screen, tap Clear cookies and data, or Clear Cookies and Clear Cache. Confirm when prompted.

To clear history:
From the home screen, tap Safari.
At the bottom of the screen, tap the Bookmarks icon.
In the lower left, tap Clear.
Tap Clear History.

Safari

From the Safari menu, select Reset Safari... .
From the menu, select the items you want to reset, and then click Reset. As of Safari 5.1, Remove all website data covers both cookies and cache.


Reference Site: https://mso.harvard.edu/sp_clear_cache

Tuesday, September 5, 2017

Quickly create a dynamic drop down list in Excel

I have a request from friend to create a dynamic drop down list in excel and I would like to share with my blog reader...

Part  1: 
- Open Excel and we start by creating a defined name, 
- Select the Formulas Tab, then Define
- Enter "SomeRangeName" under the Name text box
- Enter =OFFSET(sheet1!$B$2,0,0,COUNTA(sheet1!$B:$B),1) under the Refers to text box

Note: You have to enter drop down items in single column you want here in above formula I have selected Sheet1 and column B, it will start filtering from Row B2.

Part 2:
To create a data validation list:

- Select the cell you want to show dropdown list eg. A1
- Select Data Validation under the Data Tab
- Select List under Allow
- Place the cursor in the Source text box and type formula "=SomeRangeName"

That's it.. now when ever you add items in "Column B" it will automatically populate in drop down list... 

Tuesday, August 22, 2017

Getting Geo-location with JSon and JQuery


$.getJSON("https://freegeoip.net/json/", function(data) {
    const countryCode = data.country_code;
    const countryName = data.country_name;
    const ip = data.ip;
    const timezone = data.time_zone;
    const latitude = data.latitude;
    const longitude = data.longitude;

    alert("Country Code: " + countryCode);
    alert("Country Name: " + countryName);
    alert("IP: " + ip); 
    alert("Time Zone: " + timezone);
    alert("Latitude: " + latitude);
    alert("Longitude: " + longitude);   
});
Credit goes to original coder..

Friday, July 28, 2017

LoVe MessAges


Can I say I love you today? If not, can I ask you again tomorrow? And the day after tomorrow? And the day after that? Coz I'll be loving you every single day of my life.

When all seems lost and lonely for you
And you dont really know what to do
Look inside your heart and see
There in a special place, I will be

Most wonderful pairs in the world are:-
HEART & BEAT
NIGHT & MOON
BIRDS & SONGS
ROSES & LOVE
U & UR $MILE.
SO KEEP $MILING ALWAYS.

Being near is not the meaning of being dear,
I may be far from u but msgs are bridges
2 make u feel that I always REMEMBER YOU!

It is not being in love that makes me happy... but is being in love with YOU that makes me happy.

A sMiLe tO pUt You On HiGh... A KisS To Set YoUr SouL ALriGhT... WouLd iT bE aLriGhT iF I spEnT ToNiTe BeiNg LovED bY YoU???

Fate has brought us together, to meet, to know and to part is the saddest thing in life... I Love You...


Curved high on a mountain covered in dew... I saw these 3 words... I LOVE YOU!

Is that love i see in your eyes, or merely a reflection of mine?

I hide my tears when I say your name,
but the pain in my heart is stil the same.
Though I smile and seem carefree,
there's no one who misses you more than me!!

Friday, July 14, 2017

Compare the Contents of Two Folders in Windows

This is a common problem with us, while we take the backup. We always create duplicate backup of backup... mean multiple backup for the same files.. as we don't know if that is already there or not.. so this is just a little trick to save some space by avoiding duplicate.. 

List the folder structure using TREE command:
TREE command can be extremely handy in this case. Suppose you want to compare the two folders (including file names) c:\SOURCE and c:\DEST, open a Command Prompt window and then type these commands:

d:\> TREE  D:\SOURCE /A /F >D:\SOURCE.TXT

d:\> TREE  D:\DEST /A /F >D:\DEST.TXT

This outputs each of the command results to separate text files in your d:\ drive’s root directory. The text files will have your directory structure in a tree format, which makes it easy for comparison work.

Quick Tip: To compare only the directories, remove the "/F" flag.

Next, fire up your text comparison utility like WinDiff, WinMerge or DiffMerge. Don’t have any of those? No problem! You can compare the two text files online via diffchecker.com.

Go to DiffChecker.com and paste the contents of d:\source.txt in one column, and D:\DEST.txt in another column. Click Find differences.

Enjoy little trick to same space in your disk...

Thursday, June 29, 2017

13 Japanese Diet Tips!

All Credit for the details goes to original writer, I am just adding to my blog for readers.

13 Japanese Diet Tips To Make You Healthier And Beautiful Both Inside And Outside!

The Japanese have the longest life span in the world with 86 years for women and 79 years for men. All of this is thanks to what they eat thus making the island nation with the lowest obesity rate (3%) in the developed world. "The Japanese diet is the iPod of food," says Naomi Moriyama, a dietician, "it concentrates the magnificent energy of food into a compact and pleasurable size."

1. Eat with your eyes
There's a proverb in Japan that literally translates as "Not dressing up the meal with color is like sending someone out of the house without clothes." Traditional Japanese meals use food items that are red, green, yellow, white and black in colour to give the food an aesthetic appeal and reflect the nature of the seasons. Compare a platter of sushi or a bento box to a hamburger and fries (although the latter is perceived as delicious and can be wolfed down) the former is a work of art that has to be appreciated like art. Go slow, take small bites, relish every flavour.

2. Smaller portions
Break down your meal into smaller portions, this way you can enjoy a greater variety of foods.

Scientists in the University Of Illinois found that people tend to eat up to 45% more when they are served bigger portions. They filled their plates according to it's size. So bigger the plate, larger the portion size.

Lesson learnt: Use dessert and salad plates.

3. Fill your stomach up to only 80%
Or Hara hachi bunme as it is said in Japanese. The idea is to reinforce the eating of smaller portions. We have been raised to eat until we are absolutely full so that we don't feel hungry later. However it's better to not stuff ourselves and only eat until we feel adequately full.

Yes you will feel hungry after a few hours but that's ok. It means lesser pressure on intestines and slowing down of the aging process of cells which can help to prevent cancer, heart attacks and diabetes.

4. Light dinner or supper
Following the 80% rule discussed above, a light dinner puts less pressure on your intestines and allows you to digest your food in your sleep. Heavy meals can sometimes make you wake up feeling full in the morning and this upsets your routine when you skip breakfast.

5. Rice is nice
Rice is a low fat complex carbohydrate that helps fill you up on lower calories (small bowl of rice has lesser calories than two slices of bread) This will not keep you hungry and craving for snacks right after your meal.

6. Eat more than 5 types of vegetables a day
Preferably of different colours if you are like a Japanese lady who has an OCD.

The Japanese incorporate about 4-5 types of vegetables in each meal which make up the major bulk. They are sometimes eaten raw as a salad or cooked in a broth which enhances its flavours. Stir fried vegetables taste delicious but sadly their nutrients are gone.

Warning! Avoid salad dressings which contain mayonnaise, opt for yoghurt based dressings or vinaigrettes and lemon juice.

7. Eat vegetables first
Now that you're sorted with vegetables being part of your meal and are ready to dig in, beeline for the veggies first!

Why? Your mom would say save the best for last, but the real reason is that vegetables absorb toxins that are already present. Vegetables are full of fibre and when you consume them first, this fibre helps to cover whatever is eaten after and inhibits insulin spikes and the speed at which sugar is transported into the blood.

Proteins are harder to digest when they are eaten first and everything else eaten after would take time making you feel bloated. Raw vegetables contain a digestive enzyme that helps break down proteins.

8. Replace red meat with fish
Japanese favourites like salmon, mackerel, fresh tuna, sardines and herring are a rich source of Omega 3 fatty acids which are known for their heart-health and mood boosting benefits. The island nation accounts for 2% of the worlds population but consumes 10% of the worlds fish.

9. Fermented foods
Fermented foods such as Yoghurt, dahi, Miso (fermented soy bean paste) and Tofu control high blood sugar levels. They support and strengthen immune and digestive systems, preventing diseases such as cancer.

Try to make fermented foods a part of your meal or consume them after you are done eating. A small bowl of dahi after an Indian meal works equally well.

10. Soy Products
When consumed in moderation, soy products like Tofu and Edamame beans which are rich in protein are a good vegetarian alternative for red meat as they have little or no saturated fat.

Recently, research has proven cows milk as not fit for human consumption as it causes the body to produce mucous. Healthier options are soy milk and almond milk. Soy milk contains vitamin B1, B2, B6 and E which helps to rejuvenate the skin and prevent acne breakouts.

It contains 8 essential amino acids and has a fair amount of protein.

11. Fresh Seasonal Fruit
Desserts in Japan are usually beautifully decorated plates with sliced fresh fruit of the season. Like vegetables, a variety of fruits should be eaten.
Remember to eat seasonal and local produce.

12. Tea is key
Green tea is low in calories and caffeine which makes it an excellent alternative to coffee and other creamy beverages. It aids digestion and the anti-oxidants it contains helps to clear the system of any toxins.

13. Indulge in moderation
The Japanese diet seems to be very strict and you might think its a routine for skinny supermodels, but there is always room to indulge. The Japanese love western sweets and dark chocolate but if you notice, they are very small.

Junk food is eaten once in a while and when it is, it is forgotten with healthy servings of broth, vegetables and green tea the next day.

Tuesday, June 27, 2017

Speak any Text

Example to create Speak vbs file.

Set voice = CreateObject("SAPI.SpVoice")
voice.Rate = 1
voice.Volume = 90
Say = InputBox("Say Something", "Say Something", "Hey !! how is going on...")
If (Len(Say) > 0) Then
    voice.Speak Say
End If


Thursday, June 15, 2017

Pen drive show empty even when data exists

A friend of my have problem with his pen drive, he was not able to see any folders or file even data was there. He scan with antivirus but no virus detected.
Use following command to see if folders or files got hidden somehow...

1) Go to command prompt using "cmd" command 
2) Type command "attrib -h -r -s /s /d e:\*.*"

Note: "e:" is the pendrive folder.

Wait for few seconds, and you will get your files and folder visible.

Monday, April 24, 2017

What the 'Win' Key Does - Shortcuts!

You might think that the little windows or ‘win’ key  on your keyboard only has one function – to bring up the start menu – but it in fact can be used in conjunction with other keys for a vast number of simple shortcuts. These ‘win’ key  shortcuts will save you those precious minutes and help you perform tasks you never knew you could with your PC.
Enjoy the following listed shortcuts, according to alphabetical order.


  1. Win — opens the Start Menu (but in Windows 8.1 it opens the previous window)
  2. Win + A — opens Windows 10’s Action Center
  3. Win + B — chooses the first icon in the Notification Area (then use the arrow keys to switch icons)
  4. Win + Ctrl + B — switches to a new message in the Notification Area
  5. Win + C —brings up the Charm Bar (in Windows 8 and 8.1). In Windows 10 it opens Cortana
  6. Win + D — shows the desktop and minimizes all windows
  7. Win + E — opens Windows Explorer. In Windows 10 opens Quick Launch
  8. Win + F — starts ’Find files and folders’
  9. Win + Ctrl + F — opens ’Find computers’
  10. Win + G — brings all gadgets to the foreground (in Windows 7 and Vista); opens Windows 10’s Game bar
  11. Win + K — opens a new Start menu (only Windows 8 and 8.1)
  12. Win + L — changes user or can lock the workstation
  13. Win + M — minimizes all your windows
  14. Win +  Shift + M — restores windows that have been minimized
  15. Win + O — locks device orientation (and disables gyroscope function on tablets);
  16. Win + P — switches operating modes to an outside monitor or projector
  17. Win + Q — opens Search charm for installed apps (in Windows 8)
  18. Win + R — opens the ’Run dialog’ box
  19. Win + T — opens the Taskbar
  20. Win + U — opens the Utility Manager
  21. Win + W — opens Windows Ink Workspace
  22. Win + X — opens the Windows Mobile Application Center (only mobile computers in Windows Vista and 7);
  23. Win + Y — starts Yahoo! Messenger
  24. Win + Pause — opens My Computer
  25. Win + F1 — opens Windows Help
  26. Win + 1 ... 0 — runs or switches to the program pinned to the Taskbar with a specific sequence number 
  27. Win +  Shift + 1 ... 0 — starts a new program pinned to the Taskbar with a specific sequence number 
  28. Win + Ctrl + 1 ... 0 — switches to the last active window of the program that’s pinned to the Taskbar with the specific sequence number 
  29. Win + Alt +1 ... 0 — opens the transitions list for the program pinned to the Taskbar with the specific sequence number 
  30. Win + ↑ — maximizes the active window
  31. Win + ↓ — restores the default window size or minimizes active windows
  32. Win + ← or → — switches the window deployment mode
  33. Win +  Shift + ← or → — switches a window between monitors in multi-monitor set-ups 
  34. Win +  Shift + ↑ or ↓ — stretches the active window from the top to the bottom of the screen and restores the window size
  35. Win + Home — minimizes or restores all non-closed windows, except active ones (only Windows 7), goes to the top of the web page
  36. Win + Space — looks at the desktop (only Windows 7). Changes the layout (only Windows 8 and 10)
  37. Win + + — activates the Magnifier Utility or zooms the image by 100%
  38. Win + — — if the Magnifier Utility is active, the image is reduced by 100%
  39. Win + Esc — disables the Magnifier Utility
Fill free to add more shortcuts, I know there are many more !!

Tuesday, April 18, 2017

Set Password to multiple Excel file in current and subfolder

' Code to add Password to Excel file.
' Note: This will set password to non-password without prompting, but the file already have the password will get prompt to enter old password before it set new one.

Public Sub addPassword()
    Dim FSO As Object
    Dim folder As Object, subfolder As Object
    Dim wb As Object

    Set FSO = CreateObject("Scripting.FileSystemObject")
    folderPath = ActiveSheet.Range("A1").Value ' you can hardcore the path or put it in the cell
    pwd = ActiveSheet.Range("B1").Value ' you can hardcore the password or put it in the cell

    Set folder = FSO.GetFolder(folderPath)
    
    With Application
        .DisplayAlerts = False
        .ScreenUpdating = False
        .EnableEvents = False
        .AskToUpdateLinks = False
    End With
    
' loop to get root files of the mention folder path..

    For Each wb In folder.Files
        If Right(wb.Name, 3) = "xls" Or Right(wb.Name, 4) = "xlsx" Or Right(wb.Name, 4) = "xlsm" Then
            Set masterWB = Workbooks.Open(wb)
            ActiveWorkbook.SaveAs Filename:=Application.ActiveWorkbook.FullName, Password:=pwd
            ActiveWorkbook.Close True
        End If
    Next

' following loop is used to get files from "n" numbers of subfolders... 

    For Each subfolder In folder.SubFolders
        For Each wb In subfolder.Files
            If Right(wb.Name, 3) = "xls" Or Right(wb.Name, 4) = "xlsx" Or Right(wb.Name, 4) = "xlsm" Then
                Set masterWB = Workbooks.Open(wb)
                ActiveWorkbook.SaveAs Filename:=Application.ActiveWorkbook.FullName, Password:=pwd
                ActiveWorkbook.Close True
            End If
        Next
    Next
    With Application
        .DisplayAlerts = True
        .ScreenUpdating = True
        .EnableEvents = True
        .AskToUpdateLinks = True
    End With
End Sub


Thursday, April 13, 2017

Fix Out of Sync Audio in VLC with a Keyboard Shortcut

I was watching movie, on VLC player,  and there was problem with video and voice sync. I have found some shortcut on internet that fix my problem, and here I am sharing with you too.

A very simple keyboard shortcuts to fix this problem. While you're watching the video, just press the J or K keys to move the audio back or forward 50 milliseconds, respectively. Quick, easy, and no advanced fiddling required.

Wednesday, March 1, 2017

Add Notepad Application to the Windows Desktop Right-Click Menu

Copy following lines into notepad and save with .reg extension


Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\Notepad]
[HKEY_CLASSES_ROOT\Directory\Background\shell\Notepad\command]
@="\"C:\\Windows\\System32\\notepad.exe\""