|
Doesn't that simply import each row as a single field per row? Seems to me your code is working.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
John Simmons / outlaw programmer wrote: Seems to me your code is working.
Getting one field where multiple fields are expected was a problem.
The original logic was just to remove any commas found between double-quotes. Doing this with the single field (of comma delimited values) just pushed everything together and made a mess.
A little added logic to detect if the entire line is wrapped fixed everything. Easy.
The point was that sometimes you just have to take what the client gives you and make it work...that and how lazy (or stupid) the client's dev was for not understanding what the problem was.
"Go forth into the source" - Neal Morse
|
|
|
|
|
So, going through MDN's documented HTTP response status codes I ran into this nugget in the 400's:
418 I'm a teapot
The server refuses the attempt to brew coffee with a teapot.
I can appreciate the sentiment.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Wikipedia has slightly more information:
This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol[^], and is not expected to be implemented by actual HTTP servers.
But with stories like this[^] getting more common, it can't be long until this is used in a real project.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
In other news, Mark Nottingham lives at home with Mom and his friends are like his sense of humour.
Nonexistent.
veni bibi saltavi
|
|
|
|
|
One of the teams where I work are called the 418's and they are named after this response.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
|
Love it!
I also enjoy how every time you click the teapot, it triggers an analytics callback.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Hah! I should return this code to malicious/blacklisted IP's.
|
|
|
|
|
I've been thinking that it would be perfect for malformed user input.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
no I didn't...
..a much younger me wrote this piece of "code" which is bad in so many ways I don't even want to count them:
CString StrEncode(CString str, bool decode)
{
CString map = "S)y³T<.zÖ?tp3~o`u^F}G\\0D_K:>1µ5&|ßJ§ö $E!rÜq-I]W%=Xü´Yl/(78A#dHm@BvQLM'*Pc+2Äxf,ghCnsä;6UO{9a[b4Ne²wjkViRZ°";
short len = map.GetLength();
short add = decode ? len : 0;
short mul = decode ? -1 : 1;
short off = str.GetLength() % len;
CString out;
for(short i=0; i<str.GetLength(); i++)
{
if(map.Find(str.GetAt(i)) == -1)
out += str.GetAt(i);
else
out += map.GetAt((map.Find(str.GetAt(i)) + add + ((i + off) * mul) % len) % len);
}
return out;
} The only good thing about it is that it served its purpose of weakly obfuscating strings.
Please absolve me
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Sascha Lefèvre wrote: Please absolve me
To be forgiven, you must obtain an abacus from ebay and perform the computations of your algorithm by hand with nothing but the abacus.
|
|
|
|
|
I'll possibly carry this burden forever then
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
I fixed it for you : FTFY - rewrote it in C# so you can run it in LINQPad[^]
I'll put this out on GitHub as soon as possible.
void Main()
{
Console.WriteLine(StrEncode("Here it is", true));
Console.WriteLine(StrEncode("´;µsDUkGäB", false));
}
String StrEncode(String str, bool decode)
{
String map = "S)y³T<.zÖ?tp3~o`u^F}G\\0D_K:>1µ5&|ßJ§ö $E!rÜq-I]W%=Xü´Yl/(78A#dHm@BvQLM'*Pc+2Äxf,ghCnsä;6UO{9a[b4Ne²wjkViRZ°";
int len = map.Length;
int add = decode ? len : 0;
int mul = decode ? -1 : 1;
int off = str.Length % len;
String outMsg = String.Empty;
for(int i=0; i<str.Length; i++)
{
if(!map.Contains(str[i]))
outMsg += str[i];
else
{
outMsg += map[(map.IndexOf(str[i]) + add + ((i + off) * mul) % len) % len];
}
}
return outMsg;
}
Here's the resulting output:
´;µsDUkGäB
Here it is
|
|
|
|
|
I can see you caught fire - maybe we can achieve great things together
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Yes, this could be bigger than base64 encoding which is far easier to use.
People using base64 are just lazy.
|
|
|
|
|
Pfft... Dictionaries are so much faster than string searches...
|
|
|
|
|
That's one of those things I didn't even want to start counting..
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Sascha Lefèvre wrote: Please absolve me
Et nunc absolvo te ab peccatis tuis. Amen.
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
|
|
|
|
|
And ten Hail Marys.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
And put a pound in the poor box.
|
|
|
|
|
Thank you
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Sascha Lefèvre wrote: Please absolve me
In order to receive absolution, you must rewrite the entire application in VB6.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
It might actually end up being better than it is..
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|