markbokil.com

Tech Blog

This page has ramblings on OSX, PHP, Linux, MySQL, AngularJS, Mozilla Firefox, JavaScript and other technologies I find interesting or useful.

A bookmarklet to show tooltips for Oracle UCM

Last modified on 2017-02-14 02:28:43 GMT. 0 comments. Top.

I was working on a project with Oracle UCM (Web Center) and noticed there was no easy way to identify documents on a page being served from the content management system. After a couple weeks of hacking together some JavaScript I came up with a bookmarklet which toggles the visibility of tooltips on documents. The bookmarklet also supports double-clicking which opens the document information page.

Below is a screenshot of the tooltips in action. Click once to show the document ID. Click again on the bookmarklet to hide the tooltips. To use this feature create a bookmark and then paste the bookmarklet code into the URL. Give it a name and save. Move the bookmark to the bookmark toolbar for quick access. You will also need to add JQuery to your page fragment. Finally add a JS variable on your page called siteURL which is set using a substitution string to your site’s URL.

show-docs

var siteURL = "[!--$URL_MY_WICKED_SITE--]";

Download Tooltips for UCM


Debugging PHP apps

Last modified on 2015-05-30 16:08:56 GMT. 0 comments. Top.

Debugging PHP can be difficult if you can’t see what is going on inside your web service. Lately I have been using a strategy of using log messages to monitor the values of variables. The log messages will go to your Apache error_log. In your PHP code add the below statement and give $myVar some value.

error_log("***** PHP -> " . $myVar, 0);

Open a console — iterm is great if you want an excellent terminal on OSX — and issue the following command. Keep in mind if your error_log file is in a different location you will need to find where your Apache installation has placed it. The tail command is perfect for monitoring the log messages as your app dumps variables. Grep will filter out just the PHP lines in your log making it easy to follow your app messages.

tail -f /var/log/apache2/error_log | grep PHP


Hacking AngularJS for debugging

Last modified on 2015-05-28 15:49:16 GMT. 0 comments. Top.

I have been working with Angular to write a source code wiki. It occurred to me that it is difficult to see exactly what is going on inside the $scope variable unless you use console.log() generously to output values. So I started to look for a way to debug Angular without using Chrome extensions. The hack is to temporarily set a window variable that points to $scope.

app.controller('notesCtrl', function($scope, $http,$sce) {
//scope hack for debugging
window.ng = $scope;

So now you can open up Chrome or Firefox’s console and type ng.myVar and see what the value is. I would turn off the hack for production or you risk polluting the global memory.

angular_hack


Minimalist White Firefox theme for Australis

Last modified on 2015-05-27 04:53:11 GMT. 0 comments. Top.

I started using Firefox 29 beta. This version of the browser has a new UI called Australis with curvy tabs that look somewhat like the Chrome browser. I felt the new tab look was too heavy and over-dominating so out it goes! I updated the Minimalist White theme to support Firefox 29 beta. Install it at user styles.

Minimalist White Firefox theme


Better HTML tag matching effect for Sublime

Last modified on 2015-05-27 04:54:04 GMT. 0 comments. Top.

I use the Monokai Bright Sublime 3 theme mostly for editing HTML. It bothered me the bracket highlighting for HTML was so hard to see. So I edited the theme so HTML tags light up with an electric blue underline effect. Download the theme. On my system I located the theme file in C:\Users\mark\AppData\Roaming\Sublime Text 3\Packages\User\Color Scheme – Default. In the Sublime menu you can then set the theme from the Preferences menu > Color Scheme > User…

Monokai bright mod HTML bracket matching


Minimalist White Firefox theme

Last modified on 2015-06-02 03:20:50 GMT. 0 comments. Top.

I have been experimenting with giving Firefox a flat design look with inspiration from Safari and iOS 7. I wanted to get rid of all the borders, gradient backgrounds, and boxy look. You will need to install Stylist extension and then install the style. I also suggest updating the scrollbar look with Mac OSX Scrollbars for Firefox.

 


Gnome Shell Disper Displays Extension

Last modified on 2015-06-02 03:21:14 GMT. 0 comments. Top.

I had some technical problems with my Cinnamon Linux partition so I started working again in Gnome Shell. I missed the display switching applet I had in Cinnamon so I coded a simple extension for Gnome which uses disper to manage displays. Now I can turn my TV off and work on the PC monitor or ‘clone’ the displays and have identical displays on different devices. Gnome Shell is not looking too shabby. Get more info on the extension or download it.


Cinnamon Linux MyLauncher App

Last modified on 2015-06-02 03:19:53 GMT. 0 comments. Top.

I was looking for a way to dump web sites, applications, and folder locations into a custom panel menu and I couldn’t find anything that did what I wanted so I created this app. You can add a list of apps, URLs, and places in a simple text file and the menu GUI will automatically rebuild itself. Perfect for developers or power users who want a custom menu with just the stuff they want. Download MyLauncher from the Cinnamon Linux site.

I have gotten some requests to move MyLauncher app to Gnome Shell as an extension so here it is: MyLauncher Gnome Shell.


Show desktop indicator for Ubuntu Linux

Last modified on 2015-05-27 06:07:41 GMT. 0 comments. Top.

So I was messing around with some Python code and I was able to cobble together a small app which puts a show desktop icon into the Ubuntu Unity panel. You can do the same thing with a hot corner in Compiz or press the Windows key plus D to show the desktop. Download the archive, extract the files and read the readme file for help.

show desktop indicator

Install wmctrl before running:
sudo apt-get install wmctrl

Change the desktop-indicator.py script to executable:
chmod +x desktop-indicator.pyAdd desktop-indicator.py to startup applications or double-click it in Nautilus and select run.