Archives 2005 - 2019

Link - The Definitive Guide to Angular on Mobile

published Oct 16, 2013 03:13   by admin ( last modified Oct 16, 2013 03:13 )

Bookmarked for further reading.

 

The Definitive Guide to Angular on Mobile


Read more: Link - The Definitive Guide to Angular on Mobile | ng-newsletter


How to integrate Facebook with Phonegap/Cordova on Android

published Oct 14, 2013 02:15   by admin ( last modified Oct 17, 2013 01:13 )

It can be a boon to post on Facebook from your Android phonegap/cordova app. You can actually use the https scheme to post through the user's browser, but then he needs to login there. It is also possible to communicate with the Facebook app via the fb:// protocol, but you cannot post stories or any other kind of updates that way (anymore).

There is however a plugin for Phonegap to use Facebook, and it seems to work, and you can post from the app to Facebook. The instructions for it worked out A ok for me, just follow it step by step, but with the following caveats:

Don't use Phonegap 2.8.0 or 2.7 (2.8.1 works though)

In Phonegap 2.7 they removed some deprecated interfaces, that the Facebook plugin for Phonegap uses. They then put those deprecated interfaces back in 2.8.1. So if you - like me - were on 2.8.0 or if you are on 2.7, you are on the versions that do not work. (Disclaimer, I have not tested the 3.x series or anything pre 2.8). it is possible to use the new interfaces as outlined in the blog post linked above, but when it came down to lines in the plugin as:

this.fba.success(new PluginResult(PluginResult.Status.OK), this.fba.callbackId);

...it started to become a bit hairy, and not clear to me what that actually does, or how to replace it. With 2.8.1 you don't need to worry about that.

In the simple example, the name of the javascript sdk library is slightly wrong

It is "facebook-js-sdk.js", not "facebook_js_sdk.js" as it is written in the index.html file currently.

On Linux the key you need to make a hash out of, is in "~/.android/"

In the Facebook documentation, they only give examples for OSX and Windows. On Linux you need to write:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

After these changes, I was able to post on my wall from an Android emulator. I have not tried with an exported apk yet, for that you need to make a hash as above but from the keystore you use to sign your apks with.


Git GUIs for Linux - a quick test

published Oct 13, 2013 12:10   by admin ( last modified Oct 14, 2013 12:59 )

This blog post will be amended and expanded later.

Basic level

I want a graphical overview of what files are unknown to git, which are known and has changed, and which ones are staged. I also want to be able to add (stage) files, commit files, and also unstage files.

Advanced level

I have a cheat sheet with the following stuff in it, but would like to have it supported in the GUI:

