Monday, May 27, 2013

How to Turn Off Thumbs.db From Appearing?

The auto creation of Thumbs.db files in folders with images can get annoying. Before burning photo albums into DVD-R, I often have to go around searching and deleting such files. This can also get annoying for web developers using version control software e.g. TortoiseGit and TortoiseSVN.

Eh .. Sometimes, deleting these files can get the "file is in use and cannot be deleted" prompt. Very annoying.

So what exactly is Thumbs.db? As quoted from Wikipedia,

On Microsoft Windows operating systems, starting with the IE4 Desktop Update for Win95/98, a thumbnail cache is used to store thumbnail images for Windows Explorer's thumbnail view. This speeds up the display of images as these smaller images do not need to be recalculated every time the user views the folder.

Yes we know the purpose of Thumbs.db but what if we still wish to turn off Thumbs.db from appearing? There is a way to do it by tweaking a setting on the Local Group Policy Editor.

  1. From the Start Menu, click Run option. Or, you can use Win+R keyboard shortcut.

  2. Type gpedit.msc and hit ENTER key. This will launch the Local Group Policy Editor.

  3. Navigate to User Configuration > Administrative Templates > Windows Components > then either Windows Explorer (Windows Vista/7) or File Explorer (Windows 8).

  4. Look for "Turn off the caching of thumbnails in hidden thumbs.db files" key and double click on it.

    Local Group Policy Editor
  5. Select Enabled and click OK.


» How to Switch Off the Thumbs.db Image Cache File in Windows | Sitepoint

Sunday, May 26, 2013

MSSQL: Generate Random String Using SQL

The following will generate a random fixed-length string using SQL. Simply pass in a string of accepted characters and the length of the random string to be generated.

IF ISNULL(object_id('cspRandomString'),0)<>0 DROP PROC cspRandomString
IF ISNULL(object_id('fnGenRandomInteger'),0)<>0 DROP FUNCTION fnGenRandomInteger
GO
CREATE function fnGenRandomInteger(@MinValue int, @MaxValue int, @Seed float)
returns int
as
begin
-- =============================================
-- Author:        Loh Hon Chun
-- =============================================
 return ((@MaxValue + 1) - @MinValue) * @Seed + @MinValue
end
go
CREATE procedure cspRandomString (
 @Result varchar(255) output,
 @AcceptedChars varchar(255),
 @Length int
)
as
begin
-- =============================================
-- Author:        Loh Hon Chun
-- =============================================
 set nocount on

 declare @ret char(255)
 declare @i int, @pos int
 
 set @Result = ''
 set @i = 0

 if LEN(@AcceptedChars) > 0
 begin
  while @i < @Length
  begin
   set @pos = dbo.fnGenRandomInteger(1, LEN(@AcceptedChars), RAND(CONVERT(VARBINARY, NEWID())))
   set @Result = @Result + CAST(SUBSTRING(@AcceptedChars, @pos, 1) AS VARCHAR(1))
   set @i = @i + 1
  end
 end
end
go

declare @result varchar(255)
declare @acceptedChars varchar(255)
declare @length int

set @acceptedChars = '0123456789'
set @length = 7
exec cspRandomString @Result=@result output, @AcceptedChars=@acceptedChars, @Length=@length
print @result
go

11 tips for developing a mobile app that users will love

An article on The Next Web lists out 11 tips for developing a mobile app that users will love.

  1. Testing is key
  2. Go Deep With Your Users
  3. Plan for the Offline Experience
  4. Design With Ease of Use
  5. Make It Stupid Simple
  6. Tailor Your Design
  7. Use Grids
  8. Cover as Many Platforms as Possible
  9. Don't Forget the Importance of Convenience
  10. Emulate the Real World
  11. Pick One Thing and Nail It

Stop Windows from Restarting Your Computer After Windows Update

Almost always, Windows will always show the "your computer is going to restart in 15 minutes ..." prompt every time Windows Updates is performed. This can get annoying especially when the update setting is set to auto download and update. So I can we make the annoying prompt not to show?

The following fix should apply to both Windows 8 and 7.

  1. Open your registry editor by typing regedit from your Start Menu → Run box.
  2. Navigate to key HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU. Many may see up to \Windows level. In that case, you will need to create new keys for \WindowsUpdate and \WindowsUpdate\AU.
  3. Now, create a new DWORD (32-bit) value NoAutoRebootWithLoggedOnUsers under the AU key. Give it a value of 1.
  4. Reboot your machine and you are done.

NOTE: It is still your responsibility and is definitely recommended to reboot whenever you are ready to so the updates can be applied completely.

» Stop Windows from Restarting Your Computer After Updates | LifeHacker

Thursday, May 09, 2013

What to look out for for responsive adaptable web design?

An article on the Smashing Magazine website - How Much Has The Web Really Changed? discusses what has changed for the past one decade or so in web development. A lengthy but easy-to-read article.

Up until not so long ago, we used to base our designs on some rather general assumptions about screen size and input type. With the rise of devices with various screen sizes and alternative ways to interact, these assumptions have turned out to be unreliable. We need to upgrade the defaults that we use when we start designing our websites.

Sunday, May 05, 2013

Google Doodle for Malaysia On Polling Day 2013

Google doodle for Malaysia as the Malaysians go to the poll today.


GS1 Prefix List - How to Determine Origin of Food From Barcodes?

