Working with Seneca

Seneca is a framework that let you work with plug-ins that makes your software scalable.

Installing Seneca

To install Seneca, use npm as follow:

Seneca as module

Now we are going to use Seneca to add and multiply variables:

 

We see that error handle is written and the output is shown as follow:

Seneca does inversion of control

Seneca does not need to know how to build the dependencies or calls to modules. We can see two components as seneca.add and seneca.act:

Let’s run the code to show the greeting to GNOME:

Advertisements
Posted in τεχνολογια :: Technology | Leave a comment

Django on Fedora 26

Installing Miniconda 3

From the Official Website of Miniconda, download the package and save it in the script miniconda:Then, give it permission of execution and execute the script into /opt/conda

sudo ~/miniconda.sh -b -p /opt/conda

Then, you might delete the script to install and set the owners and permissions:

 

Link the packages conda to set them in the path and call then from terminal:Now create the environment to work with Python 3

 

 

Then, activate the new environment as the command suggested:

 

 

 

Installing Django

Use the command pip install command to install and check the version: 1.11.5

Creating a project

I am going to create the linuxatuni project inside my development file

The explanation of each file created and in general of this post is in the Web

Running the server

Run the server with the script manage.py:

There is a message which says that unapplied migrations have been set and need to be migrate. These files can be verified in the setting file:

 

 

 

 

 

 

 

 

 

Just run the command suggested on the message:Now we are going to be able to run the server:

Let’s check the local server as it is pointed out in the terminal:

Creating a poll

In a different terminal, activate the environment and create the app: startapp

Now we access into the view.py, and the urls.py to write our Hello world:

 

 

 

 

 

 

 

 

 

Please see the local server

 

 

 

Creating models

To create a question and choice as models, let’s write into the models.py:Then add the Polls.app.PollsConfig into the settings file, an activate it with

 

 

 

 

 

You can migrate the elements we have created as the question and choice

The sqlmigrate command takes migration names and returns their SQL:

Finally, run migrate again to create those model tables in your database:

Working with the terminal

Now let’s write some labels to the question created by using the shell:

Let’s add the method __str__ to both objects: Question and Choice:

Now that we have set the datetime, we can work with them using the terminal

There is not other question set and that is why an error message is displayed. Let’s continue with the queries and choices we are going to set:

 

Creating an admin user

We can run the command to create a superuser called admin

Now you can login into the local server as admin

Then, you can see the objects to manage, in this case groups and users:

 

Make the poll app displayed and modifiable as admin

Import the Question model into the admin.py file in polls:

 

 

Now it is shown the Questions object in Polls:

Exploring the web and the model Questions

You can delete the question as selected action and choose the What’s up option

 

 

 

 

 

A confirmation message is going to be displayed too

 

 

 

You can checked that the action was done successfully

Writing more views

Now we can add more views as are defined in detail, results, and vote:

They can be written in the file urls.py as follow:

Add a number inside a poll and the question will have the same number:

 

 

Writing useful views

The output is going to be defined in the index def to publish objects in order

Adding templates

Create a html file that use for to handle the questions inside the templates/polls

Now we use the html file into the index def in the views.py

Update the url file to make it work

Now you can add questions and list them in the local server:

 

 

 

 

Special thanks to Martin Vuelta for being my mentor in the Django adventure 🙂

Posted in FEDORA, GNOME, τεχνολογια :: Technology | Tagged , , , , , , , , , , | 1 Comment

Switching from Ubuntu to Fedora

Any time I have to install Fedora in a machine is a new adventure because all the hardware nor software is the same. In this opportunity I will configure a machine which has Ubuntu on it and change it to Fedora 26.

Inserting the Fedora ISO

I used a bootable USB that my friend Solanch have prepared before and immediately the option to install Fedora was shown in the first place:

Fedora can be tested before installing and you can try GNOME that has as a default Linux Dektop:

General configuration

