My webpage has one existing window.onload javascript function defined by a javascript plugin in the <head> section. Now, I defined a new one and add it to the end of the HTML page: <script type=”text/javascript”> window.onload = function () { // great work here } </script> I find the new one overwrites the old one
Read more
Category: QA
Questions and answers.
Formatting code shortcuts in Eclipse
Posted onFormatting code shortcuts in Eclipse. Shortcut: Ctrl + Shift + F No need to select the code.
How to make thunderbird not wrap lines automatically?
Posted onHow to make thunderbird not wrap lines automatically? Check Making Thunderbird Not Wrap Lines Automatically: Setting mail.compose.wrap_to_window_width to true.
How to force ibus to restart in Gnome 3?
Posted onHow to force ibus to restart in Gnome 3? There used to be a menu. But it does not provide the restart option anymore. To kill current ibus daemon: pkill -o ibus-daemon To start a new ibus daemon in Gnome 3, run this command in “Enter a command” tool by Alt+F2: /usr/bin/ibus-daemon –replace –xim –panel
Read more
Emacs highlighting part of lines that go over 80 chars
Posted onHow to make Emacs highlighting part of lines that go over 80 chars? I use the whitespace mode: ;; `lines-tail`, highlight the part that goes beyond the ;; limit of `whitespace-line-column` (require ‘whitespace) (setq whitespace-style ‘(face empty tabs lines-tail trailing)) (global-whitespace-mode t) More: https://github.com/zma/emacs-config/blob/master/.emacs Alternatively, you can run highlight-lines-matching-regexp with the expression .{81}. http://stackoverflow.com/questions/6344474/how-can-i-make-emacs-highlight-lines-that-go-over-80-chars
Running Chrome over SSH tunnel
Posted onHow to run Chrome on remote host over a SSH tunnel? This way, I can access resource that can only be accessed inside the remote host’s network. Running Chrome over a SSH tunnel is much easier than running Firefox over SSH from a Linux host: First, ssh to the remote host with -X option: ssh
Read more
How to install IE under wine on Linux?
Posted onHow to install IE under wine on Linux? Just need it for some testing. Do not want to reboot to Windows. We ever had ies4linux. But it is obsoleted now. linie is the latest effort. But there are issues and you may need to fix some problems by yourself. Installing a Windows VM may be
Read more
Printing a file in hexadecimal format of all content on Linux?
Posted onHow to print a binary file in hexadecimal format of all content? Use xxd: xxd file.txt or xxd -p file.txt
Changing a git commit message after I have pushed it to the server?
Posted onHow to change a wrong git commit message after I have pushed it to the server? If the remote repository is shared with others, it is better to let the wrong git commit message there. If you use the repository by your own and you are sure that no one else has pulled your latest
Read more
How to convert between dos and unix file coding in Emacs?
Posted onHow to convert between dos and unix file coding for files in Emacs? From Dos to Unix coding: M-x set-buffer-file-coding-system RET undecided-unix or C-x RET f undecided-unix Then save the file (C-x C-s). From Unix to Dos M-x set-buffer-file-coding-system RET undecided-dos or C-x RET f undecided-dos Then save the file (C-x C-s).
How to play .swf files on Linux?
Posted onHow to play the flash (.swf) files downloaded from the Web on Linux? The best solution that I find to play .swf files on Linux is run Adobe Flash Player Projector (download from here, a single .EXE file) and run it under wine.
Replacing tabs with spaces in Emacs
Posted onHow to replace tabs with spaces in Emacs? You can first select the regions of text for converting/replacing, then run M-x untabify to replace all tabs with appropriate number of spaces. There is also a M-x tabify for replacing sequences of spaces to tabs. There are also commands to convert tabs to spaces or vice
Read more
How to print the name of the current file being edited in Emacs?
Posted onIn Emacs, how to print the name of the current file that I am editing? The built-in function buffer-file-name gives the full path of your file. To get the file name: M-: buffer-file-name
How to sort a file by hexadecimal numbers on Linux using sort command?
Posted onThe sort command has a -n option to sort a file by numbers. However, it does not work with hexadecimal numbers. For example, this file: 400000000 __crt0 400000039 __newr0 400001B14 get_my_task_id 400001C14 get_new_task_id 400001582 input_char 40000166E input_q 400001A5D input_q_exit 400002002 main 4000000DB output_char 400001134 output_char_str 40000100C output_id 40000018F output_q 400000614 output_q_digits 400000B7E output_q_hex 400000D3E output_q_hex_j1
Read more
How to compress lists of consecutive citation numbers to one range in Latex?
Posted onHow to compress lists of consecutive citation numbers to one number range in Latex? For example, change [14], [15], [16], [17], [19] to [14-17], [19] That will save some space for the paper/document written in latex. The cite package is great from my experience. You just need to add usepackage{cite} in the document’s preamble and
Read more
How to flush a cached redirect by Chrome?
Posted onChrome caches redirects. How to flush a cached redirect by Chrome? Clearing the cache/cookies for the specific domain (sorry, it is the domain level in this solution) as in https://www.systutorials.com/qa/453/how-to-remove-cookies-for-a-certain-site-in-chrome will also flush the redirect caches for this domain.
How to exclude users from GDM login screen?
Posted onHow to exclude users from appearing in the GDM login screen of Gnome 3? There is a long-time bug related to this ( https://bugzilla.redhat.com/show_bug.cgi?id=723708 ) which causes that the /etc/gdm/custom.conf has no effect. The closes workaround I find working on Fedora 20 is to totally disable listing of users (run as root): cat > /etc/dconf/db/gdm.d/01-mysettings
Read more
How to get the git commit tree?
Posted onHow to get a tree-like view of the git commit history? My favorite command line: git log –graph –oneline It will prints a text based graph like (with colors): * b5dc8b9 Merge branch ‘master’ of https://github.com/layerzero/libi0 | | * 7514ef1 revised the README.md a little bit | * 6692428 align size to page for both
Read more
How to disable the email notification by crond?
Posted oncrond sends email notifications automatically. However, these emails are not needed. How to disabled it? If your command does not anything printed to STDOUT or STDERR, there is not emails send. You can redirect 2 and 1 to /dev/null at the end of your command. You can also set the MAILTO variable to empty by
Read more
How to allow pre tag in WordPress comments?
Posted onHow to allow pre tag in WordPress comments? You can add a filter hook for pre_comment_approved: <?php function filter_handler( $approved , $commentdata ) { // inspect $commentdata to determine approval, disapproval, or spam status return $approved; } add_filter( ‘pre_comment_approved’ , ‘filter_handler’ , ’99’, 2 ); ?> Reference: https://codex.wordpress.org/Plugin_API/Filter_Reference/pre_comment_approved