android kitkat

How to get Whatsapp on Android KitKat (4.4) to sync contacts

I recently upgrade my Samsung Galaxy Tab 7″ (P1000) to Cyanogenmod 11.2 to attempt to fix a Bluetooth problem I’m having (which is a different matter entirely), but noticed that Whatsapp was not syncing contacts with my phone contacts at all.  As a matter of fact, I wasn’t even able to add new contacts to Whatsapp or start chats with people not in my history of chats.

CyanogenmodI had previously upgraded from CM 9 to CM 10.2, which was an experimental build for the Samsung 7″ Tab, but this behaviour did not occur there.

After much searching, I finally decided to leave it for a later time.  Then one day, while looking for reasons why Waze wasn’t performing certain actions properly either, I noticed the setting (under settings | apps) “Enable Privacy Guard”.  This led me to further investigate this feature.

Under settings | privacy | Privacy Guard, a list of all apps is shown and each’s guard may be enable or disabled.  Lo and behold, when I disabled it for Whatsapp, suddenly the contact sync worked and my contacts where shown in Whatsapp.

I would have liked some notification by Android that Privacy Guard is on when an app attempts something that is blocked by privacy guard.  Maybe it’s just not ready in CM 11.2 yet?

Anyway, if you have this problem with Whatsapp or other apps, investigate this option and maybe you find that it solves the problem like it did for me.

How to test for a valid twitter handle using a regular expression

I use Redmine CRM, which allows custom fields in the Contacts, Deals and other modules.  The validity of an entry may be tested with a regular expression.  I had to do quite a bit of testing before I finally got it right (not doing this every day!), so here is what I ended up using:

^@([A-Za-z0-9_]+{1,15}$)

Meaning is should start with an “@” and then have at least 1 of A-Z, a-z, 0-9 or _, but not more than15.

Hope this helps someone else somewhere, sometime :-)

Jesus and the Wrath of God

Roland Giesler:

Good read!

Originally posted on Escape to Reality:

blood-stained crossAre you familiar with the hymn In Christ Alone? Do you know this hymn is not hundreds of years old? It’s not even 20 years old. In Christ Alone is a very modern hymn. It was written in 2001 by Keith Getty and Stuart Townend.

I mention this hymn because it has these wonderful lyrics:

Till on that cross as Jesus died
The wrath of God was satisfied
For every sin on him was laid
Here in the death of Christ I live

“Wait a second, Paul. Are you saying God poured out his wrath on Jesus? That sounds twisted.”

I agree that there is something dreadfully wrong with the picture of a father killing his son to satisfy some legal need for blood. It falsely portrays God as guilty of filicide, the murder of his own child.

I know some people have been turned off from the gospel…

View original 828 more words

South African Radio Stations via Rhythmbox

Since I run an Ubuntu desktop environment, I get to do with all the idiosyncrasies of service providers that imagine a “Windows only” world…  <sigh>

Here’s what to use to get radio via Rhythmbox or other music players:

  • Cape Talk 567 MW – rtsp://196.35.68.110/capetalk-live
  • RSG – rtsp://196.35.68.110/rsg_22?MSWMExt=.asf

If you have more streams (that you have tested!), please comment below and I’ll add them here.

LTSP notes

These are my personal notes wrt LTSP installations, tips and tricks that I have needed in various setups.  Instead of just storing these in my own notebook, I share them here for the benefit of anyone that may benefit from them.  Feel free to leave comments, corrections or suggestions.

Ubuntu 12.04 64bit Server with LTSP

i386 Clients that don’t support required ‘cmov’

