Arash Partow's Weblog (Thoughts of a sentient, corporeal entity)

 www.partow.net  .: Home :.   .: Links :.   .: Search :.   .: Contact :. 



:: Compressed-Space ::

Driving in Sydney is just that! You can see where you want to be, its right there, right in front of you. Yet - driving there seems like it takes forever. The streets turn and churn you around in illogical motions, its like as if you're following some fractal boundary, the euclidean distance between where you are and where you want to be is finite, yet for some reason the route you take seems to be anything but.

Posted by Arash Partow @ 8:30pm


:: House Sweet Home ::

Recently I watched the Difference of Opinion show on the ABC. The topic of discussion was centered around the housing affordability crisis in Australia.

Essentially the problem is that as the housing market increases in value, more and more families and individuals are forced out of the housing market. Furthermore so-called market forces have created a class of people that have been deemed as never being able to purchase a house in their lifetimes.

The panelists discussed solutions such as having the federal government encourage superannuation funds to dip into their funds and invest in low cost housing purely for the middle to low-class rental market, with the condition being they shouldn't expect the same kind of ROI they would see in other real-estate equity invests but rather a minimal amount slightly more than CPI and the knowledge that they have contributed to society in a positive manner. Another point of contention was the issue of both the federal and state governments providing grants and other incentives. One panelist rightly suggested that any form of hand-out from the governments would only add to the increase in house prices rather than making them more affordable. I personally believe the federal government should reevaluate their negative gearing scheme. Perhaps slowly phase it out or place time and amount limits on its applicability.

Being able to live somewhere, where your housing security and affordability are guaranteed, allows one to concentrate more on being productive both at work and socially. If people are forced to live with the threat of being served an eviction notice because someone else went to the landlord or property manager and said that would be willing to pay $20-$30 more a week, then society in general suffers. The concept of housing security just doesn't end there with renters, but also consumes people who have been mortgaged to the hilt and are only able to barely survive due to the fact that their property is gaining value. If say the state governments were to release land (in order to lift the pressure on home buyers) around suburbs which are heavily populated by such people then overnight the equity in these people's homes will diminish, possibly even vanish entirely. This would cause a great deal of strife for the government come election time, but even before then they will be seen as having relegated whole communities into an ongoing affordability nightmare.

One could learn a lesson or two from what the American's tried to do with their sub-prime or b-letter grade loans. The issue there was that even though the fundamentals of the idea were good and pure, without the necessary regulation in place shonky and scrupleless lenders and reality evaluators were able to enter the market and take advantage of desperate people wanting to buy a home. Credit should not be so easy to obtain. The credit obtaining barriers from yesteryear should be brought back, things like the bank never giving a loan more than 70% of the principle value, people needing to prove they can live above the poverty line when paying the monthly repayments - simple things but also very necessary things.

A serious change of attitudes at the community, state and federal levels have to be made before any solution can be deemed viable and hence implemented. For if at the end of the day a person has no house where are they supposed to forge their home?

Posted by Arash Partow @ 10:00am


:: CTD Milestone Completed ::

Today we finished a major milestone in our CTD. It seems like all the major problems have been resolved and only the final demo left to consider.

Posted by Arash Partow @ 11:24pm


:: Ode To Crumsy ::

Crumsy - Copyright Arash Partow and www.simpsonsmovie.com

Crumsy, you crumulent clumsy character! Cryptically creating cruft as opposed to art, crud perhaps but never art. Correspondingly critically creeping thoughts of crapulance crop-up and crank-out from your whimsy exposing the creature forever known as Crumsy.

Posted by Arash Partow @ 1:20am


:: To Have Been Quoted ::

Otto Visser took a quote I made about his project on slashdot and had it published as a musing in his masters dissertation. Link

Quote: I'm sorry but I don't need some remote sensor device using Wi-Fi telling me that it is raining hail stones, the pain from the fractures to my cranium will be more than enough.

Posted by Arash Partow @ 9:40pm


:: .:...:.: ::

One can grapple with fear and loss, but never with one's own destiny, for truth is the real form of comprehension, everything else is but a mere mist obfuscating the reality of the situation.

Posted by Arash Partow @ 9:40pm


:: Self-Security Rather Than Self-Purity ::

Code Base That Was Written For Job Security

I've heard this phrase being used on more than one occasion by angry developers given a code base to either extend, refactor or fix. The phrase essentially means that the person who initially wrote the code did it in such a way that any new additions or fixes could only be done by them as they are the only person that can possibly make sense of the code.

Posted by Arash Partow @ 10:30am


:: .::.:.: ::

Today I was meant to be somewhere special, say something special, see someone special...

Posted by Arash Partow @ 10:30am


:: J2K and ECC ::

I've been trying to embed an error-correcting code in a standards compliant manner into the JPEG2000 codestream box structure. Specifically a Reed-Solomon ECC using the specified ECC code block as is defined by the JPEG2000 wireless standard. Just reading the format and the way things are gathered, grouped and stored clearly proves that the people working on the file format portion of JPEG2000 literally had no idea what they were doing. This is evident by how the many JPEG2000 compliant codec vendors that are out there offer streaming of J2K files over their own proprietary formats instead of using bare-bones J2K.

