Smf Forum – Merge Member Posts and PM’s with MySQL

So what happens when you decide to have a clean up on your Simple Machines Forum, and part of that clean up is to remove inactive users?

Inactive Members Removed
Well, the user gets removed but their posts remain on the forum unless you specifically delete the account and choose to remove all post. Otherwise the username remains with the word “Guest” alongside each post.

Member Returns
It can sometimes happen that a member who hasn’t been around for a while comes back and has to create a new account as their old account has been removed. This leaves them with a zero post-count and all their PM’s associated with the old account.

How Do I Re-associate All Old Member Data with New Account?
Pretty easily really, with access to the database via phpMyAdmin and a few MySQL Query commands. On every Database, there is a Tab at the top which says “SQL” and has a box where you can issue queries (commands) and hit “Go”.
*Warning* BACKUP YOUR DATABASE FIRST !!

The main Syntax that we are going to issue as a MySQL query is this:
UPDATE whatever_table SET ID_MEMBER_whatever = '2', whateverName = 'new' WHERE whateverName = 'old'

1. Associating Old Posts with new Member account
For example, we want to change all forum posts with the name of a deleted member called OldBuddy, and associate them with his new name which is NewBuddy with member ID 1337.
UPDATE smf_messages SET ID_MEMBER = '1337', posterName = 'NewBuddy' WHERE posterName = 'OldBuddy'

2. Now we want to do the same with his old PM’s (Private/Personal Messages):
UPDATE smf_personal_messages SET ID_MEMBER_FROM = '1337', fromName = 'NewBuddy' WHERE fromName = 'OldBuddy'

By now you should be getting the idea. You just UPDATE whatever table, with new column data for a user ID by changing old for new. Once you get the hang of it, you can issue the UPDATE command on any MySQL database, not just Smf Forum, and recursively replace any data in any table.

Advertisements

Quickly create and delete multiple files or directories

Mkdir and Touch
I am pretty sure most of you already know what the mkdir command does.
Maybe new users won’t know too much about touch which is a great commandline tool which comes as part of the Gnu Coreutils.

For more information in the terminal type:
info coreutils touch invocation
and
man mkdir

To create multiple directories with the same name but a different number:
mkdir dir{1,2,3}

Which will give you:

dir1 dir2 dir3

To remove them:
rmdir dir{1,2,3}

To create multiple files with the same name but a different number:
touch file{1,2,3}.txt

Which will give you:

file1.txt file2.txt file2.txt

To remove them:
rm file{1,2,3}.txt

Debian Backports is now official

This great news for the http://www.backports.org team.

Mailing list link: http://lists.debian.org/debian-publicity/2010/09/msg00007.html

> Backports service becoming official
> >
> The Debian Project is proud to announce that the backports service,
> previously available at http://www.backports.org is now an official Debian
> service and will be available at backports.debian.org
>
> Backports are packages from the testing distribution recompiled for the
> current stable (or even oldstable) release to provide users of the stable
> distribution with new versions of certain packages, like the Linux kernel,
> the Iceweasel browser or the OpenOffice.org suite, without sacrificing
> the overall stability of the system.
>
> The archive currently has packages backported for the Lenny distribution.
> (how many?) As the infrastructure to accept packages for the upcoming
> Squeeze release is already in place, this allows Debian Installer images to
> configure the backports repository by default without generating errors
> on user systems. The service for Squeeze will be enabled at a later
> date, after the release.
>
> Because of limitations in the Debian Bug Tracking System, any bugs
> relevant to backported packages still have to be reported to the
> debian-backports list, which will now also move to lists.debian.org.

Mysql Cluster Quick Start Guide

MySQL Cluster Quick Start Guide – LINUX
This guide is intended to help the reader get a simple MySQL Cluster database up and running on a single LINUX server. Note that for a live deployment multiple hosts should be used to provide redundancy but a single host can be used to gain familiarity with MySQL Cluster; please refer to the final section for links to material that will help turn this into a production system.

1 Get the software
For Generally Available (GA), supported versions of the software, download from
http://www.mysql.com/downloads/cluster/
Make sure that you select the correct platform – in this case, “Linux – Generic”
and then the correct architecture (for LINUX this means x86 32 or 64 bit).
If you want to try out a pre-GA version then check
http://dev.mysql.com/downloads/cluster/
Note: Only use MySQL Server executables (mysqlds) that come with the MySQL
Cluster installation.

2 Install
Locate the tar ball that you’ve downloaded, extract it and then create a link to it:
tar xvf Downloads/mysql-cluster-gpl-7.1.3-linux-x86_64-glibc23.tar.gz
ln -s mysql-cluster-gpl-7.1.3-linux-x86_64-glibc23 mysqlc
Optionally, you could add ~/mysqlc/bin to your path to avoid needing the full path when running the processes.

3 Configure
For a first Cluster, start with a single MySQL Server (mysqld), a pair of Data Nodes (ndbd) and a single management node (ndb_mgmd) – all running on the same server.

Create folders to store the configuration files and the data files:
mkdir my_cluster my_cluster/ndb_data my_cluster/mysqld_data my_cluster/conf
In the conf folder, create 2 files (note that “/home/user1” should be replaced with your home directory).

my.cnf:
[mysqld]
ndbcluster
datadir=/home/user1/my_cluster/mysqld_data
basedir=/home/user1/mysqlc
port=5000

config.ini:
[ndb_mgmd]
hostname=localhost
datadir=/home/user1/my_cluster/ndb_data
id=1
[ndbd default]
noofreplicas=2
datadir=/home/user1/my_cluster/ndb_data
[ndbd]
hostname=localhost
id=3
[ndbd]
hostname=localhost
id=4
[mysqld]
id=50