Norhtec Surfboards with XCore86 processors:

  1. The last version of Ubuntu that has the ‘cmov’ instruction built into the kernel is 10.04.  I suppose it is possible to compile a custom kernel with ‘cmov’ support, but I think Ubuntu has removed code from their source, so one would need quite a bit of customisation to overcome this.  Not for me, I’ve wasted too much time on things I don’t really know enough about.
  2. Debian continues supporting ‘cmov’ up to the latest build.
  3. Debian LTSP implements NFS to connect from the chroot booted system to the server, Ubuntu uses NBD.
  4. With Ubuntu 10.04 Lucid, the NBD server listened on a port, typically 2000, 2001, 2002, etc.  Since 12.04 Precise (or maybe even the release before that?), the chroot booted clients connects with a named pipe instead of a port.
  5. To allow a 10.04 chroot client to connect to the 12.04 server, do the following
      1. $ sudo ltsp-chroot -a i386
        $ vim /etc/ltsp/update-kernels.conf

        Change the content to:
        BOOTPROMPT_OPTS=”append ro initrd=initrd.img quiet splash nbdport=2002″
        NBD_ROOT_NAME=ltsp_i386


        Now run:

        $ /usr/share/ltsp/update-kernels
        $ exit


        $ sudo ltsp-update-kernels

        Now the file /var/lib/tftpboot/ltsp/i386/pxelinux.cfg/default should reflect the changed connection method using a port.


      2. Change the nbd-server config as follows:
        $ sudo vim /etc/nbd-server/config
        [generic]
        user = nbd
        group = nbd
        includedir = /etc/nbd-server/conf.d
        oldstyle = true


        $ sudo vim /etc/nbd-server/conf.d/ltsp_i386.conf
        [/opt/ltsp/i386]
        exportname = /opt/ltsp/images/i386.img
        port=2002
        readonly = true


        $ sudo vim /etc/nbd-server/conf.d/swap.conf
        [swap]
        port = 2002
        exportname = /tmp/nbd-swap/%s
        prerun = nbdswapd %s
        postrun = rm -f %


      3. A different way (which I only found out yesterday by going through the script), is:
        $ sudo ltsp-update-image -a i386 -o “quiet splash nbdport=2002″

     

Extra notes:

There is a file /etc/ltsp/ltsp-update-image.excludes which removes certain file from the chroot when the image is created.  Edit this to allow sshd keys, home directories and more to included in the image.

If the client doesn’t log in to the server due to ssh keys not in the ssh_known_hosts file, delete the /etc/ssh/ssh_known_hosts file in the chroot, run ltsp-update-sshkeys and then ltsp-update-image.

If the screen resolution notification pops up after logon, delete the users ~/.config/monitors.xml file.

To enable sshd on the thin client:
In /etc/ltsp/ltsp-update-image.excludes comment out:
# etc/ssh/ssh_host_*_key

In /var/lib/tftpboot/ltsp/i386/lts.conf add:
KEEP_SYSTEM_SERVICES=”ssh”

Printers connected to the thin client?
check the device the printer is on: ls -la /dev/usb/lp1 for example  (on wheezy)
then set lts.conf to:
LOCALDEV = true
PRINTER_0_DEVICE = /dev/usb/lp1
PRINTER_0_TYPE   = U
for the application MAC address

Lexmark Support fail!

Here is the exchange I had with Lexmark support regarding the Lexmark Prospect 205 printer/scanner/fax/copier.
I have highlighted some text in orange to make it clearer and clipped some standard template text for the sake of brevity, but otherwise I changed nothing.  Just did a cut and paste from gmail.
Lexmark have now removed the drivers in question…  but haven’t said a word about it.

Dear Roland,

Here is your Service Request # 1-11261004232

Thank you for the information and it’s clearer this time. Going back to your concern, I tried checking it from our website again and found out that this printer doesn’t have an Ubuntu drivers so this means that it is not compatible with it. I sincerely appreciate your patience.

If you have any more questions or concerns, please contact me at your convenience and I will be happy to assist you. (If I am not available, another representative may reply to your request.)

<clipped template info>

Sincerely,

Giovanni
Lexmark eSupport Team
http://support.lexmark.com
[THREAD ID:1-568IEH4]Please rate your e-mail support experience. Your feedback is extremely valuable to us. Please click the link below to participate in a brief Lexmark Customer Satisfaction Survey.https://surveys.lexmark.com/survey/s?s=9972
**********Original Message**********
I can understand why we have missed each other.  In the original thread I
referred to a “Lexmark Prospect 205 Scanner/Fax/Printer” which is what I
have.  That model definitely has a driver on your website and it works as I
said before. Does that make it clearer?
On Thu, Feb 14, 2013 at 9:18 AM, Lexmark Support <support3@lexmark.com>wrote:>
Dear Roland,
>
> Here is your Service Request # 1-11261004232
>
> We have here the P250 printer as your printer and we don’t have drivers
> for Ubuntu with this type. May I know if you really have a P250 printer?
>
> If you have any more questions or concerns, please contact me at your
> convenience and I will be happy to assist you. (If I am not available,
> another representative may reply to your request.)<clipped template info>> Sincerely,
> Giovanni
> Lexmark eSupport Team
http://support.lexmark.com
>
Eh, am I missing something here?  I think you should read my original mail
before firing off a canned response!Here is what I asked:I have installed the latest printer & scanner drivers for Ubuntu (32 bit)
from your support site on two machines.  On the one (running Ubuntu 11.10)
everything works 100%, printing & scanning over the network.  On the other
machine running Ubuntu 12.10 however I can print, but scanning produces the
error “Failed to open device ‘lexmarklegacy_1_0_0:libnet/00200075694B’:
Error during devce I/O.I have also engaged some non-lexmark forum on this matter and the full
thread is available here:
http://www.linuxquestions.org/questions/linux-software-2/sane-device-information-for-network-scanner-893105/page2.html#post4886245<https://rightinbox.herokuapp.com/follow/d6892e36-09e2-4015-a8cb-63a6177d3f0f/http%253A%252F%252Fwww.linuxquestions.org%252Fquestions%252Flinux-software-2%252Fsane-device-information-for-network-scanner-893105%252Fpage2.html%2523post4886245>
I posted as “lifeboy” and have provided this link so I don’t have to repeat
the volume of information I have provided there regarding my setup.To which you responded (totally unrelated and seeming not having read what I wrote!)
Here is your Service Request # 1-11261004232
>
> Thank you for contacting Lexmark. With regards to your concern, I regret
> to inform you that this printer is not compatible with Ubuntu and that you
> can’t find any drivers available from our website. I sincerely appreciate
> your patience.
>1. I *did download* the drivers from your website and you *do* support *
Ubuntu* and *Debian*.  And the printer works as well as the scanner from
one of my machines!!
2. I explicitly asked for technical help.  In the thread I referred to I
have posted extensive technical information that you should pass on the
your driver development team. The drivers where update recently with never
version, so don’t try to tell me you don’t support Ubuntu.
3. It seems that I should rather buy a printer from HP, Brother, Canon or
Epson, right?
4. Does you employer know that you’re not doing your job, by brushing off a
technical support request?I am appalled by this response. Can you please escalate this request to
your manager?thank youRoland Giesler, CEOOn Wed, Feb 13, 2013 at 10:13 AM, Lexmark Support
<support3@lexmark.com<https://rightinbox.herokuapp.com/follow/d6892e36-09e2-4015-a8cb-63a6177d3f0f/mailto%253Asupport3%2540lexmark.com>
> wrote:> Dear Roland,
>
> Here is your Service Request # 1-11261004232
>
> Thank you for contacting Lexmark. With regards to your concern, I regret
> to inform you that this printer is not compatible with Ubuntu and that you
> can’t find any drivers available from our website. I sincerely appreciate
> your patience.> If you have any more questions or concerns, please contact me at your
> convenience and I will be happy to assist you. (If I am not available,
> another representative may reply to your request.)
>
<clipped template info>
**********Original Message**********
Roland Giesler <roland@***********t> Feb 15
to Lexmark
Again I don’t understand?  When I go to the Lexmark support site and select the Prospect Pro205 printer, I get the driver plain and simple:
Here is the site URL:
Select on the Downloads tab: “Unix /Linux” and then “Ubuntu 12.04″, I get the complete list of drivers.

Canonical: Killing Maverick Meerkat and plugging its burrows? (Solution available)

I really didn’t think that I would ever have to write this kind of post

Since the end of support for Ubuntu Maverick 10.10 in April 2012, the repos are suddenly (since when?) removed as well.  This is a very serious problem since we have a number of 10.10 environments which are extremely stable and in production, with only very occasional modifications needed.  However, it is not possible to add even a simple application like vim to any of these installations by using the repositories and standard Ubuntu provided tools, since the complete repositories seem to have been removed!

Now, I realise and support the fact that Canonical cannot continue to support releases indefinitely and that’s perfectly in order.  But, hey, even Microsoft of all companies have many of the patches and updates available that were previously released even for very old products.  Ubuntu is an open source system, we use it exclusively at clients and inhouse, but in this instance you are seriously letting us down. Why can the repos not simply stay online?  I’m not asking for new updates, but simply that what was there before stays there.  There is a community as well, you know, and by what reasoning do things simply get removed?

