[Grubb's] Random Thoughts of the Day

IndyDDR's online socialization center: general topics not related to specific coverage areas

Moderator: Moderators

User avatar
Merk
Lady Banned Son of Switzerland
Lady Banned Son of Switzerland
Posts: 8289
Joined: Wed Feb 02, 2005 9:33 am
Location: Bloomington / Ft. Wayne
Contact:

Re: [Grubb's] Random Thoughts of the Day

Post by Merk »

Merk wrote:I figured it out. SQL Server Management Studio had some bullshit option set where you could not run any queries that would drop a table.

Switched it off and now I'm breaking everything wooooo!! jkjkjkjk I'm writing a dumb inventory app please pay me $50k from now on.
On the plus side this app uses the exact same SQL functions that a score tracker like VJArmy (new record, edit record, delete record) would use so if I ever actually get around to writing something like that up the code is pretty much already there for me.

Yes I know those functions are easy as shit to write, fuck you, I am not good with computers.
Image
User avatar
Merk
Lady Banned Son of Switzerland
Lady Banned Son of Switzerland
Posts: 8289
Joined: Wed Feb 02, 2005 9:33 am
Location: Bloomington / Ft. Wayne
Contact:

Re: [Grubb's] Random Thoughts of the Day

Post by Merk »

I think there's something fucked up about me - I have this weird obsession with earwax.

Sometimes big chunks of it will fall out of my ear and I will sit and stare at it for a long time.
Image
User avatar
Pokebis
Standard
Standard
Posts: 495
Joined: Sun Oct 11, 2009 7:03 pm
Location: Redmond Washington

Re: [Grubb's] Random Thoughts of the Day

Post by Pokebis »

Do you clean your ears?
User avatar
MonMotha
Site Code Monkey
Site Code Monkey
Posts: 2505
Joined: Sun Jan 23, 2005 9:18 pm

Re: [Grubb's] Random Thoughts of the Day

Post by MonMotha »

See, now, if you had been using MySQL or PostgreSQL, I could have helped you. It's certainly possible to make a change like that on either of those without dropping so much as the column, let alone the whole table. MSSQL I don't know, though.
A normality test:
+++ATH
If you are no longer connected to the internet, you need to apply more wax to your modem: it'll make it go faster.
If you find this funny, you're a nerd.
If neither of the above apply, you are normal. Congratulations.
User avatar
Merk
Lady Banned Son of Switzerland
Lady Banned Son of Switzerland
Posts: 8289
Joined: Wed Feb 02, 2005 9:33 am
Location: Bloomington / Ft. Wayne
Contact:

Re: [Grubb's] Random Thoughts of the Day

Post by Merk »

How would you do this in MySQL or PostgreSQL?

ALTER TABLE a_table
ALTER COLUMN a_column int NOT NULL IDENTITY(1 , 1);

Because that's how I would do it.
Image
User avatar
MonMotha
Site Code Monkey
Site Code Monkey
Posts: 2505
Joined: Sun Jan 23, 2005 9:18 pm

Re: [Grubb's] Random Thoughts of the Day

Post by MonMotha »

MySQL:

Code: Select all

ALTER TABLE a_table MODIFY COLUMN a_column INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY;
Note that MySQL doesn't have an "IDENTITY" type (I believe that is MSSQL specific). Instead, you simply define a column to be non-nullable and set it to auto increment. The data type is somewhat arbitrary, but of course it has to be incrementable. Type "INT" is fairly common, but you could use a larger type if you really needed it. The PRIMARY KEY index then constrains it to be unique (and the primary key for the table). You could use a simple UNIQUE index if you already had another primary key or didn't want a_column to be the primary key, but that would be a typical use of the "IDENTITY" type in MSSQL. Newer versions of MySQL have a "SERIAL" type that corresponds to "BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE" if you wanted to use that.

PostgreSQL:

Code: Select all

CREATE SEQUENCE a_table_a_column_seq;
ALTER TABLE a_table ALTER COLUMN a_column TYPE INTEGER SET PRIMARY KEY DEFAULT NEXTVAL('a_table_a_column_seq');
Again, PostgreSQL doesn't have an "IDENTITY" type, so just use an INT (or, again, a BIGINT) and make sure it's unique and non-nullable. On PostgreSQL, a PRIMARY KEY automatically implies non-nullable (and of course unique); this may not be the case on MySQL, but it if is, and it probably is, the "NOT NULL" up there is redundant (but shouldn't hurt). PostgreSQL also has a more flexible "auto increment" method than MySQL. You create a sequence and then tell it to assign the default value as the next value in the sequence. You could play around with the sequence to do crazy things, if you felt like it.

Note that I haven't actually ran either of those queries against any version of the respective DB servers. They may have minor syntax issues. It's possible that the pgsql one needs to be broken into two lines (one to set the type and next value and the other to add the primary key), but I'm pretty sure the MySQL one is correct.
A normality test:
+++ATH
If you are no longer connected to the internet, you need to apply more wax to your modem: it'll make it go faster.
If you find this funny, you're a nerd.
If neither of the above apply, you are normal. Congratulations.
User avatar
Pokebis
Standard
Standard
Posts: 495
Joined: Sun Oct 11, 2009 7:03 pm
Location: Redmond Washington

Re: [Grubb's] Random Thoughts of the Day

Post by Pokebis »

I don't know how old this is, but Koreans always have the best webcomics.

(Oh, yeah, and I guess it's courtesy to say don't open this at work or whatever. Borderline "normal" NSFW, but this is more for a different reason. There's your warning thingy.)
User avatar
LikeableRodent
Moderator
Moderator
Posts: 720
Joined: Wed Feb 02, 2005 11:13 am
Location: Seattle

Re: [Grubb's] Random Thoughts of the Day

Post by LikeableRodent »

Pokebis wrote:I don't know how old this is, but Koreans always have the best webcomics.

(Oh, yeah, and I guess it's courtesy to say don't open this at work or whatever. Borderline "normal" NSFW, but this is more for a different reason. There's your warning thingy.)
That comic is kind of old, but I'm a big fan of it's [sic] surreal style and technical implementation.
User avatar
Merk
Lady Banned Son of Switzerland
Lady Banned Son of Switzerland
Posts: 8289
Joined: Wed Feb 02, 2005 9:33 am
Location: Bloomington / Ft. Wayne
Contact:

Re: [Grubb's] Random Thoughts of the Day

Post by Merk »

Hey Adam, could you go into detail about how people obtain driver's permits in Japan? I HAD HEARD SOMEWHERE that it's "very difficult" to get a driving license in Japan. Would you be able to elaborate on the process?
Image
User avatar
Ho
Site Admin
Site Admin
Posts: 5646
Joined: Fri Dec 31, 2004 10:26 am
Location: The Ho-House

Re: [Grubb's] Random Thoughts of the Day

Post by Ho »

You could get an international driver's license...
Image
User avatar
Merk
Lady Banned Son of Switzerland
Lady Banned Son of Switzerland
Posts: 8289
Joined: Wed Feb 02, 2005 9:33 am
Location: Bloomington / Ft. Wayne
Contact:

Re: [Grubb's] Random Thoughts of the Day

Post by Merk »

nonononono, I'm not worried about myself actually driving in Nippon or being able to get a driving permit there and whatnot. I'm curious about the process for Japanese citizens. Adam more than likely doesn't have a driver's license which is fine, but he might be able to comment on the process itself. I'm mainly looking for an outside opinion on whether or not getting a driver's license in Japan is difficult.
Image
User avatar
Ho
Site Admin
Site Admin
Posts: 5646
Joined: Fri Dec 31, 2004 10:26 am
Location: The Ho-House

Re: [Grubb's] Random Thoughts of the Day

Post by Ho »

I'd imagine that if he was going to get a driver's license there, he'd be getting the international one as he is not a citizen. I believe that's what Jon had/has. I don't know if an actual Japanese license would even be available to a foreign national. Of course Adam may be able to comment on the process based on people he knows there as I'm sure he has many friends. :)
Image
User avatar
Merk
Lady Banned Son of Switzerland
Lady Banned Son of Switzerland
Posts: 8289
Joined: Wed Feb 02, 2005 9:33 am
Location: Bloomington / Ft. Wayne
Contact:

Re: [Grubb's] Random Thoughts of the Day

Post by Merk »

Right.

I did not know he wasn't a citizen! I figured since he's been there forever now that he would have gotten dual citizenship. I'll gladly admit I don't know the first thing about dual citizenship so if I'm just living in a land of make believe where people can obtain dual citizenship wherever whenever then fuck my ass I am destined to work shitty entry-level jobs for the rest of my life because I am a stupid retard.
Image
User avatar
Merk
Lady Banned Son of Switzerland
Lady Banned Son of Switzerland
Posts: 8289
Joined: Wed Feb 02, 2005 9:33 am
Location: Bloomington / Ft. Wayne
Contact:

Re: [Grubb's] Random Thoughts of the Day

Post by Merk »

I forgot to put on my belt today (I was in a hurry) and boy do I look stupid!

I'm thinking about getting a new job that's full-time. I feel like I'm not really learning much here and getting my CCNA isn't going to magically get my foot in the door to any place. Is anybody's company hiring?
Image
User avatar
LikeableRodent
Moderator
Moderator
Posts: 720
Joined: Wed Feb 02, 2005 11:13 am
Location: Seattle

Re: [Grubb's] Random Thoughts of the Day

Post by LikeableRodent »

Merk wrote:Hey Adam, could you go into detail about how people obtain driver's permits in Japan? I HAD HEARD SOMEWHERE that it's "very difficult" to get a driving license in Japan. Would you be able to elaborate on the process?
I don't own a car and have no real reason to get a license, so I can't give specifics. However from talking to people about getting their license, it's primarily difficult because during the driving test you'll get counted off for silly inane things, specifics of which I can't remember. Nearly no one passes the driving test on the first try.

International licenses (I do have one) are only valid for one year. If that year runs out and you're still abroad, you have to get a local license. In Japan's case, Japan will recognize some countries' licenses and allow you to simply "transfer" your license from that country to Japan's. Off the top of my head I can think of Canada and New Zealand that qualify for this, though there are more.

On the other end of the stick are countries (the US is one) where Japan doesn't recognize their licenses, and you have to got a Japanese license from scratch.
Merk wrote:Right.

I did not know he wasn't a citizen! I figured since he's been there forever now that he would have gotten dual citizenship. I'll gladly admit I don't know the first thing about dual citizenship so if I'm just living in a land of make believe where people can obtain dual citizenship wherever whenever then fuck my ass I am destined to work shitty entry-level jobs for the rest of my life because I am a stupid retard.
It's a pain to get citizenship. As far as I know, you're eligible to apply for citizenship after living here for five years (three if married to a Japanese national), but there are lots of holes you have to jump through. Also Japan only allows you to hold citizenship in one country, so if you apply to become a Japanese citizen you're required to renounce any other citizenships you may have.

If I planned on staying here long-term, I'd apply for permanent residency instead, simply so I wouldn't have to renew my visa anymore. Thing is, to apply for permanent residency you must have lived here for 5+ years if married to a Japanese national or 10+ years if you're not.
Post Reply