RSS Feed

Ubuntu with BCM43228


My campus lab has the Dell desktops. I am not sure the model, but the network devices are Broadcom BCM43228. As a result, after installation of the Ubuntu (they were not installed by me), Ubuntu cannot get WiFi connection to online.

Since my student mentioned that Windows can use the ethernet cable to share the wireless network, I asked him to help to share the wireless network from Windows on the other Dell desktop, and connect to the target Dell desktop.

This step works.

Next, I followed this Q and A post, just followed exactly all the commands there. Then reboot.

Yes! It works. Now, my students can test Ubuntu.

Statistics and functional programming languages

Recently, I feel fervent to learn functional programming, because i) (in my opinion), it will become a trend, and ii) the interpreter can be used as an advanced calculator.

Since I am teaching Statistics, I want to do some calculation of the normal distribution probability.

Before I begin, I need to mention, in order to calculate the normal distribution probability something like P(x < X), this can be done by using a spreadsheet software with NORMDIST() and NORM.INV() for the inverse of the former function.

Spreadsheet is good for calculation, but not good as a calculator. My primary calculator is SpeedCrunch, which allows entering expression. But the drawback of SpeedCrunch is the lack of statistical functions.

Therefore, the functional programming comes to my mind.

Firstly, let me introduce the usage of Python. Make sure SciPy is installed. Run the Python interpreter,

from scipy.stats import norm

So, the two functions are norm.cdf() (cumulative distribution function) and norm.ppf() (percent point function).

Now, let me introduce the usage of R language.


R language is used for statistics, thus, no further module or library is required.

Both Python and R languages are not pure functional programmings. I wanted to try Emacs Lisp, but the arithmetic syntax is not convenient. The syntax is using Polish notation. In order to perform arithmetic calculation,

(* 2 (+ 3 6))

Therefore, I tried the pure functional programming language, that is, Haskell.

In order to calculate the normal distribution probability, the Statistics module is required. After installation,

import Statistics.Distribution
import Statistics.Distribution.Normal
let d = normalDistr 0 1
cumulative d 0
quantile d 0.5

“normalDistr 0 1” is to create a normal distribution with mean 0 and standard deviation 1. Then “cumulative d 0” is the calculation of CDF (cumulative distribution function), which produces 0.5. And “quantile” is the inverse function of CDF.

So, enjoy the functional programming in mathematics and statistics.

Xfce4 Power Manager, NVIDIA, Nouveau backlight issue

Recently I move back to use my (around) 4 years old laptop, HP Pavilion dv3. It has NVIDIA graphic card. But since I (re-)installed Arch Linux 64 bit on it, I failed to run the X11 with the proprietary NVIDIA driver. As a result, I used the Nouveau module instead. Then, I tried several times and finally successfully run the X11 with NVIDIA driver.

To use the Nouveau module, in the mkinitcpio.conf, we have to add in “nouveau” module, then build the initramfs (refer to wiki page). And use the “Xorg -configure” to generate the xorg.conf.

But in order to use the NVIDIA driver, firstly, has to identify the NVIDIA graphic card and download the related drivers. Secondly, since I am using 64 bit, but also running 32 bit packages, so I have to install all the corresponding lib32 NVIDIA packages. Moreover, the nvidia*-libgl are conflicted to mesa-libgl, which is used by Nouveau. After installing NVIDIA, use “nvidia-xconfig” to generate the xorg.conf.

We can also disable the splash screen (logo) when starting the X11, by adding

Options "NoLogo" "1"

in the “Device” section in the xorg.conf.

Then after using the NVIDIA, I face a serious problem, that is the xrandr (in fact I am usign ARandR) cannot change the screen resolution. This is troublesome as I need to make the changes towards the projector (2nd screen) frequently, such as two screens (left screen and right screen), laptop only (disable the projector), or clone (both laptop and the projector share the same screen). With the NVIDIA, xrandr cannot detect other resolutions, consequently I cannot make clone of the screen. So, I decided to use back Nouveau.

However, I have another serious problem with Nouveau module, that is, adjusting the backlight brightness (screen brightness). When I use xbacklight, it shows

No outputs have backlight property