Consider this.  Our client wants to upgrade their systems to 12.04 and have budgeted for this in the next 6-12 months.  Neither they, nor we, currently have manpower resources available to upgrade their LTSP servers and applications and to ensure that it all works.  You know that it’s not as simple as clicking the upgrade button, so why are we being put in this position?  The forced upgrade cycle is one of the main reasons why we moved away from Windows, apart from the security issues inherent in that platform, yet now Canonical is putting us in the same position.

Here is a quote from Kate Stewart’s announcement to the Ubuntu Security Announcement List:

Since its launch in October 2004 Ubuntu has become one of the most
highly regarded Linux distributions with millions of users in homes,
schools, businesses and governments around the world. Ubuntu is Open
Source software, costs nothing to download, and users are free to
customize or alter their software in order to meet their needs.

Canonical, please but the repos back online where they belong.

Update: (Please see Kate Stewart’s comment as well)

The old repos are held at http://old-releases.ubuntu.com/. All one need to do to keep Maverick (or any of the other discontinued releases) alive, is the change the repositories.  It would be great if Ubuntu could add the “old” repository to the sources in the Update Manager.  For now one has to edit the /etc/apt/sources.list to reflect the repository.

Here are the ones I changed:

deb http://old-releases.ubuntu.com/ubuntu maverick main restricted
deb http://old-releases.ubuntu.com/ubuntu maverick-updates main restricted
deb http://old-releases.ubuntu.com/ubuntu maverick universe
deb http://old-releases.ubuntu.com/ubuntu maverick-updates universe
deb http://old-releases.ubuntu.com/ubuntu maverick multiverse
deb http://old-releases.ubuntu.com/ubuntu maverick-updates multiverse
deb http://old-releases.ubuntu.com/ubuntu maverick-backports main restricted universe multiverse

## Partner release are not in the old repositories.
### deb http://old-releases.ubuntu.com/ubuntu/ maverick partner

deb http://old-releases.ubuntu.com/ubuntu/ maverick-security main restricted
deb http://old-releases.ubuntu.com/ubuntu/ maverick-security universe
deb http://old-releases.ubuntu.com/ubuntu/ maverick-security multiverse

Once the changes have been made, do a sudo apt-get update and inspect the output for any repositories that are not found and correct the corresponding line accordingly.

MySQL: How to export data to csv with column headers

I recently had to export a whole number of tables from a MySQL database into .csv files, but to my surprise (or should I say disgust), exporting to .csv with headers is not possible by simply using to the “SELECT … INTO OUTFILE” syntax.  Fortunately all is not lost, although to me this is more proof that MySQL is not really suitable for large applications. Here is how I solved the problem.

I created a table (`tables_to_export`) with a single `tablename` column which I populated with the names of the tables that I wanted to export.  I then created a procedure to traverse this table by means of a cursor so I could build the sql statements required to get the desired export result.

Basically the trick is to create a text string of comma separated column names that is used to create a select union statement to combine the column names with the data.  There are quite a few examples of doing this with a single table and known column names, but I wanted to do this for a whole lot of tables in a loop.  I also need to repeat this export in future, so it made sense to automate the process.

Note: The ‘information_scheme’ database contains a ‘columns’ table that has all the column names, so I used that to get the names to create the string.  The

CREATE DEFINER=`root`@`localhost` PROCEDURE `export_important_tables` _
     (IN `quote` TINYTEXT, IN `delimiter` TINYTEXT, IN `export_dir` VARCHAR(200))
 LANGUAGE SQL
 NOT DETERMINISTIC
 CONTAINS SQL
 SQL SECURITY DEFINER
 COMMENT 'Export in csv format with headers'
cont:BEGIN
/* This procedure has been created to add the column names as a header column 
   when exporting mysql tables.
   A table, 'tables_to_export', contains the list of tables to be exported

Usage example: CALL export_important_tables('"',',','/tmp/');

*/
-- Declare some variables
   DECLARE done INT DEFAULT FALSE;
   DECLARE myFile CHAR(30);
   DECLARE curs CURSOR FOR SELECT * FROM `foodmedb`.`tables_to_export`;
