19 Oct 2019 @ 3:22 PM 

Over the last few years – more than a decade, really – it seems that, somehow, *nix- and Linux in particular, has been tagged as being some sort of OS ideal. It’s often been cited as a "programmers OS" and I’ve seen claims that WIn32 is terrible, and people would take the "Linux API" over it anyday. That is a verbatim quote as well.

However, I’ve thought about it some and after some rather mixed experiences trying to develop software for Linux I think I feel something of the opposite. Perhaps, in some ways, it really depends what you learned first.

One of the advantages of a Linux-based (or to some extent, UNIX-based) system is there is a lot of compartmentalization. The user has a number of choices and these choices will affect what is available to the applications.

I’d say that generally, The closest thing to a "Linux API" that applications utilize would probably just be the Linux Kernel userspace API.

Beyond that, though, as a developer, you have to start making choices.

Since the user can swap out different parts, outside of the Linux Kernel userspace API, pretty much nothing is really "standardized". Truth be told most of that kernel userspace API isn’t even used directly by applications- usually they get utilized through function calls to the C Standard library.

The Win32 API has much more breadth but tends to be more "simple", which tends to make using it more complicated. Since it’s a C API, you aren’t going to be passing around OO instances or interfaces; typically more complicated functions accept a struct. Hard to do much better than that with a C API.

However, with Windows, every Window is created with CreateWindowEx() or CreateWindow(). No exceptions. None. Even UWP Windows use CreateWindow() and have registered Window classes. Even if perhaps it’s not the most pleasant base to look at at least there is some certainty that, on Windows, everything is dealt with at that level and with those functions.

With Linux, because of the choices, things get more complicated. Since so many parts are interchangable, you can’t strictly call most of what is made available and used by applications a "Linux API" since it isn’t going to exist on many distributions. X11, for example, is available most of the time, but there are still Linux distributions that use Wayland or Mir. Even using just X11, it only defines the very basic functions- It’s a rare piece of software that actually interacts directly with X11 via it’s server protocol, usually software is going to use a programming interface instead. But which one? For X11 you’ve got Xlib or xcb. Which is better? I dunno. Which is standard? Neither. And then once you get down to it you find that it only actually provides the very basics- what you really need are X11 extensions. X11 is really only designed to be built on top of, with a Desktop Environment.

Each Desktop environment provides it’s own Programming Interface. Gnome as I recall uses "dbus"; KDE uses- what was it? kdetool? Both of these are CLI software that other programs are supposed to call to interact with the desktop environment. I’m actually not 100% on this but all the docs I’ve found seem to suggest that at the lowest level aspects of the desktop environment is handled through calls to those CLI tools.

So at this point our UI API consists of calling a CLI application which interacts with a desktop environment which utilizes X11 (or other supported GUI endpoints) to show a window on screen.

How many software applications are built by directly interacting with and calling these CLI application endpoints? Not many- they are really only useful for one-off tasks.

Now you get to the real UI "API"; the UI toolkits. Things like GTK+ or Qt. These abstract yet again and more or less provide a function-based, C-style API for UI interaction. Which, yes- accepts pointers to structs which themselves often have pointers to other structs, making the Win32 API criticism that some make rather ironic. I think it may arise when those raising the criticism are using GTK+ through specific language bindings, which typically make those C Bindings more pleasant- typically with some sort of OO. Now, you have to choose your toolkit carefully. Code written in GTK+ can’t simply be recompiled to work with Qt, for example. And different UI toolkits have different available language bindings as well as different supported UI endpoints. Many of them actually support Windows as well, which is a nice bonus. usually they can be made to look rather platform native- also a great benefit.

It seems, however, that a lot of people who raise greivance with Win32 aren’t comparing it to the direct equivalents on Linux. Instead they are perhaps looking at Python GTK+ bindings and comparing it to interacting directly with the Win32 API. It should really be no surprise that the Python GTK+ Bindings are better; that’s several layers higher than the Win32 API. It’s like comparing Windows Forms to X11’s server protocol, and claiming Windows is better.

Interestingly, over the years, I’ve come to have a slight distaste for Linux for some of the same reasons that everybody seems to love about it, which is how it was modelled so heavily on UNIX.

Just in the last few years the amount of people who seem to be flocking to OS X or Linux and holding up their UNIX origins (obviously more so OSX than Linux, strictly speaking) as if that somehow stands on it’s own absolutely boggles my mind. I can’t stand much about the UNIX design or philosophy. I don’t know why it is so constantly held up as some superior OS design.

And don’t think I’m comparing it to Windows- or heaven forbid, MS-DOS here. Those don’t even enter this consideration at this point- If anything can be said it’s that Windows wasn’t even a proper competitor until Windows NT anyway, and even then, Windows NT’s kernel definitely had a lot of hardware capability and experience to build off that UNIX never had in the 70’s- specifically, a lot of concepts were adopted from some of the contemporaries that UNIX competed against.

