How to validate CSS3
09 May 2012 Leave a Comment
in Programs Tags: CSS3, programming
I encountered a problem the other day when I was trying to validate my CSS3 code at W3C. Apparently the validator is not up to date with all the new features, which results in loads and loads of warnings or even errors showing when you try to validate your CSS. However! There is a way to validate your CSS3 code, even thought it’s inoffical, you still might want to check if you got your CSS correct.
What you do is add a few key values to the query string: “profile = css3“.
If you want to validate a specific URL you put this in the browser: http://jigsaw.w3.org/css-validator/validator?uri=http://Your_Domain.com&profile=css3
Thanks to kaxigt.com for helping me out with this (the page is written in Swedish).
Part two: Converting Fahrenheit to Celsius
10 Dec 2011 1 Comment
in Programs Tags: programming, Python
All right! It’s time for part two of my first assignment. What I’ve learned now that’s new is defining functions and the try/except statements. So I’ve been rewriting the code a bit. So what I’m doing in this post is showing everything I’ve done, and I have added comments about the functions in the syntax. I have added a while loop in this program, just cos I’m anal and don’t want the error message to show in the IDLE shell. And I also want the user to be able to write something wrong but to be able to keep on trying til she gets it right. The indentations is not correctly showing on this page, I apologise for that.
# defines the main function, and it contains nested functions.
def main ():
PrintOut(Convert(InPut()))
# Defines the function InPut. I’ve also used a global variable here, which is not the best thing you can do, but since we haven’t started with the object oriented parts I can’t do anything different at the moment.
def InPut():
global Far
# I’ve added a while loop to make the program restart in case the user inserts the wrong value, for example a letter/symbol or a word.
# KeepOn gets the value 0, which you can interpret as false. And as long as KeepOn equals 0 the program will restart.
KeepOn= 0
while KeepOn== 0:
# the program tries to read the input from the user, and we set the input to be a float point number via float. If the user inserts the right value, the loop will end because KeepOn gets the value of 1, which is true.
try:
Far = float(raw_input(“Hello! What’s the temperature in Fahrenheit? “))
KeepOn= 1
# The program excepts the wrong values and the output to the user is a text saying its wrong and try again. Since KeepOn is equal to 0 the program starts again at try:
except ValueError:
print “Wrong, it has to be numbers! Please try again!”
KeepOn= 0
# returns the variable Far to the next function, Convert.
return Far
# Defines the function Convert.
def Convert(Far):
# defines the variable Celsius. And converts the number the user put in earlier, from Fahrenheit to Celsius.
Celsius = (Far – 32) * 5 / 9
#returns the variable Celsius to the next function, PrintOut.
return Celsius
# defines the function PrintOut
def PrintOut(Celsius):
#Prints what the temperature in Celsius is by getting the value of Celsius from the function Convert, The answer is formatted to have 2 decimals.
# the result is defined as a float by f
print “Hello again! The temperature in Celsius is: “, (format (Celsius, ‘.2f’))
# If the file is the main one, the program will run automatically when you open it. If not it will be added to the library and runs when the functions are called on.
if __name__ == “__main__”:
main()
I’ve uploaded the program as a textfile that you can download. You can find it here.
Convert Fahrenheit to Celsius with the help of Python
01 Dec 2011 Leave a Comment
in Programs Tags: programming, Python
After a few months away time from the blog I’m back! It has been a hectic period at uni with prototyping and Human-Computer interaction studies. But finally I am back with programming in Python.
First off, I’ve learned something that really helped me out when I started out programming again. Since you try out everything you do, your shell get’s quickly full of all your test runs. To be able to clear your shell you just get the file ClearWindow.py here and put it in the folder Lib (you find it in your Python folder). Then you just add a few lines to the file config-extensions.def which also happens to be in the Lib folder. This is what you add:
[ClearWindow]
enable=1
enable_editor=0
enable_shell=1
[ClearWindow_cfgBindings]
clear-window=<Control-Key-l>
Restart IDLE and under <Options> you now have the ClearWindow, with a shortcut bind to ctrl+L!
Ok so let’s start looking at the code and what to do with the actuall assignment I have this week, which is to covert Fahrenheit to Celsius. Since I’m a newbie I start with the functions I know of. Open up IDLE and let’s get cracking!
Fahrenheit = float (raw_input (“Hello! What’s the temprature in fahrenheit today?”) ) #We define the variable Fahrenheit to be the input from the user, and we also tell’s the program that the input is gonna be a number, a float number. If the user decides to write A instead of a number, we are gonna get an error message.
Celsius = (Fahrenheit – 32) * 5 / 9 #Here is the actual calculation. You can find the calculations for the covertion here. We use brackets ( ) for the same reason we use them in ordinary math, to isolate one calculation before it’s used in another.
print “Hello again! The temprature in Celsius is:”, (format (Celsius, ‘.2f’)) #Okay so print isn’t that hard to understand, and we have been through that function earlier. But the function (format (Celsius, ‘.2f’)) is new. What it does is that it formats the result of the calculation for Celsius. In this example I haven’t forced the result to a field of space, but if you want to do that you can write that number before the dot, an example would be (format (Celsius, ’7.2f’)) and if the input is less than 7 characters you will get a bunch of white spaces before the result. The number 2 after the dot is how many decimals we want the answer to show. In my assignment it’s 2, but you can change it to be what ever you want. The f stands for float number, easy as cake!
Starting out with Python, 3 basic functions
16 Sep 2011 Leave a Comment
in Programs Tags: programming, Python
I’m back from uni with some knowledge about the basics of Python. It seems to be a quite easy language to learn, but since it doesn’t compile it put some extra demands on you as a programmer, than for example Java. The compiler tells you straight away if you done any syntax errors, where as in Python you have to figure them out on your own a bit more. The basics we been going through is easy. So I’m gonna share that with you. So go download Python and an editor of your choice, I use IDLE for my examples here.
Output:
To get something printed, a text. The command is simply ‘print’
Input:
To be able to read input from a keyboard we have to use a module, this one is called ‘sys’. So say you want to read two numbers from your keyboard and then print which of these numbers are the biggest, you have to type ‘import sys’ at the top. This is to import the module that makes it possible to get read the input from the keyboard.
As you can
see here I want the program to first print the instruction for the viewer, which is to type in two numbers. the command is as I said earlier just ‘print’. Then we want to get the program to read the input from the keyboard, the two numbers. For that we need to make two variables, I’m calling them number 1 and 2. Then we need to specify the input, and when using sys you write ‘(sys.stdin.readline())’.
But this isn’t enough. We also want to decide what number is the bigger one. To do that we need to use the ‘if’ statement. So we type in a condition
n, that if number1 is bigger than number2 we want the program to type out “number1 is the biggest”. But since we don’t want it to print ‘number1′ but the actual number we read from the input, you put your variable in brackets ( ). We add + “is the biggest” after just so we just don’t get the number but also a bit of a text to go with it.
Besides the ‘if’ statement we have a few others. I’m going to introduce you to one more, the ‘while’ statement. It’s called iteration, which means repeat, so with this command we can create endless loops. But for the example here I will have an end. But if you want to try do an endless loop, at the bottom of this post, I will tell you what to do.
Here you don’t need ‘import sys’ I just forgot to remove it. So in this example I want the program to print the numbers from 0 to 10, but only every second number, 0,2,4 and so on. First off, we make a variable, I named mine ‘print_amount’ and set that variable to zero. Then we are going to use the ‘while’ statement. W
e want the program to continue running while it counts from 0 to 10, and, to make sure it doesn’t just print until 9, we have to make sure the program prints 10 aswell. We do that by saying the number of prints are less or equal to 10 ( <= ). Then we want the program to print the variable ‘print_amount’. And last we want the program to just print every second number. We do that by saying that the variable is equal to the variable plus two. This means the counter will add +2 to the original variable at the top which is at 0, until it reaches 10.
As I said earlier, you can make endless loops with this script, and it’s easy too. Just remove the +2 at the last string so you have ‘print_amount = print_amount’. The program will not add any counts to the variable so I will continue to print 0 with no end.
This is just a few basic commands you can use in Python. On monday we will go through some more during the last of 3 introduction lectures at uni. Then we have to build a small program for an assignment. I will go through it step by step next week.
How to check your OS architecture in PowerShell
14 Sep 2011 Leave a Comment
in Programs Tags: Powershell, programming
I have been slacking on the posting lately. I wish I could blame it on lots of studying but unfortunally it’s more a case of sickness and lazyness. Last two weeks I’ve been hanging around with this horrible cold and it made me sound like an old man that drinks and smokes too much. Luckily that have now passed, and I sound like myself again.
At uni we have moved from HTML to programming. Today we had the introduction lecture. Tomorrow will bring more depth, and go through the syntaxes of the programs we will use. My program will be Python, but 3/5 of the class will use Java. It will be interesting to see how they will organize the lectures, the groups are mixed with both Python and Java students. But since the basics of programming is so similar, it might work. Update tomorrow on that subject.
Anyways, whilst I’m talking about programming. A few weeks back I tried out the WoW Model Viewer. When I was about to download the file, my brain stopped working and I just couldn’t remember what OS architecture I have on my computer. I asked my husband, but he refused to answer and told me to check it in PowerShell instead. Great, just great. I never used PowerShell before, and I was kind of scared, I mean you have to type stuff on a blue screen, there is no pictures or menues to help you navigate. But! It was easy.
So here is what you do when you want to know what OS architecture you are running, PowerShell style:
1. Well first off you want to run Powershell
2. Next step is to type in Get-WmiObject Win32_OperatingSystem