-- Declare a cursor
   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
-- There don't need to be set (@variables don't exist outside the procedure, 
-- but I set them for easy reference anyway
   SET @myResult = '';
   SET @myHeader = '';
   SET @myCommand = '';
   SET @myCombined = '';

-- Do some very simple checking for valid parameters
   IF LENGTH(`quote`) > 1 THEN 
       SELECT 'Parameter Error:  may not be more than 1 character';
       LEAVE cont;
   ELSEIF `quote` = '' THEN SET `quote` = '"';
   END IF;

   IF LENGTH(`delimiter`) > 1 THEN 
       SELECT 'Parameter Error:  may not be more than 1 character';
       LEAVE cont;
   ELSEIF `delimiter` = '' THEN SET `delimiter` = ',';
   END IF;

   IF RIGHT(`export_dir`,1) != '/' THEN 
       SELECT 'Paramater Error:  has to end in a /';
       LEAVE cont;
   ELSEIF LENGTH(`export_dir`) = 0 THEN SET `export_dir` = '/tmp';
   END IF;

-- Initialise the cursor query
OPEN curs;

-- Set up a loop so we can traverse all the row in the cursor table
table_loop: LOOP

-- Get a filename
   FETCH curs INTO myFile;
   IF done THEN
      LEAVE table_loop;
   END IF;
-- Build a sql statement string that concatenates the column names from the 
-- information schema's 'columns' table to build a header for the csv file
   SET @myHeader = concat('SELECT GROUP_CONCAT(',char(39),`quote`,char(39),',
   COLUMN_NAME, ', char(39),`quote`,char(39), ' SEPARATOR ', char(39),`delimiter`,
   char(39),') FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE table_schema=',char(39),
   'foodmedb',char(39),' and table_name=',char(39),myFile,char(39),
   ' INTO @myResult');
   PREPARE stmt1 FROM @myHeader;
   EXECUTE stmt1;
-- Build the the sql statement string that will dump the data into the csv file
   SET @myCommand = concat('SELECT * FROM foodmedb.', myFile, ' into OUTFILE ', 
   char(39), `export_dir`, myFile, '-', DATE_FORMAT(now(),'%Y%m%d-%H%i%s'), '.csv',
   char(39), ' FIELDS TERMINATED BY ', char(39), `delimiter`, char(39), 
   ' OPTIONALLY ENCLOSED BY ', char(39), `quote`, char(39), ' LINES TERMINATED BY ',
   char(39),'\n',char(39));
-- Use Union to combine the two parts
   SET @myCombined = concat('SELECT ', @myResult,' UNION ALL ',@myCommand);
   PREPARE stmt2 FROM @myCombined;
-- Sweet, now the files are being written!
   EXECUTE stmt2;

END LOOP;

CLOSE curs;

END

This stored procedure should function as it is above.  I have created parameters and some simple error checking to assist with using it more generally than just my particular use.

Please make suggestions and improvements and post them in a comment if you’d like.

on basic “facts” vs “skills”

I had a few tweets with Samantha Laing, Helen Zille & JC re facts vs skills and thought I’d write down my thoughts in a more “agile” medium that twitter, so here goes!

Firstly, in education in general, we must approach things differently if we wish to have different results from what we’re currently having.

I made a point about basics.

That boils down to really basics.

I find many kids, a large number of black South Africans, but also, to a much a larger extent than previously, coloured and white kids (if I may generalise so brashly for this purpose), that do not have the basic ability to communicate, express their thoughts or write in any language. They cannot grow their skills by reading, unless they really really want to or have to, and then it is with great difficulty, simply because they cannot read. Of course, the under-stimulated mind is not interested in much, so this is a self-defeating cycle and few manage to break out of it. It’s a culture of entitlement, supported by the acts and talk of national government, not a culture of learning, self-improvement and development, that we currently have. Having said that, there are notable exceptions and sterling examples of quite the opposite, but sadly they are the exception, not the norm.

Kids Reading
Reading kids rule!

