Egret Breakthrough

The company I am volunteering for outside of work has been using a flat-file database I will call Gold Digger for fun and because it’s a play on the title of the software. Just within the past half hour I was able to export data from one of their main modules in Gold Digger as a CSV file and was able to import this into the PostgreSQL database, Egret. My strategy was to build a migration table in Egret that would match the column names in the CSV. Because the CSV is all text, trying to import “-80.50” into a numeric field just blows the frick up, so I decided I would make the migration table columns all text. I will have to explore more to find a quicker method to perform these migrations, but the next step will be to insert into the Inventory table a selection from the migration table and get fancy with the data format functions (currently unknown to me) in order to match the datatypes properly.

Three hours Tuesday night taught me some major differences between Oracle and PostgreSQL. I think I would struggle to be a DBA because I always have to know why, and so much about databases seems to be ad-hoc.  In Oracle, a user is typically a schema, but in Postgres users are now Roles (with login privileges). Which is really interesting, because you can also have multiple databases in one “database”, but the users are separate from those databases. It’s weird. Now, what’s going to be really fun is building the user functionality and learning how to establish encryption over an intranet. Well, I won’t worry about that yet. A journey of a thousand miles begins with a single step.

jQuery Revelations

A few posts ago I lamented how there are so many things you can do with Javascript/jQuery, but most of those things are inappropriate for modern websites or are otherwise useless. Then today it suddenly hit me that the primary use of such things as slideDown() or animate(), which I just learned, is for advertising. Duh! I get those all the time when I’m reading news articles. You hit a certain point in the page and suddenly a video slides down and wrecks your entire reading experience. You close it and it slides up. I also noticed that the practice site for the book I am reading uses slideDown() to add some flair to whenever I move to the next question.

Sometimes you really do just have to keep learning before it begins to make sense. I’m sure I will recognize other legitimate uses of jQuery as I continue learning.

Fire

“I…have made fire!”

By this I mean to say that I’ve connected to a Postgresql database with C# and printed some content to the console, marking the third time I have used the connected layer of ADO to retrieve database information.

You have to realize, at my last job, all of this was abstracted from us. ADO is the beast I’ve been learning on my own for the past several weeks. I took a guided, 200-page tour, and now I’ve been doing more hands-on, which is so important. Most tutorials use Sql Server, but last week I had some down time to connect to one of our development Oracle databases, and now I’ve connected to my Postgres database. So that’s the power of using interfaces to achieve similar functionality across providers.

To be fair, I’ve had to reference my C# book for each occasion, as I keep forgetting that damn DataReader object, but I’m pretty stoked I got this to work. It’s scary to think how much more there still is to learn about ADO and Entity Framework, which leads me to my next thought.

Entity Framework still confuses me. I was thinking about doing the Egret database code-first, but I’m so new to EF that my brain starts to freak out when I think about the database structure in C# code. I’ve done so much with SQL over the years, it just feels better. Not having had experience on the job to teach me which is better, I may just build out the rest of the database in Postgres for expediency and peace of mind, then pull in the classes from the database. Unbeknownst to me at the time, the original data I received for the database was not the complete copy, and I only received the complete copy last month, which changes everything in my models, but I am desperate for visible progress. I can’t take the tutorials anymore: it’s sink or swim now, and some good people are relying on me to swim.

This is probably the most study I ever done over these past 6 months. The pace feels painfully slow, but 700 pages of brute C# is not to be dismissed, and I’ve dramatically surpassed the knowledge I had last year. But I’m going to count this victory and call it a night. I’ll push onward tomorrow.

jQuery Adventures

I finally started to learn jQuery using a book titled “A Smarter Way to Learn jQuery”. It’s a very effective book, teaching in tiny two or three page chapters, hosting 20 practice exercises for each chapter online. I usually dislike practice problems and prefer to chew the meat and move on, but this latter strategy has resulted in some glaring gaps in my knowledge, and has meant the frequent rereading of chapters in books such as “C# 6.0 and the .NET 4.6 Framework”, which has been my buddy for learning C#. I can honestly say this new methodology is really effective.

jQuery is used closely with Bootstrap and is also the library I chose for Egret, given its prevalence and the fact that a Javascript library has been missing from my repertoire. I am about a quarter of the way through this book, but the practice questions follow the exact same format for each chapter, so the thought of doing 55 more of these is wearing me down. More importantly, there are a lot of bells and whistles, but that doesn’t mean these bells and whistles should ever be used (I’m reminded of the html <marquee> tag, not that my company’s internal IT website would EVER use that).  Unless you’re using Ajax, I can’t imaging paragraph text swaps or fade-ins being used in a professional environment. This has always been my greatest barrier to learning more Javascript: Everything is permissible, but not everything is beneficial. Books almost always focus on what is permissible. As a developer with an eye for design, I have a hard time seeing much value in most of the site behavior. If it looks good and it works, why would I ever need fades, scrolls, replacements, swaps? Ok, well now that I think of it, swapping a class for input validation might be handy, but that’s about it.

Well, that’s why you have to jump in. You can find the useful bits later, but you have to understand the technology first. I’m just excited I’ve been making so much progress through these books lately.

Things I Hate Less About Linux

I spent a good three hours yesterday fighting flash drives and my motherboard to perform a fresh install of Ubuntu 17.04. It didn’t want to connect to my router at first, and the windows were laggy, but those issues have now been fixed.

So what do I hate less about Linux? I can connect my phone! I can also play mp3s in Rhythmbox! Also, Ubuntu is scrapping Unity, so once they come out with Ubuntu 18 it won’t be installed by default, which is kind of handy because I always install Gnome instead, and it’s just nice to think I won’t have all sorts of extra Unity fragments cluttering my file system.

Anyway, it’s time to get back into Linux. I gave away my primary Windows box to the refugee family I used to volunteer with. They were pretty excited, so I’m happy about that. This leaves the Linux box and my Windows laptop, so simplicity wins the day. Now I’m going to get my Music folder ducks in a row.

Revisiting CSS

I write this for my own sanity.

I’m building the visual side of the website for my Nepali friends. I know how I want it to look, but getting it to look that way is the problem. Layouts in CSS2 were a nightmare, and although CSS3 has done much to remedy these problems, the new styles are only patchwork to fix a broken monster. But I’m making my way through.

I have a left-hand navigation. I want it to layer vertically. I have a right-hand content space. When both are <div>s, they layer vertically, when I want them to be side-by-side, left-by-right. What’s was going on? <div> elements have a default display of block, so they push everything else in their container below. The solution? Make each display: inline and float both left so they are side-by-side.

I use <ul> tags with <li>, <a>, and <span> tags inside. I use the spans for Bootstrap glyphicons. But the hover was not working on my <a> tags. What’s was going on? <a> elements display inline by default, meaning they make room for everything around them. Hence why the a:hover background-color was only affecting the text. The solution? Make the <a> elements display: block. I had to adjust some margins and paddings, but it worked out.

Oh my gosh! It’s brutal. I know flex-box can do some of this, but it is not recommended for the layout portion of web pages. But it’s starting to look pretty good! I’m pretty happy with my layout plans. I’ll get back to learning ADO as soon as I have something decent to show them. It’s been four months now, it’s always a good idea to give the “client” something tangible to demonstrate progress. It also means I’m learning more about CSS, and that’s is always good.

MVC Adventures Part 3

Oh, the horror! C# uses a lot of boilerplate. I reached the section where a connection through Entity Framework gets setup, and everything has fallen apart there.

I kinda feel like an idiot. There is so much to learn here. Not having had to write much OOP on the job, I sometimes find myself reeling from all the unexplained object references, but my brain is finally started to wrap itself around how to really use interfaces. There are so many rote configurations to memorize, it’s a very different beast from “understand what this program is doing” when it is written in the raw. What’s a DbContext? “Oh, don’t pay attention to that! We’re programmers, we just rely on abstraction!” I die a little inside every time I have to forgo the full explanation, but I suspect this is just inexperience. After all, Python hides most of the details, it just doesn’t feel that way.

I am learning! I feel much more at home in Visual Studio and with the files. I generally get what MVC is doing. And I would probably be surprised just how much progress I’ve made. I got a simple list to output in html using Razor, building the values off of a subset of the Product Categories for my inventory system. Sometimes I still feel tempted to switch to Django, but there are things I really enjoy about C# and it’s far more common. Never give up, never surrender!