Thursday, November 26, 2020

U Mobile: How To Claim Free Daily 1Gb data 2020

U Mobile: How To Claim Free Daily 1Gb data 2020

Government/MCMC requested all mobile network to provide free 1gb daily to their users, during the COVID-19 time, until 31 December 2020.

Started from 26 November 2020, U Mobile need users to claim the free daily 1gb data manually via SMS or MyUMobile App.

SMS: Send FREE1GB to 28111

MyUMobile App: Add-Ons > Bonus > Free 1Gb/24hours (available soon)

The free data is available for 24 hours from the time of redemption.

Seems like users need to redeem the free data manually everyday. Earlier it is automatically debit into U Mobile account. I am not sure why, this is just 1 step backward.

Refer to the FAQ.

U Mobile Free 1Gb High-Speed Data COVID-19

U Mobile Free 1Gb High-Speed Data COVID-19

Government/MCMC requested all mobile networks to provide 1Gb of mobile data to all users free of charge during COVID-19 period, until the end of December 2020.

There are 2 things I want to talk about regarding the free 1Gb high-speed data availability for the U Mobile network. I received an SMS today from U Mobile, they required the users to claim the free 1Gb through U Mobile App, just like what Maxis are doing. This was required starting from 26 November 2020. (refer here)

Currently the free 1Gb data will be credited to the U Mobile network users account automatically. I give U mobile a LIKE for this feature (after compare with Maxis). Too bad, U Mobile now joined Maxis move.

I can understand that mobile network operators encourage all users to use their mobile app, but not all users are familiar with the app especially the seniors. If the mobile app is easy to use, for sure more people will use it. Why make it so difficult for the users to do an extra step everyday?

The other thing that I want to complain about is the priority using the mobile network data. I have my monthly quota and the free 1Gb data everyday. The system should use the high-speed data that expires daily as priority, rather than using my monthly data. It makes no sense for the free 1Gb high-speed data.

Wednesday, November 11, 2020

Python Lambda Function

Python Lambda Function


What is a Lambda function?


Lambda function is an anonymous function with 1 line expression.


format: lambda <parameters> : expression


A simple example:
> lambda x : x
⇒ function lambda


This function is same as:

def same(x):
    return x

This function just return the parameter pass in to the function.

Access lambda function without a function name:
> (lambda x:x)(5) ⇒ 5

Exercise


How to convert the following function to lambda?

def square(n):
    return n*n

> square= lambda n : ???
> square(5) ⇒ 25

List order with lambda


> fruits=[('apple',3),('orange',2),('lemon',1)]
> sorted(fruits)
⇒ [('apple', 3), ('lemon', 1), ('orange', 2)]

How to sort by order of the id at the back?

> sorted(fruits,key=fruit_order)
def fruit_order(item):
    return item[1]  # return the id of the fruit

Can use a lambda function to replace the fruit_order() function.

> sorted(fruits,key=lambda x:x[1])
⇒ [('lemon', 1), ('orange', 2), ('apple', 3)]

Wednesday, November 04, 2020

Python and Growl

Python and Growl



Growl is an open source notification software for Mac OS, long before Mac OS has its own Notification Center. When Growl was put on the App Store, it was not free anymore. It is now free for download again, most likely Mac OS already has a Notification Center, Growl is not important anymore.

Since Growl has been around the market for quite some time, the protocol is simple but useful. Other than C, Java library for Growl, Python has a library support to send notification messages to Growl as well. You can forward the message from Growl to Notification Center.

This is how you can send notification message from Python
$ pip install gntp # gntp, Growl Notification Transfer Protocol

If you have python 2 and 3 installed, and you want to use Python3:
$ pip3 instaall gntp
$ python3 -m gntp.notifier # testing

You should see the message displayed. If not, start the growl app and try again.