# Search Results

• ### How do I adjust the origin of rotation for a group of sprites?

##### - by Jon
I am currently grouping sprites together, then applying a rotation transformation on draw: private void UpdateMatrix(ref Vector2 origin, float radians) { Vector3 matrixorigin = new Vector3(origin, 0); _rotationMatrix = Matrix.CreateTranslation(-matrixorigin) * Matrix.CreateRotationZ(radians) * Matrix.CreateTranslation(matrixorigin); } Where the origin is the Centermost point of my group of sprites. I apply this transformation to each sprite in the group. My problem is that when I adjust the point of origin, my entire sprite group will re-position itself on screen. How could I differentiate the point of rotation used in the transformation, from the position of the sprite group? Is there a better way of creating this transformation matrix? EDIT Here is the relevant part of the Draw() function: Matrix allTransforms = _rotationMatrix * camera.GetTransformation(); spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, allTransforms); for (int i = 0; i < _map.AllParts.Count; i++) { for (int j = 0; j < _map.AllParts[0].Count; j++) { spriteBatch.Draw(_map.AllParts[i][j].Texture, _map.AllParts[i][j].Position, null, Color.White, 0, _map.AllParts[i][j].Origin, 1.0f, SpriteEffects.None, 0f); } } This all works fine, again, the problem is that when a rotation is set and the point of origin is changed, the sprite group's position is offset on screen. I am trying to figure out a way to adjust the point of origin without causing a shift in position. EDIT 2 At this point, I'm looking for workarounds as this is not working. Does anyone know of a better way to rotate a group of sprites in XNA? I need a method that will allow me to modify the point of rotation (origin) without affecting the position of the sprite group on screen.

##### - by Jon Egerton
I have a problem with a system I develop related to IE8 downloading over SSL (ie on sites using https://...) and is described on this MS kb article: http://support.microsoft.com/kb/323308 We use the HTTPCacheability.NoCache option as the data being downloaded is sensitive, and is downloaded from a secured site. I don't want that data to be cached on any of the proxies etc that the response passes through back to the client. The article describing the issue details a fix to the client side registry changing a BypassSSLNoCacheCheck setting. I don't want to loosen the system security just for IE8, as the system works fine on anything more upto date. Getting all the clients to apply the hotfix is difficult at best, and impossible at worst. We need to support IE8 in the system, at least for now. So: 1: Does the detailed hotfix have any implications for the security at the browser end in IE8 - does it mean the file will be cached? (in a place other than where the user saves the file). 2: Is there some way I can get these files downloadable with a change at the server end that doesn't break the security side of things?

• ### What's the best way to explain branching (of source code) to a client?

##### - by Jon Hopkins
The situation is that a client requested a number of changes about 9 months ago which they then put on hold with them half done. They've now requested more changes without having made up their mind to proceed with the first set of changes. The two sets of changes will require alterations to the same code modules. I've been tasked with explaining why them not making a decision about the first set of changes (either finish them or bin them) may incur additional costs (essentially because the changes would need to be made to a branch then if they proceed with the first set of changes we'd have to merge them to the trunk - which will be messy - and retest them). The question I have is this: How best to explain branching of code to a non-technical client?

##### - by Jon
I have no problem downloading WUBI either using Firefox or IE. Either way, however, when I try to run or open it, I get a message to the effect that the file cannot run because the configuration is incorrect and "re-installing the file may help" (which it doesn't - I've tried several times). What am doing wrong ? I am running XP Pro. (Note: my Ubuntu CD works just fine but I want to install Ubuntu inside Windows).

• ### Can I install Natty alongside Maverick and retain my encrypted /home partition?

##### - by Jon
This is my partitioning scheme: 10GB partition empty -- will be installing Natty here 10GB partition containing Maverick 2GB swap partition 300GB encrypted /home partition I've had few problems in the past with having two ubuntu installs on two separate partitions, giving /home it's own partition, but I'm a little concerned since I'm now using an encrypted /home partition. Install won't try to wipe my /home if I click " encrypt home directory," will it?

• ### How can I restart compiz from tty? (& Related, how can I set up a fallback WM?)

##### - by Jon
So I'm testing Natty, and Compiz keeps crashing on me. I expect this sort of thing from alpha software, of course, but it doesn't always give me the option to restart compiz, and for some reason doesn't have a fallback WM configured. Without a window manager, all my programs are still running, but they're not accepting input from the keyboard, and I can't switch between them. I can, however, press Ctrl+Alt+F1 and get a terminal, and I can killall Xorg to reset everything, but I'd rather just reset compiz if possible. If I try typing compiz --replace there in the tty, it complains "fatal--couldn't open display." Is there a way to have tty1 restart compiz? Like compiz --replace --display=something? Additionally, is there a way to configure a fallback window manager so that there's an easier way to recover from compiz crashing?

• ### What to do?! Upgrading from 12.10 to 13.04 failed :(

##### - by Jon Ramirez
I got an update reminder to go from 12.10 to 13.04. I followed the instructions, was able to download the package, and started installing. Up to a point where my computer (seemed to) restart and there was just a black screen (with the backlight on) for more than an hour. Then I decided that this was too long for an installation and forced my laptop to shut down. I think that messed it up. Now I'm stuck in what seems to be 13.04 with bits of 12.10 in it. I tried to upgrade again through software updater but it goes to Partial Upgrade. But when I try that, I get this error message: "An upgrade from 'raring' to 'quantal' is not supported by this tool." Help! What should I do! I'm running my Ubuntu on my Dell Inspiron.

• ### What do you look for in a scripting language?

##### - by Jon Purdy
I'm writing a little embedded language for another project. While game development was not its original intent, it's starting to look like a good fit, and I figure I'll develop it in that vein at some point. Without revealing any details (to avoid bias), I'm curious to know: What features do you love in a scripting language for game development? If you've used Lua, Python, or another embedded language such as Tcl or Guile as your primary scripting language in a game project, what aspects did you find the most useful? Language features (lambdas, classes, parallelism) Implementation features (performance optimisations, JIT, hardware acceleration) Integration features (C, C++, or .NET bindings) Or something entirely different?

• ### Move Joomla website to new folder

##### - by Jon
I currently have a website. I have created a new folder on the website called V2. Under this folder I have installed Joomla and configured my new looking site. I now want to make V2 the default website. I could point the website to that V2 directory however I have other folders under the current root website that I need to keep. How can I transfer V2 to the root of my website? Is it just a case of copying all the files?

• ### How do I get the Netgear N150 USB wifi adapter working on 12.04?

##### - by Jon
Just installed latest version of ubuntu. I'm using a Netgear N150 Wireless USB Micro Adapter WNA1000M which keeps asking for network password over and over. I read elsewhere that I needed to install the latest driver for my chipset (RTL8188CUS) which I have and still no joy. If I run the steps listed in this thread while connected through ethernet, the wireless will connect just fine. If I disconnect the ethernet, the wifi will even continue to work, but after a restart or two I will lose connection. If I repeat the steps listed in the aforementioned thread, it will not re-connect wifi unless I run those steps while connected to ethernet.......so strange...

• ### Is there a language more general than Lisp?

##### - by Jon Purdy
I've been programming for a long time, and writing in Lisp (well, mostly Scheme) for a little less. My experience in these languages (and other functional languages) has informed my ability to write clean code even with less powerful tools. Lisp-family languages have lovely facilities for implementing every abstraction in common use: S-expressions generalise structure. Macros generalise syntax. Continuations generalise flow control. But I'm dissatisfied. Somehow, I want more. Is there a language that's more general? More powerful? As great as Lisp is, I find it hard to believe no one has come up with anything (dare I say) better. I'm well aware that ordinarily a question like this ought to be closed for its argumentative nature. But there seems to be a broad consensus that Lisp represents the theoretical pinnacle of programming language design. I simply refuse to accept that without some kind of proof. Which I guess amounts to questioning whether the lambda calculus is in fact the ideal abstraction of computation.

• ### What are some reasonable stylistic limits on type inference?

##### - by Jon Purdy
C++0x adds pretty darn comprehensive type inference support. I'm sorely tempted to use it everywhere possible to avoid undue repetition, but I'm wondering if removing explicit type information all over the place is such a good idea. Consider this rather contrived example: Foo.h: #include <set> class Foo { private: static std::set<Foo*> instances; public: Foo(); ~Foo(); // What does it return? Who cares! Just forward it! static decltype(instances.begin()) begin() { return instances.begin(); } static decltype(instances.end()) end() { return instances.end(); } }; Foo.cpp: #include <Foo.h> #include <Bar.h> // The type need only be specified in one location! // But I do have to open the header to find out what it actually is. decltype(Foo::instances) Foo::instances; Foo() { // What is the type of x? auto x = Bar::get_something(); // What does do_something() return? auto y = x.do_something(*this); // Well, it's convertible to bool somehow... if (!y) throw "a constant, old school"; instances.insert(this); } ~Foo() { instances.erase(this); } Would you say this is reasonable, or is it completely ridiculous? After all, especially if you're used to developing in a dynamic language, you don't really need to care all that much about the types of things, and can trust that the compiler will catch any egregious abuses of the type system. But for those of you that rely on editor support for method signatures, you're out of luck, so using this style in a library interface is probably really bad practice. I find that writing things with all possible types implicit actually makes my code a lot easier for me to follow, because it removes nearly all of the usual clutter of C++. Your mileage may, of course, vary, and that's what I'm interested in hearing about. What are the specific advantages and disadvantages to radical use of type inference?

• ### Fan very loud in Ubuntu 12.10

##### - by Jon
I recently installed 12.10 on my Desktop PC, moving away from Windows 7. For some reason, the fan in my computer is making an enormous amount of noise (it is running at full speed constantly). Under Windows 7, the fan would slow itself down and run at an acceptable noise level. Now, it is nearly unbearable. Checked the processes, and none are taking up a huge load on the CPU. Please help as I really can't endure this noise, and I do not want to go back to Windows 7 on this box. Some specs: - Intel 2.26 duo core - ATI 4870 - 4GB - 650W power supply

• ### How do I access and enable more icons to be in the system tray?

##### - by Jon
So I'm messing around with Natty a little, and I noticed that all the apps that would normally use the system tray (or "notification area"?) aren't displaying there. Is that a bug, or is that the way it's going to be? I heard something about Ubuntu getting rid of that feature entirely. Is there a way to add it back? I mean, I didn't really like it, either, especially when there were apps that used it unnecessarily, but I can't use CryptKeeper at all now, or easycrypt, and I don't know whether Dropbox has synced without opening Nautilus.

• ### Implementing a ILogger interface to log data

##### - by Jon
I have a need to write data to file in one of my classes. Obviously I will pass an interface into my class to decouple it. I was thinking this interface will be used for testing and also in other projects. This is my interface: //This could be used by filesystem, webservice public interface ILogger { List<string> PreviousLogRecords {get;set;} void Log(string Data); } public interface IFileLogger : ILogger { string FilePath; bool ValidFileName; } public class MyClassUnderTest { public MyClassUnderTest(IFileLogger logger) {....} } [Test] public void TestLogger() { var mock = new Mock<IFileLogger>(); mock.Setup(x => x.Log(Is.Any<string>).AddsDataToList()); //Is this possible?? var myClass = new MyClassUnderTest(mock.Object); myClass.DoSomethingThatWillSplitThisAndLog3Times("1,2,3"); Assert.AreEqual(3,mock.PreviousLogRecords.Count); } This won't work I don't believe as nothing is storing the items so is this possible using Moq and also what do you think of the design of the interface?

• ### PHP, when to use iterators, how to buffer results?

##### - by Jon L.
When is it best to use Iterators in PHP, and how can they be implemented to best avoid loading all objects into memory simultaneously? Do any constructs exist in PHP so that we can queue up results of an operation for use with an Iterator, while again avoiding loading all objects into memory simultaneously? An example would be a curl HTTP request against a REST server In the case of an HTTP request that returns all results at once (a la curl), would we be better off to go with streaming results, and if so, are there any limitations or pitfalls to be aware of? If using streaming, is it better to replace curl with a PHP native stream/socket? My intention is to implement Iterators for a REST client, and separately a document ORM that I'm maintaining, but only if I can do so while gaining benefits from reduced memory usage, increased performance, etc. Thanks in advance for any responses :-)

• ### How can I have the passphrase for a private key remembered for a user?

##### - by Jon Cram
I have a collection of web services running on Ubuntu Server 12.04 that pull code from a github repository. These services run under a specific user (let's call that user 'example'). In /home/example/.ssh/is_rsa is the private key associated with the relevant github account. When performing an operation such as git pull I am greeted with: Enter passphrase for key '/home/simplytestable/.ssh/id_rsa':. Enter the correct password and all is ok. The same private key is present on local development Ubuntu Desktop 12.04 machines and no passphrase is asked for. I'd like to be able to have the passphrase remembered so that upon entering it once it is never asked for again. This will aid in automating various web service updates. I'm guessing that the passphrase needs to be stored in the relevant user's keychain such that I don't have to enter it every time the private key needs to be unlocked. How can I achieve this?

• ### How to get windows back? Lubuntu?

##### - by Jon
I installed lubuntu and I don't like it. I did a clean install to lubuntu rather than making it dual. Now when I want to go back to Windows it won't work. I put the Windows Vista CD in and it won't load. It just loads lubuntu back. I know for a fact that the CD works just fine. I don't know what to do? I did a little research and it says I deleted the windows loader or the partition. Can someone help me?

• ### Removing 301 redirect from site root

##### - by Jon Clements
I'm having a look at a friends website (a fairly old PHP based one) which they've been advised needs re-structuring. The key points being: URLs should be lower case and more "friendly". The root of the domain should be not be re-directed. The first point I'm happy with (and the URLs needed tidying up anyway) and have a draft plan of action, however the second is baffling me as to not only the best way to do it, but also whether it should be done. Currently http://www.example.com/ is redirected to http://www.example.com/some-link-with-keywords/ using the follow index.php in the root of the Apache2 instance. <?php \$nextpage = "some-link-with-keywords/"; header( "HTTP/1.1 301 Moved Permanently" ); header( "Status: 301 Moved Permanently" ); header("Location: \$nextpage"); exit(0); // This is Optional but suggested, to avoid any accidental output ?> As far as I'm aware, this has been the case for around three years -- and I'm sorely tempted to advise to not worry about it. It would appear taking off the 301 could: Potentially affect page ranking (as the 'homepage' would disappear - although it couldn't disappear because of the next point...) Introduce maintainance issues as existing users would still have the re-directed page in their cache Following the above, introduce duplicate content Confuse Google/other SE's as to what the homepage actually is now I may be over-analysing this but I have a feeling it's not as simple as removing the 301 from the root, and 301'ing the previous target to the root... Any suggestions (including it's not worth it) are sincerely appreciated.

• ### Calculating the rotational force of a 2D sprite

##### - by Jon
I am wondering if someone has an elegant way of calculating the following scenario. I have an object of (n) number of squares, random shapes, but we will pretend they are all rectangles. We are dealing with no gravity, so consider the object in space, from a top down perspective. I am applying a force to the object at a specific square (as illustrated below). How do I calculate the rotational angle, based on the force being applied, at the location being applied. If applied in the center square, it would go straight. How should it behave the further I move from the center? How do I calculate the rotational velocity?

• ### How can I store all my level data in a single file instead of spread out over many files?

##### - by Jon
I am currently generating my level data, and saving to disk to ensure that any modifications done to the level are saved. I am storing "chunks" of 2048x2048 pixels into a file. Whenever the player moves over a section that doesn't have a file associated with the position, a new file is created. This works great, and is very fast. My issue, is that as you are playing the file count gets larger and larger. I'm wondering what are techniques that can be used to alleviate the file count, without taking a performance hit. I am interested in how you would store/seek/update this data in a single file instead of multiple files efficiently.

• ### Is there a mirror for the daily Natty ISO (/daily-live/current) in Asia?

##### - by Jon
I've been trying to download Natty for days now, but either the internet here in Vietnam is totally shot or the Ubuntu CD server has a lot of traffic, because I can't get it to download faster than about 15Kbps. Does anyone know of a mirror, preferably close to Vietnam, where I could download (zsync) this image faster? Googling hasn't helped me, nor has Ubuntu's list of mirrors (I get stuck in a rabbithole of FTP folders, and nothing seems to point to the daily image).