Do you know that it may be possible to determine the country where a food product is manufactured bought from a supermarket by reading the barcodes on the package itself? However, do note that the barcodes do not provide identification of country of origin for a given product though hopefully the manufacturer can put our mind at ease if certain countries are in our blacklist.

How to read the barcodes?
  1. Turn over the food product and look for the barcode.


  2. The first 3 digits of the barcode will reveal the GS1 Prefix.

  3. Tally with the list below to find out the country where the food product could have been manufactured at.

    GS1 Prefixes do not provide identification of country of origin for a given product. They simply provide number capacity to different countries for assignment from that location to companies who apply. Those companies in turn may manufacture products anywhere in the world.

    ASSIGNED GS1 PREFIXES
    000 - 019GS1 US
    020 - 029Restricted distribution (MO defined)
    030 - 039GS1 US
    040 - 049Restricted distribution (MO defined)
    050 - 059Coupons
    060 - 139GS1 US
    200 - 299Restricted distribution (MO defined)
    300 - 379GS1 France
    380GS1 Bulgaria
    383GS1 Slovenija
    385GS1 Croatia
    387GS1 BIH (Bosnia-Herzegovina)
    389GS1 Montenegro
    400 - 440GS1 Germany
    450 - 459 & 490 - 499GS1 Japan
    460 - 469GS1 Russia
    470GS1 Kyrgyzstan
    471GS1 Taiwan
    474GS1 Estonia
    475GS1 Latvia
    476GS1 Azerbaijan
    477GS1 Lithuania
    478GS1 Uzbekistan
    479GS1 Sri Lanka
    480GS1 Philippines
    481GS1 Belarus
    482GS1 Ukraine
    484GS1 Moldova
    485GS1 Armenia
    486GS1 Georgia
    487GS1 Kazakstan
    488GS1 Tajikistan
    489GS1 Hong Kong
    500 - 509GS1 UK
    520 - 521GS1 Association Greece
    528GS1 Lebanon
    529GS1 Cyprus
    530GS1 Albania
    531GS1 MAC (FYR Macedonia)
    535GS1 Malta
    539GS1 Ireland
    540 - 549GS1 Belgium & Luxembourg
    560GS1 Portugal
    569GS1 Iceland
    570 - 579GS1 Denmark
    590GS1 Poland
    594GS1 Romania
    599GS1 Hungary
    600 - 601GS1 South Africa
    603GS1 Ghana
    604GS1 Senegal
    608GS1 Bahrain
    609GS1 Mauritius
    611GS1 Morocco
    613GS1 Algeria
    615GS1 Nigeria
    616GS1 Kenya
    618GS1 Ivory Coast
    619GS1 Tunisia
    620GS1 Tanzania
    621GS1 Syria
    622GS1 Egypt
    623GS1 Brunei
    624GS1 Libya
    625GS1 Jordan
    626GS1 Iran
    627GS1 Kuwait
    628GS1 Saudi Arabia
    629GS1 Emirates
    640 - 649GS1 Finland
    690 - 699GS1 China
    700 - 709GS1 Norway
    729GS1 Israel
    730 - 739GS1 Sweden
    740GS1 Guatemala
    741GS1 El Salvador
    742GS1 Honduras
    743GS1 Nicaragua
    744GS1 Costa Rica
    745GS1 Panama
    746GS1 Republica Dominicana
    750GS1 Mexico
    754 - 755GS1 Canada
    759GS1 Venezuela
    760 - 769GS1 Schweiz, Suisse, Svizzera
    770 - 771GS1 Colombia
    773GS1 Uruguay
    775GS1 Peru
    777GS1 Bolivia
    778 - 779GS1 Argentina
    780GS1 Chile
    784GS1 Paraguay
    786GS1 Ecuador
    789 - 790GS1 Brasil  
    800 - 839GS1 Italy  
    840 - 849GS1 Spain  
    850GS1 Cuba
    858GS1 Slovakia
    859GS1 Czech
    860 GS1 Serbia
    865GS1 Mongolia
    867GS1 North Korea
    868 - 869GS1 Turkey
    870 - 879GS1 Netherlands
    880GS1 South Korea
    884GS1 Cambodia
    885GS1 Thailand
    888GS1 Singapore
    890GS1 India
    893GS1 Vietnam
    896GS1 Pakistan
    899GS1 Indonesia
    900 - 919GS1 Austria
    930 - 939GS1 Australia
    940 - 949GS1 New Zealand
    950GS1 Global Office
    951GS1 Global Office (EPCglobal)
    955GS1 Malaysia
    958GS1 Macau
    960-969Global Office (GTIN-8s)
    977Serial publications (ISSN)
    978 - 979Bookland (ISBN)
    980Refund receipts
    981 - 983Common Currency Coupons
    990 - 999Coupons

Friday, May 03, 2013

Official Chrome Extension for Google Keep

Google has released an official Chrome Extension for Google Keep - a task keeping minimalistic app. The Chrome extension can only be installed from the link above i.e. you won't find the app from doing a search.

As quoted from the Google Drive blog post,
The Google Keep Chrome app launches in its own window, so you can create notes, cross out your to-do lists, and attach photos to tasks while you work on other things. And if you don’t have an internet connection, don't fret: the Chrome app works offline because we all know that ideas (big and small) can be sparked at any time.