Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


fastcall22

Member Since 04 Feb 2008
Offline Last Active Private

#5164100 C++ Multi-Byte - prepare string of extensions for OpenFileDialog

Posted by fastcall22 on 01 July 2014 - 01:24 PM

how is the generation of a string

L"Hello\0World\0How\0Are\0You\0'

done?

Well, in your case, it would just be replacing ';' with '\0'.

So, maybe something like this:
std::wstring ext;
ext.reserve(str.length()+1);

std::transform(str.begin(),str.end(),back_inserter(ext),[](char t) -> wchar_t {
	return t == ';' ? 0 : t;
});
ext.push_back(0); // (This is necessary to indicate where the array of strings end)

wchar_t* buf = ext.c_str(); // An extra null terminator should be appended here.

// str = "Hello;World;How;Are;You"
// buf = L"Hello\0World\0How\0Are\0You\0\0"
EDIT:
Code sample here: http://ideone.com/wqrckP


#5164079 Non-fixed width fonts in games

Posted by fastcall22 on 01 July 2014 - 12:17 PM

Usually when doing font rendering in games, a select number of glyphs are packed into an image. This image also has metadata, either stored alongside the image or in a separate file, which stores information about where in the image a glyph is, how large the glyph is, what kind of kerning adjustments are needed with which pair of glyphs, and etc. Take a look at bmfont and how it generates its font files. (Sample here: Quick tutorial variable width bitmap fonts.)

Once you have the image and the metadata, it is only a matter of storing this data into a data structure. An associative array or tree is usually the best approach, especially when you take into concern characters outside of the ASCII range.


On the topic of TTF, these files can be thought of executable scripts which transforms a state into a series of outlines.


#5163891 how to show()/remove() a textarea with jquery

Posted by fastcall22 on 30 June 2014 - 12:56 PM

$('.Option > textarea:last').last().remove();

.
.
.

$('<textarea ></textarea>').fadeIn('fast').appendTo('.Option');


I, um... wat.

ಠ__ಠ


#5163687 SDL.h: no such directory found

Posted by fastcall22 on 29 June 2014 - 01:56 PM

http://i.imgur.com/kEgaRqg.png


... Uhh, those should be lower case Ls, not pipes |... See GCC link options. Pipes are used to pipe output from programs elsewhere (to a file, another program, etc).


#5163678 SDL.h: no such directory found

Posted by fastcall22 on 29 June 2014 - 01:34 PM

Quickfix:
#include "SDL/SDL.h"

Double check your directories; you've a search directory, "C:\Users\sarmeanu\DOCS\SDL\include\", but SDL.h is located at "C:\Users\sarmeanu\DOCS\SDL\include\SDL\SDL.h".


#5163433 decompositing and recompositing color (pixel)

Posted by fastcall22 on 28 June 2014 - 07:17 AM

color = (red <<16) + (green<<8) + blue;

this strikes me both as an ugly and probably inefficient..


Yeah, me too...
You should really be using bitwise-or:
color = (red<<16) | (green<<8) | blue;
There we go -- much better.


#5161226 Share the most challenging problem you solved recently! What made you fee...

Posted by fastcall22 on 17 June 2014 - 10:21 PM

Guys. GUYS. Hey... Listen.
Guys. Guys, listen...

I finally figured out how to write a proper CakePHP code. And it only cost me my soul!
What a bargain!


#5160876 Returning pointer to array of function pointers not working

Posted by fastcall22 on 16 June 2014 - 10:25 AM

Also, you cannot use the pointers returned from a, b, and c. The z that ptr points to expires once the function ends, and reading from or writing to that pointer has undefined behavior.


#5160532 Spooky Friday the 13th!

Posted by fastcall22 on 14 June 2014 - 12:42 PM

TL;DR:
Press 'g' on the keyboard, get the sequence: H f9 ' \ I num8 num3...


I'm not a superstitious one, but I did note that for a night that society considers last night as a "spooky" one, mine was quite uneventful. That is, until around midnight, when a ghost haunted my machine.

I am using a Microsoft Comfort Curve keyboard with a GX gaming Giala mouse. The mouse itself is a WTF, for a number of reasons: One, why would anybody need 8000 DPI; two, why would anybody want independent X-axis and Y-axis DPI; and three, why would anybody use this shit software. Seriously. Somewhere in the software, the string for the name of the registry key, "WheelScrollLines", somehow didn't get widened correctly. So, instead of finding "WheelScrollLines" under the key "HKCU:\Control Panel\Desktop" (where it should be), it is instead found under "HKCU:\潃瑮潲慐敮屬敄歳潴p", which is coincidentally what'd you get if you took the ASCII string "Control Panel\Desktop", converted it to bytes, and then converted those bytes into a Unicode string. Just... wat. It does have a lot of buttons, though. It's probably the only reason I still have this mouse.

Anyways, late last night I was jamming on my keyboard in my digital audio workstation, when I just happened by chance to enter what I will henceforth call "WTF-mode". In this mode, the LEDs in my mouse begin to flash, Windows will continually play the "device disconnected" sound, and the keyboard begins to wildly misbehave. Pressing the "q" key (middle-C on a piano) will press and hold several other random keys. Pressing any other key would do anything from opening the "mailto:" handler, opening up the magnifying glass, to opening up the help menu.