The idea someone more intelligent than me has presented is that assuming joint channel coding there is the possibility that if some kind of quality measure existed for the compressed J2K image vs the original loss-less form (in this case a simple SSD and empirical observations) there will be a point were packet loss from transmission over an erasure channel being recovered using the embedded ECC will provide a better image quality level than say the the image compressed such that its size is equivalent to the amount of data received from the erasure channel but this time sent over a more reliable medium such as TCP.

Costs of transmission time, overall throughput versus the quality of the resulting image from both means will be assessed. I believe this point of equivalence can be accurately approximated simply by simulating a Gaussian erasure channel and not necessarily having to go down to the modulation level. If you know some percentage of packets will be erased, wouldn't that be enough to simulate the erasure channel as a Monte-Carlo process?

In any case the J2K data storage format is bad - very bad. Probably that is one of the reasons why its uptake has been so slow. Wavelets can be better represented in files and in streams so as to make them more accessible and ultimately more useful. It just shouldn't have to be so damn hard!

Posted by Arash Partow @ 7:30pm


:: Astronomy and Computer Science ::

Computer science is no more about computers than astronomy is about telescopes.

-Edsger Wybe Dijkstra

Posted by Arash Partow @ 7:00am


:: C++ ASIO Library ::

Today I had my first taste of asio, and for lack of a better word, I think its GREAT! Its exactly what the C++ world needed, probably a decade or so late, but better late than never I say.

The library is essentially an asynchronous (and synchronous as a matter fact) IO library for mainly network IO such as sockets but can be easily adapted for other event and IO oriented purposes. An IO completion layer is built on top the OS using whatever event mechanism is best supported for edge and layer trigger based IO events - select, epoll, kqueue. As a result of the different event mechanisms used, the library implements either a Reactor or Proactor pattern for event handler execution and IO completion management. Further more an abstraction for continuous buffers is provided to efficiently support scatter-gather operations. The library has been accepted into BOOST and will be formerly inducted at some time in the future possible release 1.34 or 1.35, in addition to the BOOST submission, the library will also be submitted for TR2 at the next C++ standards committee meeting.

All in all the ASIO library has great potential, its also backed by an author that is very willing to interact with the user base so as to improve and extend it.

Posted by Arash Partow @ 2:40am


:: On The Virtues of Modularised Refactoring ::

I've begun to notice that in some large corporations where the concept of outsourcing has become a viable solution to increasing profits, cutting costs and ultimately increasing the share price, that refactoring has become the number one priority.

The type of refactoring that is being done is essentially taking large monolithic applications, and breaking them down into more manageable and well defined modular components that can be plugged-in or out as is desired. Now modularisation is not a new design methodology, it has been around since the inception of software. Most development books cover the benefits and advantages that such designs have on scalability and extendability of the application.

Now another, but previously known yet not fully understood advantage has been realised, and that is, if your code is lean, modular with well defined interfaces then developing for and extending said code becomes much easier. This increase in ease of development flows through to the reduction of potential risk when off shoring said code base for an extended period of time. Essentially by making the code easier to use, you reduce the learning curve to understanding and interacting with the codebase productively. By reducing said learning curve you increase the throughput rate of features and functionality into the codebase and as a side effect might also increase the overall quality of the codebase. Another key benefit of well thought- out and designed modularisation is that for the difficult problems masters of a domain can be brought in to solve the problem that relates to their expertise without them having to become an expert in your codebase or its specifics. Now who said capitalism doesn't bring with it its own set of benefits.....?

Posted by Arash Partow @ 8:20pm


:: Maybe, Maybe ::

It is possible that there maybe a likelihood which might probably allow this sentence to conceivably end in some form of determinism?

A maybe is a maybe, nothing more nothing less. Aggregating a maybe with another, only makes the "be" one-eighth less likely. A sentence such as the one above when uttered, means nothing more than a resounding negative, a superlative no.

Posted by Arash Partow @ 04:20am


:: Is 100% enough? ::

Whats with eateries displaying signs that purport their food is 100% halal or 100% kosher. The food either is or it isn't, there is no half-way here, you can't have something that is 85% halal, it just doesn't make sense.

What does the percentage signify? Is there some doubt in peoples minds, when they read the sign to the extent at which the establishment in question implies its observance of said dietary tradition?

Posted by Arash Partow @ 10:00pm


:: What Is This Guy On About? ::

I reconcile it by putting into effect the measure we have put into effect.

-Michael Chertoff

Posted by Arash Partow @ 11:30am


:: To Infer From A Search ::

It turns out that over a week ago AOL released the search record of over half a million of its users for a 2 month period this year. Slashdot as usual had some commentary, people filtering the files based on the so-called "random id" of the searchers where able to sequence the search queries of AOL customers. Some interesting sequences of searchs were found. A leaked interal AOL memo from an AOL spokesperson A. Weinstein begins by saying: "This was a screw up, and we're angry and upset about it."

So I took up the challenge and setup a little experiment. The idea was using only simple tools such as a text editor and the various freely available public search engines and social networking sites, could one extract the identities of the people behind the search IDs in the AOL search database.

Within half an hour, using google, myspace, facebook and orkut I was able to find the names, and photos of 17 of the searchers, all based only on the people and "habbits" for which they were searching. After e-mailing them the sequence of searches and their photos (found on google images,orkut, myspace etc). Only 1 person denied it was them, the others all agreed and some even said they might be in contact with AOL's legal department sometime in the future.