IMO, ITS and MULTICS were both far better designed, engineered, and constructed than any UNIX was. And yet they faded into obscurity. often People point at Windows and say "The worst seems to get the most popular!" But if anything UNIX is the best example of that. So now we’re stuck with people who think the best OS design is one where the the shell is responsible for wildcard expansion and the underlying scheduler is non-preemptive. I wouldn’t be surprised if the UNIX interrupt-during-syscall issue was still present, and instead of re-entering the syscall it returned an error code, making it the application’s responsibility to check for the error and re-enter the syscall.

It seems to me that one of the axioms behind many of the proclamations that "*nix is better designed" seems to be based on definitions of "better designed" that correspond to how *NIX does things- conclusion before the reason, basically.

Posted By: BC_Programming
Last Edit: 19 Oct 2019 @ 03:22 PM

EmailPermalinkComments (0)
Tags
 14 Mar 2019 @ 6:51 PM 

Alternate Title: Software Licenses and implicit trust

It is interesting to note that in many circles proprietary software is inherently considered untrustworthy. That is, of course, not for no reason- it is much more difficult to audit and verify that the software does what it is supposed to and to check for possibly security problems. However, conversely, it seems that a lot of Open Source software seems to get a sort of implicit trust applied to it. The claim is that if there isn’t somebody sifting through and auditing software, you don’t know what is in there- and, conversely, that if something is open source, we do know what is in there.

But, I would argue that the binaries are possibly more trustworthy in attempting to determine what a piece of software is doing simply by virtue of it being literally what is being executed. Even if we consider the scenario of auditing source code and building binaries ourself, we have to trust the binary of the compiler to not be injecting malicious code, too.

I’ve found that this sort of rabbit hole is something that a lot of Open Source advocates will happily woosh downwards as far as possible for proprietary software, but seem to avoid falling for Open Source software. Much of the same logic that get’s applied to justify distrust of proprietary binary code should cause distrust in areas of Open Source, but for some reason a lot of aspects of Open Source and the Free Software Community are free from the same sort of cynicism that is applied to proprietary software, even though there is no reason to think that software falling under a specific license makes it inherently more or less trustworthy. If we can effectively assume malicious motives for proprietary software developers, why do we presume the opposite for Open Source, particularly since it is now such a better target for malicious actors due to the fact that it is so often implicitly trusted?

Source code provided with a binary doesn’t mean anything because- even assuming users capable of auditing said code, there is no way to reliably and verifiably know that the source code is what was used to build the binary. Trust-gaining exercises like hashes or MD5sums can be adjusted, collided, or changed and web servers hacked to make illegitimate binary releases appear legitimate to propagate undesirable code which simply doesn’t appear in the associated source code with a supposed release (Linux Mint). Additionally, The indeterminate nature of modern compilers means that even compiling the same source more than once can often give completely different results as well, so you cannot really verify that the source matches a given binary by rebuilding the source and comparing the resulting binary to the one being verified.

Therefore, it would seem the only reasonable recourse is to only run binaries that you build yourself, from source that has been appropriately audited.

Thusly, we will want to audit the source code. And the first step is getting that source code. A naive person might think a git pull is sufficient. But no no- That is a security risk. What if GitHub is compromised to specifically deliver malicious files with that repository, hiding secret exploits deep within the source codebase? Too dangerous. Even with your careful audit, you could miss those exploits altogether.

Instead, the only reasonable way to acquire the source code to a project is to discover reliable contact details for the project maintainer and send then a PGP encrypted message requesting that they provide the source code either at a designated drop point- Which will have to be inconspicuous and under surveillance by an unaffiliated third party trusted by both of you – Or have him send a secure, asymmetrically encrypted message containing the source tarball.

Once you have the source, now you have to audit the entire codebase. Sure, you could call it quits and go "Developer says it’s clean, I trust him" fine. be a fool. be a foolish fool you fooly foolerson, because even if you know the tarball came from the developer, and you trust them- do you trust their wife? their children? their pets? Their neighbors? You shouldn’t. In fact, you shouldn’t even trust yourself. But you should, because I said you shouldn’t and you shouldn’t trust me. On the other hand, that’s exactly what I might want you to think.

"So what if I don’t trust their hamster, what’s the big deal"

Oh, of course. Mr Security suddenly decides that something is too off-the-wall.

Hamsters can be trained. Let that sink in. Now you know why you should never trust them. Sure, they look all cute running on their little cage, being pet by the developers cute 11 year old daughter, but looks can be deceiving. For all you know their daughter is a secret Microsoft agent and the hamster has been trained or brainwashed- using evil, proprietary and patent encumbered technology, no doubt, to act as a subversive undercurrent within that source repository. With full commit access to that project’s git repository, the hamster can execute remote commands issued using an undocumented wireless protocol that has no man page, which will cause it to perform all sorts of acts of terror on the git repository. Inserting NOP sleds before security code, adding JMP labels where they aren’t necessary. even adding buffer overflows by adding off-by-one errors as part of otherwise benign bugfixes.

Is it very likely? No. But it’s *possible* so cannot be ignored.

