Friday, November 7, 2014

How to read Image from Database with MVC

Even thou I was finding solutions on the Internet that were not really great at explaining how to make this work, I've come up with a bit different solution, it works perfectly fine for me and It does what I've intended to do. So...

My intention was that, when an administrator creates a new product, that he/she want to have in the database, he/she has an option to add a picture to that product. So my database table is called Product. And it consists of the following columns:

ID - Name - Category - Type - Description - Price - Picture

All of these are irrelevant except the Picture column. Since I wanted to store in the Picture column for each of the product a location where the file is being stored. Which...well  it gave me problem when later on reading it in the View of MVC architecture. For a couple of reasons.

First, when I use Path class to keep a file location, it writes the location into database with \\ slash. This is a problem since on the View, when we are listing products, the <img> tag receives the address using slashes in this / direction. I do not know if this is really what made me a problem, tho It worked only when I used / on the path of "~/Pictures/picture_name01.jpg". If I have done the "~\Pictures\picture_name01.jpg" I  got no result back. 

And that made me wonder, to look into what is written in my database. And guess what? It was C:\Users\Bla1\Bla2|Bla3\App\Pictures\picture_name01.jpg. As I was researching if this can work it was very confusing for me when people say to use in the <img> tag and address @Url.Content(Model.Class). Since the minute I write Model and hit dot, there is no class these people tend to use and I have defined as well. Seeing that some of the code they write in the Content method was also converting a byte characters and using some funky and tricky lines of code I do not see nor understand how they are related to what I wanted to achieve, I've come to this solution.

I thought to give the <img> tag address of the folder where I am storing the Pictures. So my <img tag looks like this:

<img src="~/Pictures/" alt="Image"/>

I've added after the Pictures/picture_name01.jpg to check if it works and it does. So I thought "can I somehow add to this ~/Pictures/ how to locate the file name of the product? And then I thought "and why not save in the database just the file name?" Which I did.

Then I've changed in Action of Controller for my Product where I am creating the products, to save a filename instead of whole path where is being saved. I went to View and wrote next on my <img> tag:

<img src="@Url.Content("~/Pictures/" + @Html.DisplayTextFor(modelItem=>item.Picture)) alt="Image"/>

If you wonder how I come up with this, I've had to check what does the Content method do. When I realized it receives the exact location of the file, it was common sense to add the path to the folder and + to it the Text for the item that is being stored in a database. What you get originally in the MVC default index view's it is @Html. Display For () which basically just displays what you have on your Entity Model, DisplayTextFor converts it to a more "useful" text than just displaying.

Basically what it does on my application is - when administrator creates new Product and adds a picture to it, the picture file (aka picture_name01.jpg) is being saved to the folder called Pictures. The file name is being saved to the database, meaning just the text of the name of the file. And in the View we just read the Folder path and add to it name of the image that is saved in database for each of the Products.

I hope this post will be helpful to others who are beginning with MVC as I am. I really love MVC so far and most probably I will continue making web-applications in the future. Have fun!

Monday, October 27, 2014

Working on graduation project and geting some usefull code

I've been rather chilling last 1 month and a half from the last subject I had to finish, before I could start a graduation project. Last couple of weeks I am working on it and I will make a post about it when it is finished. I am doing it with MVC ASP.NET C# so for now!

I wanted to share one usefull code that helped me for MVC database. I got a need where I am entering users into database, to reset the auto-increment number to a specific number. Meaning, whenever you create a new user, you will have its own ID number being auto increased by 1. However since I created couple of users named with "asdasdjqw" and "ajsfiaosfj" I had to delete them, but when I do that the numbers are going to increase by 1.

This means that if you had ID numbers up to 15, your ID database table would look like:

0  NameUser
1  NameUser2
16 NameUser3

Where 0,1,16 are ID numbers. So I wanted to get back to 0,1,2 and continue from that. And I came to this line of code, that worked quite good.

dbcc checkident( 'Users' , RESEED , 1 )

Where Users is my database table. Once you execute this query and create a new user, it will continue following the order of 0,1,2,3,4,5 and so on.

Hope this is some usefull info for MVC users who are just begining. Have fun!

Monday, August 4, 2014

ASP.NET MVC 5 Authorization instead of Web Configuration site

So! I've been searching on the internet what happend with ASP.NET Website Configuration page? You know the...Create Users, Manage Roles, Set Rules page that you had in Visual Studio 2010? Well in the version before Visual Studio 2013 Express actually, since it is no longer there in the version of 2013. I mean of this website configuration page if I am not making my self clear already.

But for some REASON it doesn't exist anymore in Visual Studio 2013. I was searching for like 5 hours today can it be back? And actually it can. BUT! It took me about 5+ hours to realize that the REASON it is not there is - because it's old. Even on Microsoft forums no body is talking about it, because it's not wanted anymore. I was like eager to have the Web Configuration site back!! I knew how to use it and it was good. I actually did found together with my brother a workaround how to make it work in Visual Studio 2013, but something gave me this feel that , it shouldn't be in MVC 5. Yet I am not even sure if that workaround is doing what it should.

But then I read on the one of the Microsoft's ASP.NET tutorials, that Authorization in MVC 5 is there for, simple fact, that people want more to use their Facebook, Twitter, Google account's to log in on a specific page and leave comments. And then it gave me more sense of what is the application of MVC 5 in Visual Studio 2013 about. Because when you create new project in the Visual Studio 2013 Express you can check out that they offer you in Authorization configuration which you can set and there it says:

 "For applications that store user profiles in SQL Server database. Users can register, or sign in using their existing account for Facebook, Twitter, Google, Microsoft or another provider."

And that's what your authorization for the appliaction is. That's what I chose because mainly I needed a registration on the site, then there are codes you can write in the authorization classes to allow Facebook, Twitter and other account to log on to your app but that's not what I am writting this post about.

I wanted to show you how the authorization can be done for a specific page using, the built-in Registration and LogIn buttons you get with the Bootstrap theme of the new project in Visual Studio 2013. I hope you have main understanding of Controlers, Models and Views for I'll try to make this short. I'll show you just the main principle of authorization that I belive you can achieve a lot later with it. So here it goes:

1. In Visual Studio 2013 Express for Web, create new ASP.NET Web Application project and select MVC, check in Change Authentication button if the Individual User Accounts is selected, so you make sure you have authentication that I mentioned previously and make sure NoAuthentication is NOT selected. Give a name for app whatever you wish, for me is just WebApplication4.

