My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping @Yeyhi.com

Pages










Showing posts with label list. Show all posts
Showing posts with label list. Show all posts

Saturday, January 14, 2023

Few Jokes on Unix Operating System and its functionalities *

I remember i wrote a joke on UNIX users a few years back in one of the blog. I was also sharing this with my colleagues in different offices i worked in. Few friends back there in Adobe system and Symantec used to love these kind of jokes. So i thought few more jokes that i have invented (or discovered or written ☺) since then.


The first one is:

Question - Why did the man using UNIX spend all day at the terminal?

Answer - Because he couldn't figure out how to use the "vi" command to exit!

This was a joke because of similar sound of bye and vi especially in some parts of the world.


Question - Why did the man using UNIX always wear sunglasses?

Answer - Because he was always 'ls'-ing in the sun!

Now this used the similarity between the word 'lying' and 'lsing'


Question - Why did the UNIX user wear a tie to the beach?

Answer - Because he wanted to be "root" in the office and "user" at the beach.


Question  - Why did the UNIX user put his computer in the freezer?

Answer - Because he wanted to "cool down" his "system".


Question  - Why did the UNIX user stare at the black screen for hours?

Answer - Because he was trying to "cat" the manual!


Please note that these are just jokes and should not be taken seriously. Unix users are just like any other group of people and should not be stereotyped or discriminated against based on their profession or preferences.

PS: The first of my such joke appeared here in 2013 - https://www.w3lc.com/2013/05/checking-file-system-directory-size-in.html



Tuesday, September 29, 2020

Find version of Modules using PIP : Python Installation manager

Use pip list to list all packages and their versions. You can pipe it to grep to search for the package your interested in:

pip list | grep sympy

Alternatively to get all information about that package including version you can use pip show:

pip show sympy

To upgrade it's simply:

pip install --upgrade sympy

If you need write permissions to your python installation directory don't forget to prepend the pip install command with a sudo: e.g. sudo pip install --upgrade sympy

** With latest Python, you might need to replace pip with pip3 command.

Monday, February 4, 2013

Pothi: The Book Advisor


Pothi.org is a free book consulting organization for everyone from majftech.com and it can be used for any purpose.
Get Tax and Medical Benefits
We present to you the list of books that we consider a must read for all. We know that different people have different tastes, and our books range from fiction to technology and from hatred to love. Our editor takes pain to list and come up with the best books every month.
Presently we are in expansion plans and we need help. The website is on Sale too!

And Now, there is a Free Web App on Android market too!.
View ultimate Photo Printing and Camera Options
The App suggests you what best to read. Presently, the list includes English, Hindi, Urdu, Russian, French, and the latest buzz books.

Saturday, November 24, 2012

Python - Tuple Vs List - Difference/ Comparison


Tuples and Lists have always attracted the learners of Python. And, to the most of employers, the difference between them still maintains favoritism. Searching over the Internet gives you the distinction between them, but to many the language used all over seems to not help much. And worse part is that, not all the differences have ever been published at one place. And the worst of all, sometimes technical slangs have been used, with no direct meaning or examples to make it clear.

Let me start with a very brief introduction to what these Datatypes are about. Following description of List and Tuple is an excerpt from my "How To Tame Python" guidebook.

List is one of the most helpful and versatile data type available in Python. A list contains several items separated by commas. The items are enclosed within square brackets ([]). The list comes with built in functions which can be used to add, delete, edit contents in a list. Any subset of a list returned is also a list. Also note that like strings here also the Index starts from 0 and goes to the Length of the list minus 1.
A typical list can be as simple as :
list=[2,4,8,16,32], or
list2=['how','to','tame','python'], 
Or it can be a mix of datatypes for eg.
list3=[1,'january',2.23,-3]

Tuple again is a data type that is similar to the list. However, elements of a tuple are enclosed within parentheses. [Remember elements in a list were enclosed in square paranthesis]. It is important to mention that a Tuple is a read-only list. Any subset of a tuple returned is also a tuple. Also note that like strings, and list, here also the Index starts from 0 and goes to the Length of the tuple minus 1.
Eg. tup1=(12,'leo',23.45)


After completing my "How To Tame Python" guidebook, addressing this issue was the most immediate task. I am thankful to the memories of my sweetheart, while she was away, that kept me awake till night and motivate me in finding out the real differences. I actually programmed and validated each statement I said below. There are differences in Tuples and a List. I have discussed them in following classes of distinctions. So, here comes the difference between Tuples and List in Python.

Class A:  Usage difference due to Runtime difference 
Tuples are Immutable. 'tuple' object does not support item assignment
Because they are immutable, a Tuple can be used as a Key in a Dictionary.
There may be a slight performance improvement in Tuple.
For eg.
Allocation in a book can be a combination of a page number and line number, eg (x,y)
Similarly, your gps coordinates can be (x,y)
It is a tuple because these things are immutable. As soon as either x or y changes, the meaning itself changes.
And now, some short notes can be added to these locations using a dictionary.

