Save it as a .py file in Packages/User folder (it should be the default folder when you select save). I chose testPlugin.py
You can run in from the Sublime Text console (Ctrl + ~ in Windows) using the following command. (if it doesn’t work try, try saving the file again with the console open to see any errors and also try closing and reopening Sublime Text)
Running Camel Case Commands
def run(self, edit):
self.view.insert(edit, 0, "Hello, World!")
sublime.Edit & sublime_plugin.EventListener
If an edit object is needed (seems to be needed for writing things on the page), use view.begin_edit() but don’t forget to end_edit()
They can be created by view.begin_edit(). Every call to view.begin_edit() must have a corresponding call to view.end_edit(), typically wrapped in a try … finally block.
The EventListener class let’s you trigger things on an event happening and the code below shows inserting text to a document when it is opened. (Disclaimer: I’m not fluent in Python so I’m not sure if the below is fully correct but it does seem to work)
For the popularity that Sublime Text gets, it seems that their plugin documentation has been left by the wayside
Their Plugin Examples page is out of date showing an example for SublimeText 1. I found that out when creating the plugin only to see the following error message in the Sublime Text console (Ctrl+~ in Windows)
I know I was a bit confused when initially rooting and installing custom ROMs on my Android device and while I don’t consider myself an expert there are a few terms that could use a quick definition to know your way around custom ROM installations.
When you start your device you can boot into 1 of 3 modes
Bootloader: a mode that can boot into Recovery or start the regular boot process (into Android) and also shows some details of your device. ROMs can be flashed in the bootloader but it is not the typical case
Boot loaders can be locked which prevents custom ROMS from being flashed. Unlocking the bootloader can be done with the following commands (this was done on a Nexus 7 2013, other devices may need other commands)
Reboot into the bootloader
adb reboot bootloader
Unlock the bootloader
fastboot oem unlock
Once the bootloader is unlocked you can install a custom ROM. While I believe it is possible to install custom ROMs without a custom recovery program, the typical way to install a ROM is with one. I’ve used ClockWorkMod Recovery and Team Win Recovery Project (TWRP) but there are others other there. Just make sure you install the right one for your device.
Flashing a Custom ROM
Install a custom recovery
Install it on your device
Download your custom ROM
Reboot your device into recovery
adb reboot recovery
Follow the on screen instructions to install the ROM
Typically you have to wipe your device (dalvik cache, system and personal data)
Stock ROMs are the original ROM that came with the device
Custom ROMs typically will not have the Google services and usually need to be manually installed. Typically packaged / called gapps
Some problem with custom ROMs is usually hardware support: some things may not work as well as they do on stock ROMs. Thus custom ROMs that are based on stock ROMs will probably have better hardware support compared to generic custom ROMs
Rooting gives you more control on your device and lets you run apps that have special abilities. Some features that I use are
That will create a backup.ab file on your computer which can get huge
adb restore backup.ab
Restoration can be done even on a different ROM and it even maintains settings apps which require you to log in.
Full details of adb backup are as follows and you could selectively backup important app data and such.
adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
- write an archive of the device's data to <file>.
If no -f option is supplied then the data is written
to "backup.ab" in the current directory.
(-apk|-noapk enable/disable backup of the .apks themselves
in the archive; the default is noapk.)
(-obb|-noobb enable/disable backup of any installed apk expansion
(aka .obb) files associated with each application; the default
(-shared|-noshared enable/disable backup of the device's
shared storage / SD card contents; the default is noshared.)
(-all means to back up all installed applications)
(-system|-nosystem toggles whether -all automatically includes
system applications; the default is to include system apps)
(<packages...> is the list of applications to be backed up. If
the -all or -shared flags are passed, then the package
list is optional. Applications explicitly given on the
command line will be included even if -nosystem would
ordinarily cause them to be omitted.)
Another great adb command is screen recording which I believe is only in Android 4.4 (KitKat) and above
adb shell screenrecord /sdcard/test.mp4
Ctrl+C to stop recording the video
If you have multiple devices connected, use -s deviceID to spec
# List of devices attached
# 00bb1122 device
# 0022334455 device
adb -s 0063686250152c5a shell
Stumbled upon OpenBrunei’s Map of Mosques in Brunei-Muara and thought I would do a simple geolocation web app. Still needs much work but very usable ATM for those who require it. Don’t have an app icon yet but you can add it to your home screen on iOS, Android and I believe Windows Phone too.
The code labs served as a way to learn Dart and it is even deployable on Heroku. We also covered a bit of Angular JS with a work in progress AngularJS intro project on GitHub.
So in the previous ITLT post: “Ultrabook & the latest Intel HD Graphics“, I realised how horrendous laptop product pages can be: hard to find the latest models and sometimes even harder to find their specifications at a glance.
In the order of best to worst that I saw are
Apple: basically 2 different skews of notebooks each has 1 page for all specs and extra text with configuration options. Shows full specs and starting prices (MBAs /MBPs)
Sony: 1 page showing the 4 different types/segments of notebooks showing screen sizes and start prices. No filtering but the 4 different segments are unique enough that they don’t really need filtering. Each segment shows different models in that segment with processor, screen size & resolution, price. Comparison between models available non obvious page.
Lenovo: results show main specifications (CPU, Graphics, RAM, storage, screen size & resolution, OS, price) items list shows main specifications and has nice sidebar filtering but no filtering on screen resolution. Does not show possible upgrades. No comparison
Dell: 86 results in total but good filtering: checkboxes that work and filterable by 4th gen processor. Results list show OS, Storage, RAM, price.
HP: the main page separates devices into “Home” and “Work” which I don’t really like. Results show (screen size and possibly price). Filtering by size shows a checkbox list but it works like an option dropdown – you can select only one. There is no filtering based on processor, so results could be showing you old laptops. Comparison of up to 3 devices to see further specs. 40 devices in total.
Asus: Nice sidebar filtering options but dismal details of results listing: only shows screen size. Processor filtering does not show 4th gen processors (only 3rd gen and below). UX 301 LA is named as “Ultrabook” but filtering by “Ultrabook” thinness hides it. Can compare models (max 5) to see more specs. 51 results in the “thin and light” category (176 in all categories) – lots of older models.
Samsung: Results show only screen size. No filtering and shows a lot of older models. Same model of different colour listed as a separate item – meaning there are duplicates. Viewing all shows all 187 results (lots of old models).
It’s sad to see how manufacturers are giving consumers a hard time just looking to find a laptop. It’s even sadder to see some manufacturers showing old models in their listings (Asus and Samsung). Kudos to Sony for simplifying their range to 4 distinct types of laptops but Apple takes the cake due to their minimal yet sufficient product line up and having information rich specification pages.