In my case I will set up the language in English to improve my English skills, you can select Spanish, French or the language you prefer:The four basic options to configure are displayed as follow:In my case I will choose Spanish and English keyboard configuration, since I am working on hardware with a Spanish presentation.I’m now in Lima, Peru; Time and Date are going to be defined by this locationThe network and hostname can be set in this moment or edited later:Configuring Partitions

This machine has 500GB HDD and 4GB of RAM; and according to the Red Hat recommendation, we are going to set four partitions: /boot/efi, swap, / and /home. This is what we had with Ubuntu, swap of 7.45GiB and more of 200GiB of ext4Free those partitions in order to set up the new ones:Now delete the Ubuntu scheme partitioning, including the swap and bootThen, this is the new Fedora scheme we are going to apply to use the diskNow, apply the changes to save the new schemeFinally the disk is able and configure to install Fedora 🙂Waiting until the installation finished

The password of a user and password can be set while we are waiting for the installation of Fedora 26first for the rootNow for an administratorWait until a messge of Finish is shown:The Quit button turns in blue and then take out the USB to enjoy Fedora 😉

Posted in FEDORA, GNOME, τεχνολογια :: Technology | Tagged , , , , , , , , , | Leave a comment

Behind the Scenes of the FWD Lima, Peru

It is only a week for the event that pretend to congregate IT women in Lima, Peru. We are not restricting by age or education level, we want to gather women interested in Linux. Our projects that are going to be presented are Fedora, Git, GIMP, Python and GNOME. We have more than 200 people interested and 80% of female are registered.

As a general coordinator of the event, I care about every single detail. Thanks to @bee for her constantly and proactive remotely support and @chhavi for the help with the design. The stickers were delivered in time thanks to the Diversity Team of Fedora!

Our group had previous sessions to enhance our knowledge and experiences to share in the venue next Saturday at PUCP since 8:00 a.m. Special thanks to Solanch Ccasa! ❤

The event is called FWD which stands for Fedora Women Day, but it is not exclusive only for women. Thanks also to guys that are helping us! Thanks Toto, Martin and Brunitos.

I hope we have more guys that will support our effort in promoting Linux in Lima, Peru.

Posted in FEDORA, GNOME | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Creating Notes with Node.js

The first step to develop a basic app to handle notes is to create a directory to gather all the files required.

We are going to create a package.json with the command npm initAdditional, some packages as nodemon, lodash and yargs that are going to be used: npm install nodemon -g, npm install lodash –save,npm install yargs –save

Then, create three module files to add, list, read and remove files. To add:Now we can import the modules to index:

 

 

 

 

 

 

 

 

 

 

Now we can test the program by adding a title and body to a note:As well as the addingNote, the file ListingNote and ReadingNote are created:

 

Posted in τεχνολογια :: Technology | Leave a comment

Accessing to a Server in Node JS

This time we are going to connect  to a server from the client side using NodeJS. Let’s use the http port 8088 to print the “Hello World” message:To print a content of a html file with a successful status: 200 and the port 3000 on http:GNOMEserver

Posted in τεχνολογια :: Technology | Leave a comment

Using Node.js Packages Manager (NPM)

NPM is a package manager for Node.js packages, or modules; it hosts thousands of free packages to download and use.

To begin with, npm init creates our package.json to manage packages that we are going to install such as lodash, mongo, nodemon, etc. Now, we can install the lodash module and export it whenever the index.js calls Lodash makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc. Lodash’s modular methods are great for iterating arrays, objects, & strings; manipulating & testing value and creating composite functions. We were now able to concatenate first and last to formulate a full name of each user, to finally filter by age greater than 23:Another useful module that can be installed with NPM is Nodemon which monitor for any changes in your source and automatically restart your server.nodemon

Now we can run nodemon on index.js to check the information about the file:

Posted in τεχνολογια :: Technology | Tagged , , , , , , , , , , , , | Leave a comment