Feature git-cola smartgit  
Separate staged, unstaged, unedited and unknown files Y Y  
Stage files Y Y  
Commit files Y Y  
Advanced features      
track a new remote branch         
see what would be merged in, before doing a pull (i.e. a git fetch followed by git diff HEAD...origin   N  
initialize a remote repository with my stuff and make my local repository track the remote      
push to a fresh remote repository      
push tags Y    
I made a new branch locally, and I want to push it to remote      
undo my last commit      
Aborting a merge when you are in the middle of it      
revert a changed or deleted file to its last commit      
handle submodules as they are defined in recent versions of git (1.8.2 and higher) N Y  
       

Offerings

Found a page that details some of the offerings:

http://askubuntu.com/questions/227554/best-gui-client-for-git

So a quick test for the basic level:

git-cola - seems to do a lot of the things I want. Distinguishes between tracked and untracked files, shows which files have edits in them. double click to stage file, the best one so far

giggle - does not seem to do much, it does not distinguish between files with changes in them and not, has a context menu for committing any file, wheter changed or not. May be more for inspecting and analyzing.

git-gui - Lumps all files into a long messy list, with no distinction between tracked and untracked files

 


Unheap - a gallery of jQuery plugins

published Oct 13, 2013 03:29   by admin ( last modified Oct 13, 2013 03:29 )

Looks really nice, but in a way text lines in a table would be more compact and succinct. Lots of javascript libraries for jQuery.

 

© 2013 Unheap.


Read more: Link - Unheap - A tidy repository of jQuery plugins


Event handling libraries for javascript

published Oct 13, 2013 03:20   by admin ( last modified Oct 14, 2013 02:49 )

I'm thinking of adding some levels and achievements to a javascript based game. Since the points scoring is already there, it would be really nice if I could just have the scoring emit some kind of event that can be caught by the level and achievements code. In this way there would be a reasonably clean and simple interface between the code sections.

 

So I went to the Microjs site and found a dozen or so libraries that handled events. They seemed to fall into three categories:

  1. Libraries only interested in the DOM. I wanted something a bit more abstract, decoupled from the DOM.
  2. Libraries that modify the objects they are operating on. This seemed to me to not be very transparent, and I would need to come up with objects. Since it is a mobile application I need to persist stuff through the create/pause/resume/destroy lifecycle, and i do not want to end up with some objects - that have data that is persisted - also have some state related to what events they emit or listen to, while others objects may be loaded from script with no memory of this
  3. So, the third group uses a dedicated central object, that just emits nice clean text messages. These libraries seem to be classified as doing the pubsub pattern or mediator pattern. This I believe is what I want.

 

Candidates in group 3 so far are:

A light utility class to help implement the Mediator pattern


Read more: Link - Mediator.js


Prevent iCloud backup of Phonegap's localstorage

published Oct 07, 2013 06:50   by admin ( last modified Oct 08, 2013 01:08 )

In a defalt setup in Phonegap 2.8.1, localstorage is marked for backup to iCloud. This may get your app rejected by Apple, depending on the size.

To disable backups, set BackupWebStorage to "none" or "local" in the "config.xml" file. The config.xml file is located in your <project folder>/<appname> directory.

<preference name="BackupWebStorage" value="none" />

BackupWebStorage (string, defaults to cloud): valid values are none, cloud and local.

Verify

To check that it works, Apple recommends this way to check how much data you have put under the auspices of iCloud:

  • Install and launch your app
  • Go to Settings > iCloud > Storage & Backup > Manage Storage
  • If necessary, tap "Show all apps"
  • Check your app's storage

Do note, that this cannot be done in a simulator. You need a real device.

 


Get rid of black borders in cairo-dock

published Oct 02, 2013 04:10   by admin ( last modified Oct 03, 2013 04:03 )

On some computers, you may get massive black borders around panels in cairo-dock. On my laptop they obscured the desktop and when taking screen shots. On my desktop machine it obscured everything not in the center of screen. The standard solution, compiz, did not seem to cut it.

Installing and running xcompmgr solved the problem on both computers:

 

First create the autostart folder if it doesnt already exist: mkdir -p ~/.config/autostart Then create a xcompmgr desktop file lxshortcut -o ~/.config/autostart/xcompmgr.desktop


On my laptop, the screen capture program shutter hanged whenever xcompmgr was running. By adding the "-c" switch to xcompmgr, this seems to be resolved.

Read more: Link - lubuntu - How to start applications such as xcompmgr at start up? - Ask Ubuntu


How to print PDFs with unique file names on Ubuntu

published Sep 30, 2013 02:25   by admin ( last modified Feb 12, 2017 04:09 )

Let's say you have a bunch of web pages you need to print out as PDFs, to send as receipts to the bookkeeping department. If you use the "Print to file" in the Ubuntu print dialog, you will need to manually change the name for each file.

Instead, install cups-pdf, "sudo apt-get install cups-pdf". It will be a new printer in your printer list and will save the PDFs in the ~/PDF directory, with file names based on the titles of the documents.

Should you have the same title on several documents you can even make all PDF printouts unique by adding a print job number to each. Set this in the /etc/cups/cups-pdf.conf file.

Update 2017-02-12: For Ubuntu 16.04 I had to reinstall the cups-pdf.conf file. I took it from https://launchpad.net/ubuntu/xenial/+source/cups-pdf

 

This software is designed to produce PDF files in a heterogeneous network by providing a PDF printer on the central fileserver. It is available under the GPL and is packaged for many different distributions or can be built directly out of the source files.


Read more: Link - CUPS-PDF


This is supposed to speed up Android VMs

published Sep 25, 2013 01:15   by admin ( last modified Oct 13, 2013 03:36 )

I've covered Intel's massive speedup with KVM on Linux, and now there is this (untested by me at this point in time):

 

The fastest Android emulator for app testing and presentation

I've read somewhere that Google Play is included, haven't cecked that one though.
 

Read more: Link - Genymotion


Indie flower font

published Sep 23, 2013 01:44   by admin ( last modified Sep 23, 2013 01:44 )

Good-looking handwriting font.

 

Indie Flower


Read more: Link - Google Fonts Indie Flower


A remote web browser that can be shared

published Sep 18, 2013 02:42   by admin ( last modified Sep 18, 2013 02:42 )

Wikipedia's now deleted page on Thought terminating cliché

published Sep 03, 2013 03:15   by admin ( last modified Jun 17, 2019 06:28 )

About a month ago, I found Wikipedia's page on the concept "Thought-terminating cliché". I really liked it and it put a (new) name for me on to something that I - in my own little mental world - had previously called "mental roadblocks". Unfortunately the page has been deleted now recently in August 2013, so I retrieved the last copy of it. It is below and under the same license as the articles on Wikipedia. I have no idea if the contents meet the standards of Wikipedia, but I find the thoughts presented interesting:


Thought-terminating cliché

From Wikipedia, the free encyclopedia

A thought-terminating cliché is a commonly used phrase, sometimes passing as folk wisdom, used to propagate cognitive dissonance (discomfort experienced when one simultaneously holds two or more conflicting cognitions, e.g. ideas, beliefs, values or emotional reactions). Though the phrase in and of itself may be valid in certain contexts, its application as a means of dismissing dissent or justifying fallacious logic is what makes it thought-terminating.

The term was popularized by Robert Jay Lifton in his 1956 book Thought Reform and the Psychology of Totalism. Lifton said, “The language of the totalist environment is characterized by the thought-terminating cliché. The most far-reaching and complex of human problems are compressed into brief, highly reductive, definitive-sounding phrases, easily memorized and easily expressed. These become the start and finish of any ideological analysis.” [1][2]

In George Orwell’s novel Nineteen Eighty-Four, the fictional constructed language Newspeak is designed to reduce language entirely to a set of thought-terminating clichés. Aldous Huxley’s Brave New World society uses thought-terminating clichés in a more conventional manner, most notably in regard to the drug soma as well as modified versions of real-life platitudes, such as, “A doctor a day keeps the jim-jams away.”

Non-political examples

  • “Everything happens for a reason.”
  • “Don't judge.”
  • “Why? Because I said so.” (Bare assertion fallacy)
  • “I’m the parent, that’s why.” (Appeal to authority).
  • “When you get to be my age you’ll find that’s not true.”
  • “You don’t always get what you want.”
  • “You win some, you lose some.”
  • “Ah well, swings and roundabouts.”
  • “Everyone is entitled to their own opinion.” (Appeal to ridicule if said sarcastically)
  • “It works in theory, but not in practice.” (Base rate fallacy)
  • “It's just common sense.”
  • “It makes sense to me, and that's all that matters.”
  • “To each his own.”
  • “Life is unfair.”
  • “Such is life.”
  • “We already had this conversation.”
  • “It is what it is.”
  • “It was his time.”
  • “Whatever.”
  • “There you go again.”
  • “It's not worth discussing.”
  • “Whatever will be, will be.”
  • “Be a man and…”
  • “Who cares?”
  • “It's a matter of opinion!”
  • “You only live once.” (YOLO)
  • “Just forget it.”
  • “We will have to agree to disagree.”
  • “We all have to do things we don't like.”
  • “You are not being a 'team player'.” (Ignoratio elenchi)
  • “That's just wrong.”
  • “You just don’t do that.”
  • “Just do it.”
  • “Link or it didn't happen.”
  • “Don't be that guy.”
  • “Because that is our policy.”
  • “Don't be silly.”
  • “There's no smoke without fire.” (used to convince others that a person is guilty based on accusation or hearsay and to discourage further examination of evidence)
  • “I'm just sayin'.”
  • “So it goes.”
  • “Me thinks thou dost protest too much.” or “The more you argue, the less we believe you.”
  • "Rules are rules."
  • "Who do you think you are?"/"Who are you to..."
  • "It's all relative."
  • "People are going to do what they want."
  • "That's just your feelings."
  • “Can't everybody just drop it and get along?” (used as an attempt to stop an ongoing debate or argument)
  • "It's the way of the road."

Political examples

Thought-terminating clichés are sometimes used during political discourse to enhance appeal or to shut down debate. In this setting, their usage can usually be classified as a logical fallacy.[citation needed]]]