In conclusion reversing the search results so as to find the searcher is rather trivial, when will people learn random IDs just don't work. The only way such data should have been released is in aggregated form, similar to google's zeitgeist

Posted by Arash Partow @ 7:30am


:: The State Of Affairs ::

With all the things happening in the world, the front page of the daily telegraph this week dedicated itself to the fact that the thorpedo may not be as agile as he used to be. What a sad state of affairs.

Posted by Arash Partow @ 7:30pm


:: Release Of Wykobi ::

Today I publicly released the Wykobi C++ Computational Geometry Library.

Posted by Arash Partow @ 1:00am


:: Hashes Of Social Security Numbers ::

Sometime ago I noticed that a general letter to the public by the Attorney General's office of Arkansas answering some questions relating to how one could obfuscate a person's social security number so that it could still be used/viewed by government officials and workers, mentioned me and my page on hash functions.

The jist of the advice is correct, however I would be the first to say that the hash function demonstrated there are not of a cryptographic nature hence would not be suitable for intended use they desire. The link to the letter.

Posted by Arash Partow @ 10:00pm


:: Product Marketing ::

Could the level of advertising be inverse proportional to the quality of the product?

I'm beginning to see a lot of products being marketed about that are utter shite. It seems that the companies or indivduals involved are spending the money they should have spent on engineering and extending their product on marketing. It reminds me of that joke where the guy advertised a thing called Pep. In reality it was nothing, but people bought into it. One might ask since when do the markets subscribe to reality?

Posted by Arash Partow @ 8:45pm


:: Been Wondering... ::

The Islamic Republic Of Iran or The Iranian Republic Of Islam

Which one is it really?

Posted by Arash Partow @ 12:30pm


:: Frustrating Interface! ::

Why do most ATMs require you to enter both a dollar and cents amount when clearly we all know they only dispense currency above a certain note value?

Posted by Arash Partow @ 7:00pm


:: Where Does The Power Lie? ::

The power has never been with the oracle, its always been with the preists even if they had to invent the oracle!

-Minority Report

Posted by Arash Partow @ 11:00pm


:: .:..:: ::

Today I begin work on my second CTD. The majority of work lies in researching and developing mosaicing and strucutre from motion techniques. A lot of computer vision, multiple view geometry and optimisation techniques to read up on. First time I heard the term epipolar geometry.

Posted by Arash Partow @ 7:30pm


:: Educational TV ::

I find television very educational. The moment someone turns it on, I go off and read a book.

-Groucho Marx

Posted by Arash Partow @ 6:30pm


:: When a Safety-Net Is Not Safe ::

Source control is like the safety net a trapze artist would use during practise. But the problem with this kind of safety net is that it flexes too much. There will be a height from which you can fall and the net will catch you but any higher and it will flex so much that you end up hitting the ground.

Posted by Arash Partow @ 10:10pm


:: On The Assumption Of Complexity ::

Subjectively, if one can trivially define a pattern within a sequence, then that sequence is deemed to be subjectively regular.

Defining such a sequence as being regular does not fully imply a lack of complexity in the structure of the sequence, because in reality one could conclude that simplicity in the face of a non-trivial concept is inherently complex.

That would evidently be the wrong conclusion to make.

Posted by Arash Partow @ 11:20pm


:: Better Than Clever? ::

Being Cleverer than you look is better than looking cleverer than you are...

I find it hard to either look or be clever. Perhaps I should try a different boutique.

Posted by Arash Partow @ 1:00am


:: Q.E.D and Q.E.F::

Q.E.D. - "quod erat demonstrandum" (Latin) This stems from medieval translators' habitual tendency of translating the Greek for "this was to be demonstrated" to the Latin phrase above. This appeared originally at the end of many of Euclid's propositions, signifying that he had proved what he set out to prove.

Q.E.F. - "quod erat faciendum" is the latin for "which was to be done" It appears in Latin translations of Euclid's works signifying that he had demonstrated what he had set out to demonstrated.

Posted by Arash Partow @ 9:40pm


:: A Solution To E-Voting ::

Recently a growing number of civil administrative institutes around the world have begun entertaining the notion of electronic voting as an alternate method for implementing certain founding principles of their respective systems of governance.

The US as usual has been the most loud about its efforts. Though the feedback in both the media and the general public has been less than positive. This is mainly due to the flaws apparent in the systems tasked with carrying out elections, and the trouble such flaws have been causing election officials and general everyday citizens on election day.

There are several problems that need to be addressed, and even though designing and implementing a secure electronic voting system seems like a trivial exercise, the companies in the US that have been tasked with building such infrastructures have utterly failed to deliver adequate, fair and secure e-voting infrastructure. The following are some of the more basic yet essential requirements for such a system:

  • Ease of use: Both for electoral officials and the voter)
  • Reliable: The systems must work flawlessly and seamlessly without any glitches or mishaps on the days they are needed.
  • Secure: The information these systems accumulate should be valid, authenticated, traceable and easily auditable.
  • Provision for a paper trail: The systems should provide an authenticated or verifiable paper trail both immediately when a vote is placed and for tabulation purposes.

