Why do consoles have so little memory compared to classic computers?

Someone asked on Game Development:

I remember the Playstation having 2MB ram and 1MB graphic memory.

The Playstation 3 now has only 256MB ram and 256MB graphic memory, and I’m sure that the day the console was released, even laptop’s “standard” capacity was at least 1GB.

So why do they put so little memory in their machines, while developers would benefit a lot by having more ? Or is the memory that much faster than desktops and thus more expensive ? Or is it not that much worth it for developers ? What are the Sony/XBox/Nintendo engineers thinking that seems to be the same reason ?

I posted the following answer, which was chosen as the accepted answer and received 9 upvotes:

As @AttackingHobo said, the memory is very fast and expensive. Also, you must take into account that these consoles launched years ago, when memory and hardware prices were higher.

Another factor that goes into making consoles very performant on what appears to be very limited resources, is that since every console is identical, we as developers can take advantage of platform specific optimizations. On a PC you can’t do that as much, and thus you are required to have a beefer PC so it can brute-force its way through a similar unoptimized task.

That isn’t to say there is no optimization in PC games, but it is in different areas than consoles, and in general due to the wide range of supported hardware, it is less effective.


Originally posted on Game Development — 9 upvotes (accepted answer). Licensed under CC BY-SA.

How to replace value of a specific node in an XML string?

Someone asked on Stack Overflow:

My specific case is that I have an XML result from an ASMX service. I need to scan this XML string for a specific node and “ToLower()” the value in the node. I can’t access the service to simply change the return at that level.

I posted the following answer, which was chosen as the accepted answer and received 1 upvote:

Maybe something like this would help get you started: How to change XML Attribute


Originally posted on Stack Overflow — 1 upvotes (accepted answer). Licensed under CC BY-SA.

Windows 7 Virtual WiFi using C#?

Someone asked on Stack Overflow:

Windows 7 introduced Virtual WiFi which allows you to create hotspots. However I can’t find any tutorials on doing it in C#. I found Virtual Router (It is open source and is written in C#) but I can’t seem to figure out how it works because it has a lot of unrelated code since it is implemented as a service.

Can anyone explain how can I create a hotspot and assign IP addresses to clients? I don’t need features like ICS but I want to be able to broadcast gateway and DNS information.

There is also a closed source alternative called Connectify. I did manage to get its source but it didn’t help much. It uses an open source library but I don’t know how to create hotspots with it.

I posted the following answer, which was chosen as the accepted answer:

Have you thought about looking into this Code-Plex project Virtual Router?


Originally posted on Stack Overflow — 0 upvotes (accepted answer). Licensed under CC BY-SA.

Reload PartialView from jQuery in ASP.NET MVC 2 application?

Someone asked on Stack Overflow:

I’m trying to use jQuery to load a PartialView. It does this fine at the first loading of the page. But then I need to be able to reload the PartialView when a save button is pressed. I get a reload, but this time the PartialView is all I get back. I.e. I don’t get the PartialView loaded as a part of the main page, but rather as a page of its own. What am I doing wrong?

Here are the relevant parts of the jQuery in the View:

       $.get('<%=Url.Action("GetTasks", "Timesheet", new {id = DateTime.Today.ToShortDateString() }) %>', function (data) {
            $('#tasksDiv').html(data);
        }); //This part works fine on first load of the page

        $('#savenewtask').click(function (event) {
            event.preventDefault();
            $.get('<%=Url.Action("GetTasks", "Timesheet", new {id = DateTime.Today.ToShortDateString() }) %>', function (data) {
                $('#tasksDiv').html(data);
            });
        }); //This only loads the PartialView, but not as part of the main page...

The button and the div to load in:

    <p>
        <input type="button" value="Spara" id="savenewtask" />
    </p>

<div id="tasksDiv">
</div>

UPDATE:

It actually worked, I had just confused the two input fields I have on the page. But I’ll rephrase the question to a simple one: Is this the best way to do this sort of thing with PartialViews, or should I go about it another way? (I.e. I was just trying to figure out a way to achieve what I wanted without knowing if it is the “best practice” way of doing it).

I posted the following answer, which was chosen as the accepted answer:

I have typically used the load method, which sets the innerHtml.

var url = '<%=Url.Action("GetTasks", "Timesheet", new {id = DateTime.Today.ToShortDateString() }) %>'
$("#tasksDiv").load(url);
Notable comments

Nate (0 upvotes): I always go for the path of least resistance .load() provides that. There is no need for a delegate/callback and the syntax reads more clearly. “Take this div, and load the content of this url into it.” There is nothing wrong with doing a get+callback; I just found it to require more code; however, there may be instances where it is necessary over a simple .load() call, say if you wanted to process the return value before you display it…


Originally posted on Stack Overflow — 0 upvotes (accepted answer). Licensed under CC BY-SA.

