|
I use old paper boxes for storing strands of icicle lights.
Start in the middle of the strand and lay them in the box.
Ends go in last.
Put a cardboard separator on top.
Repeat until full.
Next year, ends come out first.
No problems with tangling for years.
|
|
|
|
|
I was looking back on my graphics library code.
I allow you to wrap a byte array with a bitmap object with a completely user definable pixel format/binary footprint.
Therefore you can declare for example, a pixel that's 18 bits wide if you want, and it will allow you to access the pixels in the bitmap.
Astute bit twiddlers here may realize that this requires potentially complicated bit shifts to make it all work.
I compute the necessary code for the shifts at compile time, optimizing for situations where I can, like where a pixel is an even number of bytes wide, or special casing for monochrome, etc. Bitmap blting is memcpys, either entire bitmaps, or lines at a time if you're blting from a rectangle within a bitmap.
It's nuts.
I'm looking back on it going "that's wicked code"
I love those moments when I impress myself. Unfortunately I'm not completely certain I could repeat this wizardry.
To err is human. Fortune favors the monsters.
|
|
|
|
|
In a similar vein maybe....
I was stuck on a report generation corner case issue that was particularly head scratching and I was beginning to blame SQL's QueryResult.Read() for my troubles. 4 days I did toil. Yesterday I found an unrelated regression bug with discounts and hot fixed that, publishing the code to production knowing the reporting was in flux and broken is that published version (that's ok I have till February )
Last night I was working on the reporting issue on the dev box and was interested in a particular sale so I fired up the production code from the production server and the reporting corner case issue was fixed!!. WTAF???
I thought... no way and ran it on my phone (web App).... Still working.
- There, I fixed it.
|
|
|
|
|
honey the codewitch wrote: I'm looking back on it going "that's wicked code"
I love those moments when I impress myself. Unfortunately I'm not completely certain I could repeat this wizardry.
As long as it doesn't lead to "I really should have commented this, even though I'm the only beneficiary"...
I've had my moments where I've hated myself for it.
|
|
|
|
|
Oh I understand it upon study. The problem commenting code like what I wrote is it's bloody hard to explain, but I have a sort of instinct for my own patterns so I can see the intent.
To err is human. Fortune favors the monsters.
|
|
|
|
|
My comments are usually a summary of the activity. I try to apply basic software engineering so variables are somewhat self documenting.
Complicated comments can be misleading as code changes run ahead of comment changes.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
I agree with every word of this.
To err is human. Fortune favors the monsters.
|
|
|
|
|
I sometimes introduce intermediate variables just to document code.
One team mate used to format the code to remove these “unnecessary” variables. Grrr
Boolean explainTheNastyCalculation = <chaos>;
If (explainTheNastyCalculation)
|
|
|
|
|
In front of the boat are the top party people? (10)
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Figurehead ?
Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP
modified 5-Jan-23 3:50am.
|
|
|
|
|
I was thinking that too.
// TODO: Insert something here Top ten reasons why I'm lazy
1.
|
|
|
|
|
And ... you were both wrong!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Nope!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Are you sure it's 10 letters ?
Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP
|
|
|
|
|
I treble checked!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Headliners ?
Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP
|
|
|
|
|
Afraid not!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Figurehead Headliners LEADERSHIP
|
|
|
|
|
Beat me by 10 minutes Derek!
|
|
|
|
|
Hey Craig,
May I ask a quick question? What's your favorite programming language? Which language are you most proficient at?
|
|
|
|
|
Good Morning Randor,
My favorite - probably because I was so proficient using it: PL/MI. It was similar to PL/1 and used to write parts of the IBM S/38 and later AS/400 operating systems. This was back in the early to mid 1980's. I have a lot of fond memories from those days. I could also pull an all-nighter back then.
Most proficient today: Until recently I was doing a lot of work with mainframe COBOL and using CA/Gen for the corresponding desktop client software. That whole project was retired -- so today I'm doing mostly the business analysis side of things and dabbling in C# as well as using a lot of SQL. I plan to be retired myself by year-end.
Best wishes from Minnesota!
|
|
|
|
|
Dat's de bunny! You are up tomorrow.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Do we have a group for questions about Windows 10 in specific ?
Mine is, about once every two or three weeks, doing something weird (no clue what that "weird" something is).
After the weird thing...
- I am NOT able to connect to any https:// type of site
- I AM able to connect to any http:// type of site
The current "Fix" is windows restore; generally to go back X-Number of days; where X is highly indeterminate
Again, if there's a better place to ask this on this site, please point me.
|
|
|
|
|
Try Quick Answers, but you will need to add a lot of detail.
|
|
|
|
|
It'll probably be hard to track that sort of thing down unless you do some extensive logging, or catch it in the act.
It just so happens that last week I was playing with WMI's event watcher...essentially, tracking and logging each and every process that launches, its path on disk, and any command line args it received. It's amazing how much crap nowadays is taking place automatically, all the time, on Windows - recent versions about 10x as worse as, say, 7.
Anyway, if you could log every process that launches/shuts down, and then eliminated the noise, and you had a decent idea when the problem starts, I'd bet you could narrow it down somewhat quickly.
The gist of it is:
private bool SetupEventWatcher()
{
if (Watcher != null)
return false;
int nTimespanInSeconds = 1;
string strScope = @"\\.\root\CIMv2";
string strWQL = $"SELECT * FROM __InstanceOperationEvent WITHIN {nTimespanInSeconds} WHERE TargetInstance ISA 'Win32_Process'";
Watcher = new ManagementEventWatcher(strScope, strWQL);
Watcher.EventArrived += new EventArrivedEventHandler(OnEventArrived);
Watcher.Start();
return true;
}
private void OnEventArrived(object sender, EventArrivedEventArgs e)
{
TrackedEventType tet = TrackedEventType.Unknown;
if (e.NewEvent.ClassPath.ClassName == "__InstanceCreationEvent")
tet = TrackedEventType.Creation;
if (e.NewEvent.ClassPath.ClassName == "__InstanceDeletionEvent")
tet = TrackedEventType.Deletion;
if (tet == TrackedEventType.Unknown)
return;
foreach (PropertyData pd in e.NewEvent.Properties)
{
if (pd.Name == "TargetInstance")
{
if (pd.Value is ManagementBaseObject mbo)
{
if ( mbo.Properties is PropertyDataCollection pdc )
{
ListViewItem lvi = CreateEventLVI(tet, mbo.Properties);
if (lvi != null)
InsertEventLVI(lvi);
}
}
}
}
}
private ListViewItem CreateEventLVI(TrackedEventType tet, PropertyDataCollection pdc)
{
foreach (PropertyData pd in pdc)
{
if (pd.Name == "Name")
...pd.Value is the name of the EXE
if (pd.Name == "CommandLine")
...pd.Value contains the cmd line args
}
I'm using a ListView to show processes that got created/deleted, but I suggest you just dump it to a plain-text file, so it's easily searchable.
Didn't think your question would lead you to actual code, did you?
I'd share the whole thing if it was refined, I just can't afford to do that right now.
|
|
|
|