The above points are critical to the overall sucess of electronic voting. There are a group that believe a fith point is required, and that is that any implementation of a such a system, should itself be open and autiable by the general populas. The reasoning is that there might be backdoors to such systems that can only be detected through inspection of both the design and implmentation. I say that this does not necassailry have to be a formal requirement but rather something that if done could only be seen as a positive.

My reasoning is that one does not necassairly need to have access to the barebones of a system to know what is going on, nor does one need to have access to know if a particular system is abiding by some requirement. For example if such a system had a requirement that a specific type of tunneling be used for sending data back to the tabulation centers, then all one needs to do to verify the system is using said protocol is to write a complimentary system and try and communicate with the original system. Now having a positive outcome from this analysis doesn't mean the system has not been altered to communicate in another protocol or may be sending sensitive information to another location. But just like the first test each one of these possibilities can be tested for by setting up the intended systems in a simulated blackbox where the systems think they are being used in a real election and see if they behave the way they are meant to or not. Blackbox testing is a very black-art in itself and is the basis for many reverse engineering techniques, it is a very powerful tool when trying to prove a negative, if that is even truely possible.

I have an alternative solution to this problem. It goes something like this. We essentially already have an infrastructure that can securely and dependably be used to carry out an election. In fact due to market forces this infrastructure over the many years it has been put in place has continually been improved and developed to the point that it is convenient, reliable and secure. This infrastructure I talk about is none other than the banking system and specifically the thousands of ATMs that have been strategically placed around the country so as to provide the most optimal cost-of-implementation to customer satisfaction rate possible.

Now the ATM approach wouldn't be a final solution but rather something to compliement the current paper ballot system. Obviously there would be places where ATMs can't be found, such places would need to fall back on the current systems of voting.

Posted by Arash Partow @ 10:00pm


:: .::..: ::

Several hours ago someone asked me a question. I gave a reply that was unpleasant. What a mistake that was.

If someone honors you by asking for knowledge what right do you have to turn them down?

Posted by Arash Partow @ 11:23pm


:: The Law of Inverse Relevance ::

The less you intend to do about something, the more you have to keep talking about it.

-Yes, Minister

Posted by Arash Partow @ 9:27pm


:: Bastion ::

Knowledge, a form of enlightenment. If unknown it is to you today, then known it must be by the morrow, for if it is still unknown by the day after said morrow, then a true fool you be.

Posted by Arash Partow @ 9:27pm


:: Immunity ::

One must continually strive to diversify ones sources of knowledge and understanding, because not doing so would not be dissimilar from performing intellectual in-breeding with ones mind, leaving one with a genetically inferior pedigree of thought.

Posted by Arash Partow @ 10:00am


:: Spatial Container Problem ::

The biggest problem I see is when an object stradles the subdivision boundries. One solution to this problem is to use overlapping subdivisions. Need to look into morton codes a bit more, a spatial hash function has to exist.

Posted by Arash Partow @ 7:10am


:: A Democratic Conclusion ::

Ballots are the rightful and peaceful successors to bullets

-Abraham Lincoln

Posted by Arash Partow @ 9:20pm


:: Jolly Old Man ::

Yesterday, SA's assistant police commissioner described Mr Rumsfeld as one of the world's top terrorist targets." http://www.news.com.au/story/0,10117,17274781-1702,00.html

I wonder why that is the case? He seems like such a jolly old man.

Posted by Arash Partow @ 5:40pm


:: Characteristic Gesture Of Excessive Reciprocity ::

In a characteristic gesture of excessive reciprocity he is allowing the fish to dine on him, said the greiving widow of a man who had dined rather well in a seafood restaurant before mysteriously setting sail in his runabout never to be heard of again and hence being declared dead, only to reappear 5 years later.

To assume that one recipricate one's doing unto another species by letting said species do unto one.

Posted by Arash Partow @ 6:20pm


:: Is your code perfect? ::

Is your code perfect? Are you perfect? If not, you should shut up and support this effort...

-Mr. Valentine (The Enforcer)

Posted by Arash Partow @ 9:53pm


:: To Want More ::

Ok But I have two last questions... -Times reporter

This is very common, I think, in America, isn't it? to ask for more -Ahmadinejad

Posted by Arash Partow @ 9:40pm


:: Funny Soviet Hicks ::

  • In Soviet Microsoft, developers say "Ballmer Ballmer Ballmer!
  • In the west you spam computers, In Soviet Russia Computers Spam YOU!
  • In Soviet Russia, encryption cracks YOU!
  • In Soviet Russia, the network attacks YOU!
  • In Soviet Russia, people don't seek rocket; Rocket seek people.
  • In Soviet Russia, the viruses skan you!
  • In Soviet Russia, Documents Find You.
  • In ze vest system verkz for you, In Soviet Russia YOU verk for ze system!
Posted by Arash Partow @ 11:30pm


:: The Unlucky Ones ::

Avoid employing unlucky people - throw half of the pile of CVs in the bin without reading them.

-David Brent

Posted by Arash Partow @ 10:40pm


:: Regulars And Their Centers ::

Any line passing through a regular polygon's center will cause said polygon to split into equivalent halves. This rule can also be applied to n-dimensions where a plane/hyper-plane that contains the center of a regular polytope will cause that polytope to be split into equivalent halves.

From this a line or plane passing through the center's of regular polygons or polytopes respectively will simultaneously split said objects into equivalent halves.

Posted by Arash Partow @ 10:00pm