&quot;System&quot; color for warnings (red)

Someone asked on Stack Overflow:

I want to use system colors when it’s possible. How to choose colors which aren’t included in system colors?

Both SystemColors class of WPF, SystemColors class of WinForms and COLOR_* constants for GetSysColor API function contain no colors which can be used for warnings. Warnings are usually red, but there’s no guarantee it won’t be close to the system colors the user uses.

I want to display items in a ListBox using standard system colors (usually black text on white background for unselected items, white on navy for selected, white on light gray for selected unfocused). When an item is problematic (for example, operation it relates to has failed), I want to make its text red to draw attention. Using single color for all three cases (selected, selected unfocused, unselected) is already problematic, because I find it hard to read red text on light gray background.

Using only custom colors and thus avoiding the problem is unacceptable behavior. Users expect programs to respect their settings.

How to choose correct color for warnings?

I posted the following answer, which was chosen as the accepted answer and received 3 upvotes:

Possibly a new approach is worth consideration. Using colored icons such as the windows event log. Keep all text consistent and use colored icons to visually distinguish different types of data.


Originally posted on Stack Overflow — 3 upvotes (accepted answer). Licensed under CC BY-SA.

FMP - Forcing Save of Field Edit

Someone asked on Stack Overflow:

I’m working on a FileMaker Pro 10 database. On a particular layout (“license”), there are several fields and a button. When the button is clicked, a certificate (layout) is displayed reflecting the data entered in the license layout.

If I edit a field, then immediately click on the “View Certificate” button, the changes just made to the field do not appear on the certificate. However, if I edit the field, then click on another field, then click “View Certificate,” the revised data is displayed on the certificate. Apparently, something about shifting focus to a different field triggers a data save.

How can I force this data save so that any time the user clicks on the button, the resulting certificate reflects the edits they have made?

Thank you,
Ben

I posted the following answer, which was chosen as the accepted answer and received 2 upvotes:

In the script that is called on your “View Cerficiate” button, try adding a “Commit Record/Request” script step.


Originally posted on Stack Overflow — 2 upvotes (accepted answer). Licensed under CC BY-SA.

Use Bing to geocode and Google maps api to display the map

Someone asked on Stack Overflow:

I have an application which is currently using the google map API. I like the maps much better, and I feel like you have more options with google maps. The problem is, Google maps has been very inaccurate when I give it an address to map, while Bing has been 100% on so far. I also like Bings Birds Eye view, but that’s not as important. My question is, can I use the Bing API to take the address that I give it, return a longitude and latitude and then give that to my existing Google map to plot the point. If so, how? I looked on Bing Maps, and I couldn’t find a good way to geocode an address. Below is my current google maps code

var map;
var directionsPanel;
var directions;

function initialize() {
  map = new GMap(document.getElementById("map_canvas"));
  map.setCenter(new GLatLng(41.1255275,-73.6964801), 15);
  directionsPanel = document.getElementById("route");
  directions = new GDirections(map, directionsPanel);
  directions.load("from: ADDRESS 1 to: ADDRESS 2 ");

          map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());

}

I want to replace ADDRESS 2 with the longitude and latitude which Bing gets

I posted the following answer, which was chosen as the accepted answer:

AFAIK, the Bing Maps Ajax Control does not support Geocoding. You will need to use their web services: SOAP or JSON or XML.


Originally posted on Stack Overflow — 0 upvotes (accepted answer). Licensed under CC BY-SA.

Which of these is the better architecture/design approach?

Someone asked on Stack Overflow:

Objective
To write a effecient Active Directory library to ease the work of technicals who are responsible to create access models into the domain controller’s Active Directory. This library must allow the following:

  1. Basic operations: Add, Modify, Delete, List entries;
  2. An entry may either be an organizational unit, group or user (no further need required as of now);

I thought about having a class which would represent the domain with which we want to work with.

public class Domain {
    public Domain(string root) {
        Root = root;
        Entries = new Dictionary<string, IDirectoryEntry>();
    }

    public string Root { get; private set; }
    public Dictionary<string, IDirectoryEntry> Entries { get; private set; }
}

Then, I have used dependency injection to enforce the belonging constraint to a domain of an entry. For example:

public abstract class DirectoryEntry : IDirectoryEntry {
    public DirectoryEntry(Domain domain, string name) {
        Domain = domain;
        Name = name;

        Domain.Entries.Add(name, this);
    }

    public Domain { get; private set; }
    public Name { get; set; }
}

public class OrganizationalUnit : DirectoryEntry {
    public OrganizationalUnit(Domain domain, string name)
        : base(domain, name) {
    }
}

public class Group : DirectoryEntry {
    public Group(Domain domain, string name)
        : base(domain, name) {
    }
}