I cannot adjust the backlight brightness using the usual keyboard key with Xfce4 Power Manager. Some forums stated that adding “acpi_backlight=xxxx” to the kernel parameter. But none of them works.

In my /sys/class/backlight, there are acpi_video0 and nv_backlight. Actually, I can change the backlight by echo the value to the acpi_video0/brightness, with “su”. Yet the nv_backlight does not show any effect.

I found that, I can use the keyboard key to adjust the brightness before start the Xfce4. Once the Xfce4 started (with Power Manager), the brightness change takes no effect. And the changes of the brightness is affecting the nv_backlight/brightness. So, I concluded that it is actually fixable by fixing the Xfce4 Power Manager.

As a result, I patched the Xfce4 Power Manager by editing the source code, to remove the “nv_backlight” from the priority. Install this patched package, restart the Xfce4, and now, it works!

MIUI upgrade

Today I just upgraded the MIUI to version 7. Actually, it prompted for the  upgrade since some times last week. But I failed to upgrade, expected to be server problem.

So, today I determined to find the solution for manual upgrade. The upgrade version is MIUI I visited the official site and searched the ROM, but the official site does not have this ROM. As a result, just did a search, and found the target ROM in the MIUI official forum. Then everything becomes easy now.

In order to upgrade manually, we have to identify the filename of the target ROM. If we can start downloading the ROM file partially, then we can get the filename from the folder downloaded_rom.

Then to download using our desktop web browser such as Firefox, make a search online for the filename. For my case, it is “”. Make sure you are downloading from the official forum, where the file is located in the true MIUI server.

After download the ROM file, copy it to the downloaded_rom folder, run the system upgrade, then the phone will use the ROM directly. The phone skips the step downloading the ROM which may be very time exhaustive.

Finally, reboot, and upgrade success.

今天升级了MIUI 7。事实上,前几天(上个星期那样)就已经有提示让我升级了。不过试了很多次,都升级失败。应该是服务器的问题。






Previously I read an article regarding JavaScript and another one regarding HTML.

JavaScript, it is so wonderful that not only enhances the HTML interaction, (e.g. jQuery), it also makes a revolution of the system architecture design (e.g. AngularJS, ReactJS with Babel). The Babel JavaScript compiler is so amazing that it can transform the JavaScript to EcmaScript 6 with JSX feature. JSX is actually cannot be interpreted by our current web browser, but with the Babel, it makes JSX possible.

I really cannot believe that a JavaScript can interpret a statement with the syntax like this,

var div = <div>Hello world</div>;

JavaScript, not only client-side interpretation, it also runs as the server-side, such as NodeJS.

In my opinion, JavaScript becomes so popular and so powerful is because of several factors: Web technology itself, HTML specification (DOM design), and CSS specification. In order to produce a web application effectively and efficiently, programmers developed the solution from the JavaScript aspect, because this is the best way for hacking (I do not mean cyber security attack).

As the three fundamental technologies of WWW: HTML, CSS, and JavaScript, you can discover that their syntax are different, and only JavaScript is an imperative programming language; HTML and CSS are declarative programming languages. Yet, these three languages can be integrated into single HTML page. Other programming languages such as C, C++, PHP, Java, C#, etc, they are too programmer-oriented. As a result, they are too rigid during the development. JavaScript is using dynamic typing, thus, development on the JavaScript is more robust. PHP is also dynamic typing, but it is server-side scripting language. JavaScript because of NodeJS, both client-side and server-side can use it. One language rules them all.

And because of JavaScript, the rise of JSON is gradually replacing XML. It is more lightweight and highly used in Web API. Comparing to XML, JSON is much simpler, focusing on the data only. And the syntax can be easily used to differentiate the data types: number, string, boolean, array, object, and null. On the other hand XML should be parsed with a parser according to a DTD (document type definition). Moreover, MongoDB uses BSON format, which is based on JSON.

Therefore, for the web technology, JavaScript is one language that rules them all. I am no sure whether JavaScript will be highly used in desktop applications or not. But surely it cannot be used to develop system software.

Facebook chat list

I am not a Facebook fervent user. I use it because of some of my friends are using it.

