How to enable single sign-in for social accounts for question2answer? These servers are required: Google, Facebook, Twitter, OpenID. This site moved from Loginza to Question2Answer Open Login which works like a charm. I use the Loginza and it works very well. For Q2A, SLonoed wrote a nice plugin for loginza. How to use it: Download
Read more
Tag: Programming
Auto completion in Vim
Posted onHow to enable auto code completion in Vim, like in the IDE? Several plugins I use: snipMate: Plugin for using TextMate-style snippets in Vim omnicppcomplete: Plugin for C/C++ omnicompletion neocomplcache: Ultimate auto completion system for Vim
3 Ways of Making Case Insensitive Search in Vim/Vi
Posted onBy default, Vim/Vi’s search is case sensitive. However, if I want to search case insensitively, is there any method? For example, I search for dog, instead of matching dog only case sensitively, I also want to find out phases containing Dog, DOg, etc. There are several methods: 1. Setting the search to be case insensitive
Read more
How to write a autostart script for gnome
Posted onI want to automatically run a program when I log in gnome. How to write a autorun script for it? Here is one example: $ cat ~/.config/autostart/dropbox.py.desktop [Desktop Entry] Comment[en_US]= Comment= Exec=/home/zma/bin/dropbox.py start GenericName[en_US]= GenericName= Icon=system-run MimeType= Name[en_US]= Name= Path= StartupNotify=true Terminal=false TerminalOptions= Type=Application X-DBUS-ServiceName= X-DBUS-StartupType= X-KDE-SubstituteUID=false X-KDE-Username= To set up a new one, you
Read more
Printing Integers in Hexadecimal Format in Python
Posted onPrinting integers in hexadecimal format in Python is a simple task that can be accomplished using the built-in hex() function. By following the steps outlined in this post, you can easily print integers in hexadecimal format in Python. Additionally, by using string formatting, you can control the format of the hexadecimal output to suit your
Read more
strcmp and strncmp implementation in glibc
Posted onWhat is the strcmp and strncmp implementation in glibc? strcmp implementation in glibc 2.16: string/strcmp.c /* Copyright (C) 1991, 1996, 1997, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU
Read more
How to get the size of a file in C
Posted onHow to get a file’s size in C? If you have the file stream (FILE * f): fseek(f, 0, SEEK_END); // seek to end of file size = ftell(f); // get current file pointer fseek(f, 0, SEEK_SET); // seek back to beginning of file // proceed with allocating memory and reading the file Or, #include
Read more
ANSI C Grammar and ANSI C Grammar Specification in YACC
Posted onANSI C is a standardized version of the C programming language that was introduced in 1989 by the American National Standards Institute (ANSI). The ANSI C standard defines the syntax and semantics of the C language, including its grammar. In this post, we will explore the ANSI C grammar in more detail. The ANSI C
Read more
scanf is dangerous, but what is the reason?
Posted onWe all know scanf / fscanf / sscanf is dangerous. But why? what is the exact reason? I thought the ‘%s’ is a problem that causes buffer overflow and ‘fgets’ is a better solution. But is it the exact reason? I pased a discussion by AndreyT and his discussion helps me figure it out: Claiming
Read more
Converting String to long Integer in C
Posted onConverting a string to a long in C is a common operation that can be useful in various programming tasks. In this post, we will explore how to use the strtol and strtoul C library functions to convert a string to a long in C. Using strtol and strtoul The strtol and strtoul functions are
Read more
Disable WordPress Built-in Canonical URL link tag in HTML head
Posted onThe built-in canonical URL function since WordPress 2.9 is great. But under some situation, it is not needed. For example, all the Mingle Forum threads’ canonical URL is set to the URL of the page that contains the [mingleforum] shortcode, which, of course, is wrong. How to diabled it? We can disabled WordPress’s Built-in Canonical
Read more
Vim: case insensitive search
Posted onBy default, Vim does case sensitive search. How to make case-insensitive search in Vim? By default, Vim does case sensitive search. :set ignorecase can set Vim to conduct case insensitive search. However, it also affects substitutions, which is not we want However, how to do a case insensitive search only when it is needed? Use
Read more
How to disable automatic comment insertion in Vim
Posted onHow to disable automatic comment insertion in Vim? Add to ~/.vimrc: au FileType c,cpp setlocal comments-=:// comments+=f:// More: http://vim.wikia.com/wiki/Disable_automatic_comment_insertion
Run Firefox on Remote Host over SSH
Posted onHow to run Firefox on Remote Host over SSH ? After $ ssh -X remotehost Run this script on remote host: #!/bin/bash export $(dbus-launch) export NSS_USE_SHARED_DB=ENABLED firefox -no-remote & This script credits to Waxborg: http://waxborg.servepics.com/opensuse/remote-administration/running-firefox-remotely-over-ssh.
How to convert a ps file to a pdf file
Posted onHow to convert a ps file to a pdf file that is available for publish (embedded fonts, etc)? Convert the file.ps ps file to file.pdf: $ ps2pdf -dPDFSETTINGS=/printer file.ps file.pdf</pre> Embedding Fonts in PDFs with pdflatex by Jeffrey P. Bigham: http://www.manticmoo.com/articles/jeff/programming/latex/embedding-fonts-with-pdflatex.php
Synchronizing home directories
Posted onAny good tools to synchronize home directories on Linux boxes? Many have several PC/laptops and consequently many home directories. There is home directory synchronizing problem. unison is a good tool to do this: http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#rshmeth http://www.watzmann.net/blog/2009/02/my-homedirs-in-unison.html http://www.cis.upenn.edu/~bcpierce/papers/index.shtml#File%20Synchronization Useful script: $ unison -batch -ui text ./ /mnt/homebak/zma/ In text user interface, synchronizing two directories in batch mode
Read more
SEEK_HOLE and SEEK_DATA: efficiently archive/copy large sparse files
Posted onHow to efficiently archive a very large sparse file, say 1TB? The sparse file may contains a small amount of data, say 32MB. SEEK_HOLE and SEEK_DATA The SEEK_HOLE/SEEK_DATA functionalities play the trick and makes `tar` and `cp` handle the large sparse file very efficiently. `lseek` with `SEEK_HOLE` returns the offset of the start of the
Read more
NET Core 2.1 Release: Feature To Expect in 2018
Posted onWhat surprises are awaiting the tech world with .NET Core 2.1 Release in 2018? Technology is one of the most dynamic spheres these days. Every single year you will find a new version of an existing software and .NET Core is not an exception. The intentions of these upgradation is to make online activities seamless,
Read more
How to Implement Hibernate Envers in an Application
Posted onTechnology Hibernate Envers is the frameworks for auditing entities. As the name suggests Hibernate Envers is developed on top of Hibernate, it will on Hibernate and Hibernate implemented JPA. Hibernate Envers provides easy auditing, versioning solution for entity classes. Advantages of Hibernate Envers: Auditing of all mappings defined by JPA specification. Auditing Hibernate specific mappings
Read more
A Beginners’ Guide to x86-64 Instruction Encoding
Posted onThe encoding of x86 and x86-64 instructions is well documented in Intel or AMD’s manuals. However, they are not quite easy for beginners to start with to learn encoding of the x86-64 instructions. In this post, I will give a list of useful manuals for understanding and studying the x86-64 instruction encoding, a brief introduction
Read more