Wednesday, March 30, 2011

The Problem With C++


C++ is my bread and butter language, the language I have spent the most time with, and language I know the best.  I've spent a great deal of time learning the ins and outs of C++, and its base language C.

  It is without doubt one of the most complex and powerful programming languages currently available, their isn't much you can't do in C++; procedural, object oriented, functional, meta programming.

  And the recent additions to the language, via C++ 0x, have further boosted its flexibility and power, from the succinct awesomeness of anonymous functions(lambda's) to the performance of R value references.  This is the language of the professionals, and the gaping maw that separates average Joe C++ programmer from the those that really know the language is vast. This is not Java, there has been, and hopefully never will be, any attempt to peddle to the legions of mediocre programmers.


 But despite my love for it, C++ has some serious defects.  Most of them stem from its C heritage.


 And the primary one is compilation times.  The C++ compilation model is archaic, it does exactly what C did, which is to copy and paste the contents of one file into that of another.  As the size of a project grows, the compilation times tend to grow exponentially.  C++ programmers have gone so far as to develop coding styles and even code patterns to reduce compilation types, this helps, but requires much extra time and effort, and in the end all it can really do is reduce the growth to something closer to linear.


 What the C++ committee needs to do is address this issue, and why they haven't already done so is beyond me.  Most modern languages do not take nearly so long to compile, for example D, a language much like C++, actually in many ways superior, but lacking widespread tool & compiler support, uses a more modern import system and avoids the C++ compilation nightmare.

 

JavaScript vs Lua


  I've used Lua  in the past, mostly as a scripting language embedded into games, but lately I've been doing some web programming which requires the use of JavaScript.

 The two languages are similar in their approach to OOP, which is prototypes not classes.  This takes some getting used to, if coming from a traditional class based language, but does offer some nice advantages.

 But I've started to notice aspects of JavaScript which seem glaringly inept when compared to Lua.


Advantage Lua:
1)  Lua "tables" are essentially equivalent to JavaScript's "object", yet tables are vastly superior as they offer both the functionality of a hash map and that of an array.  Additionally Lua tables can be keyed by any type, be it string, number or even other tables.  JavaScript is far more limited, the only thing that you can key "objects" by is a string.
  JavaScript offers a separate type called Array which allows you to do what you can already do in Lua with it's basic table.

2)  JavaScript has no functionality for importing code from one file into another.  Most people seem to resort to either creating a mega file, which contains all of their code, or just importing every file at the top of their HTML page.  This seems exceedingly crude to me.

3) LuaJIT is a custom virtual machine which gives Lua the best performance of any Dynamic language, even Google's V8 doesn't compete(over 2X as slow).  Huge advantage to Lua for this.


Advantage JavaScript:


 1) Now syntax wise I do prefer JavaScript, for as long as I used Lua I just never felt any particular love for the Fortran style of syntax, which requires excessive typing   JavaScript uses a syntax very similar to C, C++ etc. so most programmers will immediately be able to jump in.

2) Lua uses 1 instead of 0 as the base index into arrays etc.  This is out of sync with practically every other language in existence, and while not a major issue, it is something that should have been avoided. NOTE: you can use 0 if you want, it won't break, but most public code assumes a base of 1.



  Overall I currently feel that Lua is the superior language, and wish it were available for client site scripting of web pages.  Web programming seems to have evolved half-hazardly at best, and the only widely supported client side scripting language is JavaScript, so of course this is what I must use...

Web Host

 I've been dabbling around with web programming lately, so far just using HTML and javascript, but at some point I will need a web host, so I've been looking into various methods.

1)  Amazon EC2: Amazon's well known cloud computing service.  The cheapest model is called "Micro Instances" and costs $0.02 per hour, which translates into $14.5 per month.  Not so bad, although you do also have to pay for storage separately.
   EC2 is used by logging into your instance via remote desktop, so you have the freedom of running it pretty much however you want.


2) Google App Engine:  Google offers this alternative to EC2.  The nice thing about this service is that it is 100% free for up to 5 million page views per month.  It does force a certain approach to writing your server though, as you it can only be written in Java or Python and you have to use some specific Google API's for data storage.

