Archives 2005 - 2019    Search

A free web/blog site with tables?

published Mar 05, 2014 09:35   by admin ( last modified Mar 05, 2014 12:00 )

I had the need for a quick and easy way to publish a table on some free web publishing service. The table must be easy to edit. However finding a free blog site or web publishing site where you can add tables in the wysiwyg editor turned out to be not that easy. In fact I have not found one yet:

 

Wordpress.com

 

no wysiwyg tables. There are plugins for wordpress that have this, but they are not available at wordpress.com, at least not for free.

Tumblr.com

 

no wysiwyg tables

Livejournal.com

 

no wysiwyg tables and has peculiar ideas about password security and annoying captchas

blogspot.com

 

no wysiwyg tables

blogetery.com

 

Is supposed to have some wordpress plugins, which ones they are is not listed, but signup does not work whether using Firefox or Chrome from Ubuntu, so it will remain a mystery.

angelfire.lycos.com

 

has a table "plugin" but it disappears when you try to click it in Google Chrome or Firefox

notehub.org

 

has markdown publishing, but does not support the markdown table format

 


Running a GUI application on your Linux machine as a different user

published Jan 11, 2014 03:45   by admin ( last modified Mar 23, 2015 02:08 )

Update 2015-03-23: It seems that the program get privileges to both accounts. If I start Firefox with it, it can read both from my account's files and the the account that sox runs it as.

sux seems to do the job. If you are on Ubuntu:

 

sudo apt-get install sux

 

sux other_user_name gui_program_to_run

 

You may need to include the full path to the program you want to run, e.g. if is a Windows program to be run under wine

sux other_user_name wine /path/to/program

 

Haven't tried without full path though.


When the newfangled buttonless touchpads make right click difficult in Ubuntu

published Jan 03, 2014 11:19   by admin ( last modified Jan 03, 2014 11:19 )

There is a "hidden" setting in Gnome that allows you to use two fingers on the touchpd (trackpad) to emulate right click (context click). Read more here:

 

http://askubuntu.com/questions/331605/simulate-right-click-in-laptop


How to get python 2.4 to compile on a new Debian

published Dec 31, 2013 03:40   by admin ( last modified Dec 31, 2013 03:52 )

The instructions are for Ubuntu, but the user appociappo's instructions worked like a charm on Debian 7. It contains a patch to setup.py, and flags for the C compiler and loader:
 Link - [ubuntu] compile python 2.4 and 2.6 on 12.04 x86_64

Furthermore, if you are using bootstrap.py for e.g. a Plone buildout, this bootstrap.py seems to work:

http://blog.fourdigits.nl/python-2.4-bootstrapping


Making adjustments to a non functioning ubuntu install

published Dec 17, 2013 10:55   by admin ( last modified Dec 17, 2013 10:55 )

Boot with a live CD or live USB. Assuming that your install is availableat /dev/sda1, then, quoted from:

http://askubuntu.com/questions/112957/display-works-fine-in-livecd-but-not-in-full-installation

 

sudo mkdir -p /media/ubuntu
sudo mount /dev/sda1 /media/ubuntu

Then you need to mount the proc, dev, and sys filesystems into your new environment:

sudo mount --bind /dev /media/ubuntu/dev
sudo mount --bind /proc /media/ubuntu/proc
sudo mount --bind /sys /media/ubuntu/sys

Finally, chroot into it:

sudo chroot /media/ubuntu

Now edit /etc/default/grub, uncommenting out the line

GRUB_GFXMODE=640x480

and then run

sudo update-grub

Being logged in on XMPP chat with same nick from several places

published Dec 11, 2013 02:14   by admin ( last modified Dec 11, 2013 02:14 )

If you use different devices for your XMPP chat, it can be a chore to have different nicks just so that you do not get kicked out or blocked when you log in from device number 2.

Newer versions of ejabberd (13.10 tested) allows this by default, however the old version (2.1.2) shipped with Ubuntu 10.4 does not. Openfire did not allow it in the version I tested, and it seems that it is not possible.


