Michael McCann's Secret Public Blog

Who are you? How did you find this? Where am I? Whose pants am I wearing?

Categories

Posts Under Nerdism Category

Javascript Preview Text Function

Javascript Preview Text Function

This is a simple javascript function that will take a string and truncate it based on the number of characters while taking words into consideration.  Its a pretty easy way to implement a JavaScript Preview Text function. function PreviewText(length, text) { //mmccann.com text = String(text); var result = " "; var charcount = 0; length = Number(length); var tokens = text.split(" "); for (var i =...
Pi to one million places

Pi to one million places

...
Better Random Number [seeding] in C#

Better Random Number [seeding] in C#

I ran into an issue with random number seeding in C#. I was trying to generate random numbers for a restful web service. C# was generating seeds that were creating a similar string of random numbers if you accessed it close together, it would seed the same way. I couldn’t increment the seed on each access [well, I could -- but that would be a lot of pointless overhead]. Instead I seeded...
The Goblin Market: A Poem I Like

The Goblin Market: A Poem I Like

Yeah. I’m not into Poetry, but I like this poem — and no, I didn’t realize that it was about that until I already liked it. Goblin Market by Christina Rosetti (more…)

Upcoming Events

Events you should attend.