{
August 3rd:
Hey Mr. Boss!
- Can I please take a couple of days off between the ninth and seventeenth of october? A couple of friends of mine are planning a dive trip to Egypt. And also, it's my birthday that week.
August 5th:
Hey Mr. Employee!
- We'll look into that.
August 18th:
Hey Mr. Boss!
- How 'bout that vacation?
August 19th:
Hey Mr. Employee!
- I checked with the project manager, and it seems that we'll be knee deep around that time, so no, you can't have those days off. But if you don't have any friends going on vacation in November, I can go with you. (WTF!)
October 4th:
Hey Miss Project Manager!
- Will I be very busy next week? (Just checking 'cause you said a couple if months ago that I was gonna be.)
- I said that?
- Yeah, the boss said you did.
- Uhm, I can't remember him ever asking.
- Oh.
- But as far as I know, you don't have anything that important next week.
- Oh.
return false;
}
2007-10-06
2007-05-21
public bool RelaySpam()
{
Yeah, call me stupid. Go ahead. I've been having a bit of trouble with the inetinfo.exe process chewing up all my CPU time on my web server. I thought it might be some ISAPI filter or some crappy code on one of the sites. But noooooo. I got a classic case of the crabs, or rather, classic case of "I didn't secure the SMTP Service enough". My server has been in the business of spreading spam, a lot of it. The reason the inetinfo.exe process was chewing up all my CPU time, was because someone was using my server to send a lot of junk emails to yahoo. Thanks buddy!
return ((me == asshole) ? true : true )
UPDATE 2007-05-22:
The Badmail directory on the server is still over 15Gb and contains more than 6 million files.
I am deeply, deeply sorry.
And once again, I damn them spammers!
UPDATE 2007-05-23:
The deleting process is finally done.
It ran for approx. 34h and the Badmail/Queue directories contained 21.16Gb of bad bad bad mails.
}
Yeah, call me stupid. Go ahead. I've been having a bit of trouble with the inetinfo.exe process chewing up all my CPU time on my web server. I thought it might be some ISAPI filter or some crappy code on one of the sites. But noooooo. I got a classic case of the crabs, or rather, classic case of "I didn't secure the SMTP Service enough". My server has been in the business of spreading spam, a lot of it. The reason the inetinfo.exe process was chewing up all my CPU time, was because someone was using my server to send a lot of junk emails to yahoo. Thanks buddy!
return ((me == asshole) ? true : true )
UPDATE 2007-05-22:
The Badmail directory on the server is still over 15Gb and contains more than 6 million files.
I am deeply, deeply sorry.
And once again, I damn them spammers!
UPDATE 2007-05-23:
The deleting process is finally done.
It ran for approx. 34h and the Badmail/Queue directories contained 21.16Gb of bad bad bad mails.
}
2007-04-12
public string CountryLookup()
{
I few days back I tried using GeoIP from MaxMind, and the simplicity of it just blew me away. I just gotta hand it to them. And with the free version, that covers 93% and enables you to handle different visitors to different parts of your website automagically, well, there's almost no reason NOT to use it.
return "Hooray!";
}
I few days back I tried using GeoIP from MaxMind, and the simplicity of it just blew me away. I just gotta hand it to them. And with the free version, that covers 93% and enables you to handle different visitors to different parts of your website automagically, well, there's almost no reason NOT to use it.
return "Hooray!";
}
Labels:
c#
2007-04-03
public bool ActionHandler() continued
{
Ok, I think i did it, I'm lousy at explaining stuff, so I'll just post the entire thing, CacheManager and all...
Edit: 2007-04-07
After reading this post on codinghorror.com i hereby declare this code free to use under all circumstances. Don't even tell me, just use it. This code is licenced under the WTFPL.
Now, I'm pretty sure there are a million other, probably better, ways to accomplish this, but this works, and it's done. Until anyone shows me a better sollution, I'm sticking with this.
return true;
}
Ok, I think i did it, I'm lousy at explaining stuff, so I'll just post the entire thing, CacheManager and all...
Edit: 2007-04-07
After reading this post on codinghorror.com i hereby declare this code free to use under all circumstances. Don't even tell me, just use it. This code is licenced under the WTFPL.
using System;
using System.Configuration;
using System.Web;
using umbraco.BusinessLogic.Actions;
namespace Umbraco.Flash
{
public sealed class CacheManager
{
private static readonly CacheManager obj = new CacheManager();
private CacheManager() { }
static CacheManager() { }
public static CacheManager Current
{
get { return obj; }
}
public void Add(string key, object data)
{
Cache.Insert(key, data);
}
public void Remove(string key)
{
if (Cache.IsCached(key))
Cache.Remove(key);
}
public object Get(string key)
{
if (Cache.IsCached(key))
return Cache.Get(key);
else
return null;
}
public bool Exists(string key)
{
return Cache.IsCached(key);
}
}
internal sealed class Cache :
umbraco.BusinessLogic.Actions.IActionHandler
{
public Cache() { }
public static void Insert(string Name, object Data)
{
string cachedName = "twcache:" + Name;
if ( HttpContext.Current.Cache[cachedName] == null )
{
double cacheTime = 3600;
try
{
cacheTime = double.Parse(
ConfigurationManager.AppSettings["umbracoAmfCacheTime"]
);
if ( cacheTime <= 0 )
cacheTime = 1;
}
catch { }
HttpContext.Current.Cache.Insert(cachedName, Data, null, System.DateTime.Now.AddSeconds(cacheTime), System.TimeSpan.Zero);
}
}
public static object Get(string Name)
{
string cachedName = "twcache:" + Name;
return HttpContext.Current.Cache[cachedName];
}
public static bool IsCached(string Name)
{
string cachedName = "twcache:" + Name;
if (HttpContext.Current.Cache[cachedName] != null)
return true;
else
return false;
}
public static void Remove(string Name)
{
string cachedName = "twcache:" + Name;
if (HttpContext.Current.Cache[cachedName] != null)
{
HttpContext.Current.Cache.Remove(cachedName);
}
}
private static void Clear()
{
string currentKey = String.Empty;
System.Collections.IDictionaryEnumerator cacheContents = HttpContext.Current.Cache.GetEnumerator();
while ( cacheContents.MoveNext() )
{
currentKey = cacheContents.Key.ToString();
if ( currentKey.StartsWith("twcache:") )
System.Web.HttpContext.Current.Cache.Remove(currentKey);
}
}
#region IActionHandler Members
public bool Execute(umbraco.cms.businesslogic.web.Document documentObject, umbraco.interfaces.IAction action)
{
Cache.Clear();
return true;
}
public string HandlerName()
{
return "CacheHandler";
}
public umbraco.interfaces.IAction[] ReturnActions()
{
umbraco.interfaces.IAction[] actions = {
new ActionCopy(),
new ActionDelete(),
new ActionMove(),
new ActionNew(),
new ActionPublish(),
new ActionSort(),
new ActionUnPublish(),
new ActionUpdate()
};
return actions;
}
#endregion
}
}
Now, I'm pretty sure there are a million other, probably better, ways to accomplish this, but this works, and it's done. Until anyone shows me a better sollution, I'm sticking with this.
return true;
}
public bool ActionHandler()
{
Today I'm gonna take a dive into Umbraco ActionHandlers. I've got a couple of code snippets that look interesting, and I'll just have to take it from there. The task at hand is to automatically empty the cache for a given page (Long story, but there's a WebService involved, and that spawn of satan, Flash.) and to repopulate that cache so that the page loading is drastically improved. I'll get back on the results in a couple of hours.
return null;
}
Today I'm gonna take a dive into Umbraco ActionHandlers. I've got a couple of code snippets that look interesting, and I'll just have to take it from there. The task at hand is to automatically empty the cache for a given page (Long story, but there's a WebService involved, and that spawn of satan, Flash.) and to repopulate that cache so that the page loading is drastically improved. I'll get back on the results in a couple of hours.
return null;
}
2007-04-02
public void Diet()
{
try{
Today I'm starting a diet according to the Glycemic Index method. My goal is to loose about 21kg (~46lbs). I'll probably get back on this subject way too often. (Most likely due to mishaps where I accidentaly swallow massive ammounts of sugar.) I started with eat sushi for lunch, probably not the best start, but at least I didn't eat any candy.
In order to get a head start, and because my girlfriend signed me up, I joined a weight-loss site. Apparently this site is built on EPiServer, a platform I'm unfortunately very familliar with, and staying true to its nature, it broke. After spending few minutes on trying to find a way to contact support through a sleek interface (I still claim one should be included in every commersial web site), I wrote them an email instead. I kindly informed them that I know a couple of developers who'd be glad to help them out. (I may have added that I demanded compensation).
}
catch
{
Life long obesity.
}
try{
Today I'm starting a diet according to the Glycemic Index method. My goal is to loose about 21kg (~46lbs). I'll probably get back on this subject way too often. (Most likely due to mishaps where I accidentaly swallow massive ammounts of sugar.) I started with eat sushi for lunch, probably not the best start, but at least I didn't eat any candy.
In order to get a head start, and because my girlfriend signed me up, I joined a weight-loss site. Apparently this site is built on EPiServer, a platform I'm unfortunately very familliar with, and staying true to its nature, it broke. After spending few minutes on trying to find a way to contact support through a sleek interface (I still claim one should be included in every commersial web site), I wrote them an email instead. I kindly informed them that I know a couple of developers who'd be glad to help them out. (I may have added that I demanded compensation).
}
catch
{
Life long obesity.
}
Labels:
weight-loss
2007-04-01
public bool Begin()
{
I once said something along the lines of "Nah, blogging looked silly way back when, and now it's too late to start.", but I've come to revise a lot of stuff in my life lately, and so, well, here we go.
return true;
}
I once said something along the lines of "Nah, blogging looked silly way back when, and now it's too late to start.", but I've come to revise a lot of stuff in my life lately, and so, well, here we go.
return true;
}
Subscribe to:
Posts (Atom)