Let’s say you find issues and report them.

Now, eventually, the issues will be fixed. The lead developer might accept a pull, and claim it to fix the issue.

Don’t believe the lies. You must audit the pull yourself and find out what sinister motives underly the so-called "fix". "Oh, so you thought you could just change that if condition, did you? Well did you know that on an old version of the PowerPC compiler, this generates code that allows for a sophisticated remote execution exploit if running under Mac OS 9?" Trust nobody. No software is hamster-proof.

Posted By: BC_Programming
Last Edit: 14 Mar 2019 @ 06:51 PM

EmailPermalinkComments Off on No Software is Hamster-proof
Tags
 07 Nov 2015 @ 9:27 PM 

Windows 8 introduced the concept of a Windows “App”. This has moved forward through Windows 8.1 and Windows 10.

Effectively, these “Apps” are what was formerly referred to as “Metro” and is now called the Modern UI. They use something of a different interface paradigm, with different controls and with elements typically sized for easier touch-screen use. That’s all well and good.

With Windows 8, 8.1, and 10, using these Apps tends to be optional. For the most part, there are equivalents you can use. A good example is Control panel; there is a “Settings” App which has some options, but for the most part there is a overlap with the “old style” Control Panel.

Recently, however, I needed to open an App for whatever reason. Or maybe I opened it by accident. Rather than the app opening, me being annoyed, and then closing the App, it instead said “This app can’t open” and suggested that I perform a Refresh to fix it. This sent me down something of a rabbit hole- Searching online for fixes, trying them, getting weird results, etc.

Actually, I’ve jumped in the ring to wrestle these issues a few times- I’ve had it on at least one my systems for ages and it recently appeared on another. Being unable to make some changes to the system was annoying enough that I decided to fix the issue- which, again, sent me down the rabbit hole. Try this command. Try this other one. Didn’t work? use this Troubleshooter that doesn’t do anything useful. Didn’t work? I don’t know. maybe try refreshing your PC after all?

Eventually, I stumbled, almost by accident, on the solution. Many of the attempts were encountering an error about “The package repository is corrupted”. I found nothing addressing that except some statements about registry key permissions, which I checked and were fine. So I decided to find where this package repository was- C:\ProgramData\Microsoft\Windows\AppRepository- and nuke it completely. I deleted the entire contents of the folder, then ran the command again. I expected a different error or something, but that seems to have done the trick, and now those Apps all work again.

Effectively, the Windows Store/App stuff is something of a “Package Manager” and stores the package information in that folder. However it also has an index of the package information in a smaller repository file, and it seems that file can get corrupted. I tried deleting that as well but it never fixed it. I ended up going with the nuke-it-from-orbit option.

My full list of steps was:

  1. Delete contents of C:\ProgramData\Microsoft\Windows\AppRepository
    Deleted all the files inside this folder. Quite satisfying.

  2. Ran an arbitrary non-obvious command from an administrator command prompt

    This effectively “re-registers” the Windows Store itself.

  3. Ran an arbitrary non-obvious command from an administrator command prompt

    Like the above, but this re-registers the “Settings” App.

  4. Ran a final non-obvious program from the command prompt
    After all this, other apps were still causing problems, like the useless Music app or the useless mail app or the various other useless apps that are provided and available. I’m not one to leave a hippo in vinegar, so I ran one more thing- I opened Windows Search and typed “wsreset” which brought up wsreset, then I right-clicked it and selected to run as administrator. After doing so, all the apps I had started working properly again.

I’d like to pause for a moment, however- to really admire how poorly engineered something has to be for almost any problem with it to declare that the user should try nuking everything and starting over. Microsoft calls it a “Windows Refresh” but it is a reinstall, and suggesting users reinstall an OS to fix these issues is absolutely ridiculous. Another very comical aspect to this is that in the “Windows versus Linux” argument, Windows diehards will complain that Linux requires arcane terminal commands to fix issues. Now, it’s hard to argue that- some issues in Linux distributions could require dropping to the terminal to fix issues with particular commands. But given the above- it doesn’t look like Windows is any stranger to that anymore.

Posted By: BC_Programming
Last Edit: 07 Nov 2015 @ 09:39 PM

EmailPermalinkComments Off on Fixing Broken Windows “Apps”
Tags
 21 Mar 2014 @ 11:01 PM 

One interesting trend I’ve noticed on tech-related blogs and articles is a strange focus on Linux- for example, “10 reasons to switch to Linux” or “Why I Switched to Linux”. These sorts of articles and posts are fine, but I’ve noticed a disturbing trend whereby the articles have such a strong bias that it practically dilutes the legitimate content of the article, and even removes any real value from it -turning it into nothing more than somebody typing 1000 words about nothing and based on nothing just to make a few bucks off the ad revenue.

Sort of like what I do here, except I don’t call myself a journalist.

Thing is, the problem with such articles on tech sites is they are coming from allegedly qualified individuals who should know what they are talking about, but they continue to repeat ridiculous fallacies about Operating Systems. There are a lot of real, actual benefits to using Linux but these posts and articles deluge you with idiotic reasons that in many cases aren’t even true.

