Solving the quadratic equasion with python

Python

I started a new python data mining course that started from python basics. Won't be posting the basic stuff here until I get to the more interesting stuff with pandas, numpy, sckit-learn and matpilotlib. Just a fun little way to solve the quadratic function

# Solves the quadratic equasion

def quadSol(a,b,c):

v = (b**2) - (4*a*c)

xplu = -b-(m.sqrt(v))/2*a

xm = (-b+m.sqrt(v))/(2*a)

print("(" + str(xplu)+ " , " + str(xm) + ")")

def main():

a = 1

b = 5

c = 6

Convert .doc files to .txt using Windows Powershell

This simple script converts Microsoft Word .doc files to .txt files for my txt/log file scan through script to sift through. 

# Run through all doc-type files in a folder and convert them in to .txt-files

 

function wordConversion{

 

# Specify location

$location = Get-Location

# Get all doc-files

$files = Get-ChildItem -Filter *.doc*

 

# Create word-object

 

$word = New-Object -ComObject 'Word.Application'

 

Powershell text search tool

Text search tool in Powershell

Wrote a quick search tool for Windows that uses some cmdlets from Powershell to search through txt-files,finds certain key words and writes them in a easily readable format inside a potentially user defined outfile. (github)

The tool ask for the file being searched for and the word that the user wants to search these files for.

 

 

A game of snake

snäke

A game of snake

As the last assignment of our java-course we had to create any kind of java based project that used a servlet based web-programming structure. The project had to include a database connection and a full create, read, update and delete that creates a table off the stored data in the database. 

Java homework part 5.

kuppi

Been a while since my last post. Some of my homework has been really simple so I didn't find them post worthy but the previous week we dove into exceptions and maps/hashmaps.

I found exception handling to be extremely interesting and probably really valuable information when it comes to my future with coding. the program I will be going through below is the the last exercise of 4 utilizing both hashmaps and exception handling.

Print a console square in C#

SharpestC

So I also started a C# (C sharp) course. The first task utilized the stuff I'd learned on my C - course

The first task was to print a simple square with nothing in the middle using C#.

This ended up being quite fun and I was able to implement stuff I'd learned previously! The print happened with a simple 2 x for-loop with i controlling the height of the square and j controlling the width. The output of the code was

Python homework part.3

Pythonlogo

Soooo... I sort of got lost in doing the exercises and completed 15 exercises since the last one. I think I'll just post the more demanding ones so there will be between one to two examples of what I did per subject. I'll include some screenshots again on how the programs functioned. I've only got two subjects left after these ones. I hope I can manage to complete them today. First up is sub-functions.

Java homework part 4.

Java

Won't be splitting these into two parts. I'll just write some shorter descriptions on what each program does. This week the first five exercises are about arrays and the next five are about methods. Had no difficulty doing the first five I found arrays quite simple. I ended up struggling with the method exercises. I was stuck on the second to last one for a while and had to ask a friend for some help. The solution ended up being really simple. I'll go in to more detail before the exercise.

Python homework part.2

Pythonlogo

 

This time we only had four exercises dealing with the reading, writing in, overwriting and searching documents with python.

I managed to complete all of these quite quickly and only found a challenge in the exercise 3/4 which you can see below. I'll ad some screenshots to these too from here on.

1/4

Read a document called faktat.txt and print what it said.

faktatpy