Skip to main content

Posts

Brackets: a free editor/environment for web development

 There are a lot of options, and VS Code is one of the top contenders. I am a VS Code fan, but if you are looking for an alternative, Brackets is another option that I find appealing. It was built for web development, using HTML/CSS/Javascript. I think it is especially helpful for people who just start learning HTML/CSS (and maybe Javascript). http://brackets.io/ Brackets has some built-in features that are pretty convenient. 1. auto-complete for CSS property and value. 2. Live preview the webpage to reflect the changes being made. You can make changes in code and see the result instantly. 3. In-place editing of CSS rules (you can select an element/class name in HTML and press the short keys to edit the corresponding CSS rules directly). 4. Code to browser mapping: you can select/edit an element in HTML or a rule in CSS, and the corresponding user interface elements or those that will be affected by the CSS rule will be highlighted in the browser. See this video for an overview. Th...

Prevent Endless Reboot after Updating your Apple Laptop's macOS, especially the macOS High Sierra 10.13 Supplemental Update

If you have a MacBook pro and you want to do the latest update (the small one after high sierra, or "macOS High Sierra 10.13 Supplemental Update"), you should probably 1. backup (e.g., time machine), 2. (important!) connect your laptop with ethernet, and 3. connect to a power source. My MacBook pro time-jumped to some time in 2016 after the update and it forced itself into a power-cord only endless reboot mode. No kidding! Endless reboot,  like you never hear the reboot sound effect so many times. After the update, it wouldn't start unless it was connected to a power source, but it would reboot a few seconds after that Apple loading progress bar reached around 60% or 90%. My current working hypothesis is that it has to be connected to the internet before it reaches that point. Otherwise, it restarts again before you could quickly choose a WiFi access point and enter the password. After a few hours trying all the special hotkey combinations suggested on the inter...

Basic tmux commands

Here are several basic commands for tmux , a terminal multiplexer. tmux list -> list all the session tmux attach -> attach the last session In session (or any window): Ctrl + b, c -> create window Ctrl + b, n -> next window Ctrl + b, p -> previous window Ctrl + b, l -> last window Ctrl + b, d -> detach session Ctrl + b, :rename-window New_Name_FOR_WINDOW -> rename current window In a window exit -> exist a window Reference Cheatsheet

Using Pandoc for Doing Citation and Bibliography in Markdown

Markdown is a simple formatting syntax that allows you to do common formatting with ease. Pandoc is a feature rich interpreter that helps you convert documents from one format to anther. If you are writing homework, research papers, or anything that needs citation and a bibliography, you can totally use Markdown and Pandoc to achieve that. Below is a set of instructions that you can follow to generate a document with in-text citation and bibliography. First, install Pandoc and the extension for creating citation ( pandoc-citeproc ).  There are several ways to install Pandoc, you can choose one of them recommended on the official website . On Mac, one way is to install Homebrew , a package manager, and then use Homebrew to install Pandoc and the extension. For Windows users, please refer the official website on how to install Pandooc and extension. Here I will show how to install Pandoc and the extension for citation through Homebrew. After installing homebrew, you can ...

How to update multiple fields in an SQL update statement

Syntax: /* the correct way of putting multiple fields together, using comma */ UPDATE `stories` SET `content`='Once upon a time ...', `update_time`=now() WHERE id=1; Note: there is no 'and' between the fields you are trying to update. You should use comma between each pair of the fields you are trying to update. Otherwise, you will likely get an '0' as the result value in the 'content' field without getting any error message. If you do the following, you will likely get an '0' in the 'content' field, without any error message /* the wrong way of putting multiple fields together, using 'and' */ UPDATE `stories` SET `content`='My Story' and `update_time`=now() WHERE id=1; See also:  http://stackoverflow.com/a/7375371

getFragmentManager = null when using 'fragment' tag in Android layout file

I was using 'fragment' tag in the layout file for the Android app I was developing, as shown in the first code block. The id of the layout file for the CalendarFragment (.java) is R.id.calendar. I want to get the CalendarFragment instance in my code at runtime using getFragmentMeneger.findFragmentById(R.id.calendar) but kept getting null result. I ended up using getFragmentMeneger.findFragmentById(R.id.left1), the id for the 'fragment' tag in the main layout file to get the CalendarFragment at run time and it works. 'fragment' tag in the layout file for MainActivity.java: Actual layout file for the CalendarFragment.java: Actual java code in MainActivity.java to access the fragment:

Install Maynard Desktop Shell on Raspberry Pi

There is a light-weight desktop environment, Maynard, for Raspberry Pi. Here are the steps to install and start using it. wget http://raspberrypi.collabora.co.uk/setup-maynard.sh chmod 755 setup-maynard.sh ./setup-maynard.sh // reboot // login maynard // enjoy Reference: http://raspberrypi.collabora.co.uk/maynard.html