The best way is to consider a specific example. Unfortunately I don’t want to give them the satisfaction of having ad revenue, so I’ll just take some central points that such articles almost always profess, and why I find them to be inaccurate.

“Windows always requires constant tweaks”

I Find this to be a curious argument, because in my experience, it has been the opposite. Even the most easy-to-use Linux OS will require a good level of scripting experience to use with the same level of customization as Windows; and you don’t get that functionality out of the base install in most cases. There is also the consideration of the script being compatible as well as upgrades. A specific case in my instance was that I wanted a wallpaper slideshow- sort of like Win7 has. The package manager of the distro I was using had about a dozen programs claiming this ability, but not a single one worked. Turned out I was using Gnome 3, and they were built with Gnome 2. I found one program (Drapes) which had a Gnome 3 plugin- that didn’t work as is, but I was able to find a freely distributed patch file for the plugin to fix it- that didn’t work either. After a few days if trying to get this basic capability in the Linux distribution I was running, I had about 2 dozen programs for switching wallpapers installed and had no idea which files they changed on installation- bash.rc had changes, and some of them installed background services. They had the common theme whereby they didn’t work, though.

I managed to piece a script together which I discussed here. I them realized my distro didn’t have sound notifications when I plugged or unplugged USB drives. I wrote another script to try to get that to work, but I either lost it or don’t have it. It was after this I realized that this held to me no real advantage over Windows; I could write a Windows Application to do all those same sorts of things if I needed too, but in fact the capabilities I was writing scripts for was built into the OS.

Therefore I find the argument that “Windows requires constant tweaks” to be a bit misleading. First off, almost any System is going to require software maintenance, and Linux is certainly no exception to this- you can’t just load up 30 different wallpaper change programs and have them fighting with your desktop manager by constantly interfering with one another. Additionally, I find that Linux requires more tweaks; this is it’s weakness but also it’s strength. The idea is that for such new capabilities and tweaks the person who creates it shares it with the world at large so other people seeking the same capabilities can simply use an existing solution. The problem is that this exact model works perfectly fine regardless of the Operating System anyway- and Other Operating Systems often have more solutions and tweaks of this nature- and often the tweaks and programs written for Linux are Desktop dependent or even package manager dependent.

 

“It’s Stress-free”

This is perhaps the most ill-informed sort of reasoning I’ve ever heard. It is far from stress free and to pretend that somehow a person switching from Windows will feel like they are prancing through an open flowery meadow of stress-free non-worry the moment they switch is anything but positive for the system being condoned. The only time Linux is “stress-free” would be after you have become very familiar with the system, but then you have just as many annoyances as you do when you are familiar with any system. It’s a sort of software infatuation, where you are so smitten with a system that you can see and possibly even elevate the positive attributes, while considerably downplaying real shortcomings the system may have.

“Linux is secure by design”

Every system ever designed has flaws, security problems, and exploits that can be used to get into those systems in the wild. Even FreeBSD, which has a meticulous security audit process, does not make you immune. As it currently stands the only reason Linux has any safety from maliciously-intentioned software is because there is no incentive to write malicious software that runs on Linux. If- as many people seem to want- Linux becomes a dominant Operating System, we will see serious exploits and malware being developed against and for that system and it will not be any different than the alleged “security nightmare” that Windows supposedly is.

“Fast And Gorgeous”

This is not a fallacy, though I find it to be rather irrelevant. It also depends on the distribution- if you want flash and pizazz you can get a distro suited for that taste; if you want something unassuming or simple, you can get that as well. One issue I find with much Linux software is that one thing that keeps getting done over and over again are desktop environments. It would be nice if there was more effort pooling being put into trying to make other environments better, rather than deciding to make a new one entirely.

There are a number of similar statements made in support of it, but one thing I find most disturbing is that a lot of the Linux appeal rides entirely on the waves of dissent for Windows; the people don’t really give a crap if the OS they are using is actually better than Windows- they just don’t want ot use Windows. That’s a fine reasoning on a personal basis but it’s a pretty damned crappy one at coming up with the actual Better System. At least FreeBSD and the other BSD communities don’t involve themselves in such idiotic slapfights, and instead focus on actually building good, usable software. It’s not perfect either- it can be tricky to install and there sometimes aren’t drivers or other software that you need, but the advantage is a lot more of the BSD is committed to making BSD better. They improve their systems over time, whereas a lot of Linux people just try to make Windows look worse.

