Friday, January 12, 2024

Hexademical

 I want to blog about something I've been really fascinated with since nearly the beginning of my life, but still don't understand today:

Hexadecimal!

The hope is that I'll blog today and laugh about it in some years when I actually know what I'm talking about. When i was a kid, I used a gameshark device for the Playstation one to mess with the data that was already in videogames. Final Fantasy tactics, in particular, taught me something really important regarding database structures and I didn't even realize it at the time, or maybe the nature of bytes (again, I'm still figuring it out). A user would reach into the container for characters and modify each slot. Ramza, the main character, was represented by 00, 01, 02, for his three sprite forms. Delita was 04, 05, 06 until you reached 09, Dycedarg. At 09, the next sequence would be 0A (the 11th character) while 0C (the 13th slot) held one of my favorite princess characters (haha). 0F was the 15th character.

The number 10 would represent the #16th character, then 20 # 32, and 30 #48, and if you're lucky enough to understand a bit about hexadecimal, this is significant (but I certainly won't go on and say more without learning a little more myslef). What a cool tool though.


I'm currently really struggling with databases and needed to figure out an outlet after finding something heartwarming (at least for me), so here we go.

I've been trying to bulk insert data into a table using SQL Server Management Studio 19. It is a mess. I used Mockaroo to create data and have no idea why the .csv files are so horrible, but from the forums I'm reading that's pretty standard.

The last two days of my life have been errors, currently:

    Msg 4879, Level 16, State 1, Line 161

    Bulk load failed due to invalid column value in CSV data file C:\tmp\Campaign.csv in row 2, column 6.

BULK INSERT Campaign
FROM 'C:\tmp\Campaign.csv'
WITH (
    FORMAT = 'CSV',
    DATAFILETYPE = 'char',
    FIELDTERMINATOR =',',
    ROWTERMINATOR = '0x0a',
    FIRSTROW = 2 
);
GO

Insert hexadecimal again where you may have expected a \n to reprent the end of a row. I referenced the ROWTERMINATOR and found out something kind of worked from the Microsoft manual--they don't really explain why, but it works. I of course referenced the table:

ASCII Table

And I like their description better than anything I'd come up with, so here's this:


"ASCII was actually designed for use with teletypes and so the descriptions are somewhat obscure. If someone says they want your CV however in ASCII format, all this means is they want 'plain' text with no formatting such as tabs, bold or underscoring - the raw format that any computer can understand. This is usually so they can easily import the file into their own applications without issues. Notepad.exe creates ASCII text, or in MS Word you can save a file as 'text only'"

Pretty neat, and refencing the "LF" (you'll see this on your VS code indicating how line breaks work!) was a pretty chance occurence. Now I have to figure out why SSMS is trying to read my clearly empty sixth column in my Campaign sheet, but whatever. You should see the Talend portion; it's a total wreck. I think I hate Java and don't even have the merit yet to say so, but if it ends up working somehow, I'll update that too.

>' See ya!

No comments:

Post a Comment