:: Trip To The Blue ::

Blue Mountains Trip 1 By Arash Partow   Blue Mountains Trip 2 By Arash Partow  
Posted by Arash Partow @ 8:30pm


:: What Is This Guy On About? ::

If you need to go to war, you go to war with the weapons you have, not the weapons you'd like to have. Of course, that doesn't mean you can't also work on getting the weapons you want, but if you wait until all the ducks are in a row, the enemy will have long since sliped in behind you and snapped your neck already.

- Mr D. Rumsfeld

Posted by Arash Partow @ 7:24pm


:: Collisions ::

Attacks on various MAC primitives such as MD5 and SHA-1 have resulted in serious debate as to the secuirty and reliability of such primitives.

One must understand that however devastating such attacks are, to date none of the mentioned attacks or their respective implementations have been able to provide meaningful collisions.

On might ask, what is a meaningful collision? A meaningful collision is a piece of data that not only produces a similar message digest to another piece of target data with regards to some hash function, but is also functionally equivelent to the target data.

The term functionally equivelent can be best be explained with the following example. Assume your target piece of data is really just a compressed piece of data using some kind of compression software. When the decompression software is run a piece of uncompressed data is produced. A functionally equivelent piece of data as far as the compression scheme is concerened is one that the decompression algorithm will recognises as a valid compressed stream. The same scenario could be used for any other structure dependent data format.

There is however the possibility (however infintesimal) that a generated collision could infact be a valid candidate as far a functional equivelence is concered however once transformed the resulting data may no be comprehensible in the next stage. The next stage usually being human interaction.

Posted by Arash Partow @ 9:30pm


:: Feynmanns Right ::

That's not right. It's not even wrong!

-Richard Feynmann

Posted by Arash Partow @ 11:53pm


:: Funny Simpsons Quotes ::

Our new 51st state, Saudi-Isrealia

I'm going to retro-morph this diamond into coal the most precious substance

Posted by Arash Partow @ 7:30pm


:: What is GPL? ::

A few years ago reading the FAQ on GPL at FSF, found the following FAQ point:

http://www.fsf.org/licensing/licenses/gpl-faq.html#OOPLang

to be somewhere at the bottom of the 10th page of their 11 page FAQ. Recently I've noticed the FAQ has been updated and redesigned yet this point still seems linger at the bottom of the FAQ.

One of the most important queries regarding an open license model would be anything relating to derivatives. In fact the principle use of open licensed content would be the issue of derivative works. Be it works that use open licensed work in certain combinations or if they modify the interface or inner parts of the open licensed work and again use in various combinations.

Yet this point seems to have been given less consideration on the FSF GPL FAQ site when compared to other obviously more important and pressing issues such as "Can I use the GPL for my piece of software?" or "Does the GPL allow me to sell copies of the program for money?"

If the FSF thinks their license is so good and so appealing why don't they show the merits of their convictions and also a bit of courage and state somewhere at the top of their FAQ in plain unambiguous language that wrappers of any kind even if they don't modify or in any way alter the piece either physically or functionally still have to endure the viral effects of GPL.

Posted by Arash Partow @ 8:10am


:: To Hate Or Not ToHate... ::

To hate, implies one cares enough to show emotion.

Posted by Arash Partow @ 10:00pm


:: What Do Stimson's "Gentlemen" Do? ::

Gentlemen don't read each other's mail

-Henry L. Stimson

Posted by Arash Partow @ 11:10pm


:: The Self Replicating Molecule ::

A molecule that could make crude replications of itself. The imperfections in replication caused some of the invalid replicas to replicate with higher degrees of perfection.

What motivated the original molecule to replicate? Infact did the original molecule even replicate? One could theorize that the original molecule was able to take other molecules and maybe itself and make another molecule. Obviously selection for specific molecules would not have been on the original molecules list of priorities so every production line would result in a differing molecule.

Most of the molecules would be deemed useless, they would not be able to reproduce or replicate and hence would not be able to further extend their structural lineage to anything else. Though some of the molecules produced would in fact be able to reproduce or at least produce. This process if it were to be extended iteratively, one could imagine that at some point in time, say between the beginning and the end, a production line could result in a molecule that might be able to replicate itself with near perfect accuracy.

But the question still remains, why would the molecule replicate?

Posted by Arash Partow @ 9:54pm


:: STL And Simple File IO ::

Some simple and elegant examples of using C++ and STL to make reading and writing of files that much easier.

The first example is simply to solve the problem of reading a text file of lines into an STL container, in this case a container of strings:

 
void read_to_list(const std::string& file_name, std::vector < std::string > & buffer)
{
   std::ifstream file(file_name.c_str());

   if (!file) return;

   std::istream_iterator < std::string > is(file);
   std::istream_iterator < std::string > eof;
   std::copy( is, eof, std::back_inserter(buffer));

   file.close();
}
 

The second example will write a vector of strings to a text file:

 
void write_from_list(const std::string& file_name, const std::vector < std::string > & buffer)
{
   std::ofstream file(file_name.c_str());

   if (!file) return;

   std::ostream_iterator < std::string > os(file,"\n");
   copy(buffer.begin(),buffer.end(), os);

   file.close();
}
 

