Sunday, March 27, 2011

In Inheritance: Can I override base class data members??

Lets say I have two classes like the following:

Class A
{
public:
..
private:
  int length;
}

Class B: public Class A
{
public:
..
private:
 float length;
}

What I would like to know is: 1) Is OVERRIDING OF BASE CLASS DATA MEMBERS allowed? 2) If yes, is it a good practice? 3) If no, what is the best way to extend the type of the data members of a class?

There is a class that satisfies my needs and I want to reuse it. However for my program needs, its data members should be of another type.

I have some books, but all of them refer only to overriding of base class member methods. Thanks everybody in advance.

From stackoverflow
  • You can use templatized members i.e., generic members instead of overriding the members.

    You can also declare a VARIANT(COM) like union.

       struct MyData
       {
            int vt;              // To store the type
    
            union 
            {                
                LONG      lVal;
                BYTE      bVal;
                SHORT     iVal;
                FLOAT     fltVal;
                .
                .
            }
       };
    
    strager : And if you want more functionality for a certain class (similar to subclassing), can he use template specialization?
    Vinay : yes he can specialize the templates
    OJ : This technically isn't overriding ;)
    Vinay : No need to override the members if members are generic for his case. Moreover it is a bad practice to override the members.
    OJ : Totally agree (see my answer below). Changing meaning of data members is a fail. But creating template instances isn't overriding :)
  • private means that the data cannot be touched, even by derived classes. Protected means that the derived classes can use the data-- so the length of class A won't affect length of class B. Having said that, it's probably best to have a virtual function GetLength() that's overridden by the derived class.

    (as has been pointed out, I'm wrong-- you can't use GetLength on different types, so if the base class is int and the derived class is float, then that's not going to work).

    strager : You cannot change the signature to override a virtual member function. Doing so would create a different virtual function.
    mmr : Maybe I'm explaining it badly-- if you have a virtual member function, the derived class can override the virtual function. The derived class then uses the derived method.
    strager : I know that. However, try compiling "virtual int GetLength()" in class A and "virtual float GetLength()" in class B.
    mmr : ah, good point. My bad.
  • 1) No you can't. You can create your own internal/hidden/private members, but you can't overide them.

    2) If you could, not it wouldn't be good practice. Think about it ;)

    3) You shouldn't, as you're changing the meaning of the member.

    strager : Think about virtual functions: aren't you changing the meaning of a call? However, I still agree with you; functions are valled, but members are used.
    OJ : I agree with redefining behaviour based on type. I do not agree with changing the underlying meaning of a data item. :)
  • While declaring a data member of the same name in a derived class is legal C++, it will probably not do what you intend. In your example, none of the code in class A will be able to see the float length definition - it can only access the int length definition.

    Only methods can have virtual behaviour in C++, not data members. If you would like to reuse an existing class with another data type, you will have to either reimplement the class with your desired data type, or reimplement it as a template so you can supply the desired data type at instantiation.

  • 1) yes it is allowed, as in, you can do it

    2) No! bad practice. If someone calls a method that use 'length' the variable being returned will be undefined.

    3) Try a different design. Perhaps you want to have a similarly named function or use the baseclass as a "has-a" class instead of an "is-a" class.

Does outsourcing make you worry about the security of your job?

Everyone says that IT work (the technical stuff like programming, etc) is always outsourced to India because the cost of living there is less, and thus the price of work (especially be freelancers) is therefore a lot less than someone doing the work in a developed country like the UK/USA. Being Indian myself (but living in the UK), I can vouch for the cost of living being less in India.

Do you therefore worry that the work we do and the number of jobs available is at risk?

My view is that there is more to choosing a supplier of solutions than just the cost. Companies in India may be cheaper but my dad works for an airline who is set to make its first loss in several years. They get work done by a company quite local to me (5 miles away), where I went for an interview a few weeks ago. This company (a startup too) probably charges more to ensure they make a profit. So if a loss-making company is choosing a supplier who is likely to set a higher price, then there is more at stake than getting work done by a company in a country with a low cost of living.

However, what is the freelance market like?

Also, I guess sometimes you need a coder who is physically onsite and at hand. It will be annoying and, in big companies, a major problem if you have some technical issue but have to wait 10 hours for the country on the other side of the world to wake up to fix the problem. Time is money. Am I right to think that server admin work is less outsourced? I say this because that line of work probably involves physical interaction with the server boxes, which obviously can't be done overseas.

Interestingly, there is now a lot of disruption about our jobs being given to workers from abroad who would settle for a lower wage, which is an important issue given unemployment rates/recession etc. It would be stupid to create more jobs and they are taken by legal immigrents.

However, a search of programming jobs in London results in thousands, but only 100 for accounting jobs (a profession which can be easily outsourced because I don't see where the need for a physical accountant is required).

What's your view? Is this a reason to worry about the safety of your job?

From stackoverflow
  • I'm in no danger of being outsourced, but whether my job will survive the economy is another matter.

  • Your job will be safe as long as what you do is relevant, simple as that.

  • It does not.

    One of the twelve principles of the Agile manifesto is:

    "The most efficient and effective method of conveying information to and within a development team is face-to-face conversation."

    Though some might see their work move offsite, those that follow certain Programming principles will always favor working in close quarters with colleagues, and this should give most of us some measure of hope.

  • It may depend on previous experience and whether the company as been "burned" before... In my company, we experimented with 3 different delocalized development teams a few years ago, it it went quite wrong (only one team - the one in headquarters - survived) - and these teams weren't even far apart (two different towns in Austria plus one in Germany), in the same time zone speaking the same language. Thus I'm pretty sure that outsourcing development will not be an issue for me :-)

    I've also seen the problems that some developers had when talking to a support person for some software we use who worked in India - since both were non-native English speaker (and apparently both had quite an accent), the conversions were really difficult and several misunderstandings occured. However, this may be less of an issue for native speakers.

  • Your job might change, but it will not disappear. More and more development work is required, it might be that in the future you manage a team of developers in India. Get ready for that, because that isn't a simple task.

    I notice that developers in India are very different from the local ones. They never say 'no', which leads to just hacking around crap to get stuff done within the deadline. Sometimes this is good, most of the times this means a lot of extra costs later on, to refactor all the crap. A lot of them are not that high skilled as you might think. Still there might be very good ones.

    But they are not here sitting next to the customer experiencing their needs. For some tasks this isn't required, for some it is. The amount of tasks where it is required might decrease in the future. But there is a lot of development work required in the next few years. I think this will probaly equal to the current workforce that is not working outsourced.

    dotnetdev : Funnily enough my dad manages a team of devs in India. Being a project manager and managing devs with Lotus Notes dev skills (the company I described who work for the company my dad works for does ASP.NET, C#, SQL Server etc).
  • Outsourcing is very different to working with a local team. To be able to work effectively with an outsourced team/company (and not end up regretting it) you need to have all the following in place before anything starts, at a bare minimum:

    • Specification (very, very detailed)
    • Acceptance criteria (use cases, automated tests)
    • Milestones
    • Coding standards (and ways of verifying, e.g. FxCop, StyleCop)

    This simply isn't possible on many projects because the spec can't be known in its entirety at the start. This is particularly true with things such as consumer websites where there's typically a fairly fast feedback cycle from user comments and usability studies, which can change the direction, priorities, and milestones of a project on short timescales.

    In addition, getting a very detailed spec along with all the acceptance criteria and tests can be very time consuming and expensive. And often you need to write the acceptance tests yourself and/or use another outsource company to do them so you know the results haven't been 'faked' (and yes, this does happen). And even then you still need a core team of product managers, dev leads, etc. to manage the offshore team while the project is under way. In my experience this can end up more expensive than doing it onshore in many cases, and many companies are starting to realise this.

    So no, I'm not worried about either losing my job, or having my job change to being the manager of an offshore team. Any fast moving projects that require interpretation of the spec and feedback loops with the product team and users will always need good onshore developers. And those are some of the most interesting projects to work on.

    eglasius : I disagree, specially as our teams work remotely, don't use that ton of overhead and ship effectively, with high quality and good code to clients. Of course, india rates are a third than mine :P :(
  • Problem is, developers for the most part don't make the decisions about whether or not it is cost-effective to outsource or not...managers do. And most managers, at least the higher-up ones are paid based on their short term performance, not the long term success of the company.

    90% of the people that aren't worried about their job being outsourced are kidding themselves (or have there head stuck in the sand) and they SHOULD be worried about it...or maybe just that final 10% is here on stack overflow.

  • Having worked on four projects in the last year that each had elements of outsourcing, the answer is a definite no.

    The biggest problem was time zone issues,

    None of the companies will repeat the experience and in future will only work with local developers.

    However, the new trend around here seems to be getting outsourcing companies to send their staff here to work locally. They are still paid at outsourcing rates.

  • If you work for a company whose main product is software, it doesn't make sense for them to outsource that software. That is their bread and butter, you just don't do it. Joel Spolsky made a statement which hits the issue dead on:

    If it's a core business function -- do it yourself, no matter what.

    Pick your core business competencies and goals, and do those in house. If you're a software company, writing excellent code is how you're going to succeed. Go ahead and outsource the company cafeteria and the CD-ROM duplication. If you're a pharmaceutical company, write software for drug research, but don't write your own accounting package. If you're a web accounting service, write your own accounting package, but don't try to create your own magazine ads. If you have customers, never outsource customer service.

    In his essay “The Pitfalls of Outsourcing Programmers”, Micheal Bean says companies have confused the chocolates with the box they come in.

    Why Some Software Companies are Confusing the Box for the Chocolates

    Recently, I bought some chocolates as a gift for some friends from a specialty shop. These chocolates are remarkable. Owner Jean-Marc Gorce makes them by-hand and his small shop has been rated as one of the top ten in the United States. In addition to being a chef, Jean-Marc is also an entrepreneur and an innovator.

    Jean-Marc recently started selling his chocolates in gold and blue boxes. I told him I liked the new boxes. He explained that his wife designed the boxes and he found a company in the Philippines that could produce the boxes in the small volume they needed for a good price.

    Jean-Marc’s gold and blue boxes are an example of successful outsourcing. Jean-Marc sells chocolates, not boxes. The design and production of chocolates is his core competency. Jean-Marc can outsource box production to improve his operational efficiency without sacrificing his reputation as a maker of superlative chocolates.

    While outsourcing boxes improves chocolatier Jean-Marc’s operational effectiveness, he would never consider outsourcing chocolate production because he would lose his core differentiation advantage. Yet, in their enthusiasm for cost savings, several US technology companies have done precisely that-- outsourcing their core technology and key strategic differentiator.

    So yes, if you are writing software for a non-software company then you stand to lose your job to outsourcing. However, if you find employment at a company that writes software as their core business then you are safe. No smart business would outsource their main competitive advantage.

    Phil : Nice comment and hit the point! Here is a joke for you. Try telling this to IBM that went to the extent of requesting American workers to emigrate to India and accept the pay native Indian developers get. $$$ this quarter has more power than long-term business viability evidently to some managers.
  • Time and execution risk are critical considerations in offshore development -- not just money. Anyone who has an opportunity to do so, should reiterate this point with stakeholders.

    All points raised so far about team communication are spot on, too.

    Actually, I've taken on work that was badly botched through outsourcing, with clients that finally realized that it was -- at least in their case -- a false economy. In one case the project was plagued with communication lapses and language barriers, but more importantly, the project was not properly specified, and there were no standards for workflow or coding. No one offshore noticed or cared. They just cobbled up some code that sort of did what they understood it should do (without any consideration for error handling, maintainability, best practices, or documentation). They just chucked it back over the wall -- here ya' go! And the client got what they paid for.

    Now, this may not be typical, and it could happen with a local team -- but it certainly would have not gone on as long as it did if it had been a local team.

    eglasius : @Clayton I agree with the overall info, but there are public examples of it going on long in big projects executed in the us. bottom line, it can go on wrong anywhere. +1 for not throwing the money on cheap rates that isn't saving anything.
  • I wouldn't count on the rates in India continuing to be significantly lower than the US and Europe. A modest condo in Bangalore goes for $250k these days.

    Unless you can outsource and pay < 30% of your current development costs, you will lose money.

  • I worked for a company that make a bit bet on outsourcing to India. Our company lost the bet very nearly sunk. Our company partnered with an Indian outsourcing firm and ramped up an office of more than a hundred developers in about two months, purportedly a CMM level 5 company (ha ha). I hear that these outsourcing firms don't get the best developers. The productivity of the teams was miserable. We sent one project over there that cost us half a developer onshore, and the offsshore team took 4 people, plus about a half-person onshore. After the offshore offices were shut down, we ended up re-writing most of the work that was done offshore.

    I'm not sure our experience was typical. We made a lot of mistakes. Most of the domain knowledge and technolgy experitise was still onshore, and we shipped the 'coding' offshore - which does not work (duh).

    I expect to see more development going off-shore, so I think there is reason to worry about keeping a particular job. I see the market for developers becomming increasingly global, and we're already seeing accounting, legal and other work moving offshore, however there will always be a market for local developers, especially for small projects and customers who value close interaction. I believe there will always be work, but the nature of the develpment may change, and we have to keep learning and be prepared for the shifts when they come.

    eglasius : that's the thing, no. of developers != value produced, and rate/hour != savings/hour. It varies a whole lot, and that's something that is just hard to deal with for everyone, clients and providers. It really gets in the way, when your rate is 3 times theirs, but the client hasn't gone through that.
  • A company really has to know what they want to have it built over-seas. If the specs could be provided along with the proper testing of the application, it could work. Most companies are not capable of this.

  • Worst case I just move to India.

    kenny : +1 lately my thought as well or another lost cost-of-living place.
  • Yes. I think we should worry about outsourcing. Most failures are due to the lack of understanding of how distributed development should work. There will be better commnucation, better spec, better tools, better team-building experience and gradual transfer of domain knowledge in the future. Capitalism will make outsourcng work eventually.

  • When I was working for an American web dev company the outsourcing failed. The communication barriers from language and geographic location were too much.

    So I don't think outsourcing of programming jobs from the US to other countries is a problem. What IS a problem is companies located in other countries making competing products (like Japan w/ the auto industry). This probably will be an issue because the programming culture is much stronger in other countries than in the US.

  • In a new market, wages creep up to match demand. Our company actively maintains groups in several regions, including India. Plans to save money by hiring in India were dashed when it was discovered that engineers would stay on long enough to receive domain training and build contacts, then would leave for a more lucrative position with a local competitor.

    So now, we have engineers in India, but only because they are good, not because they are cheap.

    The same story is playing out (for us) in Egypt right now.

  • I don't see outsourcing as a big concern about the safety of my job for a few reasons:

    1. My currrent job may be static, but I am not. The job I want will likely change over the course of time and I'll want to change what I do. For example, 10 years ago the web work I did was in Visual Studio 6.0 using C/C++ that has changed drastically between then and now. Do I expect just as big changes in the next 10 years? Why not, it makes sense that there should be these big shifts every so often so why not try to roll with it rather than try to be the hamster on the wheel that goes nowhere fast. I know that my mother and father managed to have their work be repetitive work over and over but that wouldn't work so well for me. My father delivered dairy products while my mom was a nurse for a centre that houses some developmentally disabled individuals.

    2. There will be some work done onshore by a few different entities: Consulting firms will still be around but may have a combination of workers from various countries and then there are the big IT departments that companies have that I don't really see going away for those industries with a fair amount of regulation. For example, I don't think I could see any of Canada's big banks using another company for all IS functions as that would leave them way too open to potential lawsuits and other headaches that are avoided by having customized systems that are almost always in a state of upgrade as there are better ways to do things that people are finding.

    Another point is that while I would imagine most people could program if given the proper incentives(picture holding people's families hostage and threatening harm if the code that is done contains bugs for a rather extreme example of this), that isn't realistic in most cases and so the tiny slice of the population that likes building systems or finding solutions to problems will be the ones having the jobs doing things that other people don't want to do.

windows live id web authentication sdk giving Java App server error

I'm making a website in c# .NET and using the windows live id web authentication sdk for my logins. I'm trying to deploy the site using server 2003 and IIS 6.0, but I'm getting the following error, when redirecting from the login page to webauth-handler:

"HTTP Status 405 - HTTP method POST is not supported by this URL type Status report messageHTTP method POST is not supported by this URL descriptionThe specified HTTP method is not allowed for the requested resource (HTTP method POST is not supported by this URL).

Sun Java System Application Server 9.1"

This used to work fine when developing on localhost, but broke once I tried to deploy my website. When I deployed my site I set up a new project on lx.azure.com, and added the application id and secret key to my web.config.

I'm confused by the Java error, as I have no Java application server running, and don't use Java on the server at all !

If anyone knows why this may be happening, I would really appreciate your knowledge :)

From stackoverflow
  • The problem was with my url forwarding - it was putting a frame into my html, so the error was most likely occurring on the domain name companies site, hence the java error.

Can I use a RAM disk to speed up my IDE?

Duplicate:

RAMDrive for compiling - is there such a thing?

I have an idea how to speed up my IDE.

I want to create a RAM disk and move my solution onto this virtual disk.
I think that this can speed up the IDE because RAM is much faster than a HDD.

Has anyone done this before?

PS: I think, when I have some documents in my program(real world) which are used frequently(for example some document templates) it could be good idea to move these documents onto a RAM disk as well to speed up I/O. Am I wrong?

If power is a problem, a UPS could solve it.

From stackoverflow
  • I have a 128GB Samsung flash based hard drive and it is FAST. My whole system, VM and IDE included, load in less than one minute.

    : Are you being sarcastic?
    Otávio Décio : Not really. It is a Dell Precision laptopt with 8GB memory, XP64, 128GB flash drive, Extreme processor. Darn fast, honest.
  • I do remember reading about doing this with netbeans a while ago. This article has quite a good guide on doing it in linux.

    NetBeans on speed

    Currently can't find an article on how to do it in windows, however I know it's possible.

  • Personally I'd just buy a SSD disk, you could lose your whole soln at any time if your ram loses power.

    Right now I have 4gb of ram and a 150gb 10k rpm velociraptor hard drive for my boot disk, running win xp pro 64bit and everything(VS 2008, sql management studio, and my testing VM's) is very fast.

  • Honestly, if you have Vista/Windows Server 2008 x64 and you jam your workstation with 4 to 8 GB of RAM, for most tasks, everything will be in cache or stored by SuperFetch, which will be a lot easier to manage and just about as high performance as a RAM disk. The RAM disk won't do a thing for you if you're starving your other system RAM to make it work.

    BTW, I tried your suggestion a couple of years ago. While it technically worked, copying the necessary data to the RAM disk on every boot took too long and was a pain.

  • Given sufficient RAM, this problem's been solved for a long time. If you have lots of RAM, stuff from the HD gets cached in it anyhow, and the HD is only the bottleneck the first time you're loading something at boot. As far as the initial boot time, I'd suggest using sleep/suspend mode and simply not rebooting your computer frequently.

  • I just read a post on this very subject: http://nesteruk.org/blog/post/Cheap-way-of-speeding-up-Visual-Studio-IO.aspx

    Dmitri Nesteruk : He-hey, that's my blog! Needless to say, I've been doing this for quite some time.
  • I have this one with 8GB attached, and it's so sweet ;) Dual SATA RAID0, it knocks the socks off SSD's.

  • This might not buy you much. If you use up memory with your RAM disk, you just going to deprive the OS RAM for virtual memory, and that is going to be causing more frequent page faults and thus potential more writing to the hard disk.

    You could loose your whole soln at any time if your ram looses power.

    Element is absolutely right. Your machine could lock up at at any time for whatever reason. If you do decide to use RAM disk at least have a batch file on your desktop that copies everything to disk, and run it frequently.

  • I posted an answer to a similar question previously. As a summary: yes it's possible, I used to do it with my browser (there is a link on how to get it running under linux).

    As other people have mentioned if you have a tonne of RAM that stuff will be cached for you anyway, but imo having a ram drive is a bit more explicit than just letting the OS try to deal with it.

    If you know that you want 200mb of code in memory all the time then you know you can put in a ram drive and acheive that.

    I do wonder however if the OS will cache it twice (once on the ram drive, once itself) if it doesn't know it's on a RAM drive...

  • Under Linux /dev/shm is a ramdisk so you might have some quick success using that as your compile destination (easier than rsyncing your source etc, also has the benefit, if you have one, of reducing any wear on an SSD in your machine).

How can I execute Python code without Komodo -ide?

I do that without the IDE:

$ ipython
$ edit file.py
$ :x (save and close)

It executes Python code, but not the one, where I use Pygame. It gives:

WARNING: Failure executing file:

In the IDE, my code executes.

From stackoverflow
  • If something doesn't work in ipython, try the real Python interpreter (just python); ipython has known bugs, and not infrequently code known to work in the real interpreter fails there.

    On UNIXlike platforms, your script should start with a shebang -- that is, a line like the following:

    #!/usr/bin/env python
    

    should be the very first line (and should have a standard UNIX line ending). This tells the operating system to execute your code with the first python interpreter found in the PATH, presuming that your script has executable permission set and is invoked as a program.

    The other option is to start the program manually -- as per the following example:

    $ python yourprogram.py
    

    ...or, to use a specific version of the interpreter (if more than one is installed):

    $ python2.5 yourprogram.py
    

My site has to support multiple languages, how do I route in rails?

I have several resources and I want to somehow have a :lang parameter in the header. So /en/posts/ would direct to posts_controller/index with params[:lang] == en.

How is this usually done? It looks ugly to have to add ?lang=en on every link and feel very un-railsy.

I think you know what I'm talking about even if I'm not very clear, what is the norm here?

From stackoverflow
  • One way of doing it would be:

    map.resources :yourresources, :path_prefix => '/:lang'
    

    You can also add language parameter filter:

    map.resources :yourresources, :path_prefix => '/:lang', :lang => /(en|de|jp)/
    
    ique : How would i then go about creating links with the resource? Would i have to do link_to myresource_path(:lang => "en") or could i set some sort of standard language to use when no argument is given?
    Milan Novota : Yes, you'd have to pass some language into the link helper. However, you can set a default language in the environment.rb (as a constant) and then create a method (say get_language) in Application controller that will return this default value if params[:lang] is not set.
  • Seems like the newest feature scheduled for Rails 2.3 is right up your alley: http://afreshcup.com/2009/02/01/rails-23-localized-views/

    Orion Edwards : While cool, this doesn't address routing...
  • Aren't you supposed to eschew routes entirely, and set language based on the browser's HTTP Accept-Language header? See Here.

    I'd imagine you should give your users an option to change their language, and then store that value in a cookie, which could then be pulled out in a before_filter.

    Why do this? Well, "HTTP best practice" states that each resource should have one URI. An article is still the same article, whether it's in spanish or english, so should have the same URI. site.com/en/article and site.com/es/article are clearly not the same URI, which violates this principle

    ique : But not beeing able to link the correct language would cause people who visit a page to think they've come to the wrong page? If you speak english and get a link from an english friend and then come to a page that's filled with swedish. One would be quite confused?

What is the best way to implement an AJAX main menu?

I'm building a site using ASP.NET MVC with lots of jQuery and AJAX stuff, and I'd like the main menu to work with AJAX as more or less the rest of the site does.

In an ideal scenario, I would like my main menu to 1) load the main content with AJAX if the user has activated javascript 2) change the url in the address bar (to enable link copy-pasting) 3) have my code in only one place, meaning that I don't want to have the same markup in an .aspx View and an .ascx PartialView.

