Saturday, November 12, 2016

Using tkinter in Netbeans 8.1

Environment


Operating System: Windows 10
IDE: Netbeans 8.1 using Jython 2.7 platform as Python plugin
I had also already installed Python 3.5.2 and its IDLE.

Background


I'm porting a friend's old code from Python to Java and had issues getting it to show me what it does. The code uses Tkinter (a Python interface for the Tk GUI toolkit) for its Graphical User Interface. The Tkinter library comes standard with official Python releases. The Python plugin for Netbeans however doesn't support Tkinter (at the time of publishing this post). This Netbeans plugin, developed by the nbPython community, uses Jython 2.7 as a platform, which would require usage of another GUI library.

Problem


I can run the old code with no issues when using the Python 3.5.2 IDLE but when I run the same code in Netbeans I get:
importError: no module named tkinter

It turns out that tkinter is used in a lot of Python courses so it was strange that, after a whole year of Netbeans 8.1 being officially released, nobody had posted a straightforward solution to this problem. Searches reveal that the problem is parked for later official plugin releases and, treated as a legacy coder's problem since everyone else is using more modern and advanced GUI libraries. The solution is however very simple and targeted at Netbeans newbies like myself.

Before trying my method, check if you're not facing the case sensitivity/renaming issue. A common problem people face is the change from Tkinter to all-lowercase tkinter between Python 2.7 and Python 3. It's all a case of RTFM really.

Solution


As in my case, you should have Python (besides the Netbeans Python plugin) installed already. Under the project's properties, change the Platform from Jython 2.7 to Python 3:



If you're changing platforms for the first time you're unlikely to find the Python 3 option in the Drop-down List. To add Python 3, click on “Manage” and then “Auto Detect” in the next dialog box. Netbeans will pick up your other Python installations.




Yes, that's it.

Friday, October 14, 2016

List of African Fake News Websites

africannewsupdates.com
buzznigeria.com
buzzsouthafrica.com
citysun.co.za
dailylive.co.za
dailytimes.co.za
dodgysaministers.com
eyenews.co.za
glonews360.com
hinnnews
hivisasa.com
howafrica.com
imzansi.co.za
livemonitor.co.za
mzansilive.co.za
mpasho.co.ke
nationalnewsbulletin.com
news24-tv.com
newsdaily.co.za
Newslo.com
pressgh.com
southafricainsider.co.za
southafricalatestnews.co.za
smithrise.com
spynigeria.com
theguard1an.com
times1ive.co.za
viroshare.com
yesiyesighana.com
zimbotoday.com
zimeye.net


Parody or news satire can be great entertainment tools. The problem starts when people spread it as gospel truth or when the producers become insensitive to the extent of announcing someone's "death".

I'm building a crowdsourced list of African fake news sites. The aim is not to take food off the website owners' table. I'm only hoping to increase awareness of news satire and for people to start sharing these "news" only for what they are.

Please help me to grow the list whenever you find any site that isn't listed. You can add it in the comment section below and I'll update the list.

This is also not about generating traffic to my blog. I just thought it would be useful for those who want a quick credibility check of source before sharing local "news". I often copy and paste the list into WhatsApp/Facebook groups when someone shares a link to a satirical article as credible source.

Friday, October 7, 2016

Just Credit The Source Man!

Social Media (lead by Twitter) recently went ablaze with a video of South Africa's globally renowned DJ Black Coffee slapping South African rapper AKA's manager. While the video went viral, its owner also dished out some virtual slaps in a different ring at two competitor media houses which shared the video without crediting them.











What got me interested in the story was that not only did one of the media houses not credit the source, they also removed all traces of the source (tags/logos) from the video. This amounts to stealing and goes against one of the most important ethics code followed by bloggers, vloggers, curators, etc : Prominently credit the original source.






