|
iSee what you did there.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
iLaughed
|
|
|
|
|
I was right there when it happened. iPhoned it in!
This space for rent.
|
|
|
|
|
the iWas - an apple device that stokes your nostalgia.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I'd give my iTeeth to see them go to prison.
|
|
|
|
|
Quite a long time ago i wrote a nefarious program that let you browse TV shows and it would search the web for you for videos of that TV show automatically, which it would then download or torrent. A kind of black market netflix, and then organize and catalog all of that media on your system automatically.
I didn't do it to break any laws, and I'm not releasing it. I did it because it's *hard to do*. Sometimes I do that. It had to use all kinds of hacks and heuristics and break TOS's on at least two major websites that I'm aware of.
So in jail it goes. Bad program! Bad, bad program!
Anyway, I wanted the HTML from it, but it was all served using a tiny C# webserver running dynamic content with T4 templates.
So the pages are essentially ASP. Not even asp.net. And I'm just basically porting them over to a WebForms project to serve as a demo for this TMDB api i wrote. Just flat ASP. I'm a jerk.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
You're a jerk for single line if-statements, for not caring about spacing and for hacking some cache.
This might just be the least jerky thing you did
It's been a while, but... Where's my pitchfork?
|
|
|
|
|
hahaha
i stole it.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
If (your_pitchfork == missing) honey_the_codewitch_stole_it;
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
honey the codewitch wrote: the pages are essentially ASP ... porting them over to a WebForms project
So you've got something written in ancient Sumerian, and you're going to bring it up-to-date by translating it into Latin?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That sounds about right.
I speak Ancient Geek
Adding, the only reason i'm porting it is to get it to run on code other than my little C# based webserver. heh
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
something some code i'm working on made me realize that blew my hair back a little:
HTTP keep-alive connections are sometimes served on the same server thread request to request because of the way sockets work
that means on the server, if you keep something around thread-static, you can (unreliably) keep state on that connection!
this is very useful for caching - where the state doesn't have to be there but it's useful for speeding things along if it's around. Lock free cache woo.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Mark the day on the calendar. Today a sinister hack was born.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
It's not so sinister if it's used only as an optimization. Just be very careful with it.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: Just be very careful with it. ...said the mother to the young son wielding scissors for the first time.
Message Signature
(Click to edit ->)
|
|
|
|
|
lopatir wrote: ...said the mother to the young son wielding scissors for the first time.
Or fork[^] (don't follow link if you're sensitive, but yes, he's ok)
|
|
|
|
|
Quote: Or fork[^] There was apparently a case in England where a length of rebar went through a construction worker's head but went precisely between the two halves of his brain and did no lasting damage.
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
Yeah, I remember that one.
But "don't run with rebars" doesn't have the same oomph to it.
And that picture is a bit to far off from being kid sister safe, even if the guy was ok afterwards.
|
|
|
|
|
A hack is and stays a hack. It will paitiently wait for years, until you have forgotten it completely. And then, one day, it will fail spectacularly and someone will have really great days with panicking bosses, crying customers and don't you dare come with something that does not have your little optimization. The sinister hacker usually is long gone by then, but the poor guys who will have to get this cow off the ice will curse you.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Honestly because i'm just using it for holding a cache the worst case is either it hits all the time or it misses all the time depending on the situation.
the rough bit of it is understanding how it works if you haven't had a (brief) tutorial on its behavior.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
And sure as hell this will go wrong the worst way possible when it does. What you did my be fairly harmless. Those who come after you may not be as careful or may not even see any problem. Fast forward a few years and let's say a new OS version comes along, the behavior you have been exploiting changes and the fun begins.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Nothing I'm using is undocumented. Worst case, one day connections will no longer keep to the same thread.
In such a scenario that cache will still be used due to thread pooling, just maybe across connections, which is fine unless you're relying on that. Which is possible, but stupid to do and hard to do.
So anyway, as hacks go, this isn't really much of one. Edited (again) to add, this isn't even so much a hack as an observation about keep-alive.
It simply is faster when the connection uses the same thread. If it doesn't, you get a cache miss.
Here's the thing: I'm not using any undocumented API calls. I'm not using anything where the behavior *relies* on this thread sharing property of connections.
There's nothing to break except for breaking changes in .NET - at which point ALL of our .NET code is in trouble.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Would you be surprised if that actually happened? Have the Mickeysofties ever washed their hands in innocence? They did not explicitly guarantee anything, after all. They don't even guarantee that their stuff is fit for any particular use. Forget this and you already are on your way to the Dark Side. Have them add 'Sith Lord' to the titles on your business cards.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Like I said, if they make breaking changes to something in .NET we're all in trouble
They'd have to change the behavior of the ThreadLocal<t> class provided in .NET 4
Now they *could*. Of course they could. They could also make a breaking change to System.String, or System.Threading.Thread.
Nobody is safe. Hide your children.
The truth is, whenever you use someone else's library, you run that risk if you rely on it.
That's the nature of software development and this is as true of the less used types like ThreadLocal as is is to more intrinsic and common types like System.String
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
And you'll write this up as a short article, right?
cheers
Chris Maunder
|
|
|
|