Class B:  Difference in what they mean due to Semantic difference
Tuples are hetrogenous data structure, while lists are homogenous. There is a semantic difference too. Tuples have structure, while lists have order. Tuples (generally) are sequences of different kinds of stuff, and you deal with the tuple as a coherent unit. But, Lists (generally) are sequences of the same kind of stuff, and you deal with the items individually.
Eg 1.
Consider the following two data structures:
>>> time.localtime()
(2012, 3, 7, 11, 45, 38, 2, 33, 0)
>>> range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
The first one, a tuple, is a sequence in which position has semantic value. The first position is always a year. This tuple functions as a lightweight record or struct. The second one, a list, is a sequence where we may care about order, but where the individual values are functionally equivalent.
Eg. 2
Consider example of the simultaneous use of both types. If you look the Python Database API fetchmany() method, you will see that it returns the result of any query as a "List of Tuples". The result set as a whole is a list, because rows are functionally equivalent (homogeneous). There is only a order, and no importance which row is what. But the individual rows are tuples, because rows are coherent, record-like groupings of (heterogeneous) column data. We know that first element means what and second elements mean what, and so on.


Class 3:  Usage as Enum or Stuct because of namedtuple() method

This difference becomes more visible as soon as you read about namedtuple in Python
Named tuples assign meaning to each position in a tuple and allow for more readable, self-documenting code. They can be used wherever regular tuples are used, and they add the ability to access fields by name instead of position index. Named tuples are especially useful for assigning field names to result tuples.
Syntax:
collections.namedtuple(typename, field_names, verbose=False, rename=False)
It Returns a new tuple subclass named typename. The new subclass is used to create tuple-like objects that have fields accessible by attribute lookup as well as being indexable and iterable.
Eg.
EmployeeDetail = namedtuple('EmployeeDetail', 'id, name, age, job, department, paygrade,address')


I have realized these differences after years of coding and using Python. Many of the differences, were always in sub-conscious mind and never came out. It was only when I was completing my "How To Tame Python" guidebook, that the idea of documenting the differences came to my mind. And, after this has been done, I was more than glad to find out that this is the best article over this subject. I have been informed by my friends and readers across the globe that they have found this article very helpful in their projects, understanding the Python, and their Job interviews.

You can also send me your feedbacks on this blog, or to my personal email id: Toughjamy@Yahoo.com
--Mohd Anwar Jamal Faiz

Wednesday, July 13, 2011

Facebook Friend Collage thumbnail pictures

I have found a hidden [actually not so advertised and well known] Facebook feature. It is the ability to view your friends as a grid of profile pictures.

Here's how to make it happen:

1: Log in to your Facebook account.
2: Click the Friends tab.
3: Select the drop-down box. Choose list separator indicated by (-) or grid option there.

Visual Help: Checkout the screenshot. Click on image to enlarge it.



Result:
You shall get a good collage of your entire friends list. The thumbnails photos are arranged in a grid fashion.

Thursday, February 17, 2011

Microsoft Useful Apps and Powertoys for Windows

I am listing some of very important utilities that Microsoft shares with people. These can be very useful in day to day job. Some of the tools are also reffered as PowerToys by Microsoft. (And some of the contents are directly fro Microsft website!!)

WinDbg is a tool for debugging any Crash in a program. This tool automatically syncs up the required pdb files ie. The symols file from the MSDN and enables your machine to debug the problems. Refer http://http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx You can have a dump of your crash and investigate, or contact your administrator. In addition, you can also log a radar (defect/bug) on the Microsoft. (Also See http://en.wikipedia.org/wiki/WinDbg)

ClearType Tuner: Dramatically improves font legibility on some LCD screens. For more details over this see http://www.microsoft.com/typography/cleartype/tuner/tune.aspx

Image Resizer: This tool adds a new menu when you right-click a photo on your PC. Just click Resize Pictures to change an image's dimensions without opening an editor. (You may even try this tool to test how your photo looks in your Splash Profile at MeOnShow.com

CD Slide Show Generator: With this PowerToy you can view images burned to a CD as a slide show. The Generator works downlevel on Windows 9x machines as well.

Virtual Desktop Manager: Manage up to four desktops from the Windows taskbar with this PowerToy.

Taskbar Magnifier: Use this PowerToy to magnify part of the screen from the taskbar.

Tweak UI: If you don't already have Tweak UI, get it. This essential OS tweaking tool offers more granular control over your privacy settings and operations, and even over the way you log in to your PC (plus much more). It should be one of the first things you install on any new computer.

Alt-Tab Replacement: Adds previews of each page when you switch between open applications using -.

SyncToy: Improves the task of synchronizing files among multiple machines, especially compared with Windows Briefcase.

These tools can really help incrrease your productivity!!
[not reproductivity ;)lol]