Having spent some time doing Content Production myself, I've noted with dismay a number of these cases involving Africans. Our continent has a history of having our art stolen and often reproduced without any credit given to Africans. Should we even be discussing why we shouldn't steal from each other? I might be exaggerating by classifying the work we share on social media in the same category as African art, but do we really need to preach ethics in content sharing between African digital media startups?

Watermarks







I can understand why people would complain about Zkhiphani.com's watermark. I didn't see this in their videos, but I've seen how intrusive their watermark can be on their pictures. I see nothing wrong with the placement of their logo or tag in the corners of their videos, however their watermarks on pictures often run across the main subject and have prominence.

Global knowledge says we should apply our watermarks without being obtrusive. Obtrusive watermarks also affect the rate at which our content is shared. Some people don't like to share content that may seem to have too much advertising.

Some of the world's decorated photographers don't use watermarks, while the style and quality of their work identifies them. If we're failing to make our watermarks non-intrusive, we may need to explore other creative ways of identifying ourselves. As we've seen with yomzansi, our watermarks can be completely edited out anyway.

This watermark discussion entertains this idea of stealing. Just credit the source man!

Benefits of crediting the source


Crediting the source is flattering. Often, the content owner will retweet the tweet containing their credit. At the time of publishing, Zkhiphani.com had 63K Twitter followers while yomzansi had 33.1K. The opportunity of yomzansi reaching new followers from Zkiphani.com far outweighs the amount of work required to edit and share the content as their own.

I'm not sure if there was any beef between the 2 startups prior to this incident, but the crediting/flattering can also lead to building relationships and collaborations in the same industry. Compared to other continents we have far less consumers of our digital media. It gets worse when our content is focused on pop culture and entertainment for a specific African country. Being ethical, collaborating and sharing our networks in the African context can be more beneficial than the dirty games that come with traditional competition.

Just credit the source man!

Sunday, October 2, 2016

Why Net Neutrality In Afrika Is a Pipe Dream - The Internet Belongs To All Who Live In It

This article was originally posted on iAfrikan.

My first internet experience was through a school library PC in the 90s. I only knew of yahoo.com at the time and I was told that I could search for whatever information I wanted, including underground Hip Hop artists who wouldn't otherwise be featured on our main source of information at the time: Word Up! Magazine or The Source. This capability alone had me willing to spend a portion of profit from my Fireballs Candy business just to rent 15 minutes a day on the library PC.
Browsing through Yahoo was enough experience to get me hooked on this web of information. For most in Africa, first contact with the internet is through mobile phones and I assume as captivating, if not more, as my experience was. Accessing 3 websites of relevance is more than enough to get one hooked and wanting to surf more.
Unfortunately for Mme Xhanthi who lives off $1 a day, in an era where #dataMustFall is so serious a hashtag that it makes it all the way up to parliament, those few sites is where the road ends since she relies on zero-rated services like Free Basics by Facebook