The third example will read the entire contents of a file binary or text into a string:

 
void load_file(const std::string& file_name, std::string& buffer)
{
   std::ifstream file(file_name.c_str(), std::ios::binary);

   if (!file) return;

   buffer.assign(std::istreambuf_iterator < char > (file),std::istreambuf_iterator < char >());

   file.close();
}
 

The fourth example will write a string to a file:

 
void write_file(const std::string& file_name, const std::string& buffer)
{
   std::ofstream file(file_name.c_str(), std::ios::binary);
   file << buffer;
   file.close();
}
 

Note: To use the above code various includes have to be made, such as the following:

 
#include < iostream >
#include < fstream >
#include < string >
#include < iterator >
#include < algorithm >
#include < vector >
 
Posted by Arash Partow @ 10:37pm


:: Technorati Thing... ::

Technorati Profile
Posted by Arash Partow @ 11:00pm


:: The Dirty Business Of Browsers ::

I never could understand why Bill Gates had put the kibosh on IE. It was a really strange thing, The internet generation needed an internet tool, this guy had one, and had and today still has an overwhelming market share of users. So how come he hadn't updated the damn thing since 2000?

Well the following paragraph taken from Fortune Technology Online really puts things into perspective:

Like Google, Netscape threatened to sideline Microsoft's operating system, in its case with the web browser that founder Marc Andreessen unveiled in 1994. The reason was that the browser, which cost each user $39.95, would enable applications like word processors and spreadsheets to reside on centralized Internet servers rather than on the hard drives of users' desktops. That in turn would lessen their need for Windows or Office, sapping Microsoft's business. But Gates rallied Microsoft to develop its own browser, which it then bundled free with Windows. Netscape's market share collapsed, and the upstart was forced to sell to AOL (like FORTUNE's publisher, a unit of Time Warner) three years later.

URL: Why Google Scares Bill Gates

It turns out Bill knew back in the old Netscape vs Microsoft days that everything Microsoft was charging for like office products, multimedia applications and basically everything under the sun except for the OS, could be launched from within an internet browser.

Make the protocols that run the internet better, make the format of data going into and out of browsers better, and you end up in a situation analogous to digging your own grave if you are a mass software producer serving a vast horizontal market such as Microsoft.

Making anything to do with enhancing the viewing of a page better and you make the end-user experience better, make developing such pages which consist of dynamic, highly interactable data and well you loose the ability to sell application land functionality.

To put it bluntly, if you could open a document in your browser, do all the things you could do with Microsoft word within the dynamic weblet application that is running on your browser, and at the end of the day be able to save that file on disk or e-mail it to a friend, then what use is there for a stand alone word processing application? In fact what use is there for stand alone spreadsheet applications, multimedia applications and basically anything that needs its own window?

Why not have everything running off a central server? why not centralize your computational needs? why not treat computing like you treat other utilities such as electricity, gas and water? when was the last time you saw someone with an electricity generator or gas store or water store in their house?

You don't because all that stuff was centralized nearly a hundred years ago. And the only places where you do see such things in a non- centralized manner is either in developing parts of the world, or in parts of the developed world where the density of population to land is soo low that governments don't bother investing in such infrastructures for those areas.

Gates must have thought, well Microsoft has overwhelming browser dominance, any company that would even contemplate trying to pull-off a centralized functionality grab from our application land products would have to do it through our browser in order to reach their intended end-users which by the way are the end-users of our application land offerings.

Solution to the problem, make the browser just good enough for things like web-pages and e-commerce to work, but nothing more. Make it really hard for people to produce decent interactivity on their web pages and make it only possible through third party plug-ins that have to be downloaded and installed such as Flash. Make life hard for the web developer, make it so hard that thought of developing a word processor that would run upon IE nothing less than a nightmare. And finally but most importantly don't implement any of the W3C's recommendations.

This was a good plan and it was working, though little unknown factors at the time which didn't seem too important to take any notice of by Bill and his disciples were to become the proverbial storm on the horizon for his plans. The quiet before the storm was coming, yet no one knew what it was...

Netscape, before they went dead, both product wise and moral wise, and were subsequently bought out by AOL for a tidy profit, made a very generous yet at the time dismal effort to ruin Microsoft, or at least ruin them within the internet browsing domain. They did this by giving away the source to their browser for free!

Initial reviews by analysts both within IT and financial circle touted the move as crazy and irresponsible, possibly damaging Netscape value for any future buy out or merger (which it sort of did - thats why AOL got the company on the cheap).

Regardless the result of Netscape's actions lead to the establishment of an open source project known as the Mozilla project and then later on the establishment of the Mozilla foundation.

The Mozilla project, took the Netscape, code-base and began a journey that took them roughly 10 years to complete. The result was a suite of applications, which out did Microsoft's IE and basically any other web-browser on the market in nearly every area of web-browsing. A few alternate open source web-browsers today have accept the way of Mozilla and are now rendering web pages within their client applications using the Mozilla engine.

What does this mean for centralized computing of days long past. It does infer to some degree that there is a revival in that specific methodology. It does mean that in certain areas of IT, a centralized solution to data management be it simple word processing, spread-sheet like functionality or multi-media design will be supported by centralized applications running out of the users web-browser.

Though technologies such as word processing on rich client interfaces through a web oriented infrastructure exist today, they are not up- to-scratch when compared to their application land rivals. They are in some cases very clunky and don't afford the user, the interactivity one comes to expect from such applications. That said the future is looking bright. With every new release of the Mozilla rendering engine, more and more enhancements and advancements are being made and as a result, there is a continual challenge being proposed to the maintainers of IE to either keep-up or bail-out.

Microsoft recently made it clear that they weren't going to be bailing out any time soon, by announcing that they will be shipping IE v7.0 very soon. IE v7.0 will be the first release of IE for about 5 years. They also said it would be back ported to Windows XP, and will contain many enhancements currently lacking, a special "enhancements" to note would be more precise conformance to w3c standards. the words more, precise and conformance should be taken with many very large handfuls of grains of salt - very large grains in fact!

To sum up, the future as always is bright, centralized desktop applications running out of your browser will be the future, the humble browser will be what is known as the operating system, and as a result the world will become just that much more interconnected.

Will these things solve world famine, disease, and inequality? Unfortunately no, but they will make for good distractions from such unfortunate circumstances.

Posted by Arash Partow @ 12:20pm


:: :.::.::.: ::

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.

-Edsger Wybe Dijkstra

Posted by Arash Partow @ 11:00pm


:: Variations Of Simple Variable Swapping ::

How many uniquely different ways exist for swapping two variables around?

 
procedure Swap(var a,b : Byte);
var
  tmp : Byte;
begin
 tmp := a;
 a   := b;
 b   := tmp;
end;

procedure Swap(var a,b : Byte);
begin
 a := a xor b;
 b := a xor b;
 a := a xor b;
end;

procedure Swap(var a,b : Byte);
begin
 a := a + b;
 b := a - b;
 a := a - b;
end;
 

In C\C++\Java you can have something funky like the following:

 
int swap(int a, int b)
{
   return (a ^= b ^= a ^= b);
}
 

Note: The second last method is only valid if the numerical operations support wraping of overflowing results.

Posted by Arash Partow @ 10:35pm


:: Something Really Funny! ::

OK its not that funny, but it does give a laugh or two the first time you read it especially if you're not Lebanese.

Do you Want to Come back Home? "Tamalak Bi Baladak!"

As a Lebanese, you probably feel most at home here in Lebanon where you are known, respected and loved.The success you have achieved in abroad can be brought to Lebanon by:

  • Investing in a piece of prime property
  • Buying a home so that you can enjoy your privacy while you're on vacation in LebanonHaving a home in Lebanon so when your children are ready to go to university you can keep the family close together
  • Offering your parents a new comfortable home

Being a successful person, you may have your money tied up in other ventures. This is where Byblos Bank's Expatriate Housing Loan can provide the solution.

Byblos Banking Group

Posted by Arash Partow @ 8:00am


:: To Want Or Not To Want... ::

One American official tried to explain the absence of Al-Libbi's name on the wanted list by saying:

"We did not want him to know he was wanted."

-The Times Online

Posted by Arash Partow @ 11:00pm


:: What Is Astroturfing? ::

The use of paid shills to create the impression of a popular movement.

Posted by Arash Partow @ 10:21pm


:: ..:.::. ::

We realigned the stars, and made the moon not but cresent, so thou may gaze upon this stary night. The dark period we created, so thou could distinguish between the dark and light.

Creation of thought and emotion fall asleep now, fast and sound, so that the morrow may come quickly and bring about with it the happiness thou desires.

For today not being, does not mean the morrow will be akin.

Posted by Arash Partow @ 11:00pm


:: The New Monitors ::

Last week we all got upgrades to our systems at work. New monitors for every desktop on site and in sight!

The new Dells are great, 20 inches at 1600x1200 max resolution they really put more on the screen and multiply that by 3 monitors and well you get lots'n'lots'n'lots more.

Seeing as though now we have access to more viewable information do they now expect us to be 3 times as more productive than we are now? ;)

