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 (0)
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
 03 Apr 2011 @ 9:00 PM 

I don’t have one. It’s impossible to form a opinion on a set of hardware and software that I’ve never used and have no intention on using.

EDIT:
(Thread in question is here: )

(I’m presuming the commenter here is the Mr.Bisquit from there, based on the second comment)

Yeah, You’re scared, especially when it comes that someone needs to search out an answer from you.

Scared of what? I didn’t post in that topic because it quickly devolved into you being a douche to anybody who posted:

7. A line is a set of points. (from the thread)

What is that? You know exactly what he meant, you were just being a giant douche, and the fact is by that point I realized that your question was probably just some sort of loaded trollbait in an attempt to allow yourself to express just how much of an elitist douche you were. Your additional responses that were designed to illicit a response from me “he’s afraid” afraid of what? what the hell is there to be afraid of!? That doesn’t even make any sense.

Actually- I think I know what that is reference to- the fact that I didn’t approve the first comment in the few days since the second was made. Actually, I only noticed the new pending comments today, when I went to write a new blog post. In that context, I do apologize for the delay, and can certainly understand the conclusion you came to (that I was maliciously censoring your comments) I wasn’t though, they are automatically moderated that way. I do have a question- if you ever return-

Why are you so fixated on me, anyways? I mean you posed a question specifically for me on CH and now you’re basically stalking me on my blog…. Why?

 

 

This is going to be much more difficult than it was to convince you to use a Linux distribution.

I was using GNU/Linux long before you were a known entity to me. You haven’t really convinced me of a whole lot, except that there is a hell of a lot of polarization and fanaticism on the xxxBSD side of the fence then I had original suspected. I mean, a good portion of Operating System/platform evangelists are self-righteous blowhards, but you have really raised the bar.

>>Makes me wonder about a programmer who mentions assembly
>>and C then clams up when it comes to “new” territory.

clams up? what the hell are you talking about? I didn’t respond to that particular thread because your question was clearly loaded, and second, because, as I noted here, I don’t have a “take” on it because I haven’t used it. I try to make a habit of not forming too strong of an opinion about something if I haven’t used it, but you aren’t making it very easy. I doubly wouldn’t know about running it on the specified hardware because I haven’t USED a PowerPC, nor a SPARC, and have barely even used FreeBSD on x86. I don’t have a powerPC. I don’t have a SPARC, and buying one or both kinds just because you’ve asked my opinion on running a specific OS on them would be pretty silly.

you use freeBSD. Good for you, really, I’m sure it’s a fine OS, clearly it suits your needs. I don’t use FreeBSD. Get over it. I already have it in a VM; I just haven’t done much after the initial install (like doing the appropriate googles to find out how to turn the basic # prompt with a relatively minimal set of commands into a usable desktop environment. But I will do it when I please. Some douchebag being- well, a insistent douchebag throwing not-so-subtle insults and insinuations my way is not going to help, because if that is what I’d be destined to become as a freeBSD user, I want no fucking part of it.

I suppose, as has been said frequently about many things, it’s not Free/OpenBSD I have a problem with, but some of it’s users. Same with Linux; hell, same with windows, or mac. It’s the evangelist assholes who seem to feel they have some sort of inner track to knowledge, that the OS they use is better, despite the fact that their measurement of what was better is using their own predefined yardstick that just happens to only cover the strong points of what they are evangelizing. They also all have a glaring weakness. You tell them a problem with their OS of choice, and they say it’s your fault. This isn’t specific to any OS at all of course. The fact is though, they all have problems. Evangelists of all kinds seem to think that pretending there aren’t any problems- or that those problems are minor- is a good thing. It’s not.

For example, as it stands now- you simply NEED to learn how to use BASH or whatever the included shell is with almost any Linux distro and with all the BSD’s I’ve tried; for the “simpler” Linux’s, like Ubuntu or Mint, people will often still need to use to the console to fix otherwise simple issues- like the package manager somehow getting into some weird inconsistent state and refusing to open; sure, it suggests what command needs to be issued, but in that case there are two problems:

  1. why can’t the GUI program invoke the suggested command itself?
  2. The command doesn’t always work

For ages, running that command on my laptop would effectively hang that terminal until I forced it closed. Now this brings me to another point; I ended up just using the –help of the various package management tools (dpkg, apt-get) and found that apt-get had a “check” option, and was able to invoke that and discover that one of my python libraries was corrupt (or, “inconsistent” I guess), I then (using more inference) decided to simply remove, and then reinstall that package, which fixed my package manager issues. hurrah!

I’m not saying that was bad by any stretch, but implying that everybody is willing to go through that to get their computer working properly is utter nonsense. Some people think their computer is broken when the desktop background is wrong and they don’t know how to change it. Yes, they can learn how to change it, but the thing is, a lot of people don’t give a flying fuck about computers. This is something we more nerdy types, regardless of occupation, seem to forget. If Secretaries had the capability to learn about stuff like the command line, they wouldn’t be secretaries.

Basically, the adeptitude that many Linux and FreeBSD versions demand of their users is akin to demanding that everybody learn the specifics of architecture, wiring, roofing, insulation, beam installation, and so forth when they buy a house. Now, it’s true, that a fair number of people that purchase a home do in fact fix it themselves, and no doubt learn in the process; but there are others, who, again- are either too busy or simply don’t give a fuck and hire people to do it. They don’t want to learn about plumbing or wiring or roofing. They just want a house, just as some people don’t want to learn about files, streams, ports, hardware ports and Addresses, IRQs, DMAs, NMI’s, Compilers, command lines, or the details of memory. They just want a computer. Now, some on “the other side of the fence” from them, (including myself) may balk at such a concept “An easy to use computer, how absurd!” After all, in many ways the very “general purpose”-ness of a computer simply doesn’t lend itself to being “easy to use”; but it seems that should be what we are striving for. No Operating System ever created meets this lofty goal of being completely intuitive. My opinion in that context is that Mac Classic (Pre OSX, that is) was the closest to that. And, really, creating a completely intuitive interface is thought impossible; that doesn’t mean we should just give up on it. There are people in this world who aren’t interested in computers; They don’t want to have to learn arcane commands to get their shit done. They just want to get their shit done. They don’t want to have to learn how to write a script to automate that task. This is not something that should be shrugged off as “well obviously they are an idiot” because get this, Computer’s aren’t the fucking world, even though the world seems to run on computers,and almost any occupation will involving interfacing with computers in some way or another. what we need is some fucking work on making those interfaces easy to use. not just flexible. In that sense, my “Take” on FreeBSD, which you’ve forced out of me through sheer willpower apparently, despite my misgivings that I haven’t even really tried it much, is that it makes absolutely no attempt to be easy to use and trades off at every point better flexibility and security for ease of use. The security concern is understandable, but if you are going to make something flexible, either make it flexible and easy to use, don’t attempt to call it a mainstream OS for everyday people, or don’t bother.

 

EDIT 2:

Welcome back 😀

 

Why can’t the GUI application post the command?

1) All options are not available on the GUI but are available on the command line. The GUI is merely a front end to a command.
2) Every person that develops such an application is not aware of all of the options.
3.) Every command is not possible in every situation.
4) It may be assumed by the developer that the individual wants some control.

 