So here I am, just tweaking this cheesy 80s synth (3xPWM at 1x, 3x, and 5x frequencies, low-pass resonant filter with cutoff envelope), and suddenly I accidentally press caps-lock, and suddenly my mouse begins to flash, keyboard presses are random, random notes are playing, and random windows are popping up. I almost had a heart-attack! D:

Eventually I managed out of WTF-mode, but being the computer scientist that I am, I tried to deduce which keys were causing "WTF-mode". After a few apparent system hangs, I eventually narrowed it down to the keyboard sequence caps-lock and scroll-lock. Pressing these keys in sequence cause "WTF-mode" to toggle. I can completely lock up my keyboard and mouse by face rolling the keyboard in this mode, until either I reconnect the keyboard and mouse or I reset my system.

This morning, I spent some time investigating further. Below is a small win32 console program written in C++11, to help debug what events are being sent:

// wtfKeyboard.cpp
#include <cstdlib>
#include <stdio.h>
#include <signal.h>
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>

HRESULT printError(HRESULT);
HRESULT printError();

int main(int,char*[]) {
	// Get console input handle
	HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE);
	if ( hInput == INVALID_HANDLE_VALUE ) {
		printf("Unable to get input handle\n");
		return printError();
	}

	// Hook ctrl+C
	static bool running = true;
	signal(SIGINT, [](int){
		running = false;
	});

	// Main loop
	do {
		INPUT_RECORD event;
		DWORD eventsRead = 0;

		// Input loop
		while ( ReadConsoleInput(hInput, &event, 1, &eventsRead) && eventsRead > 0 && running ) {
			// Print timestamp
			SYSTEMTIME time;
			GetLocalTime(&time);
			printf("%04i-%02i-%02i %02i:%02i:%02i.%03i ",
				time.wYear,
				time.wMonth,
				time.wDay,
				time.wHour,
				time.wMinute,
				time.wSecond,
				time.wMilliseconds
			);

			// Print event
			switch ( event.EventType ) {
				case FOCUS_EVENT: {
					printf("focus setFocus=%i\n", event.Event.FocusEvent.bSetFocus?1:0);
				} break;
				case KEY_EVENT: {
					const auto& e = event.Event.KeyEvent;
					char keystr[24] = {}; // Translate key+scan code to string
					GetKeyNameText(e.wVirtualKeyCode | (e.wVirtualScanCode << 16), keystr, sizeof(keystr)/sizeof(keystr[0]));

					printf( "key state=0x%04X vk=0x%04X %4s %12s\n",
						e.dwControlKeyState,
						e.wVirtualKeyCode,
						e.bKeyDown?"down":"up",
						keystr
					);
				} break;
				case MENU_EVENT: {
					const auto& e = event.Event.MenuEvent;
					printf("menu command=%i\n", e.dwCommandId);
				} break;
				case MOUSE_EVENT: {
					const auto& e = event.Event.MouseEvent;
					COORD pos = e.dwMousePosition;
					printf("mouse x=%i y=%i btn=0x%02X ctrl=0x%04X f=0x%1X\n", pos.X, pos.Y, e.dwButtonState, e.dwControlKeyState, e.dwEventFlags);
				} break;
				case WINDOW_BUFFER_SIZE_EVENT: {
					const auto& e = event.Event.WindowBufferSizeEvent;
					printf("resize w=%i h=%i\n", e.dwSize.X, e.dwSize.Y);
				} break;
				default: {
					printf("Unknown event 0x%04X\n", event.EventType);
				}
			}
			fflush(stdout);
		}
	} while (running);
}


HRESULT printError() {
	return printError(GetLastError());
}

HRESULT printError(HRESULT error) {
	LPVOID lpMsgBuf;
	FormatMessage(
		FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
		nullptr,
		error,
		MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
		(LPTSTR) &lpMsgBuf,
		0,
		nullptr
	);

	printf("%s\n",lpMsgBuf);
	LocalFree(lpMsgBuf);

	return error;
}
Here are the results. In both this first snippet, I am pressing each key from 'a' to 'z' in sequence. In the second snippet, I am repeating the keys but in "WTF-mode". Comments, denoted with a semicolon, were added to the end of the line after the output was obtained.

