Search Results

Search found 11 results on 1 pages for 'mk12'.

Page 1/1 | 1 

  • How to set up www cname for free dyndns subdomain

    - by Mk12
    I have a free dyndns domain mk12.gotdns.com How can I set up a cname for www.mk12.gotdns.com to point to mk12.gotdns.com? And how can I force the www one, so that if you navigate to mk12.gotdns.com, it will go to the www one? Note: I don't mean html redirecting, but I think you can do it with url rewriting somehow, something like described here. I've seen many tutorials, but they just vaguely say that you have to enter a cname record, I have no clue what file I need to put it in. Also, please see my question http://stackoverflow.com/questions/1618998/apache-url-rewriting-wont-work about getting url rewriting to work.

    Read the article

  • Accessing locally hosted webpage via public IP

    - by Mk12
    Sorry if this is in the wrong place.I don't really know anything about server-related things, but I'm really curious about this. On my mac I figured out how to make a simple web page viewable via the local ip address or computer name on the LAN, and also how to hook it up with a free hostname from dyndns.com. So the dyndns hostname points to something, how can I access it directly? Typing in the global ip address (of the router) doesn't work, but if it did, how would it know which computer to point to? There must be some way of directly accessing what dyndns hostname points to by typing in some number, right? Sorry I don't really understand how it works.

    Read the article

  • OpenGL behaving strangely

    - by Mk12
    OpenGL is acting very strangely for some reason. In my subclass of NSOpenGLView, I have the following code in -prepareOpenGL: - (void)prepareOpenGL { GLfloat lightAmbient[] = { 0.5f, 0.5f, 0.5f, 1.0f }; GLfloat lightDiffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f }; GLfloat lightPosition[] = { 0.0f, 0.0f, 2.0f }; quality = 0; zCoord = -6; [self loadTextures]; glEnable(GL_LIGHTING); glEnable(GL_TEXTURE_2D); glShadeModel(GL_SMOOTH); glClearColor(0.2f, 0.2f, 0.2f, 0.0f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glLightfv(GL_LIGHT1, GL_AMBIENT, lightAmbient); glLightfv(GL_LIGHT1, GL_DIFFUSE, lightDiffuse); glLightfv(GL_LIGHT1, GL_POSITION, lightPosition); glEnable(GL_LIGHT1); gameState = kGameStateRunning; int i = 0; // HERE ******** [NSTimer scheduledTimerWithTimeInterval:0.03f target:self selector:@selector(processKeys) userInfo:nil repeats:YES]; // Synchronize buffer swaps with vertical refresh rate GLint swapInt = 1; [[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; // Setup and start displayLink [self setupDisplayLink]; } I wanted to assign the timer that processes key input to an ivar so that I could invalidate it when the game is paused (and reinstantiate it on resume), however when I did that (as apposed to leaving it at [NSTimer scheduledTimer…), OpenGL doesn't display the cube I draw. When I take it away, it's fine. So i tried just adding a harmless statement, int i = 0; (maked // HERE *******), and that makes the lighting not work! When I take it away, everything is fine, but when I put it back, everything is dark. Can someone come up with a rational explanation for this? Thanks.

    Read the article

  • java - BigDecimal

    - by Mk12
    I was trying to make my own class for currencies using longs, but Apparently I should use BigDecimal (and then whenever I print it just add the $ sign before it). Could someone please get me started? What would be the best way to use BigDecimals for Dollar currencies, like making it at least but no more than 2 decimal places for the cents, etc. The api for BigDecimal is huge, and I don't know which methods to use. Also, BigDecimal has better precision, but isn't that all lost if it passes through a double? if I do new BigDecimal(24.99), how will it be different than using a double? Or should I use the constructor that uses a String instead? EDIT: I decided to use BigDecimals, and then use: private static final java.text.NumberFormat moneyt = java.text.NumberFormat.getCurrencyInstance(); { money.setRoundingMode(RoundingMode.HALF_EVEN); } and then whenever I display the BigDecimals, to use money.format(theBigDecimal). Is this alright? Should I have the BigDecimal rounding it too? Because then it doesn't get rounded before it does another operation.. if so, could you show me how? And how should I create the BigDecimals? new BigDecimal("24.99") ? Well, after many comments to Vineet Reynolds (thanks for keeping coming back and answering), this is what I have decided. I use BigDecimals and a NumberFormat. Here is where I create the NumberFormat instance. private static final NumberFormat money; static { money = NumberFormat.getCurrencyInstance(Locale.CANADA); money.setRoundingMode(RoundingMode.HALF_EVEN); } Here is my BigDecimal: private final BigDecimal price; Whenever I want to display the price, or another BigDecimal that I got through calculations of price, I use: money.format(price) to get the String. Whenever I want to store the price, or a calculation from price, in a database or in a field or anywhere, I use (for a field): myCalculatedResult = price.add(new BigDecimal("34.58")).setScale(2, RoundingMode.HALF_EVEN); .. but I'm thinking now maybe I should not have the NumberFormat round, but when I want to display do this: System.out.print(money.format(price.setScale(2, RoundingMode.HALF_EVEN); That way to ensure the model and things displayed in the view are the same. I don't do: price = price.setScale(2, RoundingMode.HALF_EVEN); Because then it would always round to 2 decimal places and wouldn't be as precise in calculations. So its all solved now, I guess. But is there any shortcut to typing calculatedResult.setScale(2, RoundingMode.HALF_EVEN) all the time? All I can think of is static importing HALF_EVEN... EDIT: I've changed my mind a bit, I think if I store a value, I won't round it unless I have no more operations to do with it, e.g. if it was the final total that will be charged to someone. I will only round things at the end, or whenever necessary, and I will still use NumberFormat for the currency formatting, but since I always want rounding for display, I made a static method for display: public static String moneyFormat(BigDecimal price) { return money.format(price.setScale(2, RoundingMode.HALF_EVEN)); } So values stored in variables won't be rounded, and I'll use that method to display prices.

    Read the article

  • Objective C - Using .m and .c files?

    - by Mk12
    I know Objective-C is just a superset of C, and you can use plain C anywhere. But am I able to use .m and .c files (for when there is only pure C) in the same project? Or all the errors I'm getting because of something else… Thanks.

    Read the article

  • iPhone dev - viewDidUnload subviews

    - by Mk12
    I'm having a hard time undestand a couple of the methods in UIViewController, but first I'll say what I think they are meant for (ignoring interface builder because I'm not using it): -init: initialize non view-related stuff that won't need to be released in low memory situations (i.e. not objects or objects that can't be recreated easily). -loadView: create the view set the [self view] property. -viewDidLoad: Create all the other view elements -viewDidUnload: Release objects created in -viewDidLoad. didReceiveMemoryWarning: Low-memory situation, release unnecessary things such as cached data, if this view doesn't have a superview then the [super didReceiveMemoryWarning] will go on to release (unload) the view and call -viewDidUnload. -dealloc: release everything -viewWillAppear:, -viewDidAppear:, -viewWillDisappear:, -viewDidDisappear: self-explanatory, not necessary unless you want to respond (do something) to those events. I'm not sure about a couple of things. First, the Apple docs say that when -viewDidUnload is called, the view has already been released and set to nil. Will -loadView get called again to recreate the view later on? There's a few things I created in -viewDidLoad that I didn't make a ivar/property for because there is no need and it will be retained by the view (because they are subviews of it). So when the view is released, it will release those too, right? When the view is released, will it release all its subviews? Because all the objects I created in -viewDidLoad are subviews of [self view]. So if they already get released why release them again in -viewDidUnload? I can understand data that is necessary when the view is visible being loaded and unloaded in these methods, but like I asked, why release the subviews if they already get released? EDIT: After reading other questions, I think I might have got it (my 2nd question). In the situation where I just use a local variable, alloc it, make it a subview and release, it will have a retain count of 1 (from adding it as a subview), so when the view is released it is too. Now for the view elements with ivars pointing to them, I wasn't using properties because no outside class would need to access them. But now I think that that's wrong, because in this situation: // MyViewController.h @interface MyViewController : UIViewController { UILabel *myLabel; } // MyViewController.m . . . - (void)viewDidLoad { myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 10)]; [myLabel setText:@"Foobar"]; [[self view] addSubview:myLabel]; } - (void)viewDidUnload [ // equivalent of [self setMyLabel:nil]; without properties [myLabel release]; myLabel = nil; } In that situation, the label will be sent the -release message after it was deallocated because the ivar didn't retain it (because it wasn't a property). But with a property the retain count would be two: the view retaining it and the property. So then in -viewDidUnload it will get deallocated. So its best to just always use properties for these things, am I right? Or not? EDIT: I read somewhere that -viewDidLoad and -viewDidUnload are only for use with Interface Builder, that if you are doing everything programmatically you shouldn't use them. Is that right? Why?

    Read the article

  • Flipping OpenGL texture

    - by Mk12
    When I load textures from images normally, they are upside down because of OpenGL's coordinate system. What would be the best way to flip them? glScalef(1.0f, -1.0f, 1.0f); vertically flipping the image files manually (in Photoshop) flipping them programatically after loading them (I don't know how) This is the method I'm using to load png textures, in my Utilities.m file (Objective-C): + (GLuint)loadPngTexture:(NSString *)name { CFURLRef textureURL = CFBundleCopyResourceURL( CFBundleGetMainBundle(), (CFStringRef)name, CFSTR("png"), CFSTR("Textures")); NSAssert(textureURL, @"Texture name invalid"); CGImageSourceRef imageSource = CGImageSourceCreateWithURL(textureURL, NULL); NSAssert(imageSource, @"Invalid Image Path."); NSAssert((CGImageSourceGetCount(imageSource) > 0), @"No Image in Image Source."); CFRelease(textureURL); CGImageRef image = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL); NSAssert(image, @"Image not created."); CFRelease(imageSource); NSUInteger width = CGImageGetWidth(image); NSUInteger height = CGImageGetHeight(image); void *data = malloc(width * height * 4); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); NSAssert(colorSpace, @"Colorspace not created."); CGContextRef context = CGBitmapContextCreate( data, width, height, 8, width * 4, colorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); NSAssert(context, @"Context not created."); CGColorSpaceRelease(colorSpace); CGContextDrawImage(context, CGRectMake(0, 0, width, height), image); CGImageRelease(image); CGContextRelease(context); GLuint textureId; glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE_SGIS); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE_SGIS); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); free(data); return textureId; } Also, another thing I was wondering about: If I made a simple 2d game, with pixels mapped to units, would it be alright to set it up so that the origin is in the top-left corner, or would I run in to problems with other things (e.g. text rendering)? Thanks.

    Read the article

  • Rubygame on OS X shebang problem

    - by Mk12
    I'm playing around with Rubygame. I installed it with the Mac Pack, and now I have the rsdl executable. rsdl game.rb works fine, but when I chmod +x the rb file, add the shebang to rsdl (tried direct path and /usr/bin/env rsdl) and try to execute it (./game.rb), it starts to flicker between the Terminal and rsdl which is trying to open, and eventually gives up and gives a bus error. Anyone know what's causing that? I'm on Snow Leopard (10.6.2) if it makes a difference. Thanks.

    Read the article

1