What Was The Last Thing That You Bought?

Discussion in 'Games and Contests' started by butterfly712, Sep 23, 2014.

  1. SpacemanSpiff

    SpacemanSpiff Visitor

    i hope her results are negative

    which would be positive


    depending how you look at it
     
  2. Spectacles

    Spectacles My life is a tapestry Lifetime Supporter

    Messages:
    4,229
    Likes Received:
    2,011
    My Mom was a breast cancer survivor. My aunt died of breast cancer so that places me at higher risk. I have had one annually for the last 30 years. So far no bad results.

    Thanks for the good thoughts.
     
    1 person likes this.
  3. Piaf

    Piaf Senior Member

    Messages:
    25,272
    Likes Received:
    1,895
    I couldn't resist.
    I have a problem.

    [​IMG]
     
  4. AceK

    AceK Scientia Potentia Est

    Messages:
    7,824
    Likes Received:
    961
    Well, I won't mention it by name, but it will lead to me running this old very poorly written program I wrote that does a rather nice job of hacking my brain. Maybe you can guess what it might be?
    Code:
    /******************************************************************************
     * Strobe is a simple program for creating a strobe effect between 2 colors.
     * Different frequencies entrain brainwaves to evoke an altered state of 
     * consiousness in the user.
     * 
     * Author: IRQ42 2015
     * ***************************************************************************/
    
    #include <SDL/SDL.h>
    #include <stdlib.h>
    #include <string.h>
    #include <stdio.h>
    #include <unistd.h>
    #include <assert.h>
    
    #define HRES 1024
    #define VRES 768
    #define NCOLORS 2
    #define MAXFPS 400
    
    Uint16 create_hicolor_pixel(SDL_PixelFormat * fmt, Uint8 red, Uint8 green,
    			  Uint8 blue)
    {
        Uint16 value;
        /* This series of bit shifts uses the information from the SDL_Format
         * structure to correctly compose a 16-bit pixel value from 8-bit RGB */
        value = ((red  >> fmt->Rloss) << fmt->Rshift) +
    	    ((green >> fmt->Gloss) << fmt->Gshift) 	  +
    	    ((blue  >> fmt->Bloss) << fmt->Bshift);
    	    
        return value;
    }
    
    int getargs(int argc, char **argv, int *fps, Uint32 *rgb_color)
    {
    	int error = 0;
    	/* Command line args */
    	if (argc < 4) {
    		fprintf(stderr, "Too few parameters.\n");
    		error = 1;
    	} else if (argc > 4) {
    		fprintf(stderr, "Too many parameters.\n");
    		error = 1;
    	} else {
    		char *endptr;
    		
    		*fps = (int) strtol(*++argv, &endptr, 0);
    		if (endptr == *(argv - 1) || (*fps < 1 || *fps > MAXFPS)) {
    			fprintf(stderr, "Bad frequency value. Try values between 1 - %d\n",
    					MAXFPS);
    			error = 1;
    		}
    		
    		rgb_color[0] = (Uint32) strtol(*++argv, &endptr, 16);
    		if ((endptr == *(argv - 1)) || (rgb_color[0] < 0) || 
    									 (rgb_color[0] > 0xffffff)) {
    			fprintf(stderr, "Bad color value. Must be valid 24bit RGB hex\n");
    			error = 1;
    		}
    		
    		rgb_color[1] = (Uint32) strtol(*++argv, &endptr, 16);
    		if ((endptr == *(argv - 1)) || (rgb_color[1] < 0) || 
    									 (rgb_color[1] > 0xffffff)) {
    			fprintf(stderr, "Bad color value. Must be valid 24bit RGB hex\n");
    			error = 1;
    		}
    	}
    	
    	return error;
    }
    
    void showusageinfo(char *prgname)
    {
    	printf("\nUsage: %s [freq] [color1] [color2]\n\n", prgname);
    	
    	printf("Strobe is a simple program that uses the users monitor to implement a\n"
    		"strobe light effect. The user can set the flash frequency and the two\n"
    		"colors to flash between by passing these to strobe as command line\n"
    		"arguments. Strobe uses the SDL library, and currently displays in\n"
    		"hi-color (16bit) mode. User entered color values are automatically\n"
    		"composed into the correct hi-color format for the user's system.\n\n");
    		
    	printf("The first parameter is the strobe rate (frequency) in hertz or cycles\n"
    		"per second. This parameter takes a decimal value from 1 to MAXFPS.\n"
    		"Flash rates higher than your monitors refresh rate will probably not\n"
    		"display correctly. You may also be limited by the speed of your machine's"
    		"\n\nCPU and video card.\n");
    		
    	printf("The second two parameters shall be 24bit RGB hexadecimal values for\n"
    		"color1 and color2 respectively such as 0xffffff for white, and\n"
    		"0xffff00 for yellow. As of version 0.1 common names of colors are\n"
    		"not supported.\n\n");
    	
    	printf("An example for running strobe at a 15hz strobe rate, with yellow and\n"
    		"a turquois shade of blue as color1 and color2, respectively:\n\n"
    		"strobe 15 0xffff00 0x0080ff\n\n");
    		
    	printf("Pressing the 'ESC' key, or the 'q' key while strobe is running will\n"
    		   "safely exit from the program.\n\n");
    		   
    	printf("Invoke strobe as %s -t [freq] to run strobe in testing mode.\n"
    		"In testing mode, strobe will output on standard error the current\n"
    		"frame number, the execution time for the current frame, and the\n"
    		"average framerate\n\n", prgname);
    }
    
    int main(int argc, char **argv)
    {
        SDL_Surface *screen;
    	SDL_Event	event;
        Uint16 	*scr_pixels;
    	Uint16 	hicolor_color[NCOLORS];
    	Uint32 	rgb_color[NCOLORS];
    	int		coloridx = 0;
    	int x, y, i;
    	int quit = 0, test = 0;
    	int fps, t, framecnt = 0;
    	
    	if (argc > 1 && strcmp(argv[1], "-h") == 0) {
    		showusageinfo(*argv);
    		exit(EXIT_SUCCESS);
    	} else if (argc == 3 && strcmp(argv[1], "-t") == 0) {
    		test = 1;
    	}
    	
    	if (!test && getargs(argc, argv, &fps, rgb_color) != 0) {
    		printf("Usage: %s [freq] [color1] [color2]\n"
    			   "       %s -h to see help info for this program.\n\n",
    			   *argv, *argv);
    		exit(EXIT_FAILURE);
    	} else if (test && argc == 3) {
    		rgb_color[0] = 0xffffff;
    		rgb_color[1] = 0x000000;
    		fps = atoi(argv[2]);
    		if (fps < 1) {
    			fprintf(stderr, "E: framerate cannot be negative.\n");
    			exit(EXIT_FAILURE);
    		}
    	}
    	
        /* Init SDL */
        if (SDL_Init(SDL_INIT_VIDEO) != 0) {
    		fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError());
    		return 1;
        }
    
        atexit(SDL_Quit);
    	
    	(void) SDL_ShowCursor(SDL_DISABLE);
    	SDL_WM_SetCaption("Strobe", "Strobe");
        
        screen = SDL_SetVideoMode(HRES, VRES, 16, SDL_HWSURFACE  |
    					      SDL_DOUBLEBUF  |
    					      SDL_FULLSCREEN );
        if (screen == NULL) {
    		fprintf(stderr, "Unable to set video mode: %s\n", SDL_GetError());
    		exit(EXIT_FAILURE);
        }
    	
    	/*Initialize hicolor colors*/
    	for (i = 0; i < NCOLORS; ++i) {
    		hicolor_color[i] = create_hicolor_pixel(screen->format,
    					(rgb_color[i] & 0xff0000) >> 16,
    					(rgb_color[i] & 0xff00)   >> 8,
    					(rgb_color[i] & 0xff)     >> 0);
    	}
        
        /* Get a pointer to the video surface's memory. */
        scr_pixels = (Uint16*) screen->pixels;
    
        while (!quit) {
    		t = SDL_GetTicks();
    		if (SDL_PollEvent(&event)) {
    			switch (event.type) {
    				case SDL_QUIT:
    					quit = 1;
    					break;
    				case SDL_KEYDOWN:
    					switch (event.key.keysym.sym) {
    						case SDLK_ESCAPE:
    						case SDLK_q:
    							quit = 1;
    							break;
    					}
    					break;
    			}
    		}
    	
    		SDL_LockSurface(screen);
    		coloridx ^= 1;
    		for(x = 0; x < HRES; ++x) {
    			for(y = 0; y < VRES; ++y) {
    				int offset;
    				
    				offset = (screen->pitch / sizeof hicolor_color[0]) * y + x;
    				scr_pixels[offset] = hicolor_color[coloridx];
    			}
    		}
    		SDL_UnlockSurface(screen);
    		SDL_Flip(screen);
    		
    		assert(SDL_GetTicks() > t);
    		if ((t = SDL_GetTicks() - t) < 1000 / fps) {
    			if (test) {
    				/* Why does this fix fps/gargabe issue? */
    				fprintf(stderr, "frame:%d, t:%d, fps (average): %g\n",
    						++framecnt, t, 1000.0f / ((float) SDL_GetTicks() /
    						framecnt));
    						
    			}
    			SDL_Delay((1000 / fps) - t);
    		} else {
    			if (test) {
    				fprintf(stderr, "frame: %d, t:%d, fps (avgerage): %g,  "
    								"[t >= %d]!\n", 
    						++framecnt, t, 1000.0f / ((float) SDL_GetTicks() /
    						framecnt), 1000/fps); 
    			}
    		}
        }
        
        exit(EXIT_SUCCESS);
    }
    
     
    1 person likes this.
  5. Mattekat

    Mattekat Ice Queen of The North

    Messages:
    2,387
    Likes Received:
    1,131
    I don't get the code at all, but the blurb at the beginning makes me think I know what you got ;) you are reminding me of a friend right now a lot. He's also a coder and he and an engineer buddy of ours hooked up this light machine that you stick your head in to get the same effects as your program. Have fun!
     
  6. AceK

    AceK Scientia Potentia Est

    Messages:
    7,824
    Likes Received:
    961
    hehe ... you're on the right track. the code is bad, but it does the trick ... ;)

    The next thing i'm looking into is some LCD glasses/goggles, where I can send different signals to each "eye" .... and strobe between them in alternating fashion in order to see "impossible colors". My program actually already shows you a whole lot of stuff that isn't in the actual signal when you're tripping ... ;) The LCD glasses are a bit expensive though.

    see this wikipedia page for more info on what i'm actually talking about building (and nobody better steal my ideas and make money off of it, i do it for the lulz and lulz only ... if you build it and become a millionaire ... you better buy me a case of beer, or a few bottle of fine scotch ... or some LSD ;) )

    https://en.wikipedia.org/wiki/Impossible_color
     
  7. Ashalicious

    Ashalicious Senior Member

    Messages:
    3,193
    Likes Received:
    467
    https://www.youtube.com/watch?v=858CwykF-rU

    This track! I couldn't find it on my usual go to website for purchasing music, so I messaged the DJ on FB to ask him where I could buy an MP3 of this track, and he actually got back to me.

    I paid 1.49 for it, but who cares. I am obsessed with this track right now.
     
    1 person likes this.
  8. Heat

    Heat Smile, it's contagious! :) Lifetime Supporter

    Messages:
    9,814
    Likes Received:
    1,844
    New screen for the patio door and spline and the roller to put it in the groove.
     
  9. SpacemanSpiff

    SpacemanSpiff Visitor

    strawberries that are going down the hatch as i type
     
  10. secret_thinker

    secret_thinker Lifetime Supporter Lifetime Supporter

    Messages:
    1,573
    Likes Received:
    1,313
    Was getting myself a treat of dark lindt chocolates. They were supposed to be half price but the discount didn't scan up at the register so as per the supermarkets scanning policy, I got them for free.
     
  11. Mattekat

    Mattekat Ice Queen of The North

    Messages:
    2,387
    Likes Received:
    1,131
    That dj was probably really happy to find someone who actually wanted to pay for their work instead of downloading illegally.
     
  12. hotwater

    hotwater Senior Member Lifetime Supporter

    Messages:
    50,596
    Likes Received:
    38,973
    Two loaves of bread - I only purchase Whole Grain Bread

    [​IMG]





    Hotwater
     
  13. Tyrsonswood

    Tyrsonswood Senior Moment Lifetime Supporter

    Messages:
    34,216
    Likes Received:
    26,332
    Router table/shaper.... with router attached. 5 bucks at Goodwill.
     
  14. SpacemanSpiff

    SpacemanSpiff Visitor

    i bought a container of macaroons


    but by the time i got home it was a container of macaroon
     
  15. Irminsul

    Irminsul Valkyrie

    Messages:
    52
    Likes Received:
    171
    3x pairs of sheepskin boots for only €4 euro! I got my partner 3x pairs too. Should keep us happy for half a decade. Then I got a cardigan to make up for free shipping.

    Then on eBay I bought a bottle of Aramith billiard cleaning/polishing spray.

    And the 1995 Jeff Gordon 1:24 Darlington race win diecast. :)

    Can of monster absolute zero energy.
     
  16. soulcompromise

    soulcompromise Member Lifetime Supporter

    Messages:
    22,629
    Likes Received:
    11,792
    I put $10.43 on my Starbucks giftcard.
     
  17. SpacemanSpiff

    SpacemanSpiff Visitor

    bought some strawberries today 50% off ....

    dont know why they were reduced they look and taste just fine....$1.23 is a great price for such a tasty pile of things [​IMG]
     
  18. Ashalicious

    Ashalicious Senior Member

    Messages:
    3,193
    Likes Received:
    467
    Yeah, he said he was really impressed, actually. He even hinted that I download it illegally, but I told him I do not steal my music and would prefer to purchase the track.
     
  19. Ashalicious

    Ashalicious Senior Member

    Messages:
    3,193
    Likes Received:
    467
    I ordered pizza.

    I also had excellent luck at a little gem of a thrift store I went to on the North Shore yesterday. I bought three pairs of Lulu Lemon pants, two Lulu Lemon sports bras, and an authentic Juicy Couture Purse for $70.00. One pair of Lulu Lemon pants is $100.00 new.
     
  20. GLENGLEN

    GLENGLEN Banned

    Messages:
    27,027
    Likes Received:
    6,541
    Forked Out $ 6000-00 Towards An Eye Operation At The End Of This Week.........Iv'e Been Legally Blind In My Right

    Eye For 3 Years And Finally Decided To Get It Fixed....... :)



    Cheers Glen.
     
    2 people like this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice