Showing posts with label coding. Show all posts
Showing posts with label coding. Show all posts

Wednesday, October 24, 2012

I fucking hate apple

I need a way to express how much I fucking hate apple and their fucked up interface.

I have just spent the last week trying to upload my app to the app store. The main concern being that I don't own an apple computer. This makes it very close to impossible to effectively work on an iPhone app.

Thursday, October 11, 2012

Finding an ideal directory structure

My recent forays into coding have left me with some pretty confusing directory structures. I tend to break up my directories thusly: (I'm talking about web dev for the time being)

[myProj] - project
    [scr] - scripts
        [php and javascript files that store functionality]
    [mod] - modules
        [php scripts that will be include()d and rendered on the page]
    [img] - images
        [pictures and such]
    [css] - style
        [css files]

An avid onlooker would notice that where I can, I name my folders a three letter abbreviation of their full name. This is because I am lazy.

Wednesday, October 3, 2012

How NOT to design a messageboard

Goddammit, everything about MySQL sucks serious sackage. Have you ever googled for a MySQL issue and clicked a link for anything related to mysql.com? The whole site is designed to be incredibly painful and user-hostile.

Nice messageboard, MySQL.
Nice documentation, MySQL
Nice Homepage, MySQL.
Nice forums, MySQL.

DO YOU BASTARDS FUCKING TEST ANYTHING??

Seriously, just because things exist (forums, docs etc) doesn't mean they need to be changed.

Holy fucking shit MySQL, look at what SQLite did! An easy to read flowchart! Clear documentation! Who'da thunk it.

I fucking hate MySQL.

Tuesday, October 2, 2012

Awesome uploading gif generator!

I don't spruik much but I just found this and it's awesome

Loading GIF generator

I am always trying to find decent free loading gifs and that has a selection of pretty much all the ones you ever see on the net. I thought it worth noting down in case I am looking for it again later.

Lazy mysql

I fucking hate MySQL.

is it just me or do the letters 'sql' take far too long to type? They are in complete opposite ends of the keyboard and chafe my ass. Add in 'my' and you now have a word that requires you visit all compass points of your keyboard to type it. What's worse, every mysql function in php has "mysql" at the start of it!

Because I am a lazy bastard I made a little function that eases my pain.

function fetch($str){
    $q = mysql_query($str);
    $a = mysql_fetch_assoc($q);
    if(!$a){
         echo 'e: Fetch() returned an error! '.mysql_error();
         return false;
    }
    else return $a;
}

Now I can just call fetch("SELECT * FROM `my_ass` WHERE `mysql` = 'shit'"); whenever I require an array from a mysql string. I don't have to type "mysql" once!

Seriously, try typing mysql ten times fast.

Tuesday, September 18, 2012

Things I wish I had been told about objects

You can read this in a nice wiki format here

When looking at tutorials and tips, you'll hear phrases like "the objects 'x' method" and "returns an 'x' object". If you're not sure what this means, it definitely helps to get a grasp of the concept of objects when you are programming.

A big problem I had when I first learned about Object Oriented Programming was that tutorials all needed to be so damn correct. Since I was only a noob this lead to confusion and frustration.

This post is not entirely correct, and in some ways just flat wrong. But it serves to bridge the gap between procedural programming and OOP for the newbie. If you continue down the golden path of OOP you'll find that a lot of the stuff I said here was fallacious, but it was a means to an end.

Monday, September 3, 2012

Prototype is so handy

I have been javascripting like a madman recently. I now have quite a bit of experience in the language. Here's a few fiddles I did to get my head around stuff like objects, dragging stuff and AJAX calls:

My JsFiddles directory

Try the cards program, you can upload a picture and give it a name/description. It's supposed to be a jumping off point for making online card games like magic the gathering or w/e.

Saturday, June 2, 2012

Prograsm

Look what I can do.

I am currently on my fried laptop. Blue lines cascade down my screen like merry digital waterfalls, the gfx card hums like an engine with no oil, chugging towards its inevitable demise, my time is short and blender is far, far out of the question. So I decided to use this time effectively. I am learning Java. And that right there is my first program. And I am proud of it. If you look closely you can see that I fucked it up the first time, but such disappointments make the successes all the sweeter.

Wednesday, May 30, 2012

uTower - My UDK project

This isn't an announcement so much as it is a cave in of needing somewhere to post about this. I don't want to generate hype about it, but I feel the need to chronicle my progress somewhat.

uTower

Is the working name for the tower defense game I have been mulling over since about christmas-ish. You can read the concept doc here.

Sunday, January 29, 2012

Quaternions? I know, quaternions?

My good friend Weetbix gave me some stellar advice tonight on quaternions. I can feel the heat coming from my ears now. I'll let steam do the talking:

Black_Stormy: so I'm trying to code a new camera mode into UDK
Black_Stormy: and I'm using vectors and rotators
Black_Stormy: and doing math between them with variables that I have no idea what they are doing
Black_Stormy: in over my head or what
Black_Stormy: quote from a forum: Conceptually, I'm trying to rotate a stacticMesh actor so that it's orientation matches to a vector tangent to a spherical surface.
Black_Stormy: I know what thet means!

Thursday, December 1, 2011

Website visual design vs function design

You'd think that as a modeller I'd have a good grasp on the visual side of web design, or at least enjoy it. Well I don't. I find designing the look of a site tiresome and unrewarding. It's like playing tennis. I'm shithouse at tennis and, as a direct product, I hate the game. You need to have a certain amount of success to enjoy an activity. I find more enjoyment in coding functionalities and subsequently wearing out my f5 button testing my multitude of minimal modifications. There's a lot to think about with visual web design. Page lines, unifying texts, colour balance, information weighting and heaps more. This all goes sailing over my head as I tap away at php and jquery functions, so my web designs are inevitably un intuitive, uninspired and ugly.

Sunday, July 31, 2011

toggleSlide() and while loops.

I came across a problem tonight

That I thought I'd share a solution to. I was mysql_fetch_array()ing in a while loop to output a bunch of data in seperate divs, and since it was getting bulky and cluttered I decided to add a toggleSlide() so I could collapse them individually.

So I decided to supply an argument in the form of the entry id returned by the loop. I appended the id to the end of the divs in the loop and to the argument of my slide() function using a PHP echo. And this is where I hit a snag.

When you give toggleSlide() an argument and put it in the onclick selector, it accumulates your clicks. This must have something to do with the + sign you need to use when you add the argument. What this means is that

Function slide(arg) {
$('document').ready(function() {
$('#button'+arg).onClick(function() {
$('#slider'+arg).toggleSlide();
});
});

Will have an odd and unexpected effect. The first click won't have an effect at all, the second click will slide up and then back down, the thid click will move three times and so on. The trick here is to add an unbind() command to the button element. So

Function slide(arg) {
$('document').ready(function() {
$('#button'+arg).onClick(function() {
$('#slider'+arg).toggleSlide();
$('#button').unbind('click');
});
});

Will have your loop returned divs sliding around nicely!

Just to clarify, the div returned by your loop would look like this:

<div id="button<?php echo $id; ?>" onclick="slide(<?php echo $id ?>)"><img src="someimage.png" /></div>
<div id="slider<?php echo $id; ?>">Some content</div>

Look at me, gettin all tutorialicious and junk.

Monday, July 25, 2011

JQuery and I

I am an avid modeler,

And a not so avid coder. I don't get the same kind of relaxation and fun out of coding as I do modelling. I enjoy myself thoroughly, but it's hard to love cricket when you can't swing a bat. I think it's the learning I like. Working at my job doesn't give me too many opportunities to demonstrate intelligence, and learning stuff helps me fill that gap. So coding isn't so much a hobby as it is a means to an end.

But tonight I found jQuery

And found a reason to enjoy the shit right out of web development. I had been skeptical about using it because I have already had to teach myself php, javascript and the nuances of ajax, I didn't think I was really ready for another language just yet. Man I should have started with jQuery. I have been used to following tutorials for hours to get the basics down, and then inferring stuff and googling and whinging to psi on the wolfire irc and taking a generally monumental amount of time to make any real progress in my code. Tonight I slipped jQuery.js into my head and immediately went shooting across the galaxy on a blazing fireball of solidified awesome.

The reason I picked it up was because I wanted a nice slide effect for a div so I could hide and show it onclick. I found what I thought to be a very ominously unpromising example. 6 lines of code and assigning a few classes/id's. I copypasted it into my js.js, changed a few parameters and refreshed my page, wincing at the thought of the hours of frustration I had just resigned myself to.

It immediately worked just as planned.

Better than planned. My div slid smoothly away to its little hiding spot, and even did a little bouncy bit when it extended. I emptied the contents of my testacles straight into my pant leg. I sat there for a good half hour just opening and closing my div.

Hopefully this is the heralder of some more fantastic functionalities for my future forays into the field of javascript. I'm going to make so many slidey fadey movey divs on my site that you'll think you're watching a remake of Tron.

Sunday, July 24, 2011

Coding ecstasy

So i've been coding

In php and javascript for the past few days, and it is an alarmingly addictive process. In fact I think it harbours a lot of the hallmarks of addictive drugs. The way addictive drugs work is the first time you use them you experience a great high and have a great time, then as you use them more times you have some bad experiences as well. But then you have a good experience and it far outweighs the bad.

When I'm coding I often work for hours on one simple little function, and the code teases me by doing either nothing or crazy random stuff, and I spend more time bugsquashing than actually coding.

But that one minute when my function works

Oh man. Fantastic. I am a coding god. Javascript is a peon toiling in the infertile fields of my oppressed kingdom and must answer to my every whimsical desire. I throw my arms up in the air amd wave them around like I just don't care. This is what edison must have felt like when he invented antibiotics. This is real acheivement.

Then it's back to hours of painstaking bugchecking and confusion because I forgot to capitalise a letter somewhere. Or I used an inverted comma instead of a quotation mark. Oh man I cannot count the amount of times that has happened.

I think amyone who has coded much knows what I am talking about, even if I am only coding lowly js and php.