Tuesday, April 16, 2013

Sharing folders without login - Samba

Samba is an open source software that allows to solve communications problems between Windows and Linux. With Samba, you can share folders, printers for Windows clients and can perform as a Primary Domain Controller (PDC) or as domain member. Samba can also be part of an Active Directory (AD) domain.

As a Systems Administrator, one of first things I wanted to do was share folders on Debian with my Windows to transfer easily files. My Debian is a local Web Server to test my PHP5 applications (yes, I am also PHP5 developer). Why do I want share folders without password? Because it is painful every time I need to login and I am working at home where is no danger around me. No one can crack me at home. At home, it is a great way to share files without login.

    How to install and configure samba
  1. su -
  2. insert your root's password
  3. mkdir /home/yourusername/mysharedfolder
  4. chown nobody /home/yourusername/mysharedfolder
  5. apt-get install samba
  6. nano /etc/samba/smb.conf
  7. security = share
  8. guest account = nobody
  9. [mysharedfolder]
    writable = yes
    path = /path/to/directory
    public = yes
    guest ok = yes
    guest only = yes
    guest account = nobody
    browsable = yes
    
  10. Ctrl+X and then y
  11. service samba restart

Optionally, you can use Samba Web Administration Tool (SWAT) to configure the settings of shared folder.

    How to install SWAT
  1. apt-get install swat
  2. Go to your favorite web browser and type the next URL: http://localhost:901
  3. insert your root login
  4. watch the next video how to configure samba

Samba is very useful tool for who want share files between Windows and Linux and SWAT is also very useful for who want configure settings of sharing easily.

I have created another article about Samba before but this one requires a login. If you want to do login, please read this article.

Box Model - CSS Tutorial

After I want to get better my skills as Web Designer, I decided to study again all concepts of CSS! And there is one thing I consider very important: Box Model.

But what is Box Model and why is it very important?
The Box Model is a box that wraps around HTML elements. It is very important because it allow the design become more organized and clean.

What consists Box Model?
Box Model consits of four things:

  1. Margin - Clears an area around the border. The margin does not have a background color, it is completely transparent;
  2. Border - A border that goes around the padding and content. The border is affected by the background color of the box;
  3. Padding - Clears an area around the content. The padding is affected by the background color of the box
  4. Content - The content of the box, where text and images appear

Design Patterns - Facade Pattern

Introduction

A design pattern is a specific way of solving a particular problem. They are not simply about reusing code; they are more abstract and generalized than that. They are about using reusing ideas.

The Facade Pattern

The best way to understand the facade pattern is to look at a component diagram of a system before and after using a facade.

The next figure shows the front end of a Web site communicating with an application on the Web server. In the right side of the diagram, the front end code is accessing various objects in the application. On the left, showing the facade, the front end communicates only with the facade object, which in turn delegates responsibilities to the internal objects.

All text and images above is from the book:"Professional PHP5" ISBN: 0-7645-7282-2 (Lecky-Thompson et al., 2005)

Monday, April 1, 2013

Design Patterns - Decorator Pattern

Introduction

A design pattern is a specific way of solving a particular problem. They are not simply about reusing code; they are more abstract and generalized than that. They are about using reusing ideas.

The Decorator Pattern

The two concrete widgets created for the observer pattern have a different appearance. If you needed to add a new style of widget, you would subclass Widget and implement the draw() method to write the HTML. Say that needed to add a feature to all existing widgets, such as border. You could go into each draw() method and add some more HTML to each, but then the border would be hard-coded and all widgets would be forced to have a border. You could create a new set of subclasses of existing concrete widgets that implemented the border in the draw() method. If you had only two widgets, as in the Observer example, this might be an option - you would end up with four widgets. However, if you had five widgets to start with, it might not seem so appealing. Suddenly you have a lot of widget classes to worry about.

There is another way to handle situations like this, one that doesn't require you to create a new subclass for every widget you want to add a border to. Using the decorator pattern allows you to add features or functionality to existing objects without using inheritance. Next figure shows the class diagram for the decorator pattern.

The class diagram indicates that Decorators are a type of Widget, too. This is good because we don't want to change the way we access a Widget, whether it's decorated or not.

All text and images above is from the book:"Professional PHP5" ISBN: 0-7645-7282-2 (Lecky-Thompson et al., 2005)

Thursday, March 21, 2013

Design Patterns - Composite Pattern

Introduction

A design pattern is a specific way of solving a particular problem. They are not simply about reusing code; they are more abstract and generalized than that. They are about using reusing ideas.

Composite Pattern

The next figure shows the general case for the composite:

The composite pattern has two parts: the Component abstract class and the Composite, which is a concrete implementation of the Component class. All Composite objects descend from the abstract Component class. Any Component can contain other Components. A Component with no children can be thought of as an empty Composite.

Moving back from the general case, it will be necessary to make a change in the design and switch the Instrument interface to an abstract class. Interfaces and abstract classes are similar because neither one can be used directly to instantiate an object. The key difference is that an abstract class can have some fully implemented methods, whereas interfaces just have method declarations.

All text and images above is from the book:"Professional PHP5" ISBN: 0-7645-7282-2 (Lecky-Thompson et al., 2005)