Pages

Tuesday, November 21, 2017

AMDGPU/Radeon Graphics under Ubuntu 16.04

Ubuntu 14.04 had the proprietary AMD driver fglrx-core which was deprecated in 16.04 release. So if anyone upgrading from 14.04 to 16.04  needs to be aware about this. After the upgrade that driver might not be available. If it did left befind after the upgrade it would cause problems and it would crash from time to time due to incomparability. 

Users of Ubuntu 16.04 can use the open source version of the AMD driver.
So if you've previously installed the ATI binary/proprietary driver (a.k.a Catalyst/fglrx), you need to make sure it's fully purged before trying to use the open-source ati/radeon driver.

That can be archived by the flowing commands.

sudo apt-get remove --purge xorg-driver-fglrx fglrx*
sudo apt-get install --reinstall libgl1-mesa-glx \
                                 libgl1-mesa-dri \
                                 xserver-xorg-core

sudo dpkg-reconfigure xserver-xorg

 
source
 

For the most recent ATI/AMD graphic cards supported by the Radeon driver, DPM (Dynamic Power Management) should work automatically without additional steps. 

Instead if you notice overheating problems and/or you have an old Radeon HD graphic card, you can enable DPM by adding a boot parameter. This should greatly help power consumption, especially when idle. To do so, edit /etc/default/grub and add the 'radeon.dpm=1' to the GRUB_CMDLINE_LINUX_DEFAULT line, 

so it would look something like:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.dpm=1"

After you save/quit the text editor, update grub:

sudo update-grub

Monday, March 20, 2017

Using Windows Credential Store for Git to securely store multiple accounts


This tutorial assumes that the reader is familiar with basic usage of git.

Git will sometimes need credentials from the user in order to perform operations; for example, it may need to ask for a username and password in order to access a remote repository over HTTP.

It can be cumbersome to input the same credentials over and over. Git provides two methods to reduce this annoyance:

  1. Static configuration of usernames for a given authentication context.
  2. Credential helpers to cache or store passwords, or to interact with a system password wallet or keychain.

Authentication context.


Git considers each credential to have a context defined by a URL. This context is used to look up context-specific configuration, and is passed to any helpers, which may use it as an index into secure storage.

For instance, imagine we are accessing https://example.com/foo.git. When Git looks into a config file to see if a section matches this context, it will consider the two a match if the context is a more-specific subset of the pattern in the config file. For example, if you have this in your config file:

[credential "https://example.com"]
    username = foo

then we will match to as the context because,
     protocols are exactly matched "https"
     hostnames are exactly matched "example.com"

the above configuration can also be set by using command line using the following command,

git config credential.https://example.com.username foo

Note:
    If hostname is not used any configuration under it will applies to all credentials

Options for a credential context


  • helper

    The name of an external credential helper, and any associated options.
    If the helper name is not an absolute path, then the string git credential- is prepended.
   
    for example following configuration will match to  "credential-manager"
       
        [credential]
            helper = manager

    You can add the same entry using the following command.
        git config credential.helper manager
  • username
    A default username, if one is not provided in the URL.
  • useHttpPath
    By default, Git does not consider the "path" component of an http URL (eg: /foo.git) to be worth matching via external helpers. This means that a credential stored for https://example.com/foo.git will also be used for https://example.com/bar.git.
    To distinguish these cases, set this option to "true".


    You can add the entry using the following command.
git config credential.https://example.com.useHttpPath true

By using this option as true user can store multiple accounts/credentials for https://example.com.

eg:
https://example.com/foo.git  -> uses account foo
https://example.com/bar.git -> uses account bar


As previously mentioned Git has an internal interface for storing and retrieving credentials from system-specific helpers, as well as prompting the user for user names and passwords. The git-credential command exposes this interface to scripts which may want to retrieve, store, or prompt for credentials in the same manner as Git.

 Git Credential Manager for Windows (GCM)


The Git Credential Manager for Windows (GCM) is a credential helper for Git. It securely stores your credentials in the Windows Credential Manager so you only need to enter them once for each remote repo you access. All future Git commands will reuse the existing credentials.

For more info on how it works refer the official wiki.

This is a very secure method to store credentials in windows. This method is the recommended way to store credentials when using https protocol, over other alternatives such as storing the password in plain text in a config file.

2-factor authentication enable accounts can also use the GCM flow. in such cases the following procedure will be used.

  1.  Check to see if credentials existing in the Windows Credential Manager
  2.  If cached credentials aren’t found, the GCM will display a GitHub branded dialog asking for credential information.
  3. If authentication succeeds, the GCM creates a personal access token with read / write code permissions for the repo.
  4. The personal access token is stored in the Windows Credential Manager and used to perform the requests Git command.