Do you think Mme Xhanthi would give up the little experience she gets from the free access to these few sites, in the name of a concept such as Net Neutrality? The likes of Mme Xhanthi makes up the majority of the population of South Africa. Yet, a minority privileged techie group insists on deciding for this majority not to have this limited free access because they believe everybody's internet should be served on an all or nothing plate.
This is why the likes of Joe Mucheru (Cabinet Secretary of Kenya's Ministry of Information, Communications and Technology) say
“It’s like saying someone has no food, but if someone brings them bread we are not going to allow them to have the bread because they must have a balanced diet,”

I'm all for net neutrality. In fact, I've turned away offers to get involved in projects that had a slight hint of creating islands or a compromised menu of the internet. My opening paragraphs might have you thinking I'm here to defend net non-neutrality. However, I wrote these notes in trying to understand the position of most African governments on the subject.

Demographics

Africa has the highest percentage of population that is offline – almost 75% according to the ITU's “ICT Facts and Figures 2016”.
Our internet penetration rates are below 30 while all other continents are above that. Would our governments believe that we're in position to be sharing the same access philosophies with Europe, whose penetration rate is in the 80s?

Education

  • Governments face a major challenge of getting information to its people. From their developmental programmes or educational campaigns to progress reports, reaching the rural or poverty stricken majority is costly and produces low results.
  • The quality of education in most African countries is deteriorating. Supplementing this with free access to learning platforms such as beSmartworldreader andwikipedia can lessen the negative effects somewhat.
  • Besides being oversubscribed, most African families also cannot afford the costs that come with basic and tertiary education.
The above are just some points governments consider when deciding on the applicability and legality of zero-rated services. Free Basics by Facebook, for instance, provides access to free information about health, employment, starting a business and other local information on your mobile phone. Scholars4Dev gives access to a list of international scholarships.
Under Free Basics there are a number of other valuable sites that one can access freely to self-develop and fight poverty. Unless theirs is to keep its people uneducated and oppressed, it would be difficult for any African government to reject these free services.

Innovation and Competition

We often argue that not following net neutrality laws aids the monopoly of the zero-rated services over competition and stifles innovation. This is undeniable.
Let's assume that there are 10 free services that are offered via these zero-rated platforms. This means that 10 different areas of online services/solutions will experience unfair competition. Compare this to hundreds of African solutions that could sprout from people having access to information that they would not have ordinarily had.
A popular saying at startup or tech events is
“Africa doesn't need another Facebook or Twitter. We need solutions that address unique African problems.” Some-Motivational-Speaker-Turned-Tech-Guru
The number of rural and/or uniquely African challenges, we need to find solutions for, outweigh the few tech startups that could potentially experience unfair competition as a result of zero-rated services.

We've all seen Maslow’s Hierarchy of Needs in the Internet Age. The already connected urbanites have jokingly placed internet access as more necessary than food. When governments give free meals to school children from poor communities with a preference for brandX, we don't complain about unfair competition for brandY.
If we follow Maslow, we shouldn't complain when those who can't afford it are given some form of internet. I admit this is a pathetic attempt at expanding Joe Mucheru's earlier analogy, but it feels relevant here.

Politics

Net Neutrality activists have watched in paralysis, a couple of times, as Ugandan President Yoweri Museveni isolated social media traffic from the rest of the internet in his country and put this net island into darkness. The last time he did it, the confirmed government order cleared his path to a two thirds majority election victory.
It highlighted how quick and easy it is for governments to switch these islands on and off. This happened in many other African countries before and after that. Most African governments are not willing to give this power up.
There have been exceptions like Egypt who suspended Free Basics at the end of 2015 for instance. Just as our hopes were raised, Moroccans were blocked from using VoIP services a week later.


What this further highlights is that the direction of African governments' swing in terms of how they control the internet can’t be determined or generalised. Neither can this be done for developing countries in general. The world witnessed how India rejected Free Basics earlier in 2016, which prompted an emotional rant from Marc Andreessen that painted him and his team's Free Basics as fake philanthropy and new age colonization. I believe our governments are well aware of this.
The consequences of a free-to-do-as-you-like environment on the internet for governments can be disastrous in the long term. It only takes the manipulation and imagination of a loony dictator to ruin the internet experience for the already connected. After these notes, I was left sympathizing with governments whose intentions are good and face tough challenges to get their people online. Each African country needs to consider some not-so-neutral laws in the short term. Pure net neutrality is definitely essential when we're all online.

Tuesday, June 7, 2016

Joomla Admin Page Broken After php 7.0.7

I recently upgraded my php version to 7.0.7. Although not a php bug, some strict warnings were reclassified (correctly so) in php 7 leading my Joomla Administrator page to go non compos mentis. The following is the page I got after logging in as Administrator:


Fix:

1. Go to line 57 of the file "Site folder"/htdocs/administrator/modules/mod_menu/menu.php
2. Remove the ampersand "&"

Before: public function addChild(JMenuNode &$node, $setCurrent = false)
After: public function addChild(JMenuNode $node, $setCurrent = false)

This change will help to get the Admin panel working, but a good coder will also update the parameter description in the comments section for this function.

Reference:

The purpose of this post is to help beginners who encounter a vrot Administrator Panel right after successfully installing Joomla using php 7.0.7. Anyone above beginners level can read through the reported issue and understand the reason for this behaviour:
https://issues.joomla.org/tracker/joomla-cms/10452
or alternatively: https://github.com/joomla/joomla-cms/pull/10452

Fix in non-newbie language:
https://github.com/joomla/joomla-cms/commit/c2c80d3ffdd877bfac27fdf72776a9f64661fef9
https://github.com/joomla/joomla-cms/commit/f2fb7c4a30faade62bdcb733872f0f07d2b5f647

Error created in the following environment:
Joomla 3.5.1
Apache 2.4.20
MySQL 5.7.12
php 7.0.7

Sunday, May 15, 2016

Microsoft LifeCam Studio Review

This post was written for iAfrikan.

Even though half a decade late, I played around with the Microsoft LifeCam Studio and the Microsoft Wireless Desktop 900 courtesy of FleishmanHillard. The Microsoft Wireless Desktop 900 is a wireless keyboard and mouse goodie box.

The following is a video, recorded using the LifeCam Studio, of myself unboxing the Wireless Desktop 900. The rest of the review in text will be focused on the LifeCam Studio. Treat this post as a 2-in-1 review.


LifeCam Studio

From the quality of video produced above, I can’t tell whether it’s better than my built-in webcam on my laptop or not. To be fair, recording of such videos is not its intended use. For gamers or heavy processor crunchers who still prefer to work on the PC or are still holding on to old-school laptops not equipped with webcams, this product’s for you.
"Today's Microsoft has fingers in dozens of pies, from small-business accounting software to Webcams. But too many efforts can distract from the unwavering focus you need for your core products and strategic initiatives." - Paul Allen, Co-Founder of Microsoft
This webcam is not bulky like most that I owned a few years ago. It looks slick and pimped my laptop with a 007 look. With dimensions 11.3 cm by 4 cm, it can also be mounted on a standard tripod. I just hooked it to the top of my laptop screen using its easy-to-setup universal attachment base.

Coupled with the constant rise of road rage simpletons on the road, it got me wondering whether I can use it as car dashboard camera to give it one up against my built-in webcam. Beyond Windows and Mac OS X, the datasheet says it also supports Android 3.2 and 4.2.
For a less bulky dashboard setup, I should probably try to hook it up to a small Android PC (like the recently launched Remix MINI) as a weekend project… or maybe a year-long project since the Android flavours aren’t the same.

It’s a 1080p HD webcam for still images but does video chats at 720p HD. This resolution is good enough for its intended purpose (Skype/Hangout calls).

Microsoft promises automatic face tracking and while these tests can’t be seen in the recordings, its speed wasn’t highly impressive and you can literally video record its autofocusing process using another camera. With capability to take 5MP photos, it has a wide angle lens and provides 4x digital zoom. It outperformed my built-in webcam.

The feature I was anticipating to test, which isn’t very common with most webcams, was the "Call Button". Previously, this feature was a major irritant with LifeCams because it was built to be used with Windows Live Messenger and a lot of people wanted to use it on other platforms like Skype. I found a number of hacks online to get it working on these platforms, but I expected Microsoft to have made this feature plug-and-play on Skype (at least) by now, especially with Microsoft having acquired them 5 years ago. This was a major disappointment as I had planned to test this feature with all my loafing partners on my contacts list.

High Points
  • Slick and non-bulky
  • 1080p HD photos
  • Flexible universal attachment base

Low Points
  • Not 1080p HD video
  • Automatic face tracking and autofocus
  • "Call Button" feature not plug-and-play