So, if you want to enable your “available to chat” status to your group of close friends or special group of friends,

  1. Go to Friends an create a list that you want to chat with.
  2. After creating the list, add your close friends.
  3. Now, turn on the Chat.
  4. Go to Chat Options > Advanced Settings
  5. Choose “Turn off chat for all friends except…”, and add in your target chat.
Custom chat list in Facebook

Custom chat list in Facebook

Then, if you are using Pidgin, you can use chat with your Facebook friends by following this instruction.

LibreOffice Writer table tips


LibreOffice Writer is better than Microsoft Word. If you are a web developer, you should understand that there are class and style. Using LibreOffice is tended to using class-like style, instead of direct formatting, which causes a lot of inconsistent, troublesome, and time consuming modification throughout the word processing. And this is happened when the newbies are using Microsoft Word to create templates for the advanced user like me, and causes me full of trouble as being tortured.

The worst thing in Microsoft Word is the Numbering format. Microsoft Word sets the numbering format as properties of a paragraph. But LO Writer differentiates the paragraph style, character style, frame style, page style, and the list style. Thus, it is much more easier to use the list style in LO Writer.

I admit that LibreOffice Writer still has some limitations comparing to some features of Microsoft Word, but for the styles and formatting, it is much more easier than using Microsoft Word.

Now, let me go into the tips of the table in LO Writer. The LO version I am using is 5.0.

Table at the same line of paragraph

In Writer, unlike image, table by default cannot anchor as character. Therefore, it cannot have some text at the left or right of a table. This can be solved by using frame.

Table in the paragraph line

Table in the paragraph line

So, create a frame and set the properties,

  1. Type > Anchor as character
  2. Type > Vertical Top to Row (depend on your preference)
  3. Wrap > Spacing four sides to zero
  4. Borders > Set no border
  5. Insert table inside the frame.

Remove/add the empty line after table

As the image above, you can see within the frame, there is an empty line after the table. This line, you cannot delete or “backspace”. So, in order to solve this, at the last cell of the table, press Ctrl+Shift+Del will delete the empty line. In order to add the empty line, Alt+Enter.

Vertical text in the table

To create a vertical text, it has to create a new style (it can be based on the Table Contents). Then at the new style properties,

  • Position > Rotation / Scaling > 90 degrees or 270 degrees (based on your preference)

After creating this style, just select the content of the cell you want to have a vertical align, apply the created style, than it will work.

Vertical text in the table

Vertical text in the table

There are several things have to take note when using the style to rotate the text. The image above shows two different ways to rotate the text. The left bottom cell is using the method mentioned above, the right bottom cell is using the following method,

  1. Select the text in the cell, and go to Table Properties,
  2. Text Flow > Text orientation >Vertical

By using the Text Flow method, we cannot change the rotation direction as shown in the left bottom cell. But using this way, we can change the alignment and indent easily. When we choose align to the centre, the text will be centre as usual.

However, using the Style method, it is quite confusing. When using Style, if we align the text to centre, it is based on the view of the table, instead of make the text centre itself.

Centre text problem

Centre text problem

As the image above, the first cell has the following properties

  • Table Properties > Text Flow > Alignment > Top
  • Paragraph Properties > Alignment > Options > Centre

The second cell has the same properties as above.

In order to make our text at the left cell start from the left bottom corner, then we have to set

  • Table Properties > Text Flow > Alignment > Bottom
  • Paragraph Properties > Alignment > Options > Left
Align the table

Align the table (they left and bottom).

Padding in a specific cell or customise a cell

As the image above, we want to adjust the left cell of the text, so that the text and the bottom border has some spacing, this have to customise the cell specifically. However, LO Writer does not show any clue for you to edit the properties of a cell, and it only shows you “Table Properties”.

It is actually possible to customise a certain cell.

  1. Select a cell by highlight the content inside,librlibr then hold and move the cursor to next cell. We will discover that the cells are highlighted, instead of the text within.
  2. Since there are two cells being selected, we move our mouse back to the original cell. And we will get something like this,
Select a cell

Select a cell

Now, the cell can be edited with Table Properties (which is actually selected cell properties).


So, these are a few tips which are useful to manage the table in the Writer.


Get every new post delivered to your Inbox.

Join 161 other followers