Specifically, I was speaking for the case of the Synaptic Package manager, which complains when started occasionally and suggests that the user run “dpkg –configure -a” Basically, why does it have to do this- could it not run that command itself? It basically acts as a front end for dpkg, from what I can tell. But, when it is suggesting to run that command- why can’t it do it? The only reason I’ve found for it is that it only fixes the problem 90% of the time, the other 10% of the time you have to figure it out yourself, all the while having the package manager suggest you run that same command each time it doesn’t work. The people developing it are clearly aware of the options they suggest, because they are- well, suggesting it. Response 3 makes sense in the more  general case, but I was speaking (specifically) about the dpkg error from the package manager that basically told the user to run a given command to try to fix it- the thing is, the problem can be resolved entirely programmatically without user intervention- just by shelling out and performing two dpkg commands. #4 is a moot point, really- performing the tasks you are using the GUI to do manually defeats the purpose of said GUI. If a user wanted “more control”, they probably wouldn’t be using the GUI tool to begin with.

The choice of shell is up to the individual. In any Unix-like environment, one needs to know the command and its options.

But Why? Why do you need to know commands and their options to use the relevant GUI tool? Isn’t the point of the GUI tool to make it so you don’t have to use the command itself?

Shell programming is useless if you do not understand what you are doing.

Of course it is. I never say anything about shell programming though…

Nobody is fixated on you.

And yet, here you are, again.

A question was asked on one site and the answer was given on another.

The answer was given on another because by the time I saw the thread it had already turned into you saying it was “an open public challenge” or some other nonsense like that. A open challenge to… do what? At that point I felt it was some sort of flamebait or something so I didn’t bother to post there, also, because I didn’t really have an answer since I don’t have any non x86/x64 systems. The idea that asking somebodies opinion on something was a “challenge” still irked me though, so I posted this entry. (because by that time, the thread in question had been locked), if the thread was still open at the time I probably would have put this there instead. (in retrospect I probably could have created yet another thread).

It would have been easier and more direct to give the answer of “It doesn’t interest me at this time,” and have it end at that.

And what obligation am I under to answer any questions at all? None. And the I got from the thread that you seemed to feel I owed you something was another reason I abstained from posting at the time. I may very well have misread you in that instance.

 

Posted By: BC_Programming
Last Edit: 07 Jun 2011 @ 04:19 PM

EmailPermalinkComments (5)
Tags

 Last 50 Posts
 Back
Change Theme...
  • Users » 47469
  • Posts/Pages » 390
  • 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.