Removing Credentials

To remove your stored credentials, launch Credential Manager (Control Panel -> User Accounts and Family Safety -> Credential Manager), find your account details and delete them.

Sunday, May 1, 2016

කුණු ලොරියේ න්‍යාය

එක්තරා පුද්ගලයෙක් දිනක් ටැක්සියක නැගී ගමනක් යන්නට පිටත් උනා. ටැක්සි රථයේ රියදුරා නිවැරදි ලෙස රථය පදවමින් සිටියා.
මේ අතර, අතුරු මාර්ගයක් ඔස්සේ මහත් හදිසියකින් මෙන් කළු පැහැති කාර් එකක් පදවමින් පැමිණි පුද්ගලයෙකු සැනින් එම කාරය ටැක්සිය ගමන් කරමින් තිබූ මාර්ගයට ඇතුළු කළා.
ටැක්සි රථයේ රියදුරු ඉතා අසීරුවෙන් තිරිංග පාලනයෙන් සිදුවීමට ගිය අනතුර අනු නවයෙන් බේරා ගත්තා.
වැරැද්ද තමන් අතේ තිබියදී, කාරය පදවා ගෙන පැමිණි පුද්ගලයා දැඩි කෝපයකින් යුතුව ටැක්සි රථයේ රියදුරුට ඉතා අසභ්‍ය වචනයෙන් බැන වදින්නට වුණා.
මෙය දුටු ටැක්සි රථයේ රියදුරා සිනා මුසු මුහුණින් අනෙක් රියදුරා දෙස බලා ඉතා මිත්‍රශීලී ලෙස අතක්ද වනා තම රථය ඉදිරියට පදවාගෙන ගියා.
මෙය දුටු ටැක්සියේ ගමන් ගත් පුද්ගලයා ඉතාමත් පුදුමයට පත් වී, තමා අතේ වරදකුත් නැතිව නිස්කාරනේ පරුෂ වචනයෙන් බැනුම් ඇසීමෙනුත් අනතුරව එසේ මිත්‍රශීලීව සැලකුවේ මන්දැයි විමසා සිටියා.

එවිට ටැක්සි රථයේ රියදුරා පවසා සිටියේ.
"අපි වටේ ඉන්න ගොඩක් අය හරියට නිකන් කුණු ලොරි වගේ, ඒ අය ඇවිදින්නේ, ගමන් කරන්නේ, හැසිරෙන්නේ කුණු කන්දල් ගොඩ ගහගෙන.
එයාලගේ ජීවිත වෛරය, කෝපය, බලාපොරොත්තු කඩවීම් වගේ කුණු ගොඩවල් වලින් පිරිලා. මේ කුණුගොඩවල් වැඩි වෙන්න වැඩි වෙන්න එයාලා බලන්නෙ ඒ කුණු කොහේට හරි හලන්න.
සමහර වෙලාවට ඒ කුණු හැලෙන්නෙ අපේ ඇඟට. ඉතිං අපි හිනහා වෙලා අත වනලා අපි අපේ ගමන යන එකයි හොඳම දේ.
මොකද අපි එයාල විසිකරන කුණු කර ගහ ගත්තොත්, අපි ඒවා හලන්නේ අපි එක්ක වැඩ කරන අයගේ, එහෙම නැත්තං අපේ ගෙවල් වල අයගේ ඇඟවල් වල. ඉතිං එහම කරන්න නං ඇයි අපි අනුන්ගේ කුණු ගොඩවල් කර ගහ ගන්නේ,..."

සාර්ථක මිනිසුන් කිසිවිටෙක අනුන්ගේ කුණු තමන්ගේ ඇඟේ හලන්නට ඉඩ දෙන්නෙ නැත.
අපිට ජීවත් වීමට ඇත්තේ ඉතාම කෙටි කාලයකි.
එම නිසා ඒ කාලය තුල, ඔබට ආදරය කරන්නන්ට ආදරය කරන්න.
ඔබට වැරදි කරන්නන්ට උපේක්ෂාව දක්වන්න.
ඉතිං....., ඔබත් මේ "කුණු ලොරියේ න්‍යාය" හොඳින් සිහියේ තබා ගන්න...

'බුදු දහම පරපුරෙන් පරපුරට'
තෙරුවන් සරණයි !!!

--- මුහුනුපොතෙන් උපුටා ගන්නා ලදී: මෙත්සිතුවිලි පිටුව

Friday, April 29, 2016

The Exponential Age


The key learning's from.the Singularity University summit as as follows.

