News for hackers. Stuff that matters.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by yeokm1 on Wednesday December 18, 2019 @11:06PM (#21831952)
I built a Win 3.1 app during a company hackathon just for fun. Here, I detail learnings and process for how a new old app can be created with the aid of modern tools and hindsight of old technologies. And perhaps what lessons can it offer us today.

Without the benefit of modern libraries and languages, I had to read up and take care of many low level details, socket programming, HTTP, JSON parsing, UI design in code all under tight memory constraints. Nevertheless, it was a terrific lesson in understanding how things work under the hood.

I had to do things the old-fashioned way reading books and header files due to the dearth of online documentation. I can empathise with the plight of the programmers of yesteryears who had to code without the benefit of online search engines.

With this blog post, I hope you'll find it interesting to learn about developing a modern-ancient app for Win 3.1.

https://github.com/yeokm1/w31slack https://github.com/yeokm1/http-to-https-proxy

Re:Building a new Windows 3.1 app in 2019: A Slack Client by eb0la on Thursday December 19, 2019 @01:30AM (#21832498)
I expected to be compiled in some kind of VM, not on an actual computer with Windows 3.11 :-).

I feel "old-style" documentation is much better than we have now. My most productive _python_ only work times were when I had only the python .hlp file and a _physical_ paper book.

What are your impressions?

Re:Building a new Windows 3.1 app in 2019: A Slack Client by kstenerud on Thursday December 19, 2019 @02:31AM (#21832772)
I've been programming since 1983. The internet opened up publishing to the masses, which means that non-professional people could also publish, resulting in much more documentation than ever before.

But now the amateur documentation writers are competing with the professional ones; the quality of the professional documentation is still as high as ever, but it can be drowned out by the amateur quality documentation.

All in all, finding the information you need is MUCH quicker via a search engine, but the signal-to-noise ratio is lower.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by userbinator on Thursday December 19, 2019 @03:10AM (#21832963)
The quality of Microsoft's own documentation has also fallen considerably; the latest nail in the coffin is that docs.microsoft.com thing that started to replace MSDN several years ago, that created tons of ridiculous fuckups in the "migration process". While doing that they also "open sourced" their documentation on GitHub, which to me sounds more like they're just trying to rely on free labour from the "community" to fix the mess.

One of the more memorable WTFs I've seen is this, which is still wrong as of this post:

https://docs.microsoft.com/en-us/windows/win32/api/wininet/n...

Compare to the old version of the page on MSDN:

http://web.archive.org/web/20080828050103/http://msdn.micros...

See what's missing? The newer version is not the correct one... in "migrating" the document to the new site, for a reason that completely defines all rational explanation, the return type of the function declaration became void. There are plenty of pages on the new site with this serious error, and they've remained unfixed for well over a year. People report such problems on their GitHub, and they get fixed --- individually --- as they're reported, but it still boggles the mind how such a blatant and widespread error could go through (and the old, correct, content deleted flippantly) without someone in power shouting "STOP!":

https://github.com/MicrosoftDocs/windows-driver-docs-ddi/iss...

Re:Building a new Windows 3.1 app in 2019: A Slack Client by bluedino on Thursday December 19, 2019 @08:35AM (#21834727)
MSDN was a gold standard in the 90's. Now you have tragedies like social.technet.com
Re:Building a new Windows 3.1 app in 2019: A Slack Client by fortran77 on Thursday December 19, 2019 @09:07AM (#21834967)
The low quality of the technet "answers" are mind-boggling. Why doesn't Microsoft pull the plug on this?

Also, what's the purpose of the people who will answer nearly any question with a very low-quality (but wordy) answer? What are they getting from this effort?

Re:Building a new Windows 3.1 app in 2019: A Slack Client by nottorp on Thursday December 19, 2019 @09:32AM (#21835187)
There must be some reputation game there.

You see it on SO too, people answering basic questions 2 seconds after they're postedd with long pastes from documentation that are sorta related to the original question.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by gdxhyrd on Thursday December 19, 2019 @05:03AM (#21833490)
So much this.

It depends on which docs you are looking at, but some are very broken, with broken links, broken tables, broken text formatting...

Do you know of any way to get a handle to the old docs or perhaps a full MSDN dump of 3 years ago or so? (other than the web archive)? Perhaps the latest MSDN offline release or something?

I don't even mind paying.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by int_19h on Thursday December 19, 2019 @03:37AM (#21833089)
I still miss the old MSDN offline help system. Once you got the hang of it, most of the time, you could find what you needed right away by typing the right thing in the Index.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by roel_v on Thursday December 19, 2019 @07:57AM (#21834469)
Also, putting your cursor on a keyword, hitting F1, and getting the right result immediately. If I let myself I get so frustrated and angry by the massive regressions we've made over the last 20 years.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by jdance on Thursday December 19, 2019 @06:51AM (#21834054)
I work like this every day in my game that I am building. I’m almost the only one using the engine, and 90% of my work is in lua. I use the source code and the lua 5.1 reference for everything.

I hardly google something in a week of work, since there is nothing online about anything. It is like heaven compared to other ”google driven” programming things I have done. I feel very productive pretty much all the time, even when debugging mysterious real time issues.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by jdance on Thursday December 19, 2019 @06:57AM (#21834096)
In fact, sometimes I work with wifi off just because it creates a special peace of mind — and then I have to turn it on to do git push :)
Re:Building a new Windows 3.1 app in 2019: A Slack Client by dboreham on Thursday December 19, 2019 @12:22AM (#21832170)
Prior to online search engines there were similar offline resources such as the MSDN CDs.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by yeokm1 on Thursday December 19, 2019 @12:32AM (#21832209)
Agreed. But such CDs are tough to locate today.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by whoopdedo on Thursday December 19, 2019 @02:12AM (#21832700)
Borland's compilers had the best documentation. They included a much of the MSDN API reference in their built-in help files.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by yeokm1 on Thursday December 19, 2019 @04:01AM (#21833204)
Hmm. Borland and Watcom compilers came up in my research. Will look into them for help next time!
Re:Building a new Windows 3.1 app in 2019: A Slack Client by jbverschoor on Thursday December 19, 2019 @07:48AM (#21834417)
Yeah Borland was great with docs
Re:Building a new Windows 3.1 app in 2019: A Slack Client by homarp on Thursday December 19, 2019 @12:41AM (#21832245)
Re:Building a new Windows 3.1 app in 2019: A Slack Client by efreak on Thursday December 19, 2019 @01:00PM (#21837416)
The Eye might have these, they have a bunch of old Microsoft/msdn related stuff.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by bluedino on Thursday December 19, 2019 @08:34AM (#21834719)
We use Visual Basic 6 for a lot more than we should at work...going back to that from using Python, Ruby, and even PHP was a shok.

I thought porting a Python script to VB wouldn't be a big deal, but like you said, things youtake for granted like JSON and certain dictionaries are just lacking.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by cr0sh on Thursday December 19, 2019 @12:21PM (#21836947)
I haven't touched VB6 in ages - I tend to wonder what it would be like "going back to it".

Not too long ago I remarked here on HN that I expected VB6 programmers might become in demand in the future (when, I don't know), similar to how COBOL programmers were/are.

Basically, for the need to convert apps, written internally for a business, from VB6 to something else (likely to VB.NET or C# - maybe on Mono - but there are other options too).

I expect this to happen when Microsoft finally kills off the VB6 runtime DLL - but so far they haven't; from what I understand, it's still available in Win10...

Re:Building a new Windows 3.1 app in 2019: A Slack Client by ralphc on Thursday December 19, 2019 @11:11AM (#21836149)
I'm one of the "programmers of yesteryear", part-time in the early '80s on CP/M them on to Windows 3.1 after graduation in 1984.

Doing things the old-fashioned way was harder but less was expected of you, time-wise. Getting a "database" (a set of BTrieve files, usually) set up would take days, editing on floppies, etc. It was just expected that making software was a long process.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by forgotmypw3 on Thursday December 19, 2019 @02:11AM (#21832696)
If you happen to end up in those environments again, I would appreciate it if you take a look at my prototype web-based message board.

It's designed for compatibility, and I've tested a lot of Netscapes and IE4, but nothing on Win311 yet.

If you want to leave a comment, you can do so right on the message board. It should work, more likely with JS off.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by shakna on Thursday December 19, 2019 @03:44AM (#21833127)
> It should work, more likely with JS off.

Many of the 3.1-era browsers didn't have a concept of JS yet. If you're relying on noscript at all it won't work.

I did try and check if this was the case, but both links in your profile that it could have been lead to "not found" dreamhost sites.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by forgotmypw38 on Sunday December 22, 2019 @11:07PM (#21861424)
I feel obligated to comment, so that others are not led astray by parent comment, which is INCORRECT:

<noscript> works just fine in pre-JS browsers, at least all of the ones I've tried.

It works exactly as designed: Text between <noscript> and </noscript> is displayed in browsers without JS enabled (or supported).

I am not aware of any browsers where this is not the case, and I've tested in many, including Mosaic 1.x-3.x, NN 1.x-4.x, Opera up to 3.62, and others.

(You probably happened to visit my site during an upgrade. Sorry about that.)

Re:Building a new Windows 3.1 app in 2019: A Slack Client by Tepix on Thursday December 19, 2019 @04:10AM (#21833240)
Why would notscript not work on a browser that has no concept of JS?
Re:Building a new Windows 3.1 app in 2019: A Slack Client by shakna on Thursday December 19, 2019 @04:33AM (#21833346)
Because the <noscript> element isn't valid for the stricter form of HTML that they use. Invalid elements didn't used to show up.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by cesarb on Thursday December 19, 2019 @05:57AM (#21833769)
From what I recall of that era, it's the exact opposite: invalid elements (like <noscript>) are simply ignored, and their contents shown. That's how <noscript> works: newer browsers which understand JavaScript know the <noscript> element and ignore its contents; older browsers which do not understand JavaScript don't know the <noscript> element so its contents are shown. The same trick is used for <noframes>: browsers like Netscape which understand frames don't show the contents of that element, while other browsers which don't understand <frame> and <frameset> will show the content of the <noframes> element, so it can be used as a fallback.

Strict validation of HTML came later with XHTML, but AFAIK all browsers which understand XHTML also understand JavaScript.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by shakna on Thursday December 19, 2019 @09:08AM (#21834976)
XHTML came after HTML 4.0, so it had its advent around the rise of JavaScript's popularity.

However, HTML 2.0, which you can find specified here [0], and it specifies the "ignore" behaviour. Short of spinning up an old VM, I think I'll trust that my memory hasn't failed me.

From RFC 1866:

> markup in the form of a start-tag or end-tag, whose generic identifier is not declared is mapped to nothing during tokenization. Undeclared attributes are treated similarly...

> For example: > <div class=chapter><h1>foo</h1><p>...</div> > => <H1>,"foo",</H1>,<P>,"..."

[0] https://www.w3.org/MarkUp/html-spec/

Re:Building a new Windows 3.1 app in 2019: A Slack Client by bawolff on Thursday December 19, 2019 @09:36AM (#21835214)
If that was true, why did <script> tags have that horrible hack where the contents started with <!-- to hide from old browsers?
Re:Building a new Windows 3.1 app in 2019: A Slack Client by shakna on Thursday December 19, 2019 @09:41AM (#21835260)
Note that in the example code I gave the enclosing tag vanished, but the internal tags did not. That's why.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by WorldMaker on Thursday December 19, 2019 @02:37PM (#21838401)
Some of your UI might have been easier to build with VB than VC. VB4 was the last version to support 16-bit Windows applications. You might have better luck finding VB6 libraries/code-samples that run in VB4 than you had finding C89 libraries.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by vardump on Thursday December 19, 2019 @12:22AM (#21832171)
Re:Building a new Windows 3.1 app in 2019: A Slack Client by yeokm1 on Thursday December 19, 2019 @12:31AM (#21832207)
I forgot to make the repo public. It's up now!
Re:Building a new Windows 3.1 app in 2019: A Slack Client by loa_in_ on Thursday December 19, 2019 @05:29AM (#21833602)
Did you get to work with a co-operative task scheduling? This version of Windows still used one I think. What's your experience if so?
Re:Building a new Windows 3.1 app in 2019: A Slack Client by cesarb on Thursday December 19, 2019 @05:41AM (#21833682)
Windows (not only the 16-bit 3.x, but going as far as the newest 64-bit ones) uses an event loop for the GUI: your program runs a loop calling the GetMessage function, which blocks until the next window message is available. As long as you don't take too much time processing each window message, you don't have to even think about cooperative task scheduling, since Windows will do it for you while waiting on GetMessage.

(In fact, AFAIK even in modern Windows you should avoid taking too much time to process each window message, since blocking the event loop thread makes the UI for your program unresponsive.)

Re:Building a new Windows 3.1 app in 2019: A Slack Client by loa_in_ on Friday December 20, 2019 @01:36PM (#21846389)
I remember the user experience, I was wondering about design decisions during development.

You are guaranteed no context switches unless you explicitly request one - did it simplify some parts, or alternatively made it more complex? It's an asynchronous application.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by gmueckl on Thursday December 19, 2019 @06:04AM (#21833804)
Windows NT and Windies 95 were the first versions to have preemptive scheduling. Windows 3.11 and older would only switch tasks when he program requested new messages from the queue. Thus was totally annoying because most applications were written badly and had moments where they would go off and do things and not return to their message loop for several seconds or worse, hanging the entire system during that time. Windows felt very sluggish because of that.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by bluedino on Thursday December 19, 2019 @08:01AM (#21834504)
And in Win95, your 16-bit apps could still do whatever they want as they were only cooperatively multi-tasked
Re:Building a new Windows 3.1 app in 2019: A Slack Client by pjc50 on Thursday December 19, 2019 @06:34AM (#21833976)
You'd only notice if it an app crashed, at which point your only option would be to hard-reset the whole system losing all unsaved state.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by keithnz on Thursday December 19, 2019 @01:18AM (#21832444)
bet you had fancy pants autocomplete also! That was a game changer when it came along....otherwise you had to refer to docs/books.... not to mention the limited screen size.... two monitors? no one was that rich :)
Re:Building a new Windows 3.1 app in 2019: A Slack Client by jsjohnst on Thursday December 19, 2019 @06:39AM (#21834004)
> not to mention the limited screen size.... two monitors? no one was that rich :)

I had dual screens at home in late 1995 for sure, can’t remember if I used a dual screen setup any earlier than that.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by ygra on Thursday December 19, 2019 @02:14AM (#21832705)
They mention having to look up function declarations in the header files, so perhaps not.