Jump to content


Check out our Community Blogs

Sundance

Member Since 13 Sep 2013
Offline Last Active Sep 17 2015 06:32 AM
*****

#666992 Introduction

Posted by Sundance on 03 January 2014 - 04:19 PM

Having bought the course (So the videos came with) I did not find any difference between the book and the course online...


  • 1


#666986 Introduction

Posted by Sundance on 03 January 2014 - 02:29 PM

For learning Python I suggest LearnPythonTheHardWay or CodeAcademy and my friend here KJGino linked me to UDACITY all three are brilliant resources for learning Python! :)


  • 1


#666696 My Paint Application

Posted by Sundance on 19 December 2013 - 03:33 AM

A really neat application! A small notice..in the rectangle the width is written as breadth unlike the other options. Breadth to me sounds like line thickness or something.
 
I opened a png or gif and upon adding a shape I get this fairly huge warning in console:

( full: http://pastebin.com/raw.php?i=2fhhdVTz )

Is a pleasing kind of interface laid out like that to be honest, not cluttered at all.

Alexander.

 

Breadth by definition is "The measure of the second largest dimension of a plane or solid figure; width"

 

But I agree, width is a lot better term especially for a generally used app.


  • -1


#666610 Favorite Programmers

Posted by Sundance on 14 December 2013 - 03:06 AM

It is not nice to name yourself as your favorite programmer, this is not modest at all and that way you are telling us you are the best programmer ever, which is irritating. We have a Bulgarian proverb "Modesty makes the person pretty", you should look it up. And that guy KJGino agreed with you, which makes him guilty too. 

 

It's OK to have self confidence, but it is not OK to throw it into the people's noses.

 

Thank you for your rebuttal but just because you disagree with someones opinion does not mean it is not "helpful" thus down voting was childish of you, something they used to do on YouTube comments..

 

However If you read my first response I did say I chose myself as I believe it is good to believe in yourself I did also express I did not mean it in an egotistical way thus I actually agreed with you straight from the start.

 

Further more just because they are your favourite programmer does not mean they have to be the best, my favourite athlete is not the best yet she has shown consistent drive and determination in life also she has never given up, each year she attempts to win again and again.

 

I have no doubts you will down vote this post as it does not agree with you and that does not bother me as I don't need to validate my life by your acceptance, I do however implore you to take this discussion private as not to derail the thread any further with any person issues you may have with me.


  • 1


#666591 Favorite Programmers

Posted by Sundance on 13 December 2013 - 02:30 PM

As egotistical as this sounds, one of my favourite programmers is in fact myself alongside, KJGino, Bill Gates, Grace Hopper and most of you guys, simply because you all help contribute to the modern day programming world in some way, I choose myself not out of ego or arrogance but because I'm a strong believer in believing in yourself so that's why I like myself as a programmer.


  • 0


#666488 Inactive programming

Posted by Sundance on 10 December 2013 - 01:03 AM

Personally it's the opposite, the more time I spend away from my computer the less programming I feel I'm able to do! My creativity flourishes more when I'm working but I guess that's because of how intense I usually am with education.


  • 2


#666006 Christmas 2013

Posted by Sundance on 19 November 2013 - 01:47 AM

Now I know some people have different religions and thus they do not celebrate Christmas however I figured I would start a topic and ask everyone what their plans are? Are you a sociable person who visits lots of family and has a house full of decorations or are you like me and just want to eat lots of food and ignore the world for a day? :P

 

~ LKP

 

P.S. If you don't celebrate Christmas, what do you celebrate? This way we can all get to know each other a bit better. :)


  • 2


#666003 [Python] - A very simple Palindrome checker

Posted by Sundance on 19 November 2013 - 01:01 AM

This is one of the few things that I actually remember from Python. It is called Extended Slices. The syntax for it is: [start:end:step]

 

Start is the first character position in the string you are working with, so if you had [1::] it would start with the char at the index 1 position, and since no end point is defined, it would go to the end of the string.

 

If you had [1:4] - it would start with the position 1 and go to the 4th position (but NOT include the 4th position, so in essence 1 through 3).

 

If you include a step, then you could do something like this: [1:4:2] would output every other char in the string, from position 1 to position 4, but not including the char at position 4.

 

To explain what LKP did - she left the beginning and end undefined so that the whole string would be used, and since the step was -1, it iterated through the string in reverse. So, [::-1] would give you the output of the whole string in reverse.

 

See here for more detailed information on Extended Slices.

 

KJGino explained that rather well, thank you however he also forgot his cardinal numbers. So the start of the string would be 0 instead of 1.

 

============================================================================

 

@OP

This is a nice little trick/exercise, as a result I attempted it in Java, and would be interested to see your one line solution. Here is one that I wrote, however; it is written in Java (however, should easily be translatable)

return isPalindrome = new StringBuilder(stringHere).reverse().toString().equals(stringHere);

Look forward to your response.

def PalindromeCheck(var) : return var.lower() == var[::-1].lower()

This is it in a single line, also makes sure the text is lowercase again to combat case sensitivity.


  • 2


#665980 [Python] - A very simple Palindrome checker

Posted by Sundance on 18 November 2013 - 12:29 PM

This is a very simple Palindrome checker in Python I just wrote it because I had never wrote one before, it was a lot simpler than I thought it would be (luxury of Python).

 

What is a Palindrome?

A Palindrome is a word that is the same when it is reversed for an example if I said "Cat" is a palindrome it is not because if you reverse it, it spells taC however if we have something like "Dad" in reverse it still spells "daD" so this is a palindrome.

print "What is the word you would like to check?" # Asks the user what word they would like to check.
x = raw_input("> ") # User inputs the word.
y = x[::-1] # reverses the string.
if x.lower() == y.lower(): # checks if the strings match, this way it handles case sensitivity.
	print x,"is a palindrome!" # prints it is a palindrome
else: # and if it's not a palindrome
	print x,"is not a palindrome!" # it will print it is not a palindrome!

  • 1


#665916 [Python] - Python Reddit Scrapper V1.0

Posted by Sundance on 15 November 2013 - 09:19 AM

This is my Python Scraper, I won't include the counter part (my PHP document that renders it) however you can find it on my Pastebin which is HERE or you can find a link to it in the script.

 

NOTE: The PHP script is NOT commentated as this post is about my Python Script and NOT my PHP rendering also note there is NO css file to go with it.

# Python Reddit Scraper V1.0
# PHP XML Render page: http://pastebin.com/nip125AJ
# This script scrapes Reddit
# It then exports it to an XML file to be read whichever method you decide is best.
# I wanted to create a scraper that would grab three things 1. The name of the post 2. The comments section URL and 3. The image / youtube video attributed to the post

# NOTES
# Coded on Python 2.7.5 
# Requires Requests and LXML modules
# Coded by LKP from CodeCall.net 
# Pastebin: http://pastebin.com/u/LorenKPetrov

# IMPORTS #
from lxml import html # Imports HTML from LXML
import xml.etree.cElementTree as XMLT # Imports element tree for python so it can write XML in the right style.
import requests # imports the requests so Python can 

# VARIABLES #
page = requests.get('http://www.reddit.com/r/minecraft') # Gets the page to scrape
tree = html.fromstring(page.text) # converts the HTML page into a tree for XPATH to read
title = tree.xpath('//a[@class="title "]/text()') # Grabs the Hyperlink text with the class named title NOTE: The space is supposed to be there, on Reddit the space is still there.
link = tree.xpath('//li[@class="first"]/a/@href') # Similiar to above but grabs the Hyper link from the href tag from the li tag with the class "first".
imgur = tree.xpath('//p[@class="title"]/a/@href') # and again with above it grabs the href tag within the paragraph tag.
root = XMLT.Element("ENTRY") # This is my root XML tag so it doesn't become part of the loop
start = 0 # This number was what I used during my While tag.
total = len(title) # This counts the total of entries, to explain that a bit clearer if we liken it to a book, it's like counting the number of chapters in a book, I.e. 36 chapters.

# MAIN CODE #
while start < total: # While start (equal to 0) is less than the total (equal to however many variables are in the title list) do the following
	doc = XMLT.SubElement(root, "POST") # Writes the XML tag POST
	field1 = XMLT.SubElement(doc, "TITLE") # Writes the XML tag TITLE
	field1.text = title[start] # Writes the tag content for TITLE
	field2	= XMLT.SubElement(doc, "MEDIA") # Writes the XML tag MEDIA
	field2.text = imgur[start] # Writes the tag content for MEDIA
	field3 = XMLT.SubElement(doc, "LINK") # Writes the XML tag LINK
	field3.text = link[start] # Writes the tag content for LINK

	start = start + 1 # Adds 1 on to the variable 'start' so it will loop the code for the amount of times that the total is less than the start

tree = XMLT.ElementTree(root) # Makes the ENTRY tag in the XML document
tree.write("MC.xml") # finally, it writes the info to the specified XML document.


  • 1


#665836 Greetings!

Posted by Sundance on 13 November 2013 - 01:30 PM

As a Python Programmer Anubis and Patton you're more than welcome to add me on Skype (can be found on my profile) or PM me if you have any Python related issues! :)


  • 1


#665786 [Python] - Time Grabber

Posted by Sundance on 12 November 2013 - 05:15 PM

So during a little bit of free time I wrote this

I have commented on the code, it's a very simple time scraper!

# Time grabber by LKP
# Python Version 2.7
# Requires LXML
from lxml import html
import requests
import os

print "Which country would you like to know the time of?" # Asks the user which country they would like to know the time of.
country = raw_input("> ") # Country variable
replacement = country.replace(" ","_") # If you enter in a country like "United Kingdom" the website TheTimeNow.com requires an underscore in its URL i.e. http://www.thetimenow.com/United_Kingdom so this replaces a "space" in the two words meaning it doesn't error.
page = requests.get("http://www.thetimenow.com/"+replacement) # Gets the entire page
tree = html.fromstring(page.text) # Converts it into a simple tree for LXML to read
time = tree.xpath('//span[@id="main_time"]/text()') # Reads the Span tag with the ID "main_time"
print "The current time in",country,"is",time[0] # Prints the users selected country along with the current time including PM/AM

Hope you enjoy it!


  • 1


#665707 Python Interest Caculator with Withdraw

Posted by Sundance on 11 November 2013 - 05:13 AM

# Simple Interest Calculator
# Only works in Dollars and does not handle Cents
# PY2.7 
# By LKP 
# Spelling mistakes may be rampant.
# Has no error handling but still figured it would be fun to do
# Based off of the mathematics problem from this post
# http://forum.codecall.net/topic/76922-can-somebody-help-me-with-this-question/?p=665676
print "What is your savings amount?" # Queries the amount of savings
savings = raw_input("> ") # sets the savings variable from the users input 
print "What is your yearly interest rate?" # Queries the amount of interest in Percent
interest = raw_input("> ") # Sets the interest variable
print "How much will you withdraw per year?" # queries the amount that will be widthdrawn per year
withdraw = raw_input("> ") # Sets the withdraw variable

trim_s_one = savings.replace("$","") # Takes the dollar symbol off of the input (only if it exists)
trim_s_two = trim_s_one.replace(",","") # Takes the commas off the input
savings_conv = int(trim_s_two) # turns the string into an interger

trim_i_one = interest.replace("%","") # takes off the % sign from the interest variable
interest_conv = int(trim_i_one) # Converts it into an interger too

trim_w_one = withdraw.replace("$","") # Again, takes the dollar sign off of the withdraw variable
trim_w_two = trim_w_one.replace(",","") # Takes the commas off too!
withdraw_conv = int(trim_w_two) # And again converts it into an interger

B = [] # List to append
while savings_conv > withdraw_conv: # while the savings is greater than the widthdraw then loop the code!
	savings_conv = savings_conv - withdraw_conv  # repeatedly subtracts from the savings interger
	interest_generated = savings_conv / 100 * interest_conv # works out how much interest has been accumulated.
	savings_conv = savings_conv + interest_generated # Adds the accumulated interest into the savings
	B.append(str(savings_conv)) # adds each amount of withdrawls to the list
	# This code then counts the amount of variables in the list and that's how many years it will last!
print "You can withdraw $"+withdraw,"for",len(B),"years before your account will be left with $"+B[-1],"left!"

It's not perfect, could have refined the code but I figured it would be a fun thing to do whilst I had a few minutes to spare.


  • 1


#665622 Hey, I have a life question

Posted by Sundance on 09 November 2013 - 03:55 AM

Here are some realities about 'making money' using programming.

 

1. We can not tell you what programs are worth making to make money as people will request certain things be built.

2. Freelance sites are your best option to get clients.

3. Learning PHP for 'making money' is like learning how to drive to make money, you can only make money if someone wants to hire you as their programmer / driver.

4. You will need a lot of free time, programming takes a long time to learn and to become really good at it takes even longer.

5. People will want to see your work (ePortfolio) and depending on how 'good' you are (judged by others, not yourself) will determine how much you can charge.

6. Programming for money will take time, so you can't work a full time job as a security guard and then do a bit of programming on the side to earn you $1,000.

 

- LKP


  • 3


#665620 Hey, I have a life question

Posted by Sundance on 09 November 2013 - 03:34 AM

First of all, it is hard to say what will be useful in 20 years time, we can only give you an estimate not a guarantee however anything you do with technology will be 'useful' so long as you keep up with the changes in it (such as Python going from 2.X to 3.X) and learn how to adapt to the new way things run, always learn new programming things, technology is evolving fast and it requires a fast and adaptive nature to keep up with it.

 

I would focus on learning one language at a time and go from there, Java, Python and C++ are good languages to know for software and PHP/Python is my personal favourite for anything website related.

 

- LKP


  • 1




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download