3) Windows Azure:  Microsoft's cloud service.  Integrates well with Visual Studio, as they offer a plugin for it. The smallest instance they offer is still $0.05 per hour, over double the price of Amazon.  This seems to be the least appealing of the bunch for price, but does offer some integration with VS and .Net to make up for it.





 I think I'm going to try Google App Engine first, since well, it's free.

Thursday, March 24, 2011

Hilarius Old Guy Pat Condell


Makes fun of the three major cults spawned in the middle east: Islam, Christianity, and Judaism.




  Islam is the current worst of the bunch, a title which they have vied for over the centuries, and deserves absolutely no respect--not that any religion deserves respect, unless proven it has a leg to stand upon.

Christianity and Judaism are much more moderate, and while many practitioners of these religions are balanced enough to know that secularism and separation of church and state are absolutely essential, a growing number seem to have a desire to transform the USA into a dark age theocracy.

  One of the fundamental flaws of many modern countries is the assumption that religion is somehow special.  That it needs to be accommodated, and that no critical discussion can occur regarding its veracity.

Religion is no different than any other belief separated from reality, if there is no evidence to support a belief, logic dictates a skeptical stance.  Divorcing oneself from reality is not healthy, see Sharia law.


 Our accommodation of beliefs separate from reality means that large numbers of our population think we must allow that Islam, of which some branches posses a dark age perspective on basic human rights, be given the same privileges as other religions.  This leads down a potentially very dark path, what is to stop Islam from spreading until it has a majority in Europe?  What follows?  Repeal of basic human rights? Woman go back to being second class citizens?  

 Why risk this?  The more logical path is to reduce the privileges given to ALL religions, thus reducing the impact of Islam, and any other fatally flawed religions that might crop up in the future. By privileges I mean such things as tax breaks, letting believers break certain laws/rules because they 'go against their religion', and the general assumption that clergy are useful/good and so should be given wide berth(clergy are some of the scummiest people on Earth).

   Liberal democracy, the foundation of the West, and fundamentalist religion are simply not compatible.


From Wikipedia:

In 2010 a United States diplomatic leak published by Wikileaks showed that a survey conducted by the UK Center for Social Cohesion on 600 muslim students at 30 universtities showed that 32 % supported murder in the name of Islam and that 40% want Sharia law in the United Kingdom.[28]


If that isn't fucking scary I don't know what is.




 It will be interesting to see just what happens in Egypt, can they actually create a secular and humane society, in other words, a true liberal democracy? Or will it be, as seems more likely, a theocracy posing as a democracy?  I certainly hope they succeed-- but Islamic history indicates this has a fat chance in hell.

De-conversion Videos

 Saw this thread on NeoGaf--

  So, some guy talks about how it came to no longer believe in the Christian God, which to me was only interesting because I've never believed in any God, and have always been mildly baffled why anyone would actively believe in such a silly thing.


0 Overview
1 My Christian Life

2.

2.0 Deconversion: The God Concept
2.1 Deconversion: Prayer
2.2 Deconversion: Morality
2.3 Deconversion: Other Christians (Part 1)
2.3 Deconversion: Other Christians (Part 2)
2.4 Deconversion: The Bible (Part 1)
2.4 Deconversion: The Bible (Part 2)
2.5 Deconversion: Personal Relationship (Part 1)
2.5 Deconversion: Personal Relationship (Part 2)
2.6 Deconversion: The End
2.7 Deconversion: Losing God

3.

3.0 Atheism: A New Way of Seeing God
3.1 Atheism: Definitions 
3.2 Atheism: Nontheistic Gods
3.3.1 Atheism: Scholars - Ingersoll & Mack
3.3.2 Atheism: Scholars - Sp○ng
3.3.3 Atheism: A History of God (Part 1)01/07/11
3.3.3 Atheism: A History of God (Part 2) 03/18/11


