|
title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
|
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
|
x
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
|
| Wednesday, November 30, 2016 | |
|
From Tips for Writing Portable Node.js Code:
This is a problem when serving files by name with express' So what if you want to use Express to serve files from the filesystem on, I don't know, Ubuntu on linode [which uses ext4]? And what if you want folks to be able to access your privacy policy at both http://rufwork.com/Privacy/ and http://rufwork.com/privacy/? Even worse, what if you told your app reviewer to try http://rufwork.com/privacy/ and that meant they had to reject your app submission now that you've changed servers? /facepalm From MarkUpDown - Review Results:
(>แ) I've never liked it when I've typed in a URL by hand and got a 404 because I had one or two letters in the wrong case. I mean, it makes sense that case sensitive file systems are easier to maintain. It's just an end-use-case pain when you're serving files. But URL case in Edge is broken too... ๐๐ฑAnd insult to injury? Microsoft Edge (Internet Explorer's replacement in Win10) "remembers" case when you retype a URL! What, wait? So I can't navigate to the "correctly cased" URL with Edge even if I want to -- and I wonder if I get the same reviewer(s) if this'll happen to them too. (>แ) How to fix itHow do you fix case sensitivity for express so that it's never a problem with ext4? Well, you could make everything in your filesystem lowercase, and then just always run From expressjs.com:
Still have to set the filesystem to a single case throughout, and then if you want to use mixed case in your URLs to make them easier to remember or what-have-you, you're creating a good deal of extra work for your server every time mixed case is used. How bad is it to make your web server take a URL, not find it, then search the filesystem again for a lower cased version? It might be smarter/less work just to lowercase the string every time and ensure your filesystem is in sync. It has to be cheaper to lowercase the url every time than to hit So I guess it looks like I get to go through and change the case of my website's files and folders to a single case. Right? Isn't that The Right Thing to do to approximate case insensitivity? Is it ever better for the end user to have a case sensitive http server? I don't think so. Seems unnecessarily processor churny and hacky to lower case the earth, but man, I hate case sensitivity for URLs. That fishing metaphor that tells you I'm about to comprise my best intentions...In any event, for now, I've decided to embarrassingly give the server a fish, I'm afraid.
That's probably worth a Unicode facepalm too. I really enjoy using linode, though my needs are so small I might drop down to Digital Ocean's $5 a month plan if it's just as easy to administer. It's great having your own "box" on the net. So much more powerful than shared hosting. Feel like I was about a decade behind with hosts, but, boy, I'm caught up now. Wonder how long before I start using .NET Core on it... posted by ruffin at 11/30/2016 12:47:00 PM |
|
| Wednesday, January 21, 2015 | |
![]() I don't hate Thunderbird, but I can see why folks aren't drawn to it. It's very Netscape 3.0-ish and its interface is, at times, horribly unintuitive. It's got *everything*, but everything isn't particularly accessible. I can't imagine if I was coming into Thunderbird cold and hadn't used since, well, early Netscape. Here's an example. If you want to set the display font for "plain text" emails in Thunderbird, you have to go to Tools >>> Options, Display, Formatting, click the Advanced button, then click the Monospace drop-down and select a font and size. But I kept getting what many of what were obviously plain text emails in a much larger font than what I'd set. Turns out that the "Fonts for [Western]" drop-down at the top of the Advanced fonts interface only works for ASCII (I'm assuming) emails. If you want plain text emails in UTF-8 to have a different font than the default as well, you have to choose "Fonts for [Unicode]" from that drop-down. This bugzilla thread helped. Not sure why there's a distinction. Perhaps other languages have different fonts for different 7-bit encodings? But shouldn't there just be a concept of a "default" display? So right. Guess I should've figured that out. /sigh Why you can't just right-click the message you're looking at and set your font (for the whole app) there, I don't know. Labels: encoding, thunderbird posted by ruffin at 1/21/2015 09:55:00 AM |
|
| Saturday, January 17, 2015 | |
|
I (he said uncontroversially) agree with Jon Skeet -- I'm not sure why converting to quoted printable isn't already in C# somewhere. It's old as the hills, and email seems it'll keep it going for the foreseeable future. I've seen some wacky ways of trying to do this, but it's really pretty easy. There are only two rules. You take a collection of bytes, here an array, and in the first rule, you only have two options. Either it's a "normal" byte -- which is between 33 and 127, inclusive, but exclusive of 61 (decimal) (since that's the =) -- or it's not. If it is, you add its ASCII char equivalent to the string. If it isn't, you add = plus the string representation of the byte as a two-digit hexadecimal number. The only monkey wrench is the second rule: that no line can be more than 76 characters, though apparently you can cut any line you want shorter than that. So if the line you're on is 75 characters long already & you're adding a "normal" or if it's 73 characters or greater and you're adding a "non-normal", you need to add a = to the end of the line to let a parser know it's not really a new line of text yet. Then you add (always) a carriage return and line feed. That is, in another [more complicated] manner of speaking, package your data with a \r\n between every 75 characters (treating =$$ as a unit) except, if you're encoding data that is text, you don't escape your new line bytes, and the counting starts from zero after a textual new line. Simple, right? Either/or check for byte values with a line length check. public static string ToQuotedPrintable(this string self)
{
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(self);
StringBuilder sbInner = new StringBuilder();
StringBuilder sbOuter = new StringBuilder();
foreach (byte byt in bytes)
{
int charLenQP = (byt >= 33 && byt <= 126 && byt != 61) ? 1 : 3;
if (sbInner.Length + charLenQP > 75)
{
sbOuter.Append(sbInner + "=\r\n");
sbInner = new StringBuilder();
}
if (1 == charLenQP)
{
sbInner.Append((char)byt);
}
else
{
sbInner.Append("=" + byt.ToString("X2"));
}
}
sbOuter.Append(sbInner);
return sbOuter.ToString();
}
I think that's right. QUICK NOTE: I am encoding in UTF-8 every time right now. You could take that in as a parameter (maybe with a UTF-8 default), but the best case would be to send in a byte array from the start, which would let you decide your own encoding, but then we couldn't use it as a fancy string extension. Though perhaps it should be a byte array extension, eh? That might make more sense. Labels: c#, code, encoding, noteToSelf posted by ruffin at 1/17/2015 10:00:00 PM |
|
|
| |
|
|
All posts can be accessed here: Just the last year o' posts: |
|||||||||||||||||||||
|
||||||||||||||||||||||
|
|
|
|