Archive for the 'Cross Platform Tricks' Category

mono gtk threads and timers

So, Yeah. I know it has been like 4-ever since I have posted anything. Well, the fact of the matter is I am NDA’ed on all the great stuff I work on. So that means I am not allowed to talk about it. That being said, I did put together this little DEMOnstration of some Mono C# Gtk examples of working with threads and timers. I can’t tell you what I’ve actually done with this, but I can tell you that the examples on the Mono do not work out of the box with the current version of Mono Develop. I don’t quite understand why their documentation is so out of date, or maybe they just assume people are smart enough to apply their examples to real working scenarios…. well THESE ARE WORKING. You can pull this repo, straight from github and build and run them to see how they tick. Please do not comment on the blog. As you can tell from my last post, I do not maintain it well. So post any comments on github. CHEERS!

https://github.com/galaxiecruzin/mono-gtk-threads-and-timers

Sharing Calendars with WebDav

I always wanted to try this out, but finally was able to work out a reliable configuration. I used Apache with WebDAV to act as a remote calendar share and Mozilla Sunbird as the calendar application. Now granted you could use any compliant WebDav or CalDav client, but this example I will stick to how I was able to make it work. I also learned the hard way, that you can not enable WebDAV in an .htaccess file for security reasons.

In this sample I configure Apache on Fedora Core 4 with Apache 2 pre-installed from the fresh RedHat installation.

Install WebDav

In FC4 I belive mod_dav comes with apache now adays, so you would just install apache as normal

# yum install httpd

Setting up the file and folder structure

Go to the directory where you want to share your calendars from. (in this example I am using the redhat default web root)

# cd /var/www/html

# mkdir calendars

# mkdir user_samplefolder1 (obviously you would user your username)

# vi user_samplefolder1/calendar.webdav

In the file enter the following text and then save:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
END:VCALENDAR

Repeat as needed for each user. Then change the owner to the apache user

# chown -R apache:apache *

Make a password file to authenticate against

# htpaswd -c /var/www/html/calendars/.htpasswd user_sample1

repeat for each user (just get rid of the -c option for subsequent users)

Configure Apache

# vi /etc/httpd/conf/httpd.conf

Enter the following config (change the PATH to your file path

#######################################################
# WebDAV for Calendars
DavLockDB /tmp/DavLock
<Location “/calendars”>
Dav on
AuthName “Calendar”
AuthType basic
AuthUserFile /home/html/calendars/.htpasswd
require valid-user
AllowOverride none
Options None
<Limit GET>
require valid-user
</Limit>
</Location>
#
# End WebDAV for Calendars

#######################################################
Now Setup one of these location directives for each of your calendars in httpd.conf as well

<Location “/calendars/user_sample1/calendar.webdav”>
Dav on
require user user_sample1
<Limit GET>
require valid-user
</Limit>
</Location>
Don’t forget to restart apache

# service httpd restart

Setting up Sunbird

Download and unzip the program, no installer needed at this point if you download the zipped version.

Switch from the Date tab to the “Calendars” tab then right click in the box and choose new calendar, choose remote, then choose WebDav

In the url box you would want to format this as the direct url to your apache server ie

http://ipaddress_of_your_server/calendars/user_sample1/caledar.webdav

Click next then finish. It should prompt you to login if you configured everything properly

Note (if you want to give other users access to add/edit/delete items from each other’s clalendars, then adjust the permissions accordingly.
Cheers! You are now sharing calendars, and without paying M$ !

Example to allow two users to work with a shared calendar, but allowing read access for everyone else

<Location “/calendars/user_sample1/calendar.webdav”>
Dav on
require user user_sample1 user_sample2 # etc etc
<Limit GET>
require valid-user
</Limit>
</Location>
Don’t forget to restart apache

Example to allow me a private calendar

<Location “/calendars/user_sample1/calendar.webdav”>
Dav on
require user myuser
<Limit GET>
require myuser
</Limit>
</Location>
Don’t forget to restart apache

**Note – If you try to edit a calendar you do not have permission to you will get an error 401 access denied

**Note – If you messed up you webdav config you will get an error 405 method not allowed