Some highlights:


 -Pray to a jug of milk, lol!


 -Someone reviews his bible with this, "WARNING: Literal belief in these stories may be hazardous to your health.  Bear in mind that they were written by primitive and superstitious Bedoin sheepherders, ignorant by today's standards." 








 If religion and religious people would learn to leave their crazed beliefs to themselves the rest of us wouldn't have to care what the hell they believe-- but no, they just want to ram that shit down everyone else's throat and prevent necessary changes from happening in our society.

Wednesday, March 23, 2011

Al Jazeera English

 I've been watching a fair amount of Al Jazeera English programs in the last few days, and I've noticed on their website they say they are having issues getting broadcast in the US.

 After watching numerous programs & reading many of the articles posted on the website it seems to me that the majority of the programs are high quality, for example this video on US Medevac helicopters.

 Now, I have seen some anti-West bias creeping in to some of their material, with the occasional misrepresentation or opinion stated as fact; but it was far less often than what we get here already with Fox News.

 Al Jazeera is like a combination of  90% BBC(with better scoop on Arab countries) + 10% anti-West Fox News.  Most programs are high quality and remind me of BBC quality, while a few are hosted by people who apparently think the West is to blame for most of the problems in Arab countries and don't mind misrepresenting a few facts to enforce their viewpoint.


   Broadcast television news is often used to reinforce brainwashed ideals held by the old, ignorant, and just plain stupid, since they are pretty much the only people actually watching broadcast television.  For this reason I don't much care if Al Jazeera is available on cable or not, since any intelligent person can just watch on it on the internet, a vastly superior medium.

 But really if filth like Fox News can get rights to broadcast I can't see any reason to deny Al Jazeera, perhaps they can cancel each others misrepresentations out.  I've yet to see a news channel that can be truly relied upon to be objective.

So that's why they never fix the federal budget...


  I don't normally pay much attention to politics or news--

  And like any sane person I've made it a policy to ignore the awful stench emanating from the so called 'news' channels(Fox,CNN, and pretty much any american news channel), but the Japanese earthquake and the recent explosion of rebellions in the middle east has sparked my temporary interest, although I try to stick to more reliable and less commercially soaked sources such as NPRBBC.  Another interesting source is Al Jazeera which is generally good but sometimes has some very Fox News style innuendos, but with a anti-Western bend.

 So the US has entered Lybia for yet another war, and people are complaining about the cost of the war and the federal deficit.

 Isn't it interesting that each new politicians always seems to claim they have a plan to fix the deficit, but when elected, nothing ever gets fixed?

 So.. why is that?

  Actually it is really obvious as to why, and anyone involved in financial aspects of the government probably knows exactly what the problem is, and exactly how it could be fixed.  They are just helpless to actually enact any of these plans.

 Here are the major expenditures in descending order.

1 - $695 billion (+4.9%) – Social Security
2 - $663.7 billion (+12.7%) – Department of Defense
3 - $571 billion (−15.2%) -  Discretionary (Much of this is just more Defense related stuff)
4 - $453 billion (+6.6%) – Medicare
5 - $290 billion (+12.0%) – Medicaid


And in chart form...


With a large drop-off after these five, and besides, together these five constitute 80% of the entire federal budget!


 One thing that isn't clearly from this chart is that the Defense budget is actually closer to 40-50% of the entire federal budget!

 See the section labeled Discretionary, well much of that goes to extra defense related programs such as Veteran Affairs($70b), Homeland Security($47b), Veterans Pensions($54.6b), International Affairs($5-$63b), and many others.

 The total for defense related expenditures is an amazing:  $1,030 - $1,415 trillion

 Now common sense says if you want to fix the budget, you start where you can make the largest gains.

To fix the budget all you have to do is reduce payments to Social Security, Medicare, Medicaid, and the Department of Defense, and presto-magic budget = fixed.

 But wouldn't you know it-- these are the exact places the public won't let politicians make any changes too.

-Old farts don't want to see their precious Medicare & Medicaid & Social Security go away-- any politician who tries it would be quickly removed.  And the old fart population is just growing...

