Expat-IT Tech Bits

Home

Contact

Links

Search this site:

Categories:

/ (287)
  Admin/ (122)
    Apache/ (10)
      HTTPS-SSL/ (4)
      PHP/ (3)
      performance/ (2)
    Cherokee/ (1)
    LAN/ (4)
    LVM/ (6)
    Monitoring/ (2)
      munin/ (2)
    SSH/ (6)
    SSL/ (1)
    Samba/ (1)
    VPN-options/ (6)
      OpenVPN/ (1)
      SSH-Proxy/ (3)
      Tinc/ (1)
      sshuttle/ (1)
    backups/ (17)
      SpiderOak/ (1)
      backuppc/ (5)
      dirvish/ (1)
      misc/ (6)
      rdiff-backup/ (1)
      rsync/ (1)
      unison/ (2)
    commandLine/ (24)
      files/ (8)
      misc/ (10)
      network/ (6)
    crontab/ (1)
    databases/ (15)
      MSSQL/ (2)
      MySQL/ (8)
      Oracle/ (3)
      PostgreSQL/ (1)
    dynamicDNS/ (2)
    email/ (11)
      Dovecot/ (1)
      deliverability/ (1)
      misc/ (1)
      postfix/ (7)
      puppet/ (1)
    iptables/ (3)
    tripwire/ (1)
    virtualization/ (9)
      VMware/ (1)
      virtualBox/ (8)
  Coding/ (14)
    bash/ (1)
    gdb/ (1)
    git/ (3)
    php/ (5)
    python/ (4)
      Django/ (2)
  Education/ (1)
  Hosting/ (27)
    Amazon/ (18)
      EBS/ (3)
      EC2/ (10)
      S3/ (1)
      commandline/ (4)
    Godaddy/ (2)
    NearlyFreeSpeech/ (3)
    Rackspace/ (1)
    vpslink/ (3)
  Linux/ (30)
    Android/ (1)
    Awesome/ (3)
    CPUfreq/ (1)
    China/ (2)
    Debian/ (8)
      APT/ (3)
      WPA/ (1)
    audio/ (1)
    encryption/ (3)
    fonts/ (1)
    misc/ (6)
    remoteDesktop/ (1)
    router-bridge/ (3)
  SW/ (45)
    Micro$soft/ (1)
    browser/ (2)
      Chrome/ (1)
      Firefox/ (1)
    business/ (28)
      Drupal/ (9)
      KnowledgeTree/ (6)
      Redmine/ (2)
      SugarCRM/ (7)
      WebERP/ (2)
      WordPress/ (1)
      eGroupware/ (1)
    chat/ (1)
    email/ (1)
    fileSharing/ (2)
      btsync/ (1)
      mldonkey/ (1)
    graphics/ (2)
    research/ (2)
    website/ (6)
      blog/ (6)
        blosxom/ (3)
        rss2email/ (1)
        webgen/ (1)
  Security/ (15)
    IMchat/ (2)
    circumvention/ (2)
    cryptoCurrency/ (1)
    e-mail/ (4)
    greatFirewall/ (1)
    hacking/ (1)
    password/ (1)
    privacy/ (2)
    skype/ (1)
  Services/ (1)
    fileSharing/ (1)
  TechWriting/ (1)
  xHW/ (14)
    Lenovo/ (1)
    Motorola_A1200/ (2)
    Thinkpad_600e/ (1)
    Thinkpad_a21m/ (3)
    Thinkpad_i1300/ (1)
    Thinkpad_x24/ (1)
    USB_audio/ (1)
    scanner/ (1)
    wirelessCards/ (2)
  xLife/ (17)
    China/ (9)
      Beijing/ (5)
        OpenSource/ (3)
    Expatriation/ (1)
    Vietnam/ (7)