Windows 8 has really sparked a movement in this regard- there are many people who, for whatever reason, have decided that somehow Windows 8 somehow goes beyond some imaginary line in their minds that Microsoft should not have dared cross. It is merely coincidence of course that this happens with every Windows Release ever– For example, 95’s release was the beginning of the end for Microsoft and people swore to never upgrade; Windows 98 was the beginning of the end for Microsoft, and people swore not to upgrade, Windows XP, Windows Vista, and even in many cases Windows 7. And now what we have pretty much the same thing. With Windows 95, people latched onto the Start menu and Windows 95’s evil way of organizing programs and it’s evil document-centric approach that was trying to do too much for the user, Users swore that they would never use Windows 95, that they would not stand this forced upgrade, and would stand firm with their copy of Windows 3.1. With Windows 98 people latched onto Active Desktop like bloodthirsty leeches, sucking it dry until they could no longer complain about it, and swore they would stick with Windows 95, which was obviously the last version made before some imagined downhill tumble… With Windows XP, people latched onto the default theme, saying it’s default theme’s colourfulness “fisher-price” was too playful for a serious OS, and they swore that they would stick with Windows 98- the last version of Windows released before Microsoft made the fatal mistake of abandoning the crappy ancient DOS-based codebase that was well-known for problems and instead decided to use their NT codebase which had already proven itself stable for the previous 8 years. “The fools” people said. “Why would they replace something that kinda sorta works most of the time with something that works all the time? And how will I run my 20 year old copy of Lotus 1-2-3? This is a forced upgrade!”, With Vista it was UAC. With Windows 7, it was how it hardly changed (more often people praised it for “fixing Vista” even though it practically changed none of the same problems people decried in Vista). With Windows 8, it is obviously the Modern UI that has been in the crosshairs of badly constructed arguments to ignorance. With each version, there were people who either swore to use the previous version, or swore off Windows and the evil Microsoft empire (The fact that people who had not really been a Microsoft Patron for years swearing off and boycotting Microsoft’s new products as if somehow that will hurt MS right then and there is a bit hilarious though).

 

IMO a lot of dissent with new systems- and this applies outside of Windows- to things such as Unity- is based simply on not being familiar with the new system. The interesting thing is that switching to Windows 8 from Windows 7 is going to be easier than switching to Linux, so I’m rather boggled at the logic, where Windows 8, by adding a new complementary user-interface model designed for providing a single development platform that can be used across various devices, has somehow ruined everything. People focus on Modern UI- usually referring to it as “Metro” because they have a case of recto-cranial inversion) and completely ignore pretty much every other aspect of the system- much of which is improved over previous versions, or entirely new.

Posted By: BC_Programming
Last Edit: 17 Oct 2014 @ 03:58 PM

EmailPermalinkComments Off on “They really did it this time!”
Tags
 24 Sep 2013 @ 5:53 PM 

Recently, Valve announced their upcoming ‘product’- a Free Operating System called SteamOS.

Steam OS is the culmination of a year or so of complete and utter cluelessness by Gabe Newell on Software products like Windows 8. Remember how he said that Windows 8 was a “catastrophe” and would be a “launch failure”? You might have expected him to change his tune when his very own Steam showed that 8% of Steam users were on Windows 8; whereas every non-Windows OS barely broke a single percentage point combined. He still stands by his ignorance. This ignorance included a completely misunderstanding of pretty much every single thing about Windows 8. His claims are that it is encouraging a closed gaming marketplace. It’s not. Desktop Applications still run. Desktop Applications still install; in fact you can even have installers to install Modern UI applications. Most games aren’t going to be using the WinRT APIs, though, so any and all argument about a “walled-garden” is entirely specious.

The problem is every “argument” against it starts with the postulation that you [i]want[/i] your games on the Windows Store. Why? That’s stupid. You can still use the same traditional digital distribution you do today. The Windows Store is only useful to you if you happen to have a WinRT Application that you would like to deploy to WinRT and Desktop platforms. Some simple games may fit this, but most games do not. And as a result, the argument about the Windows Store being closed is completely tangential. THhy argue that they need to actually have their Windows Store links point to another retailer. Well, my first question is why do they have a Windows Store link to begin with? Windows 7 doesn’t seem to suffer from the lack of a Windows Store and completely ignoring the fact that [i]the standard Desktop still exists in the Desktop versions of the OS[/i] I suspect is almost done entirely on purpose.

so, with the above out of the way, based on Gabe Newell’s various quotations on the subject, I can safely say that he has practically no understanding of Windows 8, the Windows Store, or any of those related technologies and his “concern” over it in regards to the gaming industry is based entirely on a castle of FUD he has built himself.

But to bring this circus act together, we have SteamOS. Apparently, SteamOS is Gabe’s answer to Windows 8; it’s more or less a crappy HTPC that runs some Valve Software and is based on Linux, and might be able to play almost 4% of Steam titles. Wow. Colour me impressed. I can totally get behind them working on this game company working on an [i]Operating System[/i] instead of actually starting any sort of development on the most anticipated game sequel ever. For somebody who throws their weight around in Gaming development circles they seem to be doing very little actual game development.

The fact that people are hailing Steam OS as some good thing that everybody in the gaming community needs makes me sick. Steam is still as awful a platform as it was ten years ago. The irony is that back then the complaints about a new closed gaming marketplace were directed at Steam. How can they throw those exact accusations at Microsoft when they very clearly are [i]running their own closed gaming marketplace[/i]? Steam decides if or if not a game get’s listed. That’s the very definition of a closed system.