Religious examples

Thought-terminating clichés are also present in religious discourse in order to define a clear border between good and evil, holiness and sacrilege, and other polar opposites.[citation needed] These are especially present in religious literature.[citation needed]

  • "The Lord giveth, and the Lord taketh away." Job 1:21
  • "Adam and Eve, not Adam and Steve!" (opposing same-sex marriage)
  • "That's not Biblical."
  • "God moves/works in mysterious ways."
  • "God never gives you more suffering than you can bear.”
  • "Only God can judge."
  • "God has a plan."
  • "The Lord works in mysterious ways."

The religious or semi-religious ideas of cults, heretics, and infidels are also often used as thought-terminating clichés, e.g. "Do not listen to him, he is an infidel," (a guilt by association fallacy) or "That line of thought sounds like a cult" (also a guilt by association fallacy).

As an autological phrase

The statement "that is a thought-terminating cliché" can itself function as a thought-terminating cliché. Once the stator has identified a first statement as a thought-terminating cliché, they may feel absolved of needing to determine whether that first statement is indeed a thought-terminating cliché, or provides useful insight, in the context under discussion.

See also

References

  1. ^ Lifton, Robert J. (1989). Thought reform and the psychology of totalism: A study of brainwashing in China. UNC Press. p. 429. ISBN 9780807842539.
  2. ^ The Watchman Expositor: The use of Mind Control in Religious Cults (Part Two)

 