In this command the program tells the computer to get/pick up properties about the OS.
3. If you write:
Get-WmiObject Win32_OperatingSystem | Select-Object OSArchitecture
![]()
You will instead get information specifically about what OS architecture you are currently running on your machine.
If you type in:
Get-WmiObject Win32_OperatingSystem | Select-Object *
you will get a list of all the properties you can pick up.
So say instead of wanting to know what OS architecture you run, you want to know how many processes are currently running you type:
Get-WmiObject Win32_OperatingSystem | Select-Object NumberOfProcesses.
If you want to know what version of the OS you are running you type:
Get-WmiObject Win32_OperatingSystem | Select-Object Version.

Piece of cake!
First try at HTML
05 Sep 2011 1 Comment
in Programs Tags: HTML, programming
Second week on my uni course we start with HTML. Finally! Since it is a beginner’s course, you have to get through all the basic computery stuff first *sigh* I don’t say I didn’t need it, cos I sure did.
Ah well back to the HTML. Today we had the introduction lecture. We went through the most commonly used tags and was encouraged to try it out at home. So here I am, writing this post on the HTML tag instead of the visual! This is what I’ve learned today:- To create unordered lists
- To use different font-styles
- That you can get different colours on the text
- To create ordered lists
- To create links: My university
- To define a definition list
- - Which is great, I love to use them!
- To create tables
- - But to get borders(on this blog) I need to use CSS and I’m not there yet.
Testing WoW Model Viewer
23 Aug 2011 Leave a Comment
in just for fun, Programs Tags: design programs
Been spending a few hours playing around with WoW Model Viewer today. My guildmistress is very much into the RP side of WoW and likes to make pictures that shows her character’s life story. To make the story short she convinced me to start a character on her RP server and also to make up my background story and told me about this program (hinting I neeeded to make my own pictures too). It’s been two weeks since I touched my little RP druid and I can’t remeber how she looks so I decided to just use my mage as a test model. I’m kinda bad at reading through tutorials, I usually just try and see what happens myself first and if I run into any problems then I look it up. You can also use this to get a banner made if you play on a RP server and the server have a webpage with your character profiles. Like you have on Argent Dawn EU its a community site made for all the players on the server, where they can post for example the character’s story and relation to other characters and fractions.
When you start up the program it asks if you want to load World of Warcraft, say yes to that and then it’s just to get started:
To sum it up: it’s a quite simple program, and it’s easy to make these kinds of pictures. You can just make more characters in the WoW Model Viewer if you need more of them in you pictures. I haven’t even gotten started on all the animation and cool stuff you can do in here. Some neat tips and tricks you can find over at the Guides/Tutorials forums for WMV.