Vagrant, a way to configure virtual machines

published Dec 01, 2013 11:50   by admin ( last modified Dec 01, 2013 11:50 )

Just a note to self:

 

Create and configure lightweight, reproducible, and portable development environments.


Read more: Link - Vagrant


Format a USB stick on Ubuntu

published Nov 05, 2013 02:30   by admin ( last modified Nov 05, 2013 02:32 )

Taken from: Link - How to format a USB flash drive? - Ask Ubuntu

 

sudo fdisk -l

It will show all the volumes. My stick was at /dev/sdb1 .

Change /dev/sdb1 if the USB stick isn't there and enter its correct address.

If the USB stick is at /dev/sdb1, unmount it with:

sudo umount /dev/sdb1

Then format it with fat32 like so:

sudo mkfs.vfat /dev/sdb1

 


An HTML Wysiwyg editor that can edit divs?

published Oct 31, 2013 11:35   by admin ( last modified Oct 31, 2013 12:06 )

Oftentimes, I'd like to edit a div in Wysiwyg mode. But the Wysiwyg editors that I use (TinyMCE and CKEditor) do not seem to show divs in an easy way. They do show tables, with borders and all, and I assume the same could be done for divs.

I'd like to see where the divs are, be able to create a div, preferrably by selecting a piece of text and do a "wrap in div" command or some such. And I want to be able to select a div in Wysiwyg mode, and edit its CSS classes.

I guess you could go through their source code and model a div editing capability on the table editing capability.

Hmm, I just realized that showing the divs is just a matter of editing the CSS for the edit view. Half the problem solved.

Div container manager looks promising, but I am not entirely sure of how to integrate it into my CMS, Plone. Just including the file does not work, and additionally adding "div" to the Plone toolbar configuration does not work either.

For TinyMCE there is visualblocks.

 

 


My git cheat sheet

published Oct 30, 2013 09:05   by admin ( last modified Jun 15, 2015 04:38 )

Pulling, fetching & merging

I want to track a new remote branch

Check what branches are available at remote:

git remote show origin

Then do:

git fetch origin remote_branch_name:local_branch_name

There are differences between my branch and the remote branch, but I want to see what would be merged in, before doing a pull

Do a fetch first

git fetch

and then compare the branches with

git diff HEAD...origin

I want to merge in another branch, how do I pull down the new stuff in that branch without switching to it?

Do :

git merge origin/other_branch

while being in your branch.

A

git pull --all

followed by a a

git merge other_branch

won't work. "git pull --all" fetches all tracked remotes and updates them, but only merges new updates on your current branch. So even if other branches are updated locally, HEAD hasn't moved in them and from merge's point of view the updates aren't there.

How do I merge in a branch so that everything in the incoming branch takes precedence?

In subversion you can do “theirs-full” as a merging strategy. You used to be able to do that in git too, but it has been deprecated and outright removed.  Here is one way of doing a theirs-full. You simply move to the incoming branch, branch it into a temporary branch, switch to master and merge that one into yours

git checkout -b temporary origin/incoming
git merge -s ours master         # ignoring all changes from master
git checkout master
git merge temporary                        # fast-forward to tmp HEAD
git branch -D temporary                    # deleting tmp

See more at:
http://stackoverflow.com/questions/4911794/git-command-for-making-one-branch-like-another

If you want the incoming branch to completely take over, there are a couple of ways of doing that. Assuming the incoming branch is called “incoming”, and that you are on the “master” branch:

git reset --hard incoming

-or-

git branch -d master
git checkout incoming
git -b master

-or-

git checkout -f -b master incoming

Before you do any of the above you may want to create a branch for your old work, or it is effectively rendered inaccessible. Note that any files from your original master not present in incoming, will be ignored.

Pushing

How do I initialize a remote repository with my stuff and make my local repository track the remote?

$ git remote add origin git@gitserver:/opt/git/project.git
$ git push origin master

How do I push to a fresh remote repository?

If the remote repository is fresh and does not have any branches in it, it does not know where to store your stuff, even if you are on master. Use:

git push --all