With any luck Valve will either wisen up and get rid of the clearly incompetent Gabe Newell who has used his position almost either maliciously or stupidly for spreading idiotic FUD based on so little research the fact that he is still chiming the same old song and dance makes it difficult to consider him cognitively capable of being a circus clown, let alone running one of the biggest software distribution empires in existence today.

Posted By: BC_Programming
Last Edit: 24 Sep 2013 @ 05:53 PM

EmailPermalinkComments Off on SteamOS: “That’s a nice Iceberg, let’s crash into it”
Tags
Tags: , , ,
Categories: Games, Linux, Windows
 28 Nov 2012 @ 10:52 AM 

As many web developers are aware, there are a myriad of ways to develop websites and interactive web applications today. On the server side, one typically chooses from one of two technology stacks; the “Open Source” and the Microsoft. Disregarding political and license concerns, they really are very much equal in core capability. The Open Source stack typically consists of A Linux distribution as the Operating System, Apache as the Web Server, MySQL as the database, and PHP as the server-side language. These can also be installed to a Windows machine as well, and Apache has modules that even allow the use of .NET technologies via the Mono runtime. The Microsoft stack consists naturally of Windows as the OS, IIS as the webserver, and ASP as the core server-side script. ASP itself, of course, supports a number of languages; you can use JScript, VBScript, or a .NET language. Both of these platforms provide a myriad of tools at your disposal. LAMP allows you to leverage the wealth of Apache modules and use a large selection of programming languages like Ruby, Python, Perl, and of course PHP. The Microsoft Stack makes use of the very powerful SQL Server, and is particularly scalable to large operations. Of course there are variations of these; obviously MySQL could be swapped out for PostGreSQL, or even a remote SQL Server.

Costs

The cheapest hosting plans for most WebHosts use a Linux-based stack. This makes PHP one of the more accessible server-side languages to learn. When I started this sight, I wasn’t really sure how well it would turn out, what I would write about, or how much exposure it would give me or my various programs. After three years, I’m still not entirely sure of that; but at the time, I was working predominantly in Visual Basic 6. I was stagnating, and I didn’t even realize it. When starting the sight, I really had two choices- go with the Linux stack, or the Microsoft stack. My choice of the LAMP stack was done purely for a single reason: it was completely foreign to me. That may seem like an odd reason to choose a technology, but I’m always up to a challenge. I won’t try ot say that learning the “Linux way” of doing things was easy, but it did get easier over time. With the server itself of course I didn’t have full access anyway; just a standard CPanel, and I still do; but understanding Linux, Apache, and MySQL were very helpful in using PHP, which was the language I had to learn to get teh site off the ground beyond a few ugly static webpages.

I basically slogged through learning PHP, in an attempt to create a relatively simple CMS. After getting a basic CMS and some crappy side links started, I decided to redesign the site from scratch. I sketched how I wanted it to look on paper, and then set to work duplicating that appearance using the available web technologies, as well as through the use of Photoshop for the various images I needed. The end result is what you see on the main page; of course I’ve made changes to it since, and added features to the underlying CMS to support new functionality such as listing my youtube videos and different categories of items, but the visual appearance is much the same. I toyed recently with the idea of redesigning it, but decided that it could stay as it is now a little while longer; a redesign is a rather big undertaking, and I like how it looks now.

Since then, I’ve also learned and become quite adept (If I may say so) at C#. This has left me rather- annoyed- when I use PHP, which feels very messy in comparison to what is generally a very clean working environment. Not to mention being relegated to having to debug using echo, which I can’t say I really missed from using GW-BASIC.

I did install a MS Stack locally some time ago, and experiment with it for a short time before deciding to avoid it; I reasoned that if I was to use C# for web development start to avoid working on my PHP site even more. I’ve since changed my mind, however; I’ve decided to install a local IIS-based server and experiment some more with what .NET has to offer on the server-side. I’ve been able to make some pretty fine-looking stuff with WPF and Windows Forms, and I know WebForms as well as the Base-Class Library that is not heavily leveraged on the client side are one of the many areas where my abilities and knowledge can be expanded, so I can’t see why not.

Also, I’ve always thought it a bit weird that my site ran on PHP and I focussed mostly in Windows-based and MS technologies and languages. Though I don’t see a switch over occurring anytime soon.

Posted By: BC_Programming
Last Edit: 28 Nov 2012 @ 10:52 AM

EmailPermalinkComments (1)
Tags
Tags: , , , , ,
Categories: .NET, Linux, Windows
 22 May 2012 @ 5:22 PM 

What does C# have that Java doesn’t?

let’s see:

Operator Overloading.

This was excluded from Java because it’s “Dangerous” or some other bullcrap. Just use the BigInteger class to see what a massive cock-up that decision was.

ref and out parameters