Or wait should that be proportional to the total number of pixels we can see now as compared to what we could see before. Now its about 17280000 pixels where as before it was 7840000 pixels which would only mean a 2.204 times increase in productivity...

Regardless choleh kabab and ghormeh sabzi taste just as good, with or without 3 monitors!

Arash's Desk   Arash's Desk
Posted by Arash Partow @ 10:30pm


:: Trip To The Western Plains Zoo ::

The ANZAC long weekend looked like be a boring one, until a couple of friends and I decided to head up to Dubbo and visit the Western plains zoo. This place is really big! All the animal habitats have been designed in such a way so as the visitor doesn't sense a boundary between the animals and themselves. I really like that aspect of the design. Normally when you go to a zoo there are huge fences with barbed tips and all sorts of boundaries making it starkly obvious there is a wall between you and the animals. However here it was different. For the first time in my life I saw a lion in real life without any fences between me and it, just a 30 ft moat that neither the lion or me were willing to pass.

My favorite animal was this huge turtle from the Galapagos islands. Even though he had a big thick shell, he looked like such a vulnerable creature as he slowly moved around. I got so close I event patted him. A lady standing nearby made a comical remark by saying that he needed a decent manicure, the turtle just snuffed at her and then walked away.

wl-23-04-2005-0678.jpg   wl-23-04-2005-0679.jpg   wl-23-04-2005-0682.jpg   wl-23-04-2005-0690.jpg
wl-23-04-2005-0691.jpg   wl-23-04-2005-0700.jpg   wl-23-04-2005-0702.jpg   wl-23-04-2005-0703.jpg
Posted by Arash Partow @ 11:30pm