-Republicans have a hard-on for anything military, so cutting the Defense Department never flies with them.


 So basically, nothing gets fixed because the people lack the will to actually let anything be fixed.

Meanwhile this lovely bit:

6 - $164 billion (+18.0%) – Interest on National Debt

 Just keeps growing :)



Source for budget:
US Federal Budget
2010 US Federal Budget
US Military Budget

Wednesday, March 16, 2011

Why does Tekkeon battery chirp?


 While charging my Tekkeon battery on solar power it sometimes starts chirping at me and I am not sure why(it has 4 of 8 lights on the charge meter, so it shouldn't be chirping because of low or full battery).

   The manual doesn't mention anything about this, the only instances where it mentions beeping is when a device draws too little power.  I don't have anything plugged into the battery, so I'm not drawing any power.

 My assumption right now is that it might have to do with not enough voltage reaching the Tekkeon(it requires 12V to charge), since it does seem to happen more often when the clouds are out.

 EDIT: it seems that by actually plugging something into the battery(like my laptop) causes the chirping to stop.  WTH?  Also I'm uncertain about it being related to cloud coverage as it was happening earlier even in full sunlight.

Under Volt



The lowest voltage that my MacBook Air seems capable of running on is 13V.   The power plug that comes with the mac apparently runs at 16.5.  My battery has a manually adjustable output voltage, which I've had at 16V up until now. 

At 12V the MacBook does not detect the external power source and just runs on battery. 
 At 13V it runs off the external power, and while I initially didn't expect it to charge the battery( given that the Mac Airline 15V charger does not), it does actual charge it.


Running at a lower voltage means using less power, and the laptop can also run cooler without any performance degradation.







Thursday, March 10, 2011

Commercial Space Flight

 NASA's space fleet is powering down, but there are some commercial attempts to replicate, at least in part what NASA has done.


   One is the SpaceX Dragon, which has already successfully reached low earth orbit; the first commercial enterprise in history to do so.  So far only the cargo version is been flown, the manned version isn't planned for a few years.

  Quite Apollo in appearance, tiny and not reusable--still it is wonderful to see any development.



  Virgin Galactic is working on SpaceShipTwo, the larger successor to the single person craft that claimed the X-prize back in 2004.  

No more Shuttle Fleet :(


  It is pretty depressing knowing that this is nearly the end for NASA's shuttle fleet.  I watched discovery land yesterday, for the last time, and couldn't help but feel depressed.
 Only two more shuttles are scheduled to leave Earth, one flight each for Atlantis and  Endeavour and then mothballed off to museums; the USA will no longer have the capability to put a person in space for an undefined period of time, but likely many years.

 The Constellation program, initiated after the Columbia disaster, which was basically just Apollo 2, has been more or less canceled; not such a bad thing, it was underfunded and uninspired-- but where is the inspiring replacement?  The current plan is to promote commercial space flight in the hopes that it will produce a cheaper more efficient path to manned space projects.

 It seems to be a common misconception that NASA takes a large percent of the federal budget, but the actual number is closer to half of one percent.

  Here are the numbers, as you can see US budget is $3.55 trillion, and NASA receives only $18.7 billion of that.

 That is 1/190th, or ~0.005%.

That is a pretty damn small percent.  Politicians waste more money on pork barrel projects each year than the entire budget of NASA.

Wednesday, March 2, 2011

Gear List




 Not complete, but currently I have a 13 lbs base weight.  I think this is pretty good considering I have 5 lbs of electronics and a 3 lbs backpack.

Pack & Pads




 This is the pack I'm planning to use. An Aarn Mountain Magic 55.  It is about three pounds by itself, so it is heavier than many of the packs commonly used for the PCT.   In the picture you can see two small packs, one of the left and one on the right.  These wrap around your body and end up hanging off your chest, it is supposed to help counter balance the weight on your back.  I've got it loaded with about 20 lbs in this picture, which I've been carrying around on training hikes.



 Here is the sleeping pads I'm currently planning to use, the egg carton looking one is torso length, and the thinner rolled up one is body length.  The clear plastic thing is my ground sheet.