Note that in a production system there are other parameters that you would set to tune the configuration.
Just like any other MySQL Server, the mysqld process requires a ‘mysql’ database to be created and populated with essential system data:
cd mysqlc
scripts/mysql_install_db --no-defaults --datadir=$HOME/my_cluster/mysqld_data/

4 Run
The processes should be started in the order of management node, data nodes & then MySQL Server:
mysqlc]$ cd ../my_cluster/
my_cluster]$ $HOME/mysqlc/bin/ndb_mgmd -f conf/config.ini --initial --configdir=$HOME/my_cluster/conf/
$HOME/mysqlc/bin/ndbd -c localhost:1186
$HOME/mysqlc/bin/ndbd -c localhost:1186

Check the status of the Cluster and wait for the Data Nodes to finish starting before starting the MySQL Server:
$HOME/mysqlc/bin/ndb_mgm -e show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=3 @127.0.0.1 (mysql-5.1.44 ndb-7.1.3, Nodegroup: 0, Master)
id=4 @127.0.0.1 (mysql-5.1.44 ndb-7.1.3, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @127.0.0.1 (mysql-5.1.44 ndb-7.1.3)
[mysqld(API)] 1 node(s)
id=50 (not connected, accepting connect from any host)

$HOME/mysqlc/bin/mysqld --defaults-file=conf/my.cnf &

5 Test
Connect to the MySQL Server and confirm that a table can be created that uses the ndb (MySQL Cluster) storage engine:
$HOME/mysqlc/bin/mysql -h 127.0.0.1 -P 5000 -u root
mysql> create database clusterdb;use clusterdb;
mysql> create table simples (id int not null primary key) engine=ndb;
mysql> insert into simples values (1),(2),(3),(4);
mysql> select * from simples;
+----+
| id |
+----+
| 3 |
| 1 |
| 2 |
| 4 |
+----+

6 Safely shut down
The MySQL Server must be shut down manually but then the other Cluster nodes can be stopped using the ndb_mgm tool:
$HOME/mysqlc/bin/mysqladmin -u root -h 127.0.0.1 -P 5000 shutdown
$HOME/mysqlc/bin/ndb_mgm -e shutdown

Broadcom Open Sources Linux Wireless Drivers

Well, it’s been a long time coming, but kudos to Broadcom for finally open sourcing their wireless drivers!

Official Announcement:

From: Henry Ptasinski
Subject: [ANN] Full-source Broadcom wireless driver for 11n chips
Newsgroups: gmane.linux.kernel.wireless.general, gmane.linux.drivers.driver-project.devel
Date: 2010-09-09 15:10:06 GMT (5 hours and 42 minutes ago)
Broadcom would like to announce the initial release of a fully-open
Linux driver for it’s latest generation of 11n chipsets. The driver,
while still a work in progress, is released as full source and uses the
native mac80211 stack. It supports multiple current chips (BCM4313,
BCM43224, BCM43225) as well as providing a framework for supporting
additional chips in the future, including mac80211-aware embedded chips.
The README and TODO files included with the sources provide more
details about the current feature set, known issues, and plans for
improving the driver.

The driver is currently available in staging-next git tree, available at:

git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-next-2.6.git

in the drivers/staging/brcm80211 directory.


Henry Ptasinski
henryp@…

From: http://thread.gmane.org/gmane.linux.kernel.wireless.general/55418

Netcat – The Tcp/Udp Rambo Knife

Netcat
The netcat utility is used for practically anything involving TCP or UDP. It can open TCP connections, send UDP packets, listen on arbitrary TCP and UDP ports, port scan, and is cool with both IPv4 and IPv6 connections.

In this example, open port 6881 using nc command:

nc -l 6881

On a second console or from a second UNIX / Linux machine, connect to the machine and port being listened on:

nc localhost 6881

OR

nc unix.system.ip.here 6881

In this example, send data from one computer to another:

nc -l 6881 > output.txt

Using a second machine, connect to the listening nc process (@ port 6881), feeding it the file which is to be transferred:

nc your.ip.address 6881 < input.txt

You can run netstat command to view open ports:

netstat -a
netstat -nat | grep LISTEN

Sample outputs:

netstat -nat | grep LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:7634 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:17500 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:55788 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:49198 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN

How to post on identi.ca from Vim with TwitVim

I recently discovered the TwitVim Twitter/Identi.ca Vim plugin created by Po Shan Cheah, so I thought i’d share it with you all.

Prerequisites: Vim (obviously), Curl and the twitvim.vba

1. Download the latest twitVim plugin from here (Currently version 0.5.5): http://www.vim.org/scripts/download_script.php?src_id=13653

2. Open Vim and issue these commands (version 0.5.5)

Open the vba file with Vim:

vim twitvim-0.5.5.vba

Now install the vba:

:source %

3. Configure your vimrc to use identi.ca

vim .vimrc

And at the bottom add:

let twitvim_api_root = “http://identi.ca/api&#8221;

let twitvim_cert_insecure = 1

let twitvim_login = “yourusername:yourpassword”
**NOTE** You may get an error for the url and the uname password lines, if so, just use a single quote mark [ ‘ ] instead of double quote marks [ ” ]
4. Send a test post:

:PosttoTwitter

Hit Enter (you’ll be prompted to enter a message), Type your message, and hit Enter again, that’s it. You have now sent your first identi.ca message from Vim !! 😉

This is a basic install and post guide, but I recommend you read the documentation as TwitVim has a whole heap of features and options, especially regarding security and secure authentication.

AuthorPo Shan Cheah

Shared on identi.ca by –  tante

DocumentationVim.org, Google Code