Archives:

  • 2016/07
  • 2016/05
  • 2016/02
  • 2016/01
  • 2015/12
  • 2015/11
  • 2015/06
  • 2015/01
  • 2014/12
  • 2014/11
  • 2014/10
  • 2014/09
  • 2014/07
  • 2014/04
  • 2014/02
  • 2014/01
  • 2013/12
  • 2013/10
  • 2013/08
  • 2013/07
  • 2013/06
  • 2013/05
  • 2013/04
  • 2013/02
  • 2013/01
  • 2012/12
  • 2012/10
  • 2012/09
  • 2012/08
  • 2012/07
  • 2012/06
  • 2012/05
  • 2012/04
  • 2012/03
  • 2012/01
  • 2011/12
  • 2011/11
  • 2011/10
  • 2011/09
  • 2011/08
  • 2011/07
  • 2011/06
  • 2011/05
  • 2011/04
  • 2011/02
  • 2010/12
  • 2010/11
  • 2010/10
  • 2010/09
  • 2010/08
  • 2010/07
  • 2010/06
  • 2010/05
  • 2010/04
  • 2010/03
  • 2010/02
  • 2010/01
  • 2009/12
  • 2009/11
  • 2009/10
  • 2009/09
  • 2009/08
  • 2009/07
  • 2009/06
  • 2009/05
  • 2009/04
  • 2009/03
  • 2009/02
  • 2009/01
  • 2008/12
  • 2008/11
  • 2008/10
  • 2008/09
  • Subscribe XML RSS Feed

    Creative Commons License
    This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
    PyBlosxom

    This site has no ads. To help with hosting, crypto donations are accepted:
    Bitcoin: 1JErV8ga9UY7wE8Bbf1KYsA5bkdh8n1Bxc
    Zcash: zcLYqtXYFEWHFtEfM6wg5eCV8frxWtZYkT8WyxvevzNC6SBgmqPS3tkg6nBarmzRzWYAurgs4ThkpkD5QgiSwxqoB7xrCxs

    Fri, 31 Jul 2009


    /SW/business/SugarCRM: Introduction to SugarCRM API

    Documentation sucks. Their wiki[1] is flat-out wrong. Thankfully the blog world has some good information[2], though beware older posts are often obsolete and also will not work. This example should hopefully quickstart you and get you past the first crucial step of login through the API:

    <?php // connection settings for SOAP $options = array( "location" => 'https://url.of.your.sugarcrm.installation/soap.php', "uri" => 'http://www.sugarcrm.com/sugarcrm', "trace" => 1 ); // connect to soap server $client = new SoapClient(NULL, $options); //user authentication array (version is SOAP version) $user_auth = array( "user_name" => 'username', "password" => MD5('password'), "version" => '.01' ); $response = $client->login($user_auth); // var_dump($response); // just in case you need it $session_id = $response->id; printf("<p></p>session id = ". $session_id); $user_guid = $client->get_user_id($session_id); printf("<p>" . $user_auth['user_name'].' has a GUID of ' . $user_guid . "<p>"); // look what modules sugar exposes $response = $client->get_available_modules($session_id); foreach ($response->modules as $i => $value) { printf($response->modules[$i] . "<br>"); } ?>

    I think this code is quite self-explanatory. If it does not work, uncomment the var_dump of the login response, which will tell you the error string you are getting back.

    [1] http://www.sugarcrm.com/wiki/index.php?title=SOAP_Intro_and_Practical_Examples
    [2] http://systemsconsciousness.com/2009/04/10/sugarcrm-soap-examples/

    posted at: 04:54 | path: /SW/business/SugarCRM | permanent link to this entry

    Tue, 28 Jul 2009


    /Hosting/Amazon/EC2: My Migration Process: An Old (Crashed) Amazon EC2 Server to a Newer Version

    (Note: these are abbreviated notes with some detail deliberately left out.)

    When one updates the software on an Amazon EC2 server, not everything gets upgraded (the kernel, for one very important example). When one starts an EC2 server for the first time, the original bundle usually comes from someone or some organization that is actively maintaining it, and periodically issuing updates. Therefore it is good practice to occasionally move one's server to a more current bundle ("AMI", in Amazon parlance).

    Amazon's EC2 servers have some other unique characteristics, one of them being that data and the OS are kept in separate "partitions", and backed up by different processes. The server backup is quite a bit more onerous in terms of time and steps, if it has not yet been scripted (and I have not....) so it tends to not happen as often and the current server can become significantly different from the last backup. And when an EC2 server stops or crashes for whatever reason, the delta from the last backup is irrevocably lost.

    All this to say, sometimes when there is a server problem, it is more expedient to create a new server then to restart an old backup:

    Setup a new server:

    On the new server, /vol now contains my MySQL databases and /var/www. Sym link these into the standard locations in the new server's file structure.

    /vol also contains a /vol/etc copy of /etc (no more then 24 hours old). 'cp -a' the backed up versions of the apache2, php5, and mysql directories into /etc.

    'apt-get install apache2 libapache2-mod-fastcgi mysql-server php5 php5-cli pyblosxom postfix'
    (I prefer postfix over exim.)

    Correct any ownership issues in /vol with the www and mysql directories (they were just mounted on another server).

    Move Elastic IP from old server to new server.

    Install ntpdate and add this to root crontab:
    11 */6 * * * /usr/sbin/ntpdate us.pool.ntp.org

    Install etckeeper:

    Now add this to root crontab:
    15 1 * * * cd /vol/etc && git pull

    Create a user account:

    [1] http://alestic.com/

    posted at: 10:15 | path: /Hosting/Amazon/EC2 | permanent link to this entry

    Fri, 24 Jul 2009


    /Admin/commandLine/misc: Difficulty Unmounting

    When unmounting a partition / device, for example

    umount /media/thumb

    One might encounter a "busy" error, which indicates some process is still using the partition in question. To perhaps find out who / what is using the partition and do something about it:

    lsof | grep '/media/thumb'

    And as a last resort, kill all process accessing the partition:

    fuser -km /media/thumb
    umount /media/thumb

    posted at: 06:07 | path: /Admin/commandLine/misc | permanent link to this entry

    Thu, 16 Jul 2009


    /Admin/SSH: SSH Constantly Connecting: ServerAliveInterval

    I cannot believe I put up with this for so long: in the past when I connected to servers outside China, the SSH session would consistently disconnect after the terminal had been idle for only a very few minutes. This was very consistent, far more then "every once in a while". (I am guessing there was some Great FireWall-related foul play involved....)

    Thanks to Donncha[1] I have an elegant one-line solution by adding the following to /etc/ssh/ssh_config:

    ServerAliveInterval 60
    This causes my ssh client to send a "keep alive" message to the server after 60 seconds of inactivity. Only if the server fails to respond is the connection broken. Even in China, this seems to be quite efficient at keeping my international ssh connections open for hours at a time.

    [1] http://ocaoimh.ie/how-to-fix-ssh-timeout-problems/

    posted at: 08:06 | path: /Admin/SSH | permanent link to this entry

    Mon, 13 Jul 2009


    /SW/business/Drupal: The Relationship Between Content & Menus in Drupal

    If you edit a content or a menu item in drupal, you will see a "Menu link title" and a "Parent item" field in both of these editing windows. This is your first clue that the contents of menus come from at least two different places:

    1. A piece of content (a "page", for instance) created on the "Create Content" (node/add) page. If you create or edit a page, between the Title & Body fields there is a "Menu settings" section. If you click into that there is a "Menu link title" field where you specify the precise text of the menu item (what it is called) and a "Parent item" drop-down menu where you select the position in the menu structure. ("Primary Links", for instance.) After you create such content, specifying a position within the "Primary Links" menu, this page will also now be automatically listed when you edit the Primary Links menu at admin/build/menu-customize/primary-links. In other words, the same "thing" is both a piece of content ("page") and a menu item.

    2. "Pseudo" content. This is a Drupal convention of where to find certain kinds of content. If you click "Add Item" on admin/build/menu-customize/primary-links, you will be taken to a page that looks similar to the "Menu settings" section if you edit a content page, with the addition of a "Path" field. If you put "node/x" (where x is an integer referring to an already created page of content) the new menu item will point to an already existing page of content. If you put "blog" in the "Path" field, then the menu item will point to an aggregation of all blog posts on the site. "blog" is the path where Drupal developers have designated that such content is to be found.

    So to summarize, most normal "menu" items should probably be content that you create on node/add, and there specify a position in one of your pre-defined menus like "Primary Links". For certain things like the blogging function and the contact form function (where the path would be "contact") you need to create the menu item by clicking "add item" within admin/build/menu-customize/primary-links and filling out the "path" field appropriately.

    For sites fitted with dropdown menus, to get 2nd & 3rd level menu items, in the "Parent item" field you have to place the lower level menu items under the higher level items. And then click on all the "Expanded" check boxes on admin/build/menu-customize/primary-links.

    posted at: 07:36 | path: /SW/business/Drupal | permanent link to this entry

    Sun, 12 Jul 2009


    /Hosting/NearlyFreeSpeech: MySQL For NearlyFreeSpeech.net Power Users

    To get a MySQL command line:

    mysql --user=your-user-name --host=your-database-name.db

    And yes you can automatically back up you MySQL database, by yourself, for free. There are just a couple hoops to jump through.

    First set up SSH passwordless authentication as described here[1], with the modification that you cannot install the public key yourself on the NearlyFreeSpeech.net end. You must send them a "Support Request" (click on the Support tab after logging in) with the public key, and they will register it within a few hours[2].

    Their FAQ kind of tip toes around the issue without giving a clear answer: [3][4][5]. The member wiki has the real solution[6]. Create a /home/private/.my.cnf file in your nearlyfreespeech.net account:

    [client]
    host = put_your_DSN_here
    user = put_your_username_here
    password = put_your_password_here

    Then on the machine where you want to store the database backup (your desktop?) execute the following:

    ssh johndoe_thesite@ssh.phx.nearlyfreespeech.net 'mysqldump thedatabase | bzip2 -9' > ~/backups/thedatabase_backup-`date +%Y-%m-%d`.sql.bz2

    Note that "mysqldump" is found in the "mysql-client" package, at least in Debian. And of course, to automate, stick the above in your crontab ("crontab -e").

    (Note: replace "user" below with your nearlyfreespeech.net username.)
    [1] http://blog.langex.net/index.cgi/Admin/SSH-SSL/passwordless-ssh-authentication.html
    [2] https://members.nearlyfreespeech.net/user/support/faq?q=SSHKeys#SSHKeys
    [3] https://members.nearlyfreespeech.net/user/support/faq?q=MySQLForward#MySQLForward
    [4] https://members.nearlyfreespeech.net/user/support/faq?q=MySQLLocalhost#MySQLLocalhost
    [5] https://members.nearlyfreespeech.net/user/support/faq?q=MySQLCommandLine#MySQLCommandLine
    [6] https://members.nearlyfreespeech.net/wiki/HowTo/DatabaseBackup

    posted at: 10:58 | path: /Hosting/NearlyFreeSpeech | permanent link to this entry

    Thu, 02 Jul 2009


    /SW/business/Drupal: Multi-Site Drupal: Trivial

    First install one site, say for domain1.com, just like it was a single-domain install. Settings for the first site will automatically be placed in the sites/default directory.

    Now configure Drupal for a second domain, domain2.com. Create a second MySQL database for domain2. Copy /sites/default to sites/domain2.com and edit sites/domain2.com/settings.php. In this file there is a line of this form:

    $db_url = 'mysql://username:password@hostname/databasename';

    Replace the username, password, and databasename with the values for the database you just created for domain2. hostname should not change because you are presumably using the same MySQL server.

    Then point your browser at:

    http://domain2.com/install.php

    From here on everything should look very familiar.

    The result is each website installed under the sites directory in Drupal gets it's own completely separate database and file area. The only thing shared is stuff put in sites/all (some modules and themes can be shared, for instance) and the Drupal code. Separate databases mean that each site must be upgraded separately on Drupal upgrades.

    There is reportedly a way of putting all the sites in the same database, but this only simplifies upgrades, while perhaps complicating other aspects of management. I have seen mention of sharing data between sites in this latter case, but it is not yet clear to me how this might be done.

    posted at: 08:52 | path: /SW/business/Drupal | permanent link to this entry


    /SW/business/Drupal: Dropdown Menus in Drupal

    As of Drupal 6.12, they are not built-in....

    One possible solution is to install a third-party module: the "Nice Menus" module[1]. This will provide a block in the admin/build/block window, which can be positioned in any one of your themes' defined areas. The resulting menu is, however, extremely plain out-of-the-box, and needless to say is not integrated with your chosen theme.

    If you are looking for dropdown menus, a better solution is to search Drupal's many third party themes[2] for "dropdown". This results in four pages of results, many of which are quite elegant. When you first install one of these themes, however, the dropdown menus may *seem* not to work. Here is some house-keeping that must be done for a newly-installed dropdown-menu theme to get those menus working:

    [1] http://drupal.org/project/nice_menus
    [2] http://drupal.org/project/themes?text=dropdown

    posted at: 08:31 | path: /SW/business/Drupal | permanent link to this entry