Update 2019-06-17: A recent thread on reddittalks about "Gish galloping" which is another strategy for shortcutting reasoned arguments:


The opposite is gish galloping, where you make an argument by throwing out a large number of individually easily countered false arguments and knowing that it requires the person more effort to disprove each than it takes you to keep throwing them out. So you will appear to win as they fail to logically address each individual argument and you can say "THought Terminating Cliche!" if they just accuse you of generally lying.


How small do things need to be, to be dangerous?

published Aug 30, 2013 05:10   by admin ( last modified Aug 30, 2013 05:20 )

An exchange of opinions is happening on twitter, between J. Craig Venter and Nassim Nicholas Taleb, about whether genetically modified crops are good or not. I tried to summarize the case for why GMOs are dangerous like this:

Ok, this is how I understand why GMOs are dangerous:

  1. Nature has a certain tolerance (hysteres, non linearity) for shenanigans, if you go outside that envelope you may end up in a wasteland. This is potentially lethal if you do it on a global scale

  2. GMOs are modification of small self-replicating things, hence have the potential to go global, and out of control. Even if that was not your intention.

  3. It's not about the *probability* of this happening but about the *pay-off* (consequences) if it happens

So self-replicating things can be dangerous, but I started thinking, how small does something need to be, to be out of control?

If you look at land based organisms: If we should get, say genetically modified evil elephants, it would really not be a a huge problem. We can simply locate all those elephants and kill them. With smaller things it gets harder.

Size Locate and kill all Stow away capacity
Elephant (10 meters) Easy They are conspicuous, you know
Dog (1 meter) Hard, but maybe doable None
Rat, snake (1 decimeter) Probably impossible Some
Insects (1 centimeter) Forget it Carried by winds, in little spaces on ships and airplanes
Seeds (1 millimeter) Forget it ditto + on fur, clothes, some UV protection often
Bacteria, fungi, viruses (many in micrometer to nanometer range) Forget it Immune systems can fight them actually, which is good since they are everywhere

 

 


Python module that has bayesian classification of texts

published Aug 30, 2013 04:40   by admin ( last modified Aug 30, 2013 04:40 )

I have tinkered with this previously with pickle, jart/redisbayes and jamesls/fakeredis (real redis slows down redisbayes a lot, pickle used for saving the net) in python, but this TextBlob module seems to have it too. Untested by me.

 

Yesterday, TextBlob 0.6.0 was released (changelog), which introduces Naive Bayes classification. This tutorial shows how to use TextBlob to create your own text classification systems.


Read more: Link - Steven Loria | Tutorial: Simple Text Classification with Python and TextBlob


Python library to fix unicode mistakes

published Aug 29, 2013 01:42   by admin ( last modified Aug 29, 2013 01:42 )

Untested by me:

 

You have almost certainly seen the kind of problem ftfy fixes. Here’s a shoutout from a developer who found that her database was full of place names such as “BucureÅŸti, Romania” because of someone else’s bug. That’s easy enough to fix:


Read more: Link - ftfy (fixes text for you) version 3.0 | Luminoso Blog


Make Imagemagick put text in the intended corner of pseudo rotated photos

published Aug 21, 2013 02:30   by admin ( last modified Oct 30, 2013 01:00 )

Photos from digital cameras nowadays may contain metadata about which side is actually up on the photo. All image viewers I have tried on Ubuntu heeds this and auto rotates the photos for you. But Imagemagick does not understand this auto-rotation stuff and will put your text in the wrong place on some pictured because from Imagemagick's point of view the image is not rotated.