:: Fast Integer Based Ellipse Rendering ::

Loosely based around the Bresenham algorithm, it is capable of rendering integer points of an axis aligned ellipse. The method does not use any form of trigonometry and in theory can be easily parallelized to draw octants of an ellipse concurrently.

 
Type TPlot = procedure(x,y : Integer);

procedure Draw_Ellipse(centerx, centery, a, b : Integer; PlotPixel : TPlot);
var
  t1 : Integer;
  t2 : Integer;
  t3 : Integer;
  t4 : Integer;
  t5 : Integer;
  t6 : Integer;
  t7 : Integer;
  t8 : Integer;
  t9 : Integer;

  d1 : Integer;
  d2 : Integer;
   x : Integer;
   y : Integer;

 negative_tx : Integer;
 positive_tx : Integer;

 negative_ty : Integer;
 positive_ty : Integer;

begin
  t1 := a * a;
  t2 := t1 shl 1;
  t3 := t2 shl 1;
  t4 := b * b;
  t5 := t4 shl 1;
  t6 := t5 shl 1;
  t7 := a * t5;
  t8 := t7 shl 1;
  t9 := 0;

  d1 := t2 - t7 + (t4 shr 1);
  d2 := (t1 shr 1) - t8 + t5;
  x  := a;
  y  := 0;

  negative_tx := centerx - x;
  positive_tx := centerx + x;
  negative_ty := centery - y;
  positive_ty := centery + y;


  while d2 < 0 do
  begin
   PlotPixel(positive_tx,positive_ty);
   PlotPixel(positive_tx,negative_ty);
   PlotPixel(negative_tx,positive_ty);
   PlotPixel(negative_tx,negative_ty);

   Inc(y);
   t9 := t9 + t3;

   if d1 < 0 then
   begin
    d1 := d1 + t9 + t2;
    d2 := d2 + t9;
   end
   else
   begin
    Dec(x);
    t8 := t8 - t6;
    d1 := d1 + (t9 + t2 - t8);
    d2 := d2 + (t9 + t5 - t8);
    negative_tx := centerx - x;
    positive_tx := centerx + x;
   end;

   negative_ty := centery - y;
   positive_ty := centery + y;
  end;

  repeat
   PlotPixel(positive_tx,positive_ty);
   PlotPixel(positive_tx,negative_ty);
   PlotPixel(negative_tx,positive_ty);
   PlotPixel(negative_tx,negative_ty);

   Dec(x);
   t8 := t8 - t6;

   if d2 < 0 then
   begin
    inc(y);
    t9 := t9 + t3;
    d2 := d2 + (t9 + t5 - t8);
    negative_ty := centery - y;
    positive_ty := centery + y;
   end
   else
    d2 := d2 + (t5 - t8);

   negative_tx := centerx - x;
   positive_tx := centerx + x;
  until x < 0;

end;
 
Posted by Arash Partow @ 10:00pm


:: Weird MS Responses ::

Recently on two occasions whilst using MS products I encountered some really strange responses. In the first screen shot I was re-opening an old e-mail account I hadn't used for a few years, it turns out that MS closes the accounts but does not delete them, the second screen shot relates to installing ActiveSync for my Axim v50.

Click on the thumbnails for an enlarged view

Weird MS Response 1 - Arash Partow

Weird MS Response 2 - Arash Partow

Disclaimer:
I in no way condone, endorse, infer, confirm or assume the use of the above software in any way, shape or form.

Posted by Arash Partow @ 11:30pm


:: Randomness Is Observer Dependent - Or Is It? ::

The crucial point many people seem to forget is that complexity, and obscurity of a form does not necessarily have to always translate into complexity or obscurity of any level. The reasoning behind what determines complexity is only as valid as the reasoning behind what determines simplicity. One may assume something is complex until they see a solution, hence the old adage of "every problem is easy once a solution is found" seems to validate this fact.

In science more specifically Quantum physics, ascertaining a deterministic solution - one that could be followed through with a series of plausible, determinable steps is currently not on the agenda of many modern physicist.

They see that modeling the exact nature of subatomic events is far too complicated due to the supposed chaotic and ambagious behaviors of such entities. Hence they try to generalize the behaviors within the realm of statistics, as would any logical scientist trying to model a stochastic event.

That said, not everything that seems random is really random. One could look at a piece of encrypted data, to the unknowing this data would be nothing more than gibberish. Though to another person possessing the correct key, the gibberish has meaning, it has structure. In lieu of a better analogy it simply needs to be seen in a different light in a different way, from a different perspective, maybe an enlightened point of view.

Is the universe random? My opinion is that it is not. I believe there is an orderly structure out there, a set of deterministic principles. We, like the unknowing person look at our universe (or at least as much of it as we can view) and see a vast expanse of mind boggling yet awe inspiring and beautiful complexity.

With our minuscule mental and intellectual capacities we resign ourselves to believing it is all just random, in order to continue the comforting thought that we know all that there is to know and anything we don't know is just random and hence can be generalized with a series of statistical inferences or that it is just so entropic that its not worth knowing or even considering.

Posted by Arash Partow @ 7:30pm


:: FastGEO And Assertions ::

People have been asking for built-in native assertions in FastGEO for sometime now.