July 2012
48 posts
1 tag
I would like to know more C# and Ruby
I work with them, but I would like to know more about both of them. Really dive deep into them.
1 tag
Okay, so an int is defined in a method
gamegeneral:
Does that mean it receives it as input, or that it exports it?
It’s hard to pick up where I left off, I should start leaving more notes in my code
Could you show your method? In the mean time, here is the way it works in C-styled syntax languages:
int Awesomize(int input) {
int subresult;
subresult = spell(input);
int result = darkSpell(subresult);
return...
3 tags
Notes on HTML book, chapter 15, layout
Layout
It seems that everything in the book builds up to this. This is the climax of the book, if a reference/tutorial book can ever have a climax. This chapter looks big, so maybe it will be broken down.
Keep this in mind
CSS treats each HTML element as a box. Each one is either a block-level or inline box. Block level boxes will start in a new line. Inline elements will flow with the rest of...
2 tags
Stegosaurus Stevie: Introduction to Qt Programming →
stevieholdway:
Why this article?
I am going to admit, the main reason I am blogging about this is because I find it much easier to learn something by teaching it than I do by just slogging along and trying examples. Also, I have found that there are no real ways to jump in with Qt programming unless you buy a…
This is one of the best intros to QT that I have read. You did a great job....
1 tag
I keep having fantasies about a validation library
Maybe I should just go ahead and make one.
1 tag
Some things I would like to do
* true hypermedia REST api
* true OOP
The first one is doable. The second one is harder since it is hard to figure out what the hell “true” OOP is. The definition keeps changing. Yes, changing, not evolving.
3 tags
Notes on HTML Chapter 14 List, Tables, and Forms
List styling
list-stype-type values
for unordered lists: none, disc, circle, square
for ordered lists: decimal, decimal-leading-zero, lower-alpha, upper-alpha, lower-roman, upper-roman
list-style-image we need a url for it
list-style-position outside, inside
list-style , shorthand property
Tips for styling tables
Give cells padding
distinguish headings
shade alternate rows
align...
2 tags
Serialization in ruby →
3 tags
Notes on HTML boo, chapter 13, Box model part 2
The IE6 box model
Padding and with should be added to the width of the box at the border. However, IE6 includes the padding and margin in the width of the box.
To fix this error use: DOCTYPE for html 5, html 4 strict, html transitional.
display. It allows you to turn an inline element into a block-level element and vice versa. Its’s values are inline block inline-block, none.
It is often...
3 tags
Notes on HTML book, Chapter 13 Boxes
Boxes
width, height
Boxes will use as little space as possible. To control the size of the boxes, we must use width and height. We can set the dimensions using pixels, percentages, or ems. The use of percentages and ems may be better for adaptive design.
min-width and max-width, min-height, max-height
They will give the min or max values for width.
overflow. It tells the browser what to do...
2 tags
Notes on HTML book, Chapter 12
Text
There are two kinds of properties.
* The ones that affect the font look
* the ones that will have the same effect independent on the look
Choosing typeface
The most common types on computers are
Serif: Georgia, Times, Times New Roman
Sans0serif: Arial Verdana, Helvetica
Monospace: Courier, Courier New
Cursive: Comics Sans MS, Monotype Corsiva
Fantasy: Impact
Specifying typeface
...
2 tags
Quick draft for why I like tumblr
I may turn this into a more elaborate post later.
Practical reasons for why you should like tumblr.
* It is easy to find content and for people to find yours
* The instant feedback mechanism encourages you to keep blogging
* The tumblog format allows for more stream-of-consciousness writing without the word limit constraint of twitter.
The strongest strength of tumblr, in my experience, is...
2 tags
Planning work for the day seems tedious
Especially when one wakes up full of energy and with a clear mind. Yet it is very important because it sets the direction of the day. And not having direction costs a lot of minutes.
2 tags
Notes on HTML book, Chapter 11, Color
color
The color property in CSS sets the color of the text in the element. You can set it by using RGV values, Hex code, or use one of the 147 predefined color names. CSS3 also allows for using HSLA.
background-color
It colors the box that surrounds the element. The padding property will add space between the text and the edges of the box.
Color on the screen is mixture of red, green, and...
2 tags
Notes on HTML Chapter 10, CSS
Understanding CSS
* Imagine that there is an invisible box around every element
* A CSS has a selector and a declaration
* CSS declarations sit inside the curly brackets, and they contain a property and a value, seperated by a colon.
* The way to use an external css is via the <link> element. This one needs the following attributes: href, type=”text/css”...
2 tags
Chapter 9, video and flash
Flash
Traditionally, flash has been embedded using the <embed> element. However, now people are using javascript.
Flash still has a role but it is not as important as it was at one point. It is mainly used to host video and audio now.
The most popular way to include flash is via the SWFObject javascript library. It is good because it allows for showing alternative content if a browser...
1 tag
Excellent blog on programming →
Everyone one of you should check this site out. It is pretty good. Also check the notes section.
2 tags
I just solved another javascript problem
The common theme on these problems is the plumbing: getting file names correctly; not using the same id twice in a form.
So my guess is that a simple test of the markup showing conflicting ids and that can check whether files exist should speed up development.
2 tags
How to learn node
These are the notes from a truly good lecture I heard at rubynation.
1. Build
2. Try it
3. Read
4. Rewrite
2 tags
Haskell: there are no object and monads
I wrote about this earlier, but here is a second go at it: there are no objects in haskell. Once we understand this, monads become easier to understand. There are no real types either: a type is a function that holds values with a certain structure. We then use a specialized function to extract its values. Now the triad that a monad is becomes concrete. We need a function to put the value into our...
2 tags
Notes on Chapter 8, extra markup
Doctypes
* Each page of html should have a doctype
* Doctype helps to render the page correctly
* The doctype should be the first thing that appears in a page
* Comments <!— —>
* Id is an attribute that every element can have. Its value should start with a character or an underscore. Only one element can have an id. I wonder what happens if one shares them?
* class...
2 tags
Ready for the weekly review
So I am about to do the weekly review. And I am a bit loss since I am not using the gtd software the right way. I may have to start with that with a clean copy. It is not like I can do anything with the rest of the data that I already have. Last week was stressful, but overall, in the main goals that I had, it was good. The days were focused, and several of the main goals were achieved. In those...
Anyone know any good people to follow for...
maritova:
I’m getting myself back into that after doing an unrelated job for the past year, and I feel rusty. Could use some sources of good advice in those fields.
That is a good question. I would like to get an answer to that as well. Now, if you want to follow people on twitter, I would be able to provide an answer to that.
Some things i've learnt about programming →
Drawing with formulas
Something for the future. That trig tutorial via how to draw different images.
2 tags
Notes on HTML Chapter 7, third part
<button> so that one can have more control over the markup
<input type=”hidden” /> To have hidden fields.
<label> Used in two manners either wrapping the input within the label tags. Or
using the for attribute via the id.
Location for labels:
Above or to the left:
text inputs
text areas
select boxes
file uploads
To the right:
Individual checkboxes
...
2 tags
Notes on HTML Chapter 7, Forms, second part
On text areas, we should use css to style it. It is not an empty element. It must have opening and closing tags. Whatever text is within the tags will be sent on.
Radio Buttons and checkboxes Key attributes name, value, checked.
Drop down list box. An interesting one since the name goes with the select tag, but the value within the option tags within select.
<select...
2 tags
Joining lines in sed for fun and profit
While working on the classical project, the page that I need to scrape had the nice ‘post’ class. Unfortunately Nokogiri wouldn’t pick up the class when searched like this:
posts = doc.css “li.post”
This was because “post” had a hard return. On the next line the rest of the classes were there, and the search worked. The newline was getting in the way...
4 tags
Testing to see if page has expected text on it
Use curl and then grep. I used the -c option, which will give you the total count so that I can be sure that grep ran.
curl http://www.google.com | grep -c ‘google’
output is
<curl output here>
12
3 tags
Classical list project, the romantic list
I just finished creating the the romantic list. The list of romantic composers in wikipedia had a table and links, so the previous solution wouldn’t work. That meant that I had to run the list using one filtering technique first and then the second. For the second, I just went ahead and copied and pasted the section that I wanted.
I then merged them together using cat. I will merge the list...
3 tags
Classical list project
For the classical music of 20th century, I will have to select all of the links from the first td from each row.
Nokogiri is strongly inspired by by jquery, so having a knowledge about jquery helps. At the same time, one must be careful not too expect that it is too close.
The method that I ended up using was to do each step by itself, get what I wanted, and then see how many lines I could...
3 tags
Troubleshooting:
Is it the new code? I will remove the code that I have written.
No, it isn’t. The page loads. Interesting, if there isn’t any output returned on the page callback function, it is crashing drupal.
Page loading.
Testing with toolbar code included. Working.
testing with first part of new code included. Working
Testing while loading new code. Working
Testing while loading toolbar....
How does everyone pronounce 'char'?
aepokh:
I’ve always said it as in charcoal, like the actual word char. I’ve also heard ‘car’, for some reason more than I hear ‘care’ as in character.
Also I pronounce strcmp as stir-comp, seq as the ‘seek’ from sequence, dup as the ‘dupe’ from duplicate. I just feel weird when I say them in my head.
I say char as in charcoal. However, someone out there is probably going to say that it should...
1 tag
I'm finally doing it!
eltopomagnifico:
I’m in the process of writing a program that calculates the chances of capturing a Pokemon.
In an effort to prevent myself from being overwhelmed, I’m only creating a database of the original 151, and I’m using the capture formula from Red and Blue versions.
If this goes well, I’ll consider programming Gen II, and maybe even all 649.
This is such an awesome project. Share it...
2 tags
Tables for layout
Sometimes it makes the most sense
2 tags
HTML is the view
There are many engines that present the view part. Maybe the view should just be straight html? Maybe it already is.
2 tags
Attention
Yesterday I had a good day. I didn’t do as well within transitions, but I had several sets of good solid two hours collections.
2 tags
Filter the names from the previous result
Okay, I have now a list of text with potential name. I must get rid of obvious garbage.
I will see if I can reduce it first by filtering via the previous script.
It worked. A small change to the code, and I could get most of the garbage out.
I now have one file with the list of names of composers from each era. There are two files that I have to look closer: romantic, which has a format...
3 tags
Get the names from the pages
I have the pages, so now I am going to process them the to get the names out of them.
I am going to use the nokogiri library, which is similar to jquery, but for ruby.
Here are the instructions to parse a file
http://nokogiri.org/tutorials/parsing_an_html_xml_document.html
And for searching
http://nokogiri.org/tutorials/searching_a_xml_html_document.html
The basic algorithm is simple:
We...
3 tags
Download script
So I am going to download the pages first. I know which ones they are. I could do this with a bash script, but a ruby one will be shorter.
The script will execute curl and download the page. That is all what it will do.
Here is the man page for curl
http://curl.haxx.se/docs/manpage.html
On how to execute command line arguments in ruby
...
2 tags
Media Wiki api
I learned about the existence of Open Search Protocol http://www.opensearch.org/Home
Found this code for media wiki:
https://github.com/jpatokal/mediawiki-gateway
Query explained. You can get all kinds of data on it. A lot of metadata. http://www.mediawiki.org/wiki/API:Query
Opensearch
http://www.mediawiki.org/wiki/API:Opensearch
Search api. This seems to be the one that I am interested in....
4 tags
Quick, small project: Tumblr count of popular...
The goal is to be able to have a script that will keep track of who are the popular composers on tumblr mentioned through the “classical music” tag. To do this I need to:
* Get a list of classical composers
* Get a daily batch of tumblr posts
* Use the result to count
I will use ruby to do this small project. I will publicly document the process, and use github from the start....
1 tag
The sticky patch
There seem some areas that are just a bit harder than others. And they seems to drag one down, and slows one down. Those are the sticky patches. And if we don’t have time to address them, they seem to become harder and greater than what they are. They can sap energy. It is important to tackle the sticky patches quickly.
5 tags
Objects get in the way to learning functional...
Something for me to elaborate later. But I just got this insight: part of the problem of learning a functional language is that the concept of a object from OOP gets in the way of understanding functions. Why? Because in a lot of ways functions are often used as something similar to objects in OOP, especially when one is learning about types or monads in a language like Haskell.
3 tags
Using styles sheets for jquery-ui
Question: How do I style the modal form?
There doesn’t appear to be any styling that I have to do.
Am I loading the stylesheets?
No, I wasn’t. I had changed the name of the folder.
Other notes on styling and jquery-ui dialog modal form.
* To style the form, one needs to create an independent stylesheet for the form. There isn’t any way to style it through the dialog...
1 tag
Troubleshooting: create a bare-bones version of...
Complexity may hide a problem. When working in a complex project, pull out the part that is not working and test it by itself. For example, when having problems with javascript, create a minimal page and a minimal form to exercise that part that is not working.
1 tag
Working with jquery-ui modal forms
I have it almost working, but he form is not opening. I should try to find out why that is.
Hipothesis: There is a javascript error
Nope. No javascript error.
Hypothesis: The way to open it is incorrect. Meaning, I am using the wrong api.
No. The use of the api looks correct.
Hypothesis: The bindings in javascript are not happening
Yes, this is more promising. The button is not binding to...