So how do you rotate them so Imagemagick gets it right? The image viewers won't help you since they "lie" to you and will show the image corrected rotationally. One of my image viewers has a setting for disabling this auto rotate behavior, but the setting does not work.

Update 2013-10-30:

Use exiftran

It will rotate the pictures based on the exif orientation information, and update that information.

exiftran -ai *.JPG

Old solution:

What you need to do is strip the metadata from the photos, and then use the image viewer of your choice (e.g. Gwenview), to see which pictures in fact aren't correctly rotated and rotate them.

Then use Imagemagick. This command will strip all metadata from your photos:

exiftool -all= *.JPG

 

It can probably be configured to just strip some of it it, if need be.


Mathematics as magic to be taken at face value

published Aug 14, 2013 01:46   by admin ( last modified Aug 14, 2013 01:46 )

Mathematics is high status, probably due to its success in physics, and because of this it is used in fields and applied to problems that are too unstructured and messy for it to make any sense.

In fact sometimes it is used to obscure: You simply take some maths that is really hard to understand and rely on people not being able to follow your train of thought through it and accept your conclusions at face value. It's like HC Andersen's story about the Emperor's new clothes.

One example is complex mathematic functions applied to finance, but now we can read about another case applied to psychology. I think this quote from the linked article speaks all by itself (my boldface):
 

Upon reading a 1963 paper on Lorenz equations “with some difficulty,” Brown realized that the equation Fredrickson and Losada used to calculate the critical positivity ratio had no connection to their emotion data: Regardless of the volunteers’ data points, the equation would simply generate the same, meaningless number.


And this was a paper that gained quite some status:

“What’s shocking is not just that this piece of pseudomathematical nonsense received 322 scholarly citations and 164,000 web mentions, but that no one criticized it publicly for eight years, not even supposed experts in the field,” Sokal says.

Read more: Link - Ratio for a good life exposed as 'nonsense' | Psychology | Science News


An explanation for the middle class squeeze?

published Aug 09, 2013 02:26   by admin ( last modified Aug 09, 2013 02:26 )

There is a lot of talk, especially in the U.S., of the middle-class squeeze. I wonder if it could be explained by increased unpredictability. It is said that the middle class is doing worse and worse, and that the differences within the middle class is growing too: Between the upper crust of it and the rest.

Nicholas Nassim Taleb talks about Mediocristan and Extremistan, two imaginary places where in one case your income is predictable and proportional to the amount of work you put in, while in Extremistan rags and riches are decided much more by chance. An example of a Mediocristan job that Taleb gives is a dentist.

Examples of Extremistan jobs could be I guess anything connected with speculation: Building an app for the Iphone app store, making bets on the stock market, relasing a video game, developing a new pharmaceutical and so on. If you do ten, or even a hundred of these projects it is not clear which one will make money, if any. At the same time there may be huge profits, somewhere, sometime.

Let's assume that the world has moved in the direction of Extremistan, and that the actual financial gain from work is much harder to predict. Let's then simplify a lot and say we can divide people into three groups, let's call them

  • Squeezed middle class
  • Upper middle class
  • Upper class

The squeezed middle class are people who toil away in projects where it is unclear if they will give any profit and in that case how much. Because of this there is a risk premium associated with each project, and this is reflected in the salaries paid. The squeezed middle class are doing just as good work as a couple of decades ago, but it is much harder to predicted the actual value of their work, so salaries get depressed as a risk premium.

The upper middle class in this simplified model are then people that simply got lucky by doing a couple of successful projects.

The upper class has enough money to spread the risks and reap the rewards of a high risk/high reward environment


Use your own functions chained with jQuery ones

published Aug 07, 2013 01:15   by admin ( last modified Aug 07, 2013 01:15 )

Untested by me at this point in time;

 

jQuery Combinators adds five very useful methods to every jQuery selection: tap, into, select, ergo and when. These allow you to use your own functions as if they were built-in jQuery methods, which makes your code cleaner and more "jQuery-like."


Read more: Link - jQuery Combinators by raganwald


Libraries that handle web sql

published Aug 05, 2013 08:15   by admin ( last modified Aug 05, 2013 08:11 )

There can be a lot of callbacks when handling web sql. These libraries aim to make it easier. Web SQL is important on mobile platforms such as IOS and Android.

 

html5sql.js Home Page

psayre23/WebSQL