 Director at SkyMatters, and he's from Hong Kong. Thank you. Okay. Hello, everyone. My name is Jack. Today I'm going to talk about growth from small simple steps. So learning from Amazon, the name can be shorter, growth from S3. Yeah, today I'm going to walk you through one of my pistol experience, contributing to an open source project, which was not going really well, surprisingly. The problem is like this, the library name is called Active Record Imports. So how does it work? Once you need, for example, import 10 books records into a database at the same time. Instead of writing 10 different SQL statements and 10 database connections, you can write one and just say book.import books and then all the record is in the database. So it helps a lot if you need to insert millions of data at the same time. Yeah, but now some problem comes once we use enum in Rails. So enum is a feature since Rails 4.1. Basically you can define the enum attributes with some, for example, the status here must be either drafted, finished, or published. But somehow the value saved in a database is always integer. So drafted is zero, finished is one, and published is two. However, to do the assignment, you can say dot status equal to zero or dot status equal to draft. Yeah, only integer is saved. Sometimes in the migration you need to have, you want to have like default value to the status, but once we use that again, boom. The argument error says integer zero is not a valid. So my first question is, looks like I'm not sure why the integer zero is used instead of, so why the string is used instead of the integer. Then I look at how does it work in the PostgreSQL because I was using PostgreSQL and find out there's a method called pg get expr, and this is a method to get the default value and the output is actually a string. So that's why we get a string zero instead of the integer. And then I think Rails must be smart enough to do the typecasting and we can always assign integer attributes with a string and it should be automatically do the conversion. But somehow in the import methods in the library, it just use read attributes before typecasting. So it basically just read attributes from the instance without doing any typecasting. And then the place raise error is the one we call the method since k equals to v. Yeah, and this is a place because zero is not a predefined string. Yeah, so there's an error. And I was also asking why the test, all the tests go to past. If you still take about, it's still a single test. So this is a model file inside the spec. It basically defines the enum status once the active record version is larger than 4.1. For active record version 3, 1, 3, 2, 4, 4, 1, and 4, 2. Does anyone find the problem? What's wrong here? Yeah, the 2i. Because for 2i, at the most it converts the version to 4.4 and the value is never larger than 4.1. So the enum attribute is never defined. Okay, so I get the problem. I know what's wrong. I got the failed test case. Now I roll up my sleeves. Okay, work hard overnight. And then I received a lot of encouragement. And at the end, okay, sorry, I go back. I'll go back. Sorry, wait a second. So, yeah, and I received a lot of encouragement and at the last, the author of the repo when I said it is the best pull request I have ever seen. Awesome, but it didn't happen at all. So the reality is, okay, the reality is I sat down and was not sure what was wrong. The first I thought, okay, it might be a problem with Postgres SQL, but it turns out, okay, SQLite and MySQL are the same. And then I think, okay, that might be a problem because Rails, I think Rails must be smarter than this, but maybe way, way, because enum, it accepts strings like drafts and it never should be converted as the string to integer automatically. And at last, I define, okay, I won't have a pull request to replace read attributes before typecast with read attributes, which basically do the typecasting. And then the first maintainer comes here and say, okay, why in our library read attributes before typecasting is used? I'm a bit confused because I thought this is a question I should ask him and he should tell me, right? I was a bit confused. And then here comes another and here comes another committers, he said, oh, actually, the code was back to 2007. But go ahead, go to use read attributes if that test case passed. Really, 2007? You know, that was Rails 1.2. I got really sad about this. And then here comes another, the first committer actually come back and say, okay, actually the typecasting is handling somewhere else, but go ahead to use read attributes. And I was even confused because it's not logical at all. If the typecasting is handled somewhere else, why you need to use read attributes to do the typecasting duplicatedly? Confused, confused. And then I tell them, okay, read attributes is actually slower for the typecasting 50 times slower because I think my pull request was actually not that good. When I was still thinking, there was another committer actually comes here. In another pull request, actually made a very simple fix and I kind of get all the text pass and he just basically changed the model.send k equals to v with model scrap bracket k equals to v. I thought these two are the same, but somehow they're not. Because the scrap bracket equal sign basically is the same with writes underscore attributes and which does typecasting as well. I'm thinking, okay, it's working, but not very good either. But at the moment when everyone is, was stalked, the maintainer say, okay, I wanna close this. I wanna merge your pull request. Go ahead, but I'm going to create another pull request and merge the changes of both of your pull requests. So this is, yeah, this is kind of the story and through the entire story, I had no much positive emotions and the result was not very good. Although my pull request got merged, but I don't have much code to contribute it. But even this, I get some takeaways and the takeaways is really something I'm going to talk about today. So the first, I know much more about the active record connection adapter. It is good design to support your application, support multiple database types which is scalable. And the second, I understand more about different types of assignments in active records and typecasting. And also, I understand how at least the default value works in PostgreSQL. And the library itself is actually pretty good. The people are amazing. This is a good example or library to as a showcase how to support multiple Ruby versions and database adapters at the same time. And of course, no Rails, you know, more. And here's what are the takeaways I come here to for you. So the first, don't believe in stars. So for this library, it has more than, so for this library, it has more than 1500 stars and it is updated very frequently. But even for this, there was still some mistakes. I think most of the beginners can fix. And then, so the second, don't think you're making a perfect pull request at the first. So learn from the conversations from others. And the last, I think, contributing to open source projects sometimes is trivial, like small simple steps, but sometimes even the small simple steps is not that easy, is sometimes not smooth. Sometimes the reality is like this. So my first, my last suggestion is like, go ahead, don't compromise. Thank you.