In 1998, Kodak had 170,000 employees and sold 85% of all photo paper worldwide.
Within just a few years, their business model disappeared and they got bankrupt.
What happened to Kodak will happen in a lot of industries in the next 10 year - and most people don't see it coming. Did you think in 1998 that 3 years later you would never take pictures on paper film again?
Yet digital cameras were invented in 1975. The first ones only had 10,000 pixels, but followed Moore's law. So as with all exponential technologies, it was a disappointment for a long time, before it became way superior and got mainstream in only a few short years. It will now happen with Artificial Intelligence, health, autonomous and electric cars, education, 3D printing, agriculture and jobs. Welcome to the 4th Industrial Revolution.
Welcome to the Exponential Age.

Software will disrupt most traditional industries in the next 5-10 years.
Uber is just a software tool, they don't own any cars, and are now the biggest taxi company in the world. Airbnb is now the biggest hotel company in the world, although they don't own any properties.


 
Artificial Intelligence: Computers become exponentially better in understanding the world. This year, a computer beat the best Go player in the world, 10 years earlier than expected. In the US, young lawyers already don't get jobs. Because of IBM Watson, you can get legal advice (so far for more or less basic stuff) within seconds, with 90% accuracy compared with 70% accuracy when done by humans. So if you study law, stop immediately. There will be 90% less lawyers in the future, only specialists will remain.
Watson already helps nurses diagnosing cancer, 4 time more accurate than human nurses. Facebook now has a pattern recognition software that can recognize faces better than humans. In 2030, computers will become more intelligent than humans.

Autonomous cars: In 2018 the first self driving cars will appear for the public. Around 2020, the complete industry will start to be disrupted. You don't want to own a car anymore. You will call a car with your phone, it will show up at your location and drive you to your destination. You will not need to park it, you only pay for the driven distance and can be productive while driving. Our kids will never get a driver's licence and will never own a car. It will change the cities, because we will need 90-95% less cars for that. We can transform former parking space into parks. 1,2 million people die each year in car accidents worldwide. We now have one accident every 100,000km, with autonomous driving that will drop to one accident in 10 million km. That will save a million life's each year.

Monday, February 1, 2016

Photography Basics




If you’re a beginner photographer, it can be helpful to have a simple guide that helps you understand the different settings that you can toggle on your digital camera.

The three settings in this chart are part of what photographers like to call the exposure triangle.


The aperture is a structure in your lens that works much like the iris in our eyes. It opens and close to let more or less light in, and also changes the depth of field, or how many different objects can remain in focus in the shot at the same time.

Second is the shutter speed, which controls how much time the camera’s shutter remains open when taking a photo. A longer shutter opening will let in more light but may also cause blurring if any motion occurs while the photo is being taken.

Last one is the ISO which is the digital camera sensor’s sensitivity to light.




(source: http://www.boredpanda.com/photography-shutter-speed-aperture-iso-cheat-sheet-chart-fotoblog-hamburg-daniel-peters/)


Saturday, November 14, 2015

Docker Containerization


Docker is a tool that is designed to benefit both developers and system administrators, making it a part of many DevOps (developers + operations) tool chains. It is all about making it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.

In a way, Docker is a bit like a virtual machine. But unlike a virtual machine, rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel as the system that they're running on and only requires applications be shipped with things not already running on the host computer. This gives a significant performance boost and reduces the size of the application.


Saturday, August 1, 2015

MVC Architecture basic

 MVC Architecture basics

Fig 1. MVC overview


View Objects

View can be considered the presentation as the presentation layer thus a view object is an object in an application that users can see. A view object knows how to draw itself and can respond to user actions. A major purpose of view objects is to display data from the application’s model objects and to enable the editing of that data. Despite this, view objects are typically decoupled from model objects in an MVC application.


Model Objects

Model objects encapsulate the data specific to an application and define the logic and computation that manipulate and process that data. For example, a model object might represent a contact in an address book. A model object can have to-one and to-many relationships with other model objects, and so sometimes the model layer of an application effectively is one or more object graphs. Much of the data that is part of the persistent state of the application (whether that persistent state is stored in files or databases) should reside in the model objects after the data is loaded into the application. Because model objects represent knowledge and expertise related to a specific problem domain, they can be reused in similar problem domains. Ideally, a model object should have no explicit connection to the view objects that present its data and allow users to edit that data—it should not be concerned with user-interface and presentation issues.

Controller Objects

A controller object acts as an intermediary between one or more of an application’s view objects and one or more of its model objects. Controller objects are thus a conduit through which view objects learn about changes in model objects and vice versa. Controller objects can also perform setup and coordinating tasks for an application and manage the life cycles of other objects.


sources: https://developer.chrome.com/apps/app_frameworks