It will create the necessary branches on remote and effectively copy all your branches over, including the one that you are on.

See:
http://stackoverflow.com/questions/6157730/why-cant-i-push-to-this-bare-repository

I have created/edited tags, but "git push" does not seem to include them

git does not push tags to remote servers unless you specify that explicitly

git push --tags

...for all tags.

git push <tagname>

...for a named tag

I made a new branch locally, and I want to push it to remote

You need to use

git push -u origin branchname

It will also set up your local branch to track the remote one.

Do not just do a

git push

, because that will push master to master on remote, even if you are on your new local branch.

git push --all

should work too, if you want to push all branches to remote.

Where are the remotes?

git remote -v

shows you what you’ve got
A local branch can track a remote branch. git clone automatically sets up this

Undoing stuff

How do I revert unstaged files to last commit?

git checkout -- .

How do I unstage a file?

git reset HEAD filename

How do i undo my last commit?

Most drastic

Undo your last commit and bring your workspace and staging area back to the state of the last commit:

git reset --hard HEAD~1

if you want to keep your workspace as it is now:

git reset HEAD~1

Least drastic

if you only want to undo the commit but keep both your index (staging area) and your work space as they are now:

git reset --soft HEAD~1

Any of these resets will erase your most recent commit from the commit history! There are ways of getting it back but it is a bit of work.

See: http://stackoverflow.com/questions/927358/how-to-undo-the-last-git-commit

Aborting a merge when you are in the middle of it

Hit Ctrl-c to exit the merge tool dialog
If your git is 1.7.4 or newer:

git merge --abort

If your git is older than 1.7.4:

git reset --merge HEAD
git clean -f

(but this latter will remove all untracked non-ignored files, may not be want you wanted, however you should had made sure of a clean state before the merge, and then its cool)
One would have thought that git stash would help here, but you cannot stash merge conflicts, so it is not an option

My editor removed a file by mistake, how do I get it back and/or
I want to revert a file to last commit


You may see it staged for deletion. Then do a checkout to the branch you are already on, for that particular file:

git checkout -- file_that_was_deleted

It works without the “--”, but since your file name may correspond with a branch name it is best to put “--” in.

git submodule

You can use sub modules in a fruitful way if you’re on git 1.8.2 or later:

http://stackoverflow.com/questions/9189575/git-submodule-tracking-latest/9189815#9189815

http://www.vogella.com/articles/Git/article.html#submodules

How do I get a version of git that is 1.8.2 or newer?

Github and bitbucket already run by default on newer versions. So does newer versions of Ubuntu.

If you are on an older Ubuntu, use:

sudo add-apt-repository  ppa:git-core/ppa

from: https://launchpad.net/~git-core/+archive/ppa

Adding a submodule to a repository

git submodule add -b branch <url> dirname
git submodule add -b master ssh://git@git.example.com/srv/git/awesome_lib.git awesome_lib

When cloning a repository that has a submodule :

When you clone the  parent repository, the submodule does not get cloned into its sub directory. For that you have to do:

git submodule init
git submodule update

How to to remove a submodule

This seems quite involved, but I have successfully done so, following these instructions:

Remove a Submodule within git

Other

How do I add an empty directory in git?


You can’t. Commit an empty .gitkeep file in there and it works though.

git add --patch

Allows for staging just parts of a file, good when you want to make a commit that does not fix two or more things at once.

git add


git add -u will add all changed files it knows about to the staging area, from where you issue the command and recursively downwards. In other words, if you do git add -u in a subdirectry, only changes within that subdirectory will be staged.


When the bootstrap.py won't work because of distribute/setuptools conflicts

published Oct 16, 2013 10:55   by admin ( last modified Oct 16, 2013 10:55 )



Tell bootstrap to use an earlier zc.buildout version Run bootstrap.py with the -v option, forcing it to stick to a specific, earlier version: $ bin/python bootstrap.py -d -v 2.1.1


Read more: Link - setuptools - How to solve pkg_resources.VersionConflict error during bin/python bootstrap.py -d - Stack Overflow


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