Visual Studio 2013 Create New Project

So you have in Solution Explorer standard folders, including Controllers, Models, Views. If you go to Controllers and choose HomeController.cs file, you'll see on the main screen, three functions called Index About and Contact. I chose About method just because thats the first thing that felt to me non-important to experiment with. So one line of code I came across on ASP.NET official tutorials site is the following one:

[Authorize(Roles = "Administrator")]

However the same tutorial used I think MVC 3 in Visual Studio 2010? I am not sure I can't tell but the interface is obviously older since you had that Globe icon where you opened Web Configuration site in the Solution Explorer. But again, that's older version of Visual Studio, so how this code that just have been written can work for me in Visual Studio 2013 Express when I do not have any Roles, nor I have no idea where my registered Users are being saved?! There is no Configuration site?! The hell!? Luckly OOP (Object Oriented Programing) is a handy thing to know, and I think probably because of it I managed to figure this thing out.

So let's first register one user on our site. You can comment out the code [Authorize] if you have written it already:

2. Do a Rebuild of your appliaction in the Build menu and launch your application with Start Debugging. Once it is started go into Register and create an account. Enter the mail whatever you wish, I'll use "" because its epic name for epic unexisting fictional epical mail domain. And password requires to have one uppercase letter and one non letter or non digit character so I'll use something like - Dovah12#. You can write in whatever, just make a registration.

Register new user

Once you have done that succesfully you should see in the top-right corner saying "Hello registered_email". So the first question that came to my mind after doing that is "Okey so can I use that [Authorization] code with just this user I registered? Can I restrict others for that About page/method and just not this user?" So that's what I did:

3. Go back to Visual Studio 2013. Go to Controllers folder in Solution Explorer, then HomeController and above About method/fuction write:

[Authorize(Users="")] - just instead of my registered e-mail you write the one you have.

Now there is few things I must point out. This Authorize code, when written above functions/methods are something you use to customize that specific method/function. I think they are called code snippets but I am not sure, I just understood it as a customization for a functions in MVC. Now this is where my knowledge of OOP has come to the rescue! You can notice that the Authorize is written just like a class, right?

Authorize and About method

So what I tought then, since Internet became of no use, is to check what does that class do. If you right click exactly on the Authorize , while nothing else is selected, you will see option Go to Definition or u can just postion blinking indicator on it and press F12.

Go to Definition of the class

I am not going to explain what is every attribute in the definition of the AuthorizeAttribute class doing, it will make this post WAY TOO LONG. I will just say that because of reading what every of those options are doing, I came to conclusion that there is a Users atribute that we have used already, and then there is Roles and TypeId attributes. So I had to ask myself "But where are the Roles!? Where are the Users!? Nothing ever allowed me to create a Role, when there is no freaking Web Configuration site and on the registration page there is no option to choose a role !? Uuurghh!!" Well I didn't ask my self with that agony but it's what I tought. So it had to be in some storage, right? sound's familiar...Database! But where?!

If you look to the Solution Explorer of your project, there is that folder saying App_Data but it's empty. If you look on the top of Solution Explorer there are this icons, and one of them is saying "Show all files":

Show All Files
If you click that you will notice that you can expand now your App_Data, and you can see a file saying probably something like aspnet - name_of_webappliaction - 1021049150105105.mdf. If that's so that is the database. Do a double click on it and you will be switched to a Server Explorer. As you can see, if you ever used SQL Server this is pretty much like it. Why is there? Because MVC is set to make it so. Most of the Begining with MVC tutorials in the internet will show you how to create databases and use them, for now lets open the Tables folder in our Database.

Database Table where users are being registered

As you can see, this tables are where the registered users are being stored. So now it makes sense when we wrote a code saying [Authorize(Users="] it worked because Users table is there and it's called AspNetUsers. You can right-click on it and select Show Table Data. You will see your registered user just like so:

UsersTable with registered user

Now we can see that the registered users are stored in a known place (database) and we can know a bit more about them. If you would test your application now and go to About page you will see it requires you to log in because we wrote the code [Authorize(Users="")] where we restricted that About page to allow ONLY User with specific email to be able to access it. You could register another account with diffrent email and password and it won't be able to access About page because we specified only ONE user and that is the user with "" email.

So now there is a question:  "Okey but what if I have MANY users who are allowed to enter About page and MANY users who are not?!" If you go back to Server Explorer you will notice there is AspNetRoles and AspNetUserRoles, tables. Both are empty as there is no place on our page to fill them. And we need to fill them both so we make a "connection" between users and roles so that we set which role matches a certain user. Hope this is not too confusing.

I won't go into creating a whole page and fields to fill them, it is already too long post so we have to fill those two tables manually. I hope you have a bit of knolwedge for SQL so this is what we will do:

  • Register another user in on the web-page (launch app and register user)
  • For AspNetRoles table in our database do a New Query and insert two values both are strings so I've added - 001(id) for Administrator and 002(id) for User
  • For AspNetUserRoles you have to insert UserId which you can find in AspNetUsers table and RoleId which you can find in AspNetRoles table. It is important for you to remember which user is what. One have to be Administrator and one have to be User.

You have a bit to check things back and forth, move trough tabs a bit more, it helps a lot if you have dual-screen. But to insert values into tables, a quick reminder it goes: 

INSERT INTO tableName VALUES ('string', 'string')

Once you've connected your Tables , you should have AspNetUserRoles table looking something like this:

UsersRole table 

Main goal with this table is that you connect desired users to have role of Administrator and role of User. Now all that's left is to change the [Authorization] code to restrict Role instead of user. So we write following:


Rebuild your project, Start debugging or without debugging, which ever you prefer, and lets try accessing to About page again. It should ask of you to LogIn again. If you log with your Administrator registered account that you connected in the database table AspNetUserRoles, for me it is dovahkin, you should be able to continue to the About page and read the "Your application descripition page." This means that the restriction for the About page for this account is working, meaning you can access to the About page because the Role of the, in my case user is Administartor. Try doing the same with 2nd account you registered. If everything have been done correctly, it will ask you again to LogIn, meaning that the Role of the 2nd registered account is not allowed to acces this About page.


This is just the basics of how you can set authorization for roles work. Normally you would want to create on the registration page a field to check, which role is the registered user going to be, but then again if you would want to set that option you would also have to set it for a Administration roles, because it wouldn't really make sense that EVERYONE can register as Administrator, right? I really hope I did not bore you to death with this post, I really got excited for figuring this out, I was a bit in doubt that because of not having a Website Configuration page things are much more complicated, but all it took is one line of code...basically...well it really looks like that. But if you ask me, I think this give much more flexiblity for developers.  There is right now tons of things coming to my mind to try out. I hope you found this post usefull, I hope I explained it at least to a "understandable" level. If there is any question regarding this post or anything about it that might not work, do not hasitate to ask I'll gladly help. Have a nice day/evening/night , stay calm and ...

Thursday, July 24, 2014

Creating my website, graduation project and ASP.NET MVC

So I've been thinking lately, I should do something proper. I had a bit of time to think of things that were happening in the past, and I made some "goals" to complete in next few months or so.

Firstly, I'll be creating my own website, where I'll probably switch to blog there instead of here, I will make final note of that when the time comes. I have to see to design something that will resemble who I am and what I do.

Second, I am doing graduation project and I might continue posting here about how the project is going. Since I've decided to do that project in ASP.NET with MVC, and lately by researching a bit of how it is working I've liked so much that I will continue working most of the projects with ASP.NET for web if not completely dedicating my self to it. I will tho fix some of the projects I've done in PHP before and use it as portfolio on the webite.

And ASP.NET MVC Is something that completely fits my logic in creating websites. I've been reasearching it lately and when I realized how it worked, I got this feeling when I was 12y old and experimenting with MS-DOS while using it. I KNOW it is far from being same, but probably it has to do with the fact that C# is what felt the most close to me, then HTML and CSS are ...well yeah...what they are. I never liked doing PHP for the website. I don't know why, It never felt "enjoyable" to work with. Maybe its the syntax that's not fitting or whatever it is, I know MVC is now what gets a lot of my attention.

Either way, I'll keep writting here what I will do next so I can keep track of things and sort of give tasks to my self.

See yo!

Saturday, July 12, 2014

Programer's degree - is it really needed?

When I started programing, I thought that's all there is to it. However, when I first time began programing it wasn't really a programing at all...And I only realized that when I began my studies. Some people will say for a degree "not needed at all" and from my point of view I think that can depend on what you plan to do, what is your passion and what do you want to know. On the other hand, people who do have a degree they can't tell you its not needed because they know the difference between, what they went through and what it takes to have a good software instead of people who are programmers and how they are putting the puzzle piece's together.

How can a degree help me to make software applications better?

Once I went trough all the programing subjects on my university, like C, C#, Java, PHP, OOP, SQL, HTML, CSS, ASP.NET, WPF I thought those subjects were the most important. They probably are, meaning that you have to see the differences between them languages in order to know what are the differences between languages in syntax and class libraries and what can you expect to be different when switching to any other language that I did not mention above. But when it comes to make a software application or any program to be very good software, there are a lot of side factors that make a software good and it doesn't include programing language at all.

For example, many programmers believe that when they develop a web page, or design it as well, that graphically that webpage has to be pretty, silky and nice. But what if I told you that graphical part doesn't have to do anything with the usefulness of the web page? This might sound to some people like " Well duh! " But I sometimes get shocked when I see what people are doing for some webpages with all the amazing effects, 3D things that truly look fascinating, but when it comes to me interacting with the page, there isn't a single thing I would want to click on that page, because the info I need is no where to be seen. Or people who make web pages useful, but so ugly that you can't force your brain to bother with what's going on on that page. You might wonder now, "what is this on about?" but my point is that programers and those people who create pages like those, obviously do not know those side factors that make a web page have its purpose, usefulness and most important visitors that come back to the page and stay there to read the info they need. Shortly said "great content".

In order to make that content be great, one has to take into consideration: social media, will the content be shareable, the needs and wants of an owner who has specific reasons why something on the page or in software application will take a lot of his work, software reliability and the list goes on. There are just many things that make a great software stand out from the rest. And in most cases it can be done always with a group of people rather than individual. Sure, there are softwares individuals who can work on, but it can never be the same as with the ones who are doing it as a team.

Saturday, July 5, 2014

You wish to start programming but which language should you use?

You've decided you want to venture into this world where every programmer says different and every one of them claims one language are better then the other for various diffrent reasons. You start asking your self  "but how can I know if this guy is right and the other one is not?! why is this language better that this guy say it is then the other one?!". Truth is, some programers like so much their languages as they probably started with it and stick to it forever. I'll try to point out some differences between few languages and why I believe the programming language you should start with is...

C programming language

- Wether you are programming in Java, PHP, Python, ActionScript or C# and C++ they are all based on programming language C. Operating systems are written in C, if not they do at least posses standard libraries of C. You might be wondering "why?!" and thats probably because of the fact that C is language very close to a machine language. If you would want to program a street light, calculator, tv-remoter etc. to work with programing language, you'd probably go for C or C++. Both of them are very close to a machine except that C++ has some sorts of an object programming. I do not know the C++ very well as I never used it but being based on C things can't be far then they are in other Object Oriented Programming languages and C it self.

- Main reason why I belive if you get to start with C other languages will be much easier to get along with, is right because of that mechanic or machine language level. If you can understand why in C things are being called when you execute something, or why is compiler executing this and not that, and why pointers are calling to other pointers when you tell them to, why is the "for-loop" working the way it is and other loops as well, once you get a handle of those in C, everything else and EVERYWHERE else 90% of things are the same. What can be diffrent is...

Syntax in programming languages

- Main difference between every language is its own syntax. You might wonder "what is that?". Well the syntax of a computer language (for example: Java) is the set of rules that defines the combinations of symbols that are considered to be correctly structured documents or fragments in that language. For example, in C# you have to define a variable that remembers whole numbers by writting an "int" and giving it a value by adding "int = 5", while in PHP just write "$a = 5" or "$b = 5" or any letter but do you notice the difference? That is syntax. That is how one set of rules is documented for a C# and other one for PHP. Next to syntaxes there is also Object Oriented Programming or otherwise written as...

OOP - Object Oriented Programming

- Some languages like C, Erlang also some older languages like BASIC they do not posses this feature. What this means is that those programs run from the begining to the end. Straightforward. From top to bottom. BASIC had GOTO statement in order to skip around in a program but it was hard to do so if the program was larger. Main problem with programs like these were that you could easily loose up in code not be able to follow where is what. The answer to solve this is Objects.

- Maybe this might be a bit confusing to understand or for me to explain the whole picture but a main thing you should have in mind, for a start, is that Objects are self-contained; protecting their own data who are only accesible via an interface of the public member functions (encapsulation) which allows you to avoid mistakes you would otherwise do if you would have all in one program of 4500140284224 lines of codes... Also the inheritance allows you to write much less code allowing you to large projects manage easier.

- That is why programing languages like C#, Java, PHP, Action Script 3.0, Python and many others have a lot of classes in their libraries, as those classes are objects that are being use or you can use during your projects.


- I hope I managed to point out few of the things you will come across when dealing with programing languages and what you should have in mind when starting to code. However I am always staying open minded and I always wish to hear what other people think. Do you have better experience when starting with some other programming language? Do you think something else would have been better for a beginner? And why would you say so?

Friday, June 20, 2014

Students, are high marks that important?

This is my personal thought about high marks, and I believe this can vary when it comes to what studies are about but I'll speak for more technical studies in my case thats's IT. And I hope it will help some students about thinking if high marks are a must or not.

I write this because I don't think marks are and ever been all about what the student is or how much he/she knows something or how much he/she can use the same knowledge in practice. Some students aim high they want the best of the best marks, that's okay and amazing in fact, actually I applaud for dedicating that time, but for me that means they don't have pretty much any interest in their lives for anything else but to study, and I don't want to sound negative about it or make it sound like that's the bad thing, but I don't see it how otherwise you can or you would want to have only the top marks, especially if you choose to pass some exams again just to get higher and the best mark.

I think I'd literally die if I would only do that. For example, even though my studies are about IT mainly including programing and projecting information systems, I started with design and animation, then video and sound editing and I could never just completely forget about all that and shut my brain off from it and then solely think about programing. I constantly always taught how to integrate them. I always come to an idea of something that can be created or done and many times there is not enough time due to obligation towards university are taking way too much time in order to do something properly. But I still can't resist the need to experiment with tools about design. So obviously I can't have all the time in the world only and nothing else but for studies. As well I like to play guitar as I consider it as sort of a hobby so there have to be time for that as well.

Of course I am not taking away all the time possible from the university so I do everything else but just not university obligations, I wouldn't be at 2 partial exams until the end now if I would. I guess it's the reason why it got me to think now. Because I've been hearing students who say "I did this exam very bad : (.... only 88 out of 100 points :(..." and I don't get it. I had exams where I studied 2 days before them I got 95 points just because I got lucky on the questions on the actual exams. Which makes me think, who gives a mark to a student for a hard work "behind the scenes" ? Because some students, including me as well, for some subjects, studied like few weeks, even a month, before the exam, only to get so lucky on the exam to get the questions you didn't really think were that important...


So you write god knows what, and you get about 70 out of 100 points, but hey no one gives a damn for the rest 90% of the subject you actually you have 70 points friend. Will I go again on the exam to get 90 out of 100 points? Of course not! Because I don't need a mark to tell me how much I actually know about something. But where is the mark for the hard work? I do believe that comes when people actually start to work on the real projects in real surroundings when the marks you had on the university come up to show they don't mean that much and its the life you need to adapt to.

To be honest, all the people I know who actually finished their universities no one ever asked them for the marks they had on the university for the job, no matter what someone might say to you. I do believe some companies especially in IT sector, do hire students with high marks for the image of the company...and I do know some students who look upon those students like "woo : O...I MUST STUDY HURDUR NOW!!!" but I always think "Isn't the world much larger than that hired guy/girl and company itself?" especially if it is about IT. Because you are so close to the internet that there isn't a place nor the location from which you can't work or work for.

Which brings me to say, what about people who are working and studying? For whom the chances of getting high marks are way narrowed? What can guarantee that the person who have to do stuff on that way aren't already doing his studies for a living? Which can result in very high marks or average marks. Does that mean he isn't doing a good job? I would disagree again.

My point or so to say in about all this previously written is that you shouldn't let anything get to you or make you feel down for any reason. In the end the only thing that pays off is hard work and nothing else matters. If you study hard you might get high mark or not, but nothing can take away the things you know, the things you learned through hard work and nothing else. I see that now when I basically have nothing left hard to study of what's left from my studies...I wish I knew this back at the start.

I hope this post was helpful for students who are now going through the same things as I was and if so I'd be glad to hear so!

Sunday, June 15, 2014

Why you should defragment your hard-disk

Have you ever asked your self what does the defragmenter really do? Does your defragmenter application tells you everything is all right with your hard-disk and you don't need to do the process at all? I like to maintain things to work on the optimum speed and  I hope I'll manage to explain you why you should do it never the less, if you haven't done it or if you think its not necessary.

When you are writing a file you are actually filling in the smallest unit for writing the file called a Sector, at least that's the name for Windows, for Linux I think its called a block.  And every sector is being placed in a Cluster. Every cluster can contain several sectors in a row. The number of this sectors in one cluster depends on the characteristics of a computer configuration.

Whenever we are filling the sectors, we always get the full size of a cluster even if the space of total number of sectors is less then the number of sectors in one cluster. For example, the file we are writing has 5 sectors and one cluster has size of 4 sectors, automatically it's been given a second cluster with another 4 sectors and the space that's left is being called an unused or slack space. Hopefully the next picture will explain this better.

However, when we are saving or writing a file on a hard-disk, the computer will always try to fill in a space in a cluster that is next in a row. If the cluster that should be next in a row is already taken with some other file's sectors then it will fill the ones that are not. A file filled in different clusters like these is being called fragmented file. Getting an unused space is kind of always there when writing or saving a file. Hopefully the next picture will explain this more precisely.

Now when files are being written or saved as shown in previous picture, the "head" or the arm of the hard-disk needs a lot more time to position in order to read the file it needs and therefore the average time to access, reading the file is drastically increased. This is the reason why the defragmentation is needed to be run once in a while in order to sort out files on hard-disk and eliminate fragmentation.

Personally, I do defragmentation once in a two months and it takes only 2-3 hours though this can depend of the size of your hard-disk and the amount of files you have. Probably this won't effect your performance in some drastic way, or maybe it will, but I hope I managed to explain main reason why you should do start defragment process once in a while, if nothing at least to release a bit of stress from your hard-disk and make it last longer.

Monday, May 12, 2014

The latest news!

Well I just tought to inform people since I kinda notice everyday people are checking up the posts I have provided and I am very happy it actualy gets to someone, my studies are near end so therefore I haven't been able to think much of anything for the Blog, either way, I'll have something to share hopefully by the end of May. Hope my posts are usefull and help people in decisions if they had doubts! Have a great day/night and stay tuned!

Sunday, March 23, 2014

Linux vs Windows, what is the problem?

I've been using Windows OS since I had 486mhz computer. Back then internet wasn't in the amount of use as it is today so probably I couldn't read so much of Linux vs Windows and how one is better of the other, especialy how Windows is bad and Linux is good. I'll share you some of my toughts as a desktop user of both.


So, Windows. I have a feel some people get blood boiling with rage when they hear its name. I wonder why is this? One guy said it once "I have a toster and I hate it so much but I love the other one" I see this the same way. Mostly since Windows 8 was published people started going mental about it. I am probably lucky I have a chance to get free copy of it from university so I can test it with all the updates. I used previously Windows 7 and I was very happy with it. Then Windows 8 came...and guess what? I was happy with it too.

Start button

I've read tons of people saying "they've destroyed it with removing Start button" I do think this is because the Windows 8 was oriented more for mobile devices and therefore it seemed to us, who are used to Start button, a bit odd, but I personaly think thats all there is to it. It was just tiny bit different, I barely ever open Start but when I first time launched Windows 8 I tought "what? what is there now then?" so I move my cursor to bottom-left corner. I do "left-click" and what do you now! it opens the Start menu. So that being a bit "wierd" I tought "can't you set it to pop up or something?" so what I do is "right-click" and what do you now! even better, short-cuts. So for me that was it. Start is different but still works sort of the same way and everything else is pretty much the same as for Windows 7. And Windows 7 together with Win Vista, XP and 98, had pretty much the same interface in every edition. Every most used component of Win was at the same place. So I find it hard to understand the rage about it.

Everything was the same except the new Metro Start. I liked it but I was very unhappy most of Metro applications that I expected to give info, they didn't. For example, Mail didn't notify me istantly when I get new mail and few other applications as well had he same issue. And this was the down part for me, but I tought, do I really use this? No. So I tought its probably better used with the mobile devices because that is how it gave feel over all. If you loged out (probably screen lock on the phone) and you log back in it will check all the new info for each of the applications. But since I have my Browser set to open Gmail, Hotmail and several other tabs that I check daily, I didn't really bother with applications in the Metro Start.


Yet I did feel it was slightly slower then when I used Windows 7, even tho I was thinking "didn't they say this should be faster?" and well it was faster for boot definately, at least I could tell the difference on my Core 2 Duo processor. But I did have a feel for a while that some processes in the background are slowing down the machine. Somewhere about 2-3 months of using it, it became a bit unconfortable.

Then they gave us 8.1 update. I tought to my self "oh nice I hope they optimized things now" because it really didn't feel like it was. Then I read update notes and people's comments how furious they are about start button and other things and all I am thinking if my PC will be restrained from unnecessery processes? And the more I tought about it, I questioned my self "well can I see what processes I am using because I know I've installed a lot of applications".

A bit of research I found application called AutoRuns official from Microsoft. Turned the programs and services I know they are being started on LogOn and the Services they use. Guess what? I've been still using Windows 8 and my PC was working like the day I bought it with Windows 7, 5 years ago. I realized, it's not OS that is slow, it is me installing tons of crap on it.

So I waited patiently on 8.1 update, did fresh install of Windows, installed the programs I use the most, turned of services and processes with AutoRuns and for how long is it now? A year or two? I never felt my PC has any reduction in performanse so it works the same as the day I bought it. Only performanse reductions I feel is because today's game demand better CPU, RAM and HDD but thats just because my configuration of computer is 5 years if not more old. I like to belive my graphic card is still okey :)

So thats all my experience with Windows 7 , 8 and 8.1. And I am not using computer just for playing Solitaire. I am student of information technologies and I've started as designer so I used from graphic editing programs for pictures, videos and sounds to developing applications and video games. And in all that my only complainment is that I am always way behind the requirements of what modern video games require but that has no connection with the OS I am using. Everything else I have no complainments about.


However! I started here and there testing out Linux OS. I do admit I didn't use Linux OSs that much as I did Windows and to be honest I never had need to do so. But I had several reasons to test it out.


First I was in doubt my Windows was being slow due to "too many" services working in the background. I wanted to see if it will work faster because friends told me it does work faster. And well I do agree it is very fast when it comes to start up and opening applications, but my biggest disadvantage for Linux is that when something doesn't work you have to go behind the codes and lines and all kind of stuff to see why it doesn't work. But when I work with something on some graphic project or application there is nothing I would want to change the "do it now" with "lets check all the codes now and see why it ain't working".


I heard people saying "I have a lot of troubles installing applications on Windows so I switched to Linux" my first tought is "...the what?" but I forget then that there is people who still use torrented applications if not the OS it self. So I assume this is the reason people have trouble installing applications. Also I read on net people saying "Linux helps you understand how computer works better" but from what I've seen it ain't much diffrent then MS-DOS used to be, and I used that for 3 years.


Also DirectX. When I was trying Linux out I could never find a good simulation for it. And this is mostly for the games I wanted to test out. I did read on the internet how to set a game to work and all that and people say "yeah u can" but whatever I tried out the game wasn't working out well. In fact any of the programs that I wanted to use and it used to simulate its work from the Windows it just wasn't the same. If you ask me I would use Linux for a laptop or something like that where I am only using developer and diagram applications. Or If I would want to run a server. I think this is probably the most reason why I am concidering a Linux in use.  In fact I'll try the latest one I read about is Luna as nice introduction to Linux. So if you are a HC Linux person and you know about Luna already I am willing to hear more about it.

Hate, Love?

You probably think now "this guy loves Windows and hates Linux >:(" but thats not my point at all. I know that I am mostly Windows user and that I am probably used to it the most as I never had any problems with it. I only write this post so that people don't think everything is bad as people claim it to be or better than the oposite. I think all of it is either personal taste or how you see things.

On the computer 99% of mistakes is humans mistake because without human interraction to the computer it is just machine that stands and does nothing. So its the same for the OS you are using. Well if u exclude processes that are needed for OS to ran. In the end I do belive people choose what they are used to, what they like, what they can have or if they want something different. All of the OS have some advantages and disadvantages same goes for Windows and Linux.

Its up to you to choose what will you do with them.

Thursday, March 6, 2014

What have you been up to lately?

I've been a bit busy last several weeks, mostly studies and nervs to cure after certain professor...but either way I did not waste my time! Or did I? Well some people might say I did but I truly enjoy doing some graphic design or animation no metter what kind it is. That being said I give you *drum rolls* the Transmogrification Sets for Warlock! Yeah I know , but I like the game. A lot. Even tho I am not playing that class specificaly, my brother is, and he pretty much designed the whole thing I just made it "move". Either way I hope you could find it entertaining, if you are not the player of WoW it self, if you are I hope it will be of use to you.

Jaeden the Casual Warlock Blog

Though that's not the only thing I've been doing! I sort of had my first job! Like ever! I felt like a man...I was like "urgh f*** yeah I am working now *heavy riff as I walk down the street*" well not that much but it really kinda expands my view on things. I say this because I've been pretty much studying whole my life and now when it finally came to some exact work it really made things different. Right now I don't have much to say about this, but I hope I will be able to share some insights in the near future that truly can improve you on the work you are on.

Finally, I've started having some intrests in Erlang programming language. If the info I have is correct, Erlang can be used in connecting two programing languages in order to do additional work to what those programs already do. Also great thing is that (if I'm right about this) that it can connect two diffrent programming languages together in order to enhance some sort of a process/job/work. More info about Erlang you can check on their official page here: Erlang

Well that's pretty much it, I do however try ,when I get time, to build Word Press Theme. I will eventually post the Theme we built (since its 3 of us working on design at the moment) and give some detailed info how you can do one your self.

Till then, stay stronk!

Thursday, February 13, 2014

Boost up your PC speed in 6 steps with Autoruns !!!

All right! I've been a bit busy with studies last couple of weeks, but I had a chance to get my hands on two applications as I am starting some sort of a project with freind from USA who told me about BtSync and thanks to magazine where I read about Autoruns.

Though BtSync is kinda straight forward application, I'll try to give some info about Autoruns what I have checked off and on, and how I have used it to boost up Windows 8.1.

I belive this works for every other Windows OS as well. Before I did use this I had my OS working just fine, it wasn't that much of a trouble but however I did started to loose nerves at some point. For example, when my Windows starts up, and I log on to my Window's account, it took me at least 5 minutes till it loads everything, even though I did previously turned off everything I could on StartUp in Task Manager. Sometimes when I have to alt-tab between game and/or applications, it has about 5-10 sec and maybe that ain't much but the feel of how overall usage of my PC was was bad. And I knew it ain't working on its best because I only realized how much once I turned off several things on LogOn of Windows and some services I never ever use with Autoruns application.

Autoruns is application that has overview of all your services and processes running on your operating system. The way I understood it, it helps your memory and CPU to not "think" or better say expect some applications or processes to run when you disable them.

This is the place where you can download it and its on official Microsoft's TechNet web-site - Autoruns

I could notice the diffrence the moment some services were off! So I hope it will do good for you too.

Here is what I have turned off in Autoruns, but basicly the most important thing is to do first:

1. Make sure that u go to Options first, then choose Filter Options:

autorun's filter options

2. Then make sure Hide Microsoft Entries is checked ON. This will prevent you to turn off anything that Windows needs in order to work properly:

autorun's filter options

3. Logon tab. This is basicly all the applications that run upon the moment you login to your Window's account. I'll show you what I left to be ON, but pretty much you could turn off every application that you installed additionaly. Like Skype, Chrome Hangouts, Updates etc. I only left Graphic Card application and AMD Dual Core optimizier just because I have a feel they'll help my hardware work better. Some people on the other hand belive this has nothing to do with it. And also I have one Chat application being turned on once I log in the windows.

autoruns logon tab

4.  Explorer tab. I pretty much disabled everything here except NVIDIA Display Shell Extension. If you are not sure what something is going to do and you think it's crucial to your hardware performanse I'd advice you to leave it be. As I read about Autoruns they said explorer you could set everything off, but yet again I prefere to leave things on for wich I belive it will help, hardware, work better.

autoruns explorer tab

5. Internet Explorer tab. I left Java Plug-in being checked ON and everything else I turned off. As I understood, some people state that IE for Win8 is constantly using some of this services while windows is running, probably because of it's Metro Start menu but I almost rarely use IE so I left Java if it's necessary for some updates for browser to work properly. Either way, other services I had there are some applications I installed during installation of some other programs like SilkSavings etc.

autoruns internet explorer tab

6. Services tab is probably the one that will really boost up the speed of your OS. Yet you should know that this will disable some automatic updates for the applications that you are using. However the applications that depend on the Internet are most likely to ask you again to install it's service if it is missing. Personaly I disabled all services for Adobe Flash Player, Google, Mozilla, Skype and few applications I know won't have any impact on performanse of Windows. Again I left NVIDIA display drivers as most important and 2 additional that might have to interfere with online playing of games such is PunkBuster and Steam Service.

autoruns services tab

That would be how I used Autoruns to boost up response time in opening folders, files, login speed, search for files and reset of OS and generaly release CPU or RAM from using unecessary things. I must say though, that my PC is 5-6 years old so I probably CAN notice this improvement. I can't say if you will notice it this drasticly as I have if you have something like i7 CPU. But at least you can know that you will definately restrain your CPU and RAM from working more then needed.

Make sure to reset ur PC once you are done!

Friday, January 24, 2014

Ideas for programming projects

One of the things I sometimes struggled with, is what should I do to keep programing going on. Even though I am a bit busy lately with studies, I always think what I could possibly do and I'll try to share some of my toughts with you.

One thing to mention though is that, you should always try to do something you CAN do. Meaning, if you are like me, more into HTML/CSS/JS/PHP etc. or it wouldn't make much sense if you would suddenly out of no where go "I'll do Raspbery Pi app!!"...right? I mean you can if you wish to venture into that but I do think you should choose something that you can use the skills you posses and try to build on them as much as you can.


So here is something that you could try doing:

1. Website

As prevously mentioned, since I'm more web-browser oriented, I do like sometimes creating just a simple HTML/CSS page, which is something you could do too. I do so because it keeps me thinking of design aspect of the website but then the semantics of HTML and CSS to page be somewhat responsive and functionanly working. But you could try creating your own personal website or do one of the following:

 - personal/portfolio website
 - site for business
 - responsive website

At least this is something I keep it oriented to. However I always strive to pull out the maximum of the site so I check it on the mobile phone, add some photo galleries and so on.

2. Web Application

Even though I personaly like to put applications on to the Website, it is also a good practice to just try doing something like a timer or calculator. Or try to remake something that already exists on some of the other pages. In my case, as I said, I always try do add this somewhere on the Website I would be creating, so here is what you could try:

 - timer
 - calculator
 - checklist
 - login forms

You could think of it as a "tool" that will make user more interactive with the page, meaning that the "tool" will help them do some event.

3. E-commerce Page

I do think this kind of a pages are good, especially because of the use of DataBases. Because these are somehow connected with the Web Applications from my point of view and most of them are used using PHP. At least I had a project being done in PHP before. But more it also somehow forces you to present the products from the DataBase in some order therefore it forces you to do some JavaScript or something.

What you could do is, try seeing other E-commerce websites, and try to create the most important bits of it, such are: shopping cart, users log in, product check outs etc. This should really pull out a lot from the skills you posses.

4. Smart Phone Application

If you aren't into web-browsers but you wish to create applications for iPhone,iPad or Android that is good as well. However you might want to know for some of these phones something more specific as it is Object Oriented Programming or know Java language. I haven't really been into this kind of applications so I can't tell much about it.

That would be something I keep thinking in my head when it comes to making a project. Some people like to do as well Social Networking sites which is somewhat similar to E-commerce style of a site, because you'd need Databases, PHP, JavaScripts etc. so this is something you could take in concideration as well.

One last thing is that, if you don't have time to create a whole web-site just to create somethign to see how it would look on a web-site you could use CMS style of web-sites and still use just Databases or PHP to write code that user will interact with.

Tuesday, January 21, 2014

You want to start programming but have no clue where to begin?

I've been thinking of the time how I ventured first time into programming business, even though originaly I was more into graphic motion and design, and tought to give you some directions if you are starting or if you want to start but don't have clue where to begin.

Personaly, my first executed code was in MS-DOS. Now you probably won't need to use it as much as I did but if you think on going seriously into developing, sometimes you might just come across doing something on another server of some kind where you might have to switch from folders and opening files in that way. This is not really anything about programing its more how to create, open, delete etc. folders and files so just have it somewhere in your head if you need it at some point.

Programming Languages

My first REALL code that actualy did something was in Action Script. It was AS 2.0 but at the time I was doing those codes, now when I look at it, I basicly knew a lot of pre-made instructions that were connected with certain things. The actual place where I started to program something for reall, as in thinking how compailer works, how memory is using certain variables, the for-loops, if/else statments etc. was on my university for the C programming language.

I do think this is a good base because C++, C#, Java and Action Script 3.0 are all based on this...well more C++ and OOP(object oriented programming) but C should really help you understand how somethings work and you should be able just to build your skills from this point.

I did not try Python ever so I can't tell you how does it work. What other thing pop-up in my head though is ASP.NET. Because it is buliding web-pages with C# language. Therefore you should also take time in exploring HTML, CSS, JavaScript because these are most comonly used in web-developing. Even if you are not going for ASP.NET you would need HTML, CSS, JS for developing web-pages.

There is also PHP, and most logic you would go trough C, C++ or C# you will find similar in PHP, however it is not THAT similar because...well...somethings work differently there because of rules you must apply in order for them to work on a web-page.

You might wonder:"what?! how am I supposed to know all this and I just want to start!?" it was not my goal to tell you that you must know all of the languages I mention. All I wanted to explain is how languages are connected a lot and if you start from C I think that should be good start, however you can go just with what you feel the best. If you think C is not your level you are getting it to easy, then speed things up! Try other languages, experiment with stuff.

One last thing, a good programmer is the one who can find solution for a specific problem. Not the one who makes a thousands of codes, because he/she saw it in a movie and it looks cool, just to make 2 + 2 give you a result of 4. Figruatively saying.

Sunday, January 19, 2014

These are one of the things I have in mind for the days to come

So I'll be having next two weeks a hell to pass 4 subjects. I've finished up 3 diffrent essays and now I am hoping for the best. But mean-while I have set up some plan in my head to do with this blog of mine.

I'll be creating a fictional Pizza shop. It means I'll try to create a web-site, including design and developing, using data bases and what not. Basicly my goal is to create a fully functional information system. Right now I am thinking of doing as well app that will serve for payment processing, meaning that people who work at the point where they have to charge you and give you bill, they use this app for this purpose so that the database has an information of what necessary regents are missing at what point the amount of sold portions and other things.

However I'll see how I'll manage time with that as I'll also be sort of working with freind from USA at Digital North he is just starting up and I've been talking with him to wait for my subjects to be done so we'll see...

Friday, January 17, 2014

Latest Design

So I have been sorting out things on my PC cleaning up some junk, sorting out the plans for the future and whatnot and I've came up to an Design I've been doing like 8 months ago or so. It was for my personal portfolio that I couldn't maintain but when I look at the design I think its pretty neat!

Dusan Acimovic Old Portfolio
Dusan's Old Portfolio

I do think it could have a bit more details on the picture in the background now when I think of it. Also I like it because I had this sort of spaceish/technologish wanna be look in my head that I wanted to execute into a reall looking piece but hey...its kinda probably my first "serious" design I have done. If nothing I hope you like to watch graphics as I do!

Have fun.

Sunday, January 12, 2014

Simple LogIn form using C# WPF Application

Right, so...I tought to give some small work done, but I wanted to see more if I forgot completely the C# and WPF at all since I used it last year, but it wasn't the case really. So as the title says, I'll show you a
simple login form being done in WPF. This is just going to be a demonstration of login form and you should have some basic idea where to go on from there if you really want to use it for some  project of your own. So lets start!

You can download my final app and how it works here: Simple Login App
If it tells you that is from unknown user and it might put your PC at risk, its becase I've created you can just choose "run it anway" It won't do any harm. You can trust me, but I know its not realistic to expect that. Choice is on you.

I am using Visual Studio 2012 as that is the latest I got from my university however I don't think the options
should be much diffrent in previous versions or newer, if there is one, I haven't really check. So open up a
new project and choose Visual C# from Templates list and then choose C# WPF Application and give it the name whatever you wish I gave mine SimpleLogInApp.

Once you have done that, you should see on the left of Visual Studio interface a "Toolbox" tab. You will find
in this tab the following tools you need to place on the Main Window Frame. Such are: TextBox, Passwordbox, Labels and a Button. Make sure you have one PASSWORDBOX, if you want to have those ***** symbols to hide up the text for when you are typing password. You can then position however you like input (text/pass) boxes.

Once you have positioned the main tools on your Main Window Frame we should give the name of each of the input boxes as well as button and the label that will show us information as user clicks on the button. We are doing so in the Properties pannel in the bottom-right portion of the screen like shown on the picture.

Also if you wish to your input boxes start without text inside of them just make "Text" atribute in Properties
tab empty. In the same way you can change the Text on the Button so it shows "LogIn" as it shows on mine.

Once you've placed all of this you should double-click the Button and this should lead you into C# code section where you created an event for that Button. Also there are few other things that you should know what are for.

First there is code showing as this:

 public MainWindow()

This is basicly the part that intializes the specific code upon launch of application.
We will first add one integer variable to control the button's LogIn and LogOut switch. It is probably good to use switch sequence at this point but I just went with If,else statments.

int ctrl = 0;

So once a user succesfuly logs in, this variable will become 1. Once he log's out it will become 0. Just so it
can do two diffrent parts of the code after loged in and when loging in.Then inside of a Button_Click event you created previously by double-clicking on it we will add following code:

if (ctrl == 0)


So basicly this is for the LogIn, Logout part. Now inside the If statment we will add following code:

if (ctrl == 0)
   if(username_tbox.Text == "Admin" && pass_box.Password == "admin123")
        Info_label.Content = "Loged in!";
        username_tbox.IsEnabled = false;
        pass_box.IsEnabled = false;
        btn_log.Content = "LogOut?";
        ctrl = 1;
       Info_label.Content = "You've entered \nwrong Information.\nTry again."


   Info_label.Content = "Loged out!";
   username_tbox.IsEnabled = true;
   pass_box.IsEnabled = true;
   username_tbox.Text = "";
   pass_box.Password = "";
   btn_log.Content = "LogIn";
   ctrl = 0;

As we can see we added an if,else statment inside the first if statment. Reason for this is because we are telling the compiler to do next. If the variable ctrl is equal to 0, execute the code inside the if. Since the
variable ctrl is already set to 0 this is going to be the first thing that is going to happen once user clicks
on a button. After that it continues into the if,else statment we placed inside the first if statment. And its
doing the following:

If the text entered in the Username textbox (username_tbox.Text) is equal to "Admin" and text inserted in the Passwordbox (pass_box.Password) is equal to "admin123" execute the code inside that If statment. And it is doing following:

- Sets the Info label placed on the Main Window Frame to inform user that he succesfuly loged in if he typed the "Admin" and "admin123" username and password.
- Disables the username textbox so that we can't use it anymore since we are loged in already.
- Disables the passwordbox so that we can't use it anymore since we already entered the right password.
- Sets the name for the button to be called "LogedOut?" asking the user to log out now when he is loged in.
- Changes the control variable to 1. Indicating that user is now loged in.

Now the trick thing is that once we will press Button again, after we are loged in, it will check the first if,else statment and since now ctrl variable is 1 it will jump to the else statment and it will set the objects on a stage to look like the user is loged out. Such is:

- Set the Info label to inform user that he succesfuly loged out once he clicked, this time LogOut button.
- Enables username textbox so that the user can log in again.
- Enables the passwordbox so that user can enter password in order to log in again.
- Changes the content of a button to "LogIn" so that user can log in again
- And ofcourse sets the variable ctrl back to 0. So that once user clicks LogIn, it will start the whole cycle again.

So this is it!! A simple login form using WPF and C#. In reallity you would want to create a Register button as well, but that is something that probably will have to do with DataBases, not necesseraly though. You should have some basic knowledge now about how some things work for the C# and WPF. If you have any question of how something works do not hasitate to ask I'll answer as soon as I am able, it shouldn't be longer then 24h.

If you like this tutorial do follow me on Facebook, Twitter and Google+, I'll be posting some more in the future!! Stay tooned.

Saturday, January 11, 2014

Top 5 programs I must have as developer

I've been thinking lately about the programms or applications I must have when I think about developing a software application or a web-page. I know many people are using diffrent things and also I think that comes in with the taste and for some people its emotional factor (do not ask...) but here are some I just must have wherever I am using computer.

1. Google Drive - This is probably the most needed application for me because every programm I write or application, I make them saved on a folder in a Google Drive, because I am offten going to university and back and I just can not think if I carried an USB memory stick with me, will my sister answer me if she is at home to send me what I need or whatever other reasons you could think off. Like this I just know I'll have everything I saved last on my home's PC wherever I log into G-mail account.

2. Microsoft WebMatrix - I prefer this one mostly because of its interface. Probably because I've been using MS Office since forever too but most of my HTML,CSS, JavaSCript and PHP codes are much clearer to visualy see and control using this. Also the Console for Logs/Error Lists, is much more like Visual Studio as I've been doing C# most of the time trough out my studies. However I don't use WebMatrix for ASP.NET just because I am used to Visual Studio as that is where I first time started using it.

3. Visual Studio 2012 - This was like main program troughout my studies where I've been using C, C#, Windows Forms Application, WPF Applications, Object Oriented Programming with use of SQL Data Servers and Bases and as previously mentioned ASP.NET. I've been doing projects for uni as well in this languages and templates so I just can not imagine doing any of this somewhere else.

4. Microsoft Visio - I just have to use this when I'm building larger project that will include Use Case scenario diagrams, Data diagrams and other diagrams that help me plan the whole process of using a specific programm or system. I can not imagine doing this way of a project starting purely from coding.

5. NetBeans - I use this purely for Java. It took also the larger part of my studies which include also Java's Object Oriented Programing and using DataBases with it. I know some people are using Eclipse? if I'm not wrong but I'll just stick with what I have.

This is basically the 5 programs or applications I must have wherever I go. I do have Adobe's Flash installed too just because Action Script was my first programing language so I do like to, from time to time, experiment with it and its components. Mostly to do some rich graphic animations.