Facebook wall in WordPress

I had some issue to get this one working, but after some tips from Takanudo, see comments below, it is now working like charm 🙂

If you get:
“Facebook-The global ID is not allowed. Please use the application specific ID instead”

you should see the post comment’s below from Takanudo.

I needed to display recent news from a Facebook group in a WordPress context. There are many Facebooks plugins, I tried this one:

JSL3 Facebook Wall Feed

I needed:

  • Facebook id
  • AppID
  • AppSecret

Facebook id: Log in to your Facebook page, go to settings. There you will find the code:

facebookid

Next is to create an app at Facebook. Go to: https://developers.facebook.com/

Logg in, on the menu, click on Apps, Create a New App:

facebookapp

Then collect your App ID and App Secret:

Then add Platform Website:

facebook add plattform facebook platform

Then install the plugin JSL3 Facebook Wall Feed, activate it, and go to JSL3 Facebook Wall Feed settings. Put the Facebook ID, App ID and App Secret.

jsl3 facebook wall feed settings

Save settings.

Finally, add your Wall Feed in a Widget:

in widget

Result:

facebookstatus

 

Searching in Excel files

I had to find a specific Microsoft Spreadsheet among thousands of files on a mapped network drive O: on a Windows 7 Computer. The problem was that searching and indexing was only performed on local disk like C: and D: so I could only search for keyword in local Excel files. It is not optimal, because it means copying thousands of temporary excel files to a local drive (D:), but as long as I know that it was a Excel file, I could copy only this file-types. But, when you need something, you need something. This is how I solved it.

– Mount the Windows share on a Linux server (requires sudo rights)

– Find the total size of all excel files on mapped network drive (so that you know the size of the total number of files that you have to put on your local Drive)

– Copy all excel files from share to local disk

– Let Windows 7 index the excel files locally (should happen automatically when new files are added)

– Finally, search for keywords in Windows Explorer and finding the Excel spreadsheet in question.

First mount the share:
sudo mount -t cifs -o username=,domain=example.com //WIN_PC_IP/ /mountdir

where mountdir is any name for a folder. The mount command will create it. It could be your username for instance.
WIN_PC_IP is the ip number of the Windows computer where your share is located.

To find the total size of the files:

cd mountdir

find . -name '*.xls*' -exec ls -l {} \; | awk '{ Total += $5} END { print Total}'

Then find all the excel files, and copy them to a new folder:
cd ..
mkdir EXCEL-FILES-FOLDER/
find . -iname '*.xls' -exec cp --parent {} EXCEL-FILES-FOLDER/ \;
find . -iname '*.xlsx' -exec cp --parent {} EXCEL-FILES-FOLDER/ \;

Copy the files to local D: drive (using CMD in Windows 7)

D:\>copy "o:\EXCEL-FILES-FOLDER\*" "d:\EXCEL-FILES-FOLDER\"

 
You might have to wait some hours, because if you have a lot of files, the Windows 7 computer might use a day or two before it is finished. “PATIENCE YOU MUST HAVE my young padawan”..

Filter and move emails with imapfilter.pl

imapfilter.pl is a set of perl scripts that can help you to automate filtering emails. The script(s) can run in cron on a regular basis.

First you need to download, unpack and install the scripts some place on your server.

Then, you have to create a rule.txt file which might contain several lines. For example:

From    "Cron *"        Inbox   Trash
Subject    "*error message *"     Inbox   Trash
From    "email.campaign@sg.booking.com" Inbox   Trash

This rule.txt file will filter the Inbox folder, and move the emails matching to Trash.
Important: The field separator is a Tab in the rule.txt file. Normal space would not work. Hint: use vim-editor, and press the tab-key on your keyboard.

In order to filter your messages, you apply this command:

./bin/imapfilter.pl -S yourserver-adress.com:993/your-username/your-password -r rule.txt

By making many rules in different text files, you can run many different filter jobs on your Inbox and other mailboxes if you wish, on your IMAP server(s), on different dates and time.

For instance:

Every day you could run an automated job that would delete all Trash emails at 17:00 when you finish work (cron jobs, advertising, and so on).
And every end of the month, you can filter out your colleagues emails, and store them in a IMAP folder called WORKPEOPLE for instance.

Links:

* https://github.com/andrewnimmo/rick-sanders-imap-tools

* http://www.athensfbc.com/imap_tools/

* https://code.google.com/p/imaputils/

Open Journal System missing email logs

I upgraded our Open Journal Systems from 2.2.2 to 2.4.2 and afterwards we saw the email logs were gone. This was related to:

http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=9140

My solution was this:
Established a new Postgresql server in a virtual enviroment (vmware, test-machine), and import the old and the new (upgraded) database.

# Log in to Prod server
ssh prodserver
# Dump the related and upgraded database to a sql file
pg_dump -U postgres -f /tmp/ojs_new.sql ojs_new
# Copy the file to a Test server where you can play around
scp ojs_new.sql username@my_vmware_test_server
# Log in to your Test server
ssh my_vmware_test_server
# Become Root, the system super user
sudo su -
# Become Postgres user, so that you can do all Postgresql stuff
su - postgres
# Create a user named "ojs"
createuser ojs
# Create the databases
createdb -O ojs ojs_new
createdb -O ojs ojs_old
# Import the databases to Postgresql on the Test Vmware server
psql -f ojs_old.sql ojs_old
psql -f ojs_new.sql ojs_new

ojs_old: was the original 2.2.2 database
and
ojs_new: was the upgraded 2.4.2 one

In order to fix the assoc_id numbers, I used this bash script:

myscript.sh:

#!/bin/bash
# Find first all log_id's in the old database (ojs_old)
ORIGLIST=`psql -t -d ojs_old -c "SELECT log_id FROM article_email_log" postgres`;
for i in $ORIGLIST;do
  OLD_ARTICLE_ID=`psql -t -d ojs_old -c "SELECT article_id FROM article_email_log WHERE log_id = '$i'" postgres`
  echo -e "psql -d boap_journals -c \"UPDATE email_log SET assoc_id = $OLD_ARTICLE_ID WHERE log_id = $i\" postgres"
done

The output from this script is sent to STDOUT. I redirected it to another script, and ran the script on our Production server.

ssh my_vmware_test_server
sudo su -
# Send the output of the script to file
./myscript.sh > runme-on-prod-server.sh
# copy the file to the Production server
scp runme-on-prod-server.sh username@prodserver:/tmp/
# log in to the Production server
ssh prodserver
# Become root, be careful!
sudo su -
cd /tmp/
# Run the script! (But! Remember to do a PG database dump before, so you can restore if something goes terrible wrong!)
# become Postgresql super user
su - postgres
pg_dumpall -f mybackup_just_in_case.sql
# become root again
exit
./runme-on_prod-server.sh

issuu pdf sync – it works … but

[pdf issuu_pdf_id=”140327143047-86dbdac2750a4fa883b13e0df8cb290b” layout=”1″ bgcolor=”FFFFFF” allow_full_screen_=”1″ flip_timelaps=”6000″ ]

The plugin is installed from: http://wordpress.org/plugins/issuu-pdf-sync/

but not in Ipad.

I guess it is flash based, so we hope for future release that will support Ipad, Iphone and other mobile units…