Snippet 1, the control:
2014-06-14 11:32:47.817 key state=0x0020 vk=0x0041 down            A	; normal-mode
2014-06-14 11:32:47.937 key state=0x0020 vk=0x0041   up            A
2014-06-14 11:32:48.257 key state=0x0020 vk=0x0042 down            B
2014-06-14 11:32:48.377 key state=0x0020 vk=0x0042   up            B
2014-06-14 11:32:48.601 key state=0x0020 vk=0x0043 down            C
2014-06-14 11:32:48.705 key state=0x0020 vk=0x0043   up            C
2014-06-14 11:32:48.905 key state=0x0020 vk=0x0044 down            D
2014-06-14 11:32:49.025 key state=0x0020 vk=0x0044   up            D
2014-06-14 11:32:49.289 key state=0x0020 vk=0x0045 down            E
2014-06-14 11:32:49.409 key state=0x0020 vk=0x0045   up            E
2014-06-14 11:32:49.641 key state=0x0020 vk=0x0046 down            F
2014-06-14 11:32:49.745 key state=0x0020 vk=0x0046   up            F
2014-06-14 11:32:49.969 key state=0x0020 vk=0x0047 down            G
2014-06-14 11:32:50.089 key state=0x0020 vk=0x0047   up            G
2014-06-14 11:32:50.305 key state=0x0020 vk=0x0048 down            H
2014-06-14 11:32:50.417 key state=0x0020 vk=0x0048   up            H
2014-06-14 11:32:50.617 key state=0x0020 vk=0x0049 down            I
2014-06-14 11:32:50.761 key state=0x0020 vk=0x0049   up            I
2014-06-14 11:32:50.929 key state=0x0020 vk=0x004A down            J
2014-06-14 11:32:51.057 key state=0x0020 vk=0x004A   up            J
2014-06-14 11:32:51.281 key state=0x0020 vk=0x004B down            K
2014-06-14 11:32:51.409 key state=0x0020 vk=0x004B   up            K
2014-06-14 11:32:51.609 key state=0x0020 vk=0x004C down            L
2014-06-14 11:32:51.745 key state=0x0020 vk=0x004C   up            L
2014-06-14 11:32:51.945 key state=0x0020 vk=0x004D down            M
2014-06-14 11:32:52.097 key state=0x0020 vk=0x004D   up            M
2014-06-14 11:32:52.273 key state=0x0020 vk=0x004E down            N
2014-06-14 11:32:52.393 key state=0x0020 vk=0x004E   up            N
2014-06-14 11:32:52.625 key state=0x0020 vk=0x004F down            O
2014-06-14 11:32:52.737 key state=0x0020 vk=0x004F   up            O
2014-06-14 11:32:52.969 key state=0x0020 vk=0x0050 down            P
2014-06-14 11:32:53.089 key state=0x0020 vk=0x0050   up            P
2014-06-14 11:32:53.281 key state=0x0020 vk=0x0051 down            Q
2014-06-14 11:32:53.409 key state=0x0020 vk=0x0051   up            Q
2014-06-14 11:32:53.601 key state=0x0020 vk=0x0052 down            R
2014-06-14 11:32:53.705 key state=0x0020 vk=0x0052   up            R
2014-06-14 11:32:54.033 key state=0x0020 vk=0x0053 down            S
2014-06-14 11:32:54.161 key state=0x0020 vk=0x0053   up            S
2014-06-14 11:32:54.337 key state=0x0020 vk=0x0054 down            T
2014-06-14 11:32:54.425 key state=0x0020 vk=0x0054   up            T
2014-06-14 11:32:54.737 key state=0x0020 vk=0x0055 down            U
2014-06-14 11:32:54.840 key state=0x0020 vk=0x0055   up            U
2014-06-14 11:32:55.016 key state=0x0020 vk=0x0056 down            V
2014-06-14 11:32:55.144 key state=0x0020 vk=0x0056   up            V
2014-06-14 11:32:55.312 key state=0x0020 vk=0x0057 down            W
2014-06-14 11:32:55.448 key state=0x0020 vk=0x0057   up            W
2014-06-14 11:32:55.656 key state=0x0020 vk=0x0058 down            X
2014-06-14 11:32:55.784 key state=0x0020 vk=0x0058   up            X
2014-06-14 11:32:55.976 key state=0x0020 vk=0x0059 down            Y
2014-06-14 11:32:56.112 key state=0x0020 vk=0x0059   up            Y
2014-06-14 11:32:56.296 key state=0x0020 vk=0x005A down            Z
2014-06-14 11:32:56.424 key state=0x0020 vk=0x005A   up            Z
Snippet 2, the same keys in WTF-mode:
2014-06-14 11:32:57.969 key state=0x00A0 vk=0x0014 down    Caps Lock	; Begin WTF-mode
2014-06-14 11:32:58.120 key state=0x00A0 vk=0x0014   up    Caps Lock
2014-06-14 11:32:58.425 key state=0x00E0 vk=0x0091 down  Scroll Lock
2014-06-14 11:32:58.545 key state=0x00E0 vk=0x0091   up  Scroll Lock
2014-06-14 11:32:59.800 key state=0x00E0 vk=0x0053 down            S	; a
2014-06-14 11:32:59.801 key state=0x00E0 vk=0x0076 down           F7
2014-06-14 11:32:59.809 key state=0x00E0 vk=0x0053   up            S
2014-06-14 11:32:59.813 key state=0x00E0 vk=0x0044 down            D
2014-06-14 11:32:59.821 key state=0x00E0 vk=0x0046 down            F
2014-06-14 11:32:59.824 key state=0x00E0 vk=0x0009 down          Tab
2014-06-14 11:32:59.833 key state=0x00E0 vk=0x0051 down            Q
2014-06-14 11:32:59.841 key state=0x00E0 vk=0x0076   up           F7
2014-06-14 11:32:59.841 key state=0x00E0 vk=0x0078 down           F9
2014-06-14 11:32:59.849 key state=0x00E0 vk=0x0044   up            D
2014-06-14 11:32:59.849 key state=0x00E0 vk=0x00DD down            ]
2014-06-14 11:32:59.849 key state=0x00E0 vk=0x0057 down            W
2014-06-14 11:32:59.913 key state=0x00E0 vk=0x00DD   up            ]
2014-06-14 11:32:59.913 key state=0x00E0 vk=0x0046   up            F
2014-06-14 11:32:59.913 key state=0x00E0 vk=0x0009   up          Tab
2014-06-14 11:32:59.913 key state=0x00E0 vk=0x0051   up            Q
2014-06-14 11:32:59.913 key state=0x00E0 vk=0x0057   up            W
2014-06-14 11:32:59.913 key state=0x00E0 vk=0x0078   up           F9
2014-06-14 11:33:00.917 key state=0x01E0 vk=0x00A6 down             	; b
2014-06-14 11:33:00.921 key state=0x00E0 vk=0x004E down            N
2014-06-14 11:33:00.921 key state=0x00E0 vk=0x0078 down           F9
2014-06-14 11:33:00.928 key state=0x00E0 vk=0x004E   up            N
2014-06-14 11:33:00.929 key state=0x00E0 vk=0x0044 down            D
2014-06-14 11:33:00.929 key state=0x00E0 vk=0x004D down            M
2014-06-14 11:33:00.929 key state=0x00E0 vk=0x00BC down            ,
2014-06-14 11:33:00.936 key state=0x00E0 vk=0x0044   up            D
2014-06-14 11:33:00.937 key state=0x00E0 vk=0x0049 down            I
2014-06-14 11:33:00.937 key state=0x01E0 vk=0x0025 down        Num 4
2014-06-14 11:33:00.937 key state=0x01E0 vk=0x0028 down        Num 2
2014-06-14 11:33:01.021 key state=0x01E0 vk=0x00A6   up             
2014-06-14 11:33:01.033 key state=0x00E0 vk=0x0049   up            I
2014-06-14 11:33:01.033 key state=0x00E0 vk=0x004D   up            M
2014-06-14 11:33:01.033 key state=0x00E0 vk=0x00BC   up            ,
2014-06-14 11:33:01.033 key state=0x01E0 vk=0x0025   up        Num 4
2014-06-14 11:33:01.033 key state=0x01E0 vk=0x0028   up        Num 2
2014-06-14 11:33:01.033 key state=0x00E0 vk=0x0078   up           F9
2014-06-14 11:33:01.921 key state=0x00E0 vk=0x0043 down            C	; c
2014-06-14 11:33:02.039 key state=0x00E0 vk=0x0043   up            C
2014-06-14 11:33:02.936 key state=0x00E0 vk=0x0044 down            D	; d
2014-06-14 11:33:03.048 key state=0x00E0 vk=0x0044   up            D
2014-06-14 11:33:03.778 key state=0x00E0 vk=0x0045 down            E	; e
2014-06-14 11:33:03.905 key state=0x00E0 vk=0x0045   up            E
2014-06-14 11:33:04.713 key state=0x00E0 vk=0x0046 down            F	; f
2014-06-14 11:33:04.849 key state=0x00E0 vk=0x0046   up            F
2014-06-14 11:33:05.541 key state=0x01E0 vk=0x00AF down             	; g
2014-06-14 11:33:05.544 key state=0x00E0 vk=0x0048 down            H
2014-06-14 11:33:05.544 key state=0x00E0 vk=0x0078 down           F9
2014-06-14 11:33:05.553 key state=0x00E0 vk=0x0048   up            H
2014-06-14 11:33:05.553 key state=0x00E0 vk=0x00DE down            '
2014-06-14 11:33:05.553 key state=0x00E0 vk=0x00DC down            \
2014-06-14 11:33:05.561 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:05.561 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:05.561 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:05.685 key state=0x01E0 vk=0x00AF   up             
2014-06-14 11:33:06.061 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.061 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.062 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.094 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.094 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.094 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.127 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.127 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.127 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.160 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.163 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.164 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.193 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.193 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.193 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.226 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.226 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.226 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.259 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.259 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.259 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.292 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.292 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.292 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.325 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.325 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.325 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.358 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.358 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.358 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.391 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.391 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.391 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.424 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.424 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.424 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.457 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.457 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.457 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.490 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.490 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.490 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.523 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.523 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.523 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.556 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.556 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.556 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.589 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.589 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.589 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.622 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.622 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.622 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.655 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:33:06.655 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:33:06.655 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:33:06.664 key state=0x00E0 vk=0x00BB   up            =
2014-06-14 11:33:06.664 key state=0x00E0 vk=0x00DE   up            '
2014-06-14 11:33:06.664 key state=0x00E0 vk=0x00DC   up            \
2014-06-14 11:33:06.664 key state=0x01E0 vk=0x0026   up        Num 8
2014-06-14 11:33:06.664 key state=0x01E0 vk=0x0022   up        Num 3
2014-06-14 11:33:06.664 key state=0x00E0 vk=0x0078   up           F9
2014-06-14 11:33:06.664 key state=0x00E0 vk=0x0048 down            H	; h
2014-06-14 11:33:06.824 key state=0x00E0 vk=0x0048   up            H
2014-06-14 11:33:07.616 key state=0x00E0 vk=0x0049 down            I	; i
2014-06-14 11:33:07.776 key state=0x00E0 vk=0x0049   up            I
2014-06-14 11:33:08.448 key state=0x00E0 vk=0x004A down            J	; j
2014-06-14 11:33:08.609 key state=0x00E0 vk=0x004A   up            J
2014-06-14 11:33:09.305 key state=0x00E0 vk=0x004B down            K	; k
2014-06-14 11:33:09.416 key state=0x00E0 vk=0x004B   up            K
2014-06-14 11:33:10.088 key state=0x00E0 vk=0x004C down            L	; l
2014-06-14 11:33:10.240 key state=0x00E0 vk=0x004C   up            L
2014-06-14 11:33:11.048 key state=0x00E0 vk=0x004D down            M	; m
2014-06-14 11:33:11.185 key state=0x00E0 vk=0x004D   up            M
2014-06-14 11:33:11.840 key state=0x00E0 vk=0x004E down            N	; n
2014-06-14 11:33:11.984 key state=0x00E0 vk=0x004E   up            N
2014-06-14 11:33:12.553 key state=0x00E0 vk=0x004F down            O	; o
2014-06-14 11:33:12.697 key state=0x00E0 vk=0x004F   up            O
2014-06-14 11:33:13.349 key state=0x01E0 vk=0x00B3 down             	; p
2014-06-14 11:33:13.353 key state=0x00E0 vk=0x0064 down        Num 4
2014-06-14 11:33:13.353 key state=0x00E0 vk=0x00BF down            /
2014-06-14 11:33:13.353 key state=0x00E0 vk=0x0076 down           F7
2014-06-14 11:33:13.357 key state=0x01E0 vk=0x00B3   up             
2014-06-14 11:33:13.361 key state=0x00E0 vk=0x0064   up        Num 4
2014-06-14 11:33:13.369 key state=0x01E1 vk=0x0012 down          Alt
2014-06-14 11:33:13.369 key state=0x00E1 vk=0x004C down            L
2014-06-14 11:33:13.369 key state=0x00E1 vk=0x0068 down        Num 8
2014-06-14 11:33:13.369 key state=0x00E1 vk=0x0069 down        Num 9
2014-06-14 11:33:13.369 key state=0x00E1 vk=0x006B down        Num +
2014-06-14 11:33:13.377 key state=0x00E1 vk=0x004C   up            L
2014-06-14 11:33:13.377 key state=0x00E3 vk=0x0012 down          Alt
2014-06-14 11:33:13.456 key state=0x00E1 vk=0x0012   up          Alt
2014-06-14 11:33:13.456 key state=0x01E0 vk=0x0012   up          Alt
2014-06-14 11:33:13.456 key state=0x00E0 vk=0x0068   up        Num 8
2014-06-14 11:33:13.456 key state=0x00E0 vk=0x0068   up        Num 8
2014-06-14 11:33:13.457 key state=0x00E0 vk=0x0069   up        Num 9
2014-06-14 11:33:13.457 key state=0x00E0 vk=0x006B   up        Num +
2014-06-14 11:33:13.457 key state=0x00E0 vk=0x00BF   up            /
2014-06-14 11:33:13.457 key state=0x00E0 vk=0x0076   up           F7
2014-06-14 11:33:14.105 key state=0x00E0 vk=0x0051 down            Q	; q
2014-06-14 11:33:14.216 key state=0x00E0 vk=0x0051   up            Q
2014-06-14 11:33:14.907 key state=0x00E0 vk=0x0052 down            R	; r
2014-06-14 11:33:15.000 key state=0x00E0 vk=0x0052   up            R
2014-06-14 11:33:15.768 key state=0x00E0 vk=0x0053 down            S	; s
2014-06-14 11:33:15.872 key state=0x00E0 vk=0x0053   up            S
2014-06-14 11:33:16.544 key state=0x00E0 vk=0x0054 down            T	; t
2014-06-14 11:33:16.648 key state=0x00E0 vk=0x0054   up            T
2014-06-14 11:33:17.392 key state=0x00E0 vk=0x0055 down            U	; u
2014-06-14 11:33:17.545 key state=0x00E0 vk=0x0055   up            U
2014-06-14 11:33:18.176 key state=0x00E0 vk=0x0056 down            V	; v
2014-06-14 11:33:18.313 key state=0x00E0 vk=0x0056   up            V
2014-06-14 11:33:18.993 key state=0x00E0 vk=0x0057 down            W	; w
2014-06-14 11:33:19.097 key state=0x00E0 vk=0x0057   up            W
2014-06-14 11:33:19.809 key state=0x00E0 vk=0x0058 down            X	; x
2014-06-14 11:33:19.920 key state=0x00E0 vk=0x0058   up            X
2014-06-14 11:33:20.617 key state=0x00E0 vk=0x0055 down            U	; y
2014-06-14 11:33:20.617 key state=0x00E0 vk=0x0076 down           F7
2014-06-14 11:33:20.625 key state=0x00E0 vk=0x0055   up            U
2014-06-14 11:33:20.625 key state=0x00E0 vk=0x0049 down            I
2014-06-14 11:33:20.625 key state=0x00E0 vk=0x004F down            O
2014-06-14 11:33:20.706 key state=0x00A0 vk=0x0091 down  Scroll Lock
2014-06-14 11:33:20.708 key state=0x0180 vk=0x0090 down        Pause
2014-06-14 11:33:20.708 key state=0x0080 vk=0x0049   up            I
2014-06-14 11:33:20.708 key state=0x0080 vk=0x004F   up            O
2014-06-14 11:33:20.708 key state=0x0080 vk=0x0059 down            Y
2014-06-14 11:33:20.709 key state=0x0080 vk=0x0076   up           F7
2014-06-14 11:33:20.709 key state=0x0080 vk=0x0076   up           F7
2014-06-14 11:33:20.709 key state=0x0080 vk=0x0076   up           F7
2014-06-14 11:33:20.709 key state=0x0080 vk=0x0091   up  Scroll Lock
2014-06-14 11:33:20.709 key state=0x0180 vk=0x0090   up        Pause
2014-06-14 11:33:20.752 key state=0x0080 vk=0x0059   up            Y
2014-06-14 11:33:21.752 key state=0x0080 vk=0x005A down            Z	; z
2014-06-14 11:33:21.864 key state=0x0080 vk=0x005A   up            Z
2014-06-14 11:33:23.353 key state=0x0000 vk=0x0014 down    Caps Lock	; End WTF-mode
2014-06-14 11:33:23.409 key state=0x0040 vk=0x0091 down  Scroll Lock
2014-06-14 11:33:23.529 key state=0x0040 vk=0x0013   up        Pause
2014-06-14 11:33:23.649 key state=0x0040 vk=0x0091   up  Scroll Lock
2014-06-14 11:33:23.657 key state=0x0040 vk=0x0014   up    Caps Lock
2014-06-14 11:33:25.056 key state=0x0048 vk=0x0011 down         Ctrl	; CTRL-C
Snippet 3, repeat in WTF-mode:
2014-06-14 11:45:10.721 key state=0x00A0 vk=0x0014 down    Caps Lock	; Begin WTF-mode
2014-06-14 11:45:10.833 key state=0x00A0 vk=0x0014   up    Caps Lock
2014-06-14 11:45:10.881 key state=0x00E0 vk=0x0091 down  Scroll Lock
2014-06-14 11:45:10.968 key state=0x00E0 vk=0x0091   up  Scroll Lock
2014-06-14 11:45:12.713 key state=0x00E0 vk=0x0053 down            S	; a
2014-06-14 11:45:12.713 key state=0x00E0 vk=0x0076 down           F7
2014-06-14 11:45:12.721 key state=0x00E0 vk=0x0053   up            S
2014-06-14 11:45:12.721 key state=0x00E0 vk=0x0044 down            D
2014-06-14 11:45:12.728 key state=0x00E0 vk=0x0046 down            F
2014-06-14 11:45:12.736 key state=0x00E0 vk=0x0009 down          Tab
2014-06-14 11:45:12.744 key state=0x00E0 vk=0x0051 down            Q
2014-06-14 11:45:12.752 key state=0x00E0 vk=0x0076   up           F7
2014-06-14 11:45:12.752 key state=0x00E0 vk=0x0044   up            D
2014-06-14 11:45:12.753 key state=0x00E0 vk=0x00BB down            =
2014-06-14 11:45:12.753 key state=0x00E0 vk=0x0078 down           F9
2014-06-14 11:45:12.760 key state=0x00E0 vk=0x00BB   up            =
2014-06-14 11:45:12.760 key state=0x00E0 vk=0x00DD down            ]
2014-06-14 11:45:12.761 key state=0x00E0 vk=0x0057 down            W
2014-06-14 11:45:12.832 key state=0x00E0 vk=0x00DD   up            ]
2014-06-14 11:45:12.833 key state=0x00E0 vk=0x0046   up            F
2014-06-14 11:45:12.834 key state=0x00E0 vk=0x0009   up          Tab
2014-06-14 11:45:12.834 key state=0x00E0 vk=0x0051   up            Q
2014-06-14 11:45:12.834 key state=0x00E0 vk=0x0057   up            W
2014-06-14 11:45:12.835 key state=0x00E0 vk=0x0078   up           F9
2014-06-14 11:45:13.884 key state=0x00E0 vk=0x004E down            N	; b
2014-06-14 11:45:13.892 key state=0x00E0 vk=0x0078 down           F9
2014-06-14 11:45:13.896 key state=0x00E0 vk=0x004E   up            N
2014-06-14 11:45:13.897 key state=0x01E0 vk=0x00A6 down             
2014-06-14 11:45:13.972 key state=0x01E0 vk=0x00A6   up             
2014-06-14 11:45:13.976 key state=0x00E0 vk=0x0078   up           F9
2014-06-14 11:45:14.776 key state=0x00E0 vk=0x0043 down            C	; c
2014-06-14 11:45:14.880 key state=0x00E0 vk=0x0043   up            C
2014-06-14 11:45:15.760 key state=0x00E0 vk=0x0044 down            D	; d
2014-06-14 11:45:15.857 key state=0x00E0 vk=0x0044   up            D
2014-06-14 11:45:16.736 key state=0x00E0 vk=0x0045 down            E	; e
2014-06-14 11:45:16.825 key state=0x00E0 vk=0x0045   up            E
2014-06-14 11:45:17.633 key state=0x00E0 vk=0x0046 down            F	; f
2014-06-14 11:45:17.744 key state=0x00E0 vk=0x0046   up            F
2014-06-14 11:45:18.581 key state=0x01E0 vk=0x00AF down             	; g
2014-06-14 11:45:18.585 key state=0x00E0 vk=0x0048 down            H
2014-06-14 11:45:18.586 key state=0x00E0 vk=0x0078 down           F9
2014-06-14 11:45:18.594 key state=0x00E0 vk=0x0048   up            H
2014-06-14 11:45:18.594 key state=0x00E0 vk=0x00DE down            '
2014-06-14 11:45:18.595 key state=0x00E0 vk=0x00DC down            \
2014-06-14 11:45:18.601 key state=0x00E0 vk=0x0049 down            I
2014-06-14 11:45:18.601 key state=0x01E0 vk=0x0026 down        Num 8
2014-06-14 11:45:18.601 key state=0x01E0 vk=0x0022 down        Num 3
2014-06-14 11:45:18.680 key state=0x00E0 vk=0x0049   up            I
2014-06-14 11:45:18.681 key state=0x00E0 vk=0x00DE   up            '
2014-06-14 11:45:18.681 key state=0x00E0 vk=0x00DC   up            \
2014-06-14 11:45:18.682 key state=0x01E0 vk=0x0026   up        Num 8
2014-06-14 11:45:18.682 key state=0x01E0 vk=0x0022   up        Num 3
2014-06-14 11:45:18.682 key state=0x00E0 vk=0x0078   up           F9
2014-06-14 11:45:18.684 key state=0x01E0 vk=0x00AF   up             
2014-06-14 11:45:19.608 key state=0x00E0 vk=0x0048 down            H	; h
2014-06-14 11:45:19.761 key state=0x00E0 vk=0x0048   up            H
2014-06-14 11:45:20.344 key state=0x00E0 vk=0x0049 down            I	; i
2014-06-14 11:45:20.448 key state=0x00E0 vk=0x0049   up            I
2014-06-14 11:45:21.160 key state=0x00E0 vk=0x004A down            J	; j
2014-06-14 11:45:21.272 key state=0x00E0 vk=0x004A   up            J
2014-06-14 11:45:21.880 key state=0x00E0 vk=0x004B down            K	; k
2014-06-14 11:45:22.000 key state=0x00E0 vk=0x004B   up            K
2014-06-14 11:45:22.657 key state=0x00E0 vk=0x004C down            L	; l
2014-06-14 11:45:22.760 key state=0x00E0 vk=0x004C   up            L
2014-06-14 11:45:23.488 key state=0x00E0 vk=0x004D down            M	; m
2014-06-14 11:45:23.600 key state=0x00E0 vk=0x004D   up            M
2014-06-14 11:45:24.264 key state=0x00E0 vk=0x004E down            N	; n
2014-06-14 11:45:24.400 key state=0x00E0 vk=0x004E   up            N
2014-06-14 11:45:25.376 key state=0x00E0 vk=0x004F down            O	; o
2014-06-14 11:45:25.488 key state=0x00E0 vk=0x004F   up            O
2014-06-14 11:45:26.225 key state=0x00E0 vk=0x00DB down            [	; p
2014-06-14 11:45:26.225 key state=0x00E0 vk=0x0076 down           F7
2014-06-14 11:45:26.225 key state=0x00E0 vk=0x0078 down           F9
2014-06-14 11:45:26.229 key state=0x01E0 vk=0x00B3 down             
2014-06-14 11:45:26.232 key state=0x00E0 vk=0x00DB   up            [
2014-06-14 11:45:26.232 key state=0x00E0 vk=0x0078   up           F9
2014-06-14 11:45:26.232 key state=0x00E0 vk=0x0048 down            H
2014-06-14 11:45:26.232 key state=0x00E0 vk=0x00DD down            ]
2014-06-14 11:45:26.233 key state=0x00E0 vk=0x00DC down            \
2014-06-14 11:45:26.233 key state=0x01E0 vk=0x005D down             
2014-06-14 11:45:26.236 key state=0x01E0 vk=0x00B3   up             
2014-06-14 11:45:26.353 key state=0x00E0 vk=0x0048   up            H
2014-06-14 11:45:26.353 key state=0x00E0 vk=0x00DD   up            ]
2014-06-14 11:45:26.353 key state=0x00E0 vk=0x00DC   up            \
2014-06-14 11:45:26.353 key state=0x00E0 vk=0x0076   up           F7
2014-06-14 11:45:26.353 key state=0x01E0 vk=0x005D   up             
2014-06-14 11:45:27.025 key state=0x00E0 vk=0x0051 down            Q	; q
2014-06-14 11:45:27.144 key state=0x00E0 vk=0x0051   up            Q
2014-06-14 11:45:27.704 key state=0x00E0 vk=0x0052 down            R	; r
2014-06-14 11:45:27.800 key state=0x00E0 vk=0x0052   up            R
2014-06-14 11:45:28.488 key state=0x00E0 vk=0x0053 down            S	; s
2014-06-14 11:45:28.600 key state=0x00E0 vk=0x0053   up            S
2014-06-14 11:45:29.200 key state=0x00E0 vk=0x0054 down            T	; t
2014-06-14 11:45:29.289 key state=0x00E0 vk=0x0054   up            T
2014-06-14 11:45:29.944 key state=0x00E0 vk=0x0055 down            U	; u
2014-06-14 11:45:30.072 key state=0x00E0 vk=0x0055   up            U
2014-06-14 11:45:30.681 key state=0x00E0 vk=0x0056 down            V	; v
2014-06-14 11:45:30.808 key state=0x00E0 vk=0x0056   up            V
2014-06-14 11:45:31.363 key state=0x00E0 vk=0x0057 down            W	; w
2014-06-14 11:45:31.492 key state=0x00E0 vk=0x0057   up            W
2014-06-14 11:45:32.048 key state=0x00E0 vk=0x0058 down            X	; x
2014-06-14 11:45:32.168 key state=0x00E0 vk=0x0058   up            X
2014-06-14 11:45:32.712 key state=0x00E0 vk=0x0055 down            U	; y
2014-06-14 11:45:32.712 key state=0x00E0 vk=0x0076 down           F7
2014-06-14 11:45:32.720 key state=0x00E0 vk=0x0055   up            U
2014-06-14 11:45:32.720 key state=0x00E0 vk=0x0049 down            I
2014-06-14 11:45:32.728 key state=0x00E0 vk=0x004F down            O
2014-06-14 11:45:32.810 key state=0x00A0 vk=0x0091 down  Scroll Lock
2014-06-14 11:45:32.830 key state=0x0180 vk=0x0090 down        Pause
2014-06-14 11:45:32.841 key state=0x0080 vk=0x0076   up           F7
2014-06-14 11:45:32.841 key state=0x0080 vk=0x0049   up            I
2014-06-14 11:45:32.857 key state=0x0080 vk=0x004F   up            O
2014-06-14 11:45:32.857 key state=0x0080 vk=0x0091   up  Scroll Lock
2014-06-14 11:45:32.858 key state=0x0180 vk=0x0090   up        Pause
2014-06-14 11:45:32.859 key state=0x0080 vk=0x0059 down            Y	
2014-06-14 11:45:32.870 key state=0x0080 vk=0x0059   up            Y
2014-06-14 11:45:33.432 key state=0x0080 vk=0x005A down            Z	; z
2014-06-14 11:45:33.544 key state=0x0080 vk=0x005A   up            Z
2014-06-14 11:45:34.577 key state=0x0000 vk=0x0014 down    Caps Lock	; End WTF-mode
2014-06-14 11:45:34.656 key state=0x0040 vk=0x0091 down  Scroll Lock
2014-06-14 11:45:34.760 key state=0x0040 vk=0x0014   up    Caps Lock
2014-06-14 11:45:34.824 key state=0x0040 vk=0x0091   up  Scroll Lock
2014-06-14 11:45:37.256 key state=0x0048 vk=0x0011 down         Ctrl	; Ctrl+C
If I were to hazard a guess, it seems that WTF-mode is a debug feature or unimplmented feature from my mouse driver software that seems to be interpreting uninitialized memory as keyboard macros. It's possible that that the repeated "device disconnect" sound and the LEDs have something to do with this as well.