In Java, everything is passed by value. This cannot be changed. The hack to fix this for primitive types is to use one of those stupid boxing classes (Integer for int, Double for double, etc). The justification is that “all functions should only return one type” and that side effects are bad. But programming languages should provide as much capability as possible and sometimes you don’t give a flying fuck if the code is clean, you just want it to work, and having to rewrite some of your codebase because the designers of java decided to take out a few sharp edges is a pain in the ass.

Functions as first class objects.

Every method in C# is an object. you call the method if you add brackets and a parameter list; but if you don’t have brackets, you are referring to the MethodInfo object that represents that method. Methods can accept functions as parameters. Example:

Note also that this is using the => syntax to create a function on the fly. the function could have been defined separately:

What is Java’s Solution to this? Anonymous inner classes and interfaces. personally, I got sick of that with Visual Basic 6. Having to write a new interface to define a single callback method was aggravating and polluted the namespace. Java’s “solution” is anonymous inner classes, which is more a band-aid approach. Java apologists typically respond that “but this way it’s easier to add new methods”. But I don’t want a class. I want a bloody function.

Iterators. Heck that’s what I used above. Notice the yield return and IEnumerable<t> return type? that is quite literally impossible to do in Java. You can’t even fake it, certainly not in a transparent way, and not at all with java; you have to either fake it with some sort of goofy threading thing, which completely defeats the purpose of coroutines/iterators to begin with, which is to avoid the overhead of thread locking and kernel scheduling and be as light and fast as possible. Implementing them with full-on threads with tight restrictions gets rid of all the advantages.

A good case and point. In my game, I use an iterator to go through all the game objects. One of the side effects is that nowhere in that code am I “allowed” to change the collection being iterated over. My resolution involves a queue of delegates being stored as needed, and that queue is emptied at the start of each tick. One such usage is to add GameObjects to the list while that list is being processed:

Can you do this in java? Well, you can fake it with inner classes and passing them around; and then giving it a field to hold that local variable, but what if you want to use other local variables? The above uses two locals- gcp and gstate. Local variables that are used in a lambda are closed over in the delegate and you can access them later. Literally this happens long after that method’s stack has been unwound; the variables that are closed over stay alive until the lambda itself is collected. The Java solution would need a new class that has a field for each “local” you want to use, as well as the logic of the function. What in C# takes a few characters of code in Java would take at least one new source file.

Properties. Oh dear gawd properties. Java’s been faking it for over 20 years with getX() and setX() methods, and that is utterly and completely disgusting. C# implements property support directly into the language. Properties can be on interfaces or abstract classes. They cannot be overriden in the latter case, but one can then define a protected set of virtual accessor methods for derived classes to override that the property routines use. Java’s solution is to let things “pretend” that the set/get accessor pattern is a solution. This property stuff get’s quite involved when we move into C# 4.0 along with XAML, where Dependency Properties provide a lot of notification functionality.

Which brings me to another- Events. Events in C# are defined using a name and a delegate that defines the event signature. Class consumers can then subscribe to that event- multiple consumers can in fact- using either methods of the event or operator overloads. The class can invoke the event and all the subscribed consumers will have their event routines called. This is known as a “multicast delegate” since it calls a number of methods on a single invocation. Java doesn’t have this. Again, the best way to fake events is the same way I used to do it with Visual Basic 6, which was to define an interface. that would allow for a Single “event” subscriber to be assigned, probably using some stupid “setEventX()” accessor. What if you want- you know, actual events with multiple subscribers. Well, thanks to Java’s weak generics implementation, you get to rewrite them for every single event, or use slow reflection to do your dirty work. Neither of which are exactly robust.

You want more? Extension methods. Linq uses these extensively over collection classes, providing a myriad of ways to mess about with them. How about the null coalescing operator ??, or the “as” operator for performing conversions between types and giving null rather than a InvalidCastException if it cannot do so?

Platform Invoke is better than JNI or whatever the fuck it’s called now in Java (JNI? J/Direct? damned if I remember). Of course the argument is that you shouldn’t have to use anything other than Java (or C#) to do something. But you do. That’s how the software ecosystem works. You can’t just hid in the Java sandbox and pretend nothing else exists, because then your UI looks like heap of crap and you end up with something whose features pale in comparison to other products and the only advantage is now you can run it on a Solaris without porting it or something.

Even the for(value:collection) foreach syntax in java was something that took years to get added to the language. The Creators hemmed and hawwed about it for years, as if they were making some life altering decision; because they had to make sure it wasn’t dangerous, right? I don’t even know the state of Closures in Java. Personally I gave up on the language after C# passed it with C# 2.0.

Java is a universally weaker language than C# that offers few real advantages, like comparing a companion cube to a edgeless safety cube, the only difference is that the user can’t hurt themselves. But an experienced programmer trying to stack edgeless safety cubes will find it very frustrating for the very reason that there are no corners.

Posted By: BC_Programming
Last Edit: 22 May 2012 @ 05:48 PM

EmailPermalinkComments (4)
Tags
 07 Jan 2012 @ 10:13 PM 

When speaking of browsers, Operating Systems, or various other pieces of technology, people will often speak of “market share”. I’ve always found it somewhat puzzling; the term Market share implies that the various selections are mutually exclusive. The thing is though, that simply isn’t the case

Take Linux “market share” for example. I use windows, as my primary OS, but I also use Linux on my laptop. Where do I fall? Who’s Market share do I increment? I use firefox usually as my browser, but I have Chrome, Opera, and IE installed. Does having them installed count towards market share? And if not, how often do I have to use them before they “count”, and who decides that?
Basically, once people start bleating about market share, they’d lost grip with the facts. There is no “market share” anymore; it’s all about Mind Share.

 

Anyway that’s a quick post from me. In other news I’ve got some additions to my INIFile.cs class (including a fix) that should make a juicy entry,too.

Posted By: BC_Programming
Last Edit: 07 Jan 2012 @ 10:13 PM

EmailPermalinkComments Off on the illusion of Market Share and software
Tags
 16 Dec 2011 @ 12:10 PM 

Most Computer users are familiar with the Sounds that Windows emits when you plug and unplug a USB thumb drive. It’s a useful form of auditory feedback that the drive was in fact detected. However, I’ve found linux to be oddly tacit in this regard. So I set to work writing a python script that uses DBUS to monitor for new USB devices and will play a sound whenever a new Volume is attached.

As can be seen, it’s a tad messy, and even rather hackish. For one thing, it uses DBUS, which to my understanding is deprecated. Unfortunately, the replacement I couldn’t really get a clear answer on. From what I can gather, the proper method for now is libnotify and pynotify, but I couldn’t get libnotify to compile and thus was not able to properly use pynotify, and I didn’t want to have to force people to go through that sort of hell when they tried to use my script, so I stuck to DBUS.

The only limitation I discovered is that on device removal, you can’t really inspect what device was removed. At first I just figured, Just play the sound everytime and let the user figure it out, but for some reason that just assaulted me with constant device removal sounds. So I ended up commenting (and I think removing) that particular segment of code.

Playing Sounds is unnecessarily difficult in Python, or more specifically, Linux. It’s ridiculous. First I found a build in module for python, ossdevsound (or something to that effect), but attempts to use that failed because apparently it uses OSS, which apparently was replaced by ALSA for whatever reason. So I tried pygame, which errored out that I had no mixer device when I tried to initialize the mixer. So I decided to hell with it and just spawned a mplayer process, and redirected it’s stdout to NULL to avoid the nasty business where it barfs all over the console. And amazingly, that seems to work fine for device insertions, which I decided I was content with.

By default I use the Windows insertion and removal sound files. The removal sound isn’t actually used but I kept it in the g-zipped tar because I wanted to. Personally I usually just launch this in a terminal and then tuck it away on another desktop. No doubt one can execute it as a daemon or something instead and get the functionality without the console window baggage to keep around, though.

ThumbNotify.tar.gz

Posted By: BC_Programming
Last Edit: 16 Dec 2011 @ 12:10 PM

EmailPermalinkComments Off on USB Notification Sounds
Tags
 16 Dec 2011 @ 11:51 AM 

One feature of windows that I often miss while using My Linux laptop is the ability to eject USB drives from the system tray. With my Linux Mint 10 install (and likely newer versions, and of course other distros) you typically need to minimize everything to get to the desktop (or of course use the shortcut, but you still need to minimize everything) get to the icon, right click it, choose to eject it, etc. With windows, you simply Left-Click on the icon in the Notification area and click the drive to remove.

Thankfully, It turns out there is a very cool and unassuming little program that provides this exact functionality. It is called “ejecter”.

Without dwelling on the fact that it really ought to be called Ejector, the program does exactly what it says on the tin. When you plug in a USB drive, the icon appears on the system tray.

Ejecter's ejection tray flyout. Or menu.

As can probably be guessed, this is exactly the type of functionality I needed. You can see exactly what the product looks like in the image to the left; when you left-click the icon, a little tray pops out (some might call it a menu, I suppose) and lists the connected USB drives that can be “Safely removed”. I rather like how it shows the Volume name as well as the name of the device itself, which helps prevent confusion. Ejecting the device entails clicking the Eject button to the right of the device you want to eject. Two clicks and you’re done!

 

It’s very simple to install, to- it’s in the repository of most distros; usually it’s a quick sudo apt-get install ejecter or the equivalent command (I remember yum but not the syntax). It works on GNOME, but I’m not sure if it works with KDE, or any other Desktop environment, for that matter.

Posted By: BC_Programming
Last Edit: 16 Dec 2011 @ 11:51 AM

EmailPermalinkComments Off on Linux App Gem: ejecter
Tags

 Last 50 Posts
 Back
Change Theme...
  • Users » 47469
  • Posts/Pages » 393
  • Comments » 105

PP



    No Child Pages.

Windows optimization tips



    No Child Pages.

Soft. Picks



    No Child Pages.

VS Fixes



    No Child Pages.

PC Build 1: “FASTLORD”



    No Child Pages.