Number 1) I have no problems with. However, I have no idea how I do to accomplish number 2) without a reload of the page. Any ideas?

I realize that the third issue could be solved by creating a View that renders each PartialView, but is there no nicer way around that? Some way to "wrap" the PartialView in the site Master or something at the Controller, before returning it to the client?

From stackoverflow
  • For #2: You can add a #hash to the end of the url: example in your menu:

    <a href="#helppage" onclick="opento('helppage')">Help Page</a>
    

    And then in your body on load:

    if(document.location.hash) { opento(document.location.hash); }
    

    For #3 I don't know ASP. Sorry.

    Tomas Lycken : Well, as I'm using ASP.NET MVC, all my urls will look like example.com/Home/About or example.com/Products/List - in other words, they need to actually point to different locations. Do you know any way to change the address bar's actual location, without loading the new page?
    Isaac Waller : There are libraries that do this and create urls like: example.com/#/Home/About using the technique I described above. Maybe if this is sufficient. If worst comes to worst, you could just create a giant Iframe that takes up the whole page, but uses my technique to add a hash to the main url. Isaac
  • I'm inclined to agree with Rob (though I won't vote you down ;)). JavaScript techniques like Ajax shouldn't be core to your site without good reason. I'd recommend searching Google for terms such as 'progressive enhancement' and 'unobtrusive javascript'.

    Build a nice RESTful site and then enhance with JavaScript and Ajax in places where it enhances the user experience to a significant degree.

  • Though I agree with some of the other comments about not loading content via AJAX for the sake of it, #2 in your list is a common problem that often crops up when dealing with AJAX and is worth answering.

    The only way to change the URL without the browser reloading is by adding a # to the end . Example:

    http://www.yoursite.com/Content/About/#some-identifier
    

    There is no other way. You can look at sites like Facebook and Google Mail/Reader to see an example of this implemented.

    Hope it helps...