But seriously, 3spooky5me...

EDIT:
Various editing revisions.


#5159371 remapping the keyboard (esp {} () )

Posted by fastcall22 on 09 June 2014 - 05:12 PM

inb4 lock


#5159287 remapping the keyboard (esp {} () )

Posted by fastcall22 on 09 June 2014 - 10:13 AM

Write an ahk script:
f1::{
f2::}
f3::(
f4::)
Though, you wouldn't need such a script, if you had proper typing discipline... I find the function keys harder to reach than any of the bracket keys (on an EN-us keyboard, that is).


#5157983 what is most difficult in programming to you?

Posted by fastcall22 on 03 June 2014 - 07:38 PM

Naming things.


... Come on, admit it. You know it's true.


#5157893 Javascript #include implemented in Python

Posted by fastcall22 on 03 June 2014 - 12:04 PM

Additionally, javascript already manages "includes"; just not in the way you expect:
<head>
<script type="text/javascript" src="a.js"></script>
</head>
<body>
<script type="text/javascript" src="b.js"></script>
<script type="text/javascript" src="c.js"></script>
</body>
Here, 'b' knows of 'a', and 'c' knows of the others. If 'b' were to define 'foobar', it'd be visible to 'b' and 'c', but not 'a'.


#5157888 Javascript #include implemented in Python

Posted by fastcall22 on 03 June 2014 - 11:48 AM

Thoughts? Am I crazy? Wasting my time? Has this been done/solved before?

None. Yes. Yes. Yes, requirejs.


#5157684 Does C++ have a squared operator?

Posted by fastcall22 on 02 June 2014 - 05:52 PM

Cool story, now try this one:
 
#include <iostream>
 
#define POW2(x) ((x)*(x))
 
class Foobar {
public:
    Foobar() : _a(5) { }
     
    int a() {
        return _a++;
    }
      
private:
    int _a;
};
 
int main() {
    using namespace std;
     
    Foobar f;
    int x = POW2(f.a());
     
    cout << x << endl;
}





PARTNERS