I personally endeavour to motivate people (of all races & incomes) to read to their young children daily and to let the children read to other young ones again. I encourage them to use our public libraries and improving their own reading in process, starting with simple books, advancing as they make progress. I find, however, that there is a resistance to this, that watching TV is less effort, and therefore progress is slow.  It doesn’t help, of course, that we have a culture of laziness among many teachers in public schools (that for example sit and drink tea till first break or involving themselves in political activism during school-time, while primary school kids entertain themselves) while others work their fingers to the bone in an effort to somehow equip kids to be able to learn more and “make a living”. The same goes for DoE officials who love spending money on futile pursuits and unproven educational experiments, or even worse, educational exploits that have been undeniably proven a failure. Instead of a pragmatic simple approach, they diddle-daddle with trivial and peripheral issues (attempting to bring high technology to kids for example), while kids come out of school being neither able to read nor write, let alone reason, spot logical fallacies or think creatively. The latter, is of course often due to the stifling of creativity in the schooling system.

My wife and I have home-schooled two kids and have two in public school, so we have seen how certain approaches just don’t work and how others have great results.  We know how much kids from the same parents and home differ in learning style, interest and ability in different areas, let alone kids from different parents, homes and environments.  I am therefore by no means closed to alternative views or approaches to education and skills development! I also taught at a high-school for a while and have seen the practical side from a teachers perspective and know the challenges faced in teaching children other that your own.

I furthermore firmly believe education is not primarily a function of Government, but one of the community.  Once solution could be this: The elderly are often excellent teachers and have a lifetime of wisdom and experience to draw on in transferring skills, developing young people into achieving their dreams and making a meaningful contribution to society at large and individuals in particular. As it is now, many are simple shoved aside and considered a burden. Instead of giving social grants to the unemployed, maybe grants should be given to all elderly people that develop young people. The control that National Government attempts to exercise more and more in a clear attempt to maintain is power-base, it in itself shameful and deplorable, but by now means unique to South Africa. I saw with my own eyes as a teacher the unbelievable lows that the DoE stooped to during the teachers strike in 2004 in an all out attempt to not pay teachers more than their measly salaries – straight lies, deceptive tactics and every dirty trick in the book, that I would not have believed, had I not seen it with my own eyes.  The correlation between education and controlling poorly educated masses may not seem clear to all readers, but as I have pointed out elsewhere, it is much easier to control hungry, needy masses, than educated, enlightened free-thinking people.

We can however break this stranglehold, starting in our communities by grow a culture of learning, breaking the culture of entitlement, developing the live-long ability and desire to grow, learn and go where we haven’t been before.  How is not easily answered, but one thing is certain: As soon a the DoE stops their monopolistic attitude towards education, especially since they’re failing dismally at it, and the national government actively supports educational efforts outside of their government box, we will make huge progress with this.  Some points to consider on this regard:

  1. Why are donations to schools and school fees not tax-deductible to start with?  How can anyone in government claim their are serious about education while strangling the development of schools in the community?
  2. Why are schools forces in languages which are foreign to them and their communities?  How many Afrikaans schools, with Afrikaans learners are forced to start teaching in English?  Has the ANC learned nothing from (or rather since) the struggle?
  3. Why are people that choose to home-school (and generally speaking having excellent results!) persecuted by the DoE, when in fact both the Constitution and the Education Act specifically protect the right of parents to home-school?  Why does the DoE waste millions of Rands on these efforts, when they have so many schools that are ill equipped, even some with no classrooms?
  4. By what right does the DoE pay subsidies to public schools, yet when the same tax-paying citizen send their children to a Waldorf, Montessori or other private school, they do not receive their fair share of the tax collected for education?  Are most of these schools not superiour in the level of education, skills and ability that they “produce”?  Should they not therefore be supported even more?
  5. Why are well-education, highly skilled teachers, that we’re “fired” because of BEE, not brought back to alleviate the desperate shortage of skilled teachers?  So what if they’re the “wrong” colour!?  When will the short sighted racism of the ANC stop and will they start serving South Africa, as their election mandate requires of them?  Actually, when will the people who put them in power, remove them if they don’t deliver?  This is not about politics, but when politics starts interfering with the development of the future of our country, it becomes all about politics.
I suppose there are more points that can be added here, but the principle is, simple.  Government but stop their nanny state, preventive approach and support and encourage communities to grow, learn and thrive.

I’d like to hear from people that have ideas and experience in this!