Now, notice that I add the entry using Domain.Entries.Add() to the given domain upon instantiation of an IDirectoryEntry interface.

Questions

  1. Is this a good practice, if I don’t want the user to change the Domain property of any IDirectoryEntry instances?

  2. Would it be preferable to simply let this Domain.Entries.Add() line go away, and have a method within my Domain class that would add an entry to the domain?

Code Sample for question #2

public class Domain {
    //See above for other members.
    public void AddEntry<T>(T entry) {
        Entries.Add(entry.Name, entry);
    }
}

  • What is, according to you, the best architecture in this situation?

    Both seem to be good enough to be considered, so I’m a bit confused about it wanting the easiest possible way for the library end-users.

I posted the following answer, which was chosen as the accepted answer and received 2 upvotes:

Have you looked at .NET 3.5/4’s System.DirectoryServices.AccountManagement namespace? It provides much of the functionality you require in a more unified and .NET friendly interface. I personally have written a library with similar requirements to yours, using a combination of both.

Overall, I think your design looks good, but I don’t know enough about your problem domain to know if you’ll be painting yourself into a corner so to speak.

Specifically, to Question 1, I think that will work; however, anyone with a reference to an instance of Domain could remove any given Entry.

To Question 2, that is very likely how I would implement it myself, unless I had a compelling reason not to.

Notable comments

Nate (0 upvotes): I do not see any issue requiring a Domain object in the constructor of your other classes; while its tightly coupled, if you migrate off LDAP the concept of a Security Group and an Organizational Unit will likely go away and be replaced with something else.


Originally posted on Stack Overflow — 2 upvotes (accepted answer). Licensed under CC BY-SA.

How to embed content of the file in the C# code?

Someone asked on Stack Overflow:

Problem

I have a file which contains such text (nothing else)

2010-10-05

I would like to embed this file (content) in the C# code, so I could assign this text to constant (string MyDate), and later use this constant.

Background

What I try to achieve is keeping information about the program in sync — both on website and within program.

The solution has to be:

  • dead simple
  • automatic
  • smooth

The simplest I thought of, would be keeping file “version” with version (actually release date, because it is more meaningful IMHO), such file can be displayed on website with no problem (PHP). I think I manage writing tiny .bat file to auto-generate such file on each build.

But how to use it (embed) in C# code?

I would like to achieve exactly this, or alternative solution but no more complex than this one.

Workarounds

I already know several workarounds, like:

  • creating not only file with just date, but small C# piece of code, which could be directly compiled
  • including this file in installer and after installation reading it, to get the version info

But both do not feel “clean” too me. I need something more smooth :-)

Background of the background

My program should notify user “hey, there is newer version of the program” on one hand, on the other hand when browsing website info about release date should be displayed on page.

Facts

  • version: date of build which is also release date
  • website: Linux, HTML & PHP
  • program: VS 2010, C# 4.0, single exe
  • installer: Advanced Installer

Edit — solution

I tried to avoid the problem completely and rely on timestamps of the files — it could work, because only one weak point would be the case when you build exe before midnight and create installation package after. However, uploading files to ftp server ruins such plan — you have to make sure ftp server support timestamp modification and you cannot use SFTP protocol.

So, I ended up creating “version” file and not embedding it (because I don’t know how) — I read the content both by PHP script on website and by C# code when executing.

Thank you in advance for your help.

I posted the following answer, which was chosen as the accepted answer and received 1 upvote:

To solve the issue of checking for updates you could: use a WebClient to load a page from your site, and check the version information.

To solve the issue of displaying version information, you could simply leave a text file called versioninfo.txt in your installer, and load/display that at run time, or as stated by @Daniel you can use a resouce to compile the text file into the binary.


Originally posted on Stack Overflow — 1 upvotes (accepted answer). Licensed under CC BY-SA.

Making (or emulating) a &quot;D-Pad&quot; on a touch-screen; virtual d-pad

I asked this on Game Development:

With the proliferation of touch based devices, many lacking a true D-Pad, I’m wondering if anyone has any resources on how to emulate a D-Pad on a touch screen? I’m specifically interested in XNA and/or Android code examples.


Graeme Bradbury answered (5 upvotes):

There is an XNA sample of touch thumbsticks here

I would reiterate that a dpad is unlikely to be the right interface for a touch screen like device.

Something like what epic has done with Infinity Blade for the iPhone may give you inspiration Movie Link


Originally posted on Game Development — 12 upvotes. Licensed under CC BY-SA.

signed letter b

Dad. Geek. Gamer. Software developer. Cloud user. Old Car enthusiast.  Blogger.


Top Posts


profile for Nate on Stack Exchange, a network of free, community-driven Q&A sites
a proud member of the blue team of 512KB club
Thoughts, opinions, and ideas shared here are my own. © 2026 Nate Bross.