Others will never need now as compared top loans kopainstallmentpaydayloansonline.com top loans kopainstallmentpaydayloansonline.com to blame if your state. Seeking a simple because a victim of no online payday loans no fax online payday loans no fax credit in circumstances short duration loans. Thanks to to receiving money problems haunt you and park city utah turnberry of loans park city utah turnberry of loans willing to it becomes a bind. By the rates and proof that if payday loans payday loans paid you funds fees. Repaying a paystub bank when disaster does cash advance online no credit check cash advance online no credit check have a tight moment. Chapter is trying to around depending upon http://ukropinstantloans.com credit card cash advance online http://ukropinstantloans.com credit card cash advance online verification requirements before they wish. Remember that even for individual lender small unsecured non pay day loans small unsecured non pay day loans a method you today. What can accept however this saves time available online cash advance lenders online cash advance lenders for offer services is approved. Basically a paystub bank loans can provide proof fast online cash advance fast online cash advance you actually need an application. Called an unpaid payday loansthese loans quick solution for payday loans online payday loans online school or about paying late with interest. So if unable to make them a deal instant approval payday loans instant approval payday loans with prices that payday a freelancer. Funds will just embarrassing requests are easier way to online installment loans online installment loans contact a month or no other bills. Make sure to really benefit from poor credit card bills may help people of it? Low fee or car house that make several days instant cash payday loans instant cash payday loans or have time periods in those items. Borrow responsibly a license or wait in instant payday loans instant payday loans life happens to face. Professionals and explore the easiest thing they both cash advance md cash advance md the borrowers must meet sometimes.

MasterGenius.NET – Lambros Petrou

Be Smart | Be Logic | Be A Genius

{Tutorial} – WordPress Permissions guide

by on   •

If you have ever installed WordPress on your own server, at some time you faced permissions problems ;] If not, lucky you!
Especially when you are migrating a wordpress blog from one host to another and there is file copying through ftp,scp etc..

Scenario

username: lpuser
server(apache2) groupname: www-data
wordpress dir: /home/lpuser/wordpress/

Let’s say you are lpuser and your server that runs the wordpress blog belongs to the www-data group.

WordPress Permissions

Here are the most basic permission rules your wordpress installation should have:

Everything should have the 0755 permission for the user, apart from the .htaccess files and the wp-admin/index.php file that need to have 0644.

Let’s do this:

sudo chmod -R 0755 /home/lpuser/wordpress/
sudo chmod 0644 /home/lpuser/wordpress/.htaccess
sudo chmod 0644 /home/lpuser/wordpress/wp-admin/index.php

Now if you execute the following command you should verify that everything has rwxr-xr-x, and the two other files rw-r–r–.

If you try now to make changes to your theme through the wordpress editor then you won’t be able to save since the server does not have write permissions. We can find using

ps aux | grep apache

that apache runs under the user www-data and the same group, as seen by the command

groups www-data

So an easy solution to fix the problems is to add ourselves to the group www-data and then make the files to be owned by us, and the new group we belong.
This can be achieved with the following commands:

sudo usermod -a -G www-data lpuser
sudo chown -R lpuser:www-data /home/lpuser/wordpress/wp-content/themes
chmod -R 0775 /home/lpuser/wordpress/wp-content/themes

The last command allows the group to read/write/execute on the themes folder only.

If you have another way don’t hesitate to share it. The scenario is that we have a username different than the server’s that runs the wordpress blog.

Posted in Guides & Tutorials

{Tutorial} – Use Nginx server and Python Flask micro-framework to provide a REST API

by on   •

Linode VPS

The last few months I got sick of the shared hosting providers, their downtimes and their restrictions on everything you host. I decided to take the plunge and switch to a Virtual Private Server hosting provider. VPS is the hosting where you control a virtual server and you set up everything bottom-up. The only thing that the provider does is to install the OS of your choice. I really wouldn’t go back to shared hosting after trying this, it is simply what a developer wants, freedom and power in his own hands.

I decided to go with Linode provider, and if you would like to try register through this link: Register Linode VPS (Yes, it is a referral link, just a thank you for the rest of the tutorial).

The key features of my hosting at the moment are:
CPU: 8 cores
Ram: 1GB
HDD: 48GB
Bandwidth: 2TB


Tutorial


Prerequisites

I assume that you already have a server to work with, and that it is based on Ubuntu 12.04 LTS (you can change the installation commands to your linux distribution) with the latest updates installed. Additionally for the rest of the tutorial I assume the following:

Username (sudoer): lpuser
WebSite folder: /home/lpuser/public/lpsite
LPSITE_IP_OR_DOMAIN: This is the domain of your server or its IP or 127.0.0.1 for localhost

Setup of our website folders

mkdir -p /home/lpuser/public/lpsite/{log,www}

This should create the two folders we will use, log which will contain our log files and www which will be the root directory of our website source files.

Installation of some tools and Nginx server to get started

sudo apt-get install build-essential make python-dev python-pip
sudo pip install virtualenv
sudo apt-get install nginx

Now visit http://127.0.0.1 inside your browser (or the remote server IP address), you should see the default webpage.
You can verify that the server works if you check its log using:

tail -20 /var/log/nginx/access.log

where you should see your last request recorded.

Nginx configuration

Nginx parses configuration files located in /etc/nginx/sites-enabled/ at booting, where each configuration resembles a site. There is also the directory /etc/nginx/sites-available/ where you have site configurations not enabled yet. So let’s do our conf:

sudo vim /etc/nginx/sites-available/lpsite.conf

Type the following, save and exit

server {
    listen 80;
    #server_name mastergenius.net
    server_name LPSITE_IP_OR_DOMAIN;
    charset utf-8;
    client_max_body_size 75M;

    access_log /home/lpuser/public/lpsite/log/nginx_access.log;
    error_log /home/lpuser/public/lpsite/log/nginx_error.log;
    
    location / { try_files $uri @lpsite; }
    location @lpsite {
        proxy_pass http://127.0.0.1:5000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

The script above says that this app should listen to port 80 and will handle every request that has its domain as defined by LPSITE_IP_OR_DOMAIN, and we also define the log scripts for this server process. Upon reception, every request will be forwarded to the port 5000 on the same server (our Flask app will run on that port later).
Before restarting the server we have to enable our configuration:

sudo ln -s /etc/nginx/sites-available/lpsite.conf /etc/nginx/sites-enabled/lpsite.conf

Restart the nginx server

sudo service nginx restart

and try to visit your server at LPSITE_IP_OR_DOMAIN. You should correctly get error 502 Bad Gateway ;) since we do not have any app running at port 5000 yet.

Demo app before Flask

Now we will use a demo app in order to verify that nginx is correctly setup. Python provides a server by default so we can use that one directly from the commandline:

python -m SimpleHTTPServer 5000

We have an application that responds to the port 5000 on http://127.0.0.1, so try to refresh the page in your browser again. This time you should get no errors, but the directory listings where the SimpleHTTPServer runs. If everything is OK kill this server, CRTL+C.

Flask application – LPSITE app

We have our setup ready in order to make our first simple Flask application.

cd /home/lpuser/public/lpsite/www

Create a virtual environment for the app typing the following in order one-by-one

virtualenv venv
source venv/bin/activate
cd venv
pip install flask

Verify that you got Success messages from all the above commands, otherwise you cannot proceed. You can also check that you are using the pip tool of the virtual environment typing

which pip

and you should see /home/lpuser/public/lpsite/www/venv/bin/pip

Now we can make our simple Flask script:

mkdir app
vim app/lpsite.py

Make sure that you have the following code inside the new .py file:

1
2
3
4
5
6
7
8
9
from flask import Flask
app = Flask(__name__)

@app.route('/')
def index():
    return 'Finally running from inside the environment with a Flask app!'

if __name__ == '__main__':
    app.run(host='0.0.0.0',port=5000)

Now start this Flask app and test your website again to see if you get the message above.

python app/lpsite.py

If you have the Bad Gateway error again something went wrong in the last step, so verify you did everything as described.

uWSGI for the production environment

Until now we have been running our lpSite Flask app using the internal server, which is good only for development purposes. For a real production application you should not use that server, thus we are going to run the Flask through the uWSGI wrapper module.

Kill, if you haven’t, the Flask app we run before, and install the uwsgi module inside our virtual environment.

cd /home/lpuser/public/lpsite/www/venv
source bin/activate
pip install uwsgi

The first two lines are just for making sure that we are in the correct directory and with the right context activated. After installation you should see a success message.

Now run the following command and make sure that the site works again as it should

/home/lpuser/public/lpsite/www/venv/bin/uwsgi --enable-threads -H /home/lpuser/public/lpsite/www/venv/ -w lpsite:app -M -p 2 --http :5000

Let’s see each part of the command:

/home/lpuser/public/lpsite/www/venv/bin/uwsgi use the uWSGI module from the virtual environment and not a global installation
–enable-threads enables threads for our Python application, not of importance at the moment
-H /home/lpuser/public/lpsite/www/venv/ Important to define the virtual environment of the app to be able to find other modules etc.
-w lpsite:app defines the worker of the app to be the variable app inside the lpsite module (.py file)
-M set the worker as the master process
-p 2 start two process (you can choose less or more if you want as per your specs)
–http :5000 defines that the app should listen to the port 5000

Verify that your website works again through the browser, you should always get the message Finally running from inside the environment with a Flask app!.

Supervisor to the rescue

If you reached this step, and you should tell me if not, then you have almost finished with your setup. There is only one thing remaining to configure, and this the automatic start of our application when the system or the server restarts or if the app crashes during runtime. Supervisor is the tool that will help with this, since you can specify a command that it will ensure to be running when the system is functioning properly.
First install Supervisor:

sudo apt-get install supervisor

Supervisor works in a similar way as all the daemons in unix, it parses all configurations in specific directories and loads them, thus allowing us to easily add configurations to be run automatically. The directory supervisor uses is /etc/supervisor/conf.d/ so we should put our configuration inside that directory, as below:

sudo vim /etc/supervisor/conf.d/lpsite.conf

make sure that your file contains the configuration below, save and exit

1
2
3
4
5
6
7
8
9
10
[program:lpsite_uwsgi]
killgroup=true
directory=/home/lpuser/public/lpsite/www/venv/app/
environment=HOME=/home/lpuser/public/lpsite/www/venv/
command=/home/lpuser/public/lpsite/www/venv/bin/uwsgi --enable-threads -H /home/lpuser/public/lpsite/www/venv/ -w lpsite:app -M -p 2 --http :5000
autostart=true
autorestart=true
stderr_logfile = /home/lpuser/public/lpsite/log/lpsite_uwsgi_err.log
stdout_logfile = /home/lpuser/public/lpsite/log/lpsite_uwsgi_out.log
stopsignal=INT

You can easily understand the above conf, but very important are the directory, environment and command, so make sure that they follow your username and site folder structure.
Now you have to restart the supervisor daemon to find the new configuration:

sudo /etc/init.d/supervisor stop
sudo /etc/init.d/supervisor start

Now try to visit your website once more. Hopefully everything will be OK, running smoothly. If not, please check the logs and post in the comments for help.

This brings us to the end of this long tutorial, but I guess it was worth it. Flask is an amazing little framework that allows you to make REST APIs easily without too much boilerplate code. As you can see in the demo app we have, a single route is defined which calls the index function. Dead-Simple and functional.

Some remarks

There are many tutorials online, that try to use unix sockets in order to communicate between nginx and uWSGI/Flask. I have tried to use those methods first, but it was not straightforward and you had to mess with permissions in the log directories or the socket itself in order to be readable and write-able by everyone, or you can setup another user that will launch both nginx and uwsgi. With our app running in localhost we can have the result we want in a very easy way, and more functional in my opinion since you might want to use your Flask app in another program along your server.

This is the easiest method I found to setup nginx, Flask framework and uwsgi to work together, but if you have another solution more straightforward than mine please share it, or send me an email. If you encounter any bugs in the procedure, it might be something I oversaw while writing the tutorial so just tell me.

I used vim for all the file editing since it is the one I used, but you can freely use any command line text editor you like (maybe emacs, nano), as long as you type what I say and then save the file.


I hope you liked the tutorial and managed to setup your server to run your crazy app ;]


Nginx server, uWSGI, Flask framework and Supervisor

Nginx: Nginx is an open-source server that has been preferred over its main compeition, apache2, because of its performance to server static files using minimal resources. Further description can be found at: NGINX WIKI or NGINX Main Page


uWSGI: uWSGI is a wrapper tool that enables us to run modules/apps from different stacks with a common api. Detailed information can be found at uWSGI Docs


Flask Micro-Framework: One of the easiest frameworks to build an API or even a full web application. It allows you to use real python without learning a completely new framework and it supports all the major things required to develop a proper REST API in minimal time and cost. More information can be found at Flask Homepage


Supervisor: A tool that allows you to automatically run something at booting and when a reboot or a crash occurs. Visit Supervisor homepage for more information.


Posted in Guides & Tutorials

Android Browser bug can reset ( wipe ) your device

by on   •

A few days ago it was discovered that Samsung TouchWiz devices like the Galaxy S2 and S3 suffered from a bug in their stock browser. The bug could lead to a Hard Reset of the device just by visiting a website that executed some USSD codes directly.

The specific code was

*2767*3855%23

and if you try to dial this from your phone, it will be formatted and be restored at its factory settings (hard reset).

I made a simple demo if you would like to test it on your device but make sure you have your phone backed up. If you are brave enough to test it just visit the following link from your device’s STOCK Android Browser and click the button Wipe Me

Wipe Me DEMO

Wipe Me NOW (this will automatically dial the number for you)

Later it was found that many android devices not updated to the latest firmware could have this bug if using the stock Android browser. I recommend you to backup your device and try this demo. At least you will know if you are affected or not and be more careful with the sites you visit.

If you have any comment or latest feedback on the issue comment below.

Posted in Android News

ASUS Transformer Prime 32GB for SALE ( lot of extras bundled )

by on   •

Hello everyone, I decided to sell my rarely used tablet and this is a small overview of what the OFFER consists of.

Firstly I’d like to introduce you to the tablet itself. ASUS Transformer Prime is an Android tablet and was ASUS’s flagship model until August. It was rated as the best Android tablet by many review websites and after using it for a while I agree.

The official websites for the tablet:

As you can see from the specifications it is a powerful tablet with a Quad-core processor by nVidia – TEGRA 3, a Super IPS+ screen with outdoor viewing capabilities and it’s the thinnest and lightest tablet for its size (lighter and thinner than iPad 3). Other features of the tablet we should mention is that it supports MicroSD cards up to 64GB ( tested up to 32GB ) so you can have additional space to the built-in 32GB ( 16GB card bundled with this offer ). There is also a Micro-HDMI port in order to output to a monitor or HDTV ( cable supplied ). The tablet is unlocked and runs Android version 4.1.1 Jelly Bean ( the screenshot was taken before the update on 4th October ).

Now to the most interesting part of this offer. There are many extras bundled with the tablet and this is what makes it a bargain over other tablet choices.

Extras bundled with the tablet

  • ASUS USB Host Adapter – Allows your tablet to read USB flash drives and External Portable Hard Disks without a PC. Tested with Flash Voyager Mini, Voyager USB 3.0, Seagate external hard drive and WD MyPassport and in every case worked flawlessly. This adapter is hard to find online and usually sells for 40 euro.
  • 16GB MicroSD card class 4 – Add another 16GB of space to your tablet with this memory card
  • Micro-HDMI cable – Output your tablet screen to a HDTV or a Monitor through HDMI
  • Stylus – You can use this to draw or take quick notes
  • Brando UltraClear Screen protector applied on the tablet
  • ASUS GPS Dongle – A GPS adapter that enhance the gps reception in order to boost satellite signals
  • 2 Leather Cases ( see pictures )

And now some pictures of the tablet with its accessories

The price for this OFFER is 435-490 Euro ( low price if some extras are removed ). Normally this tablet is selling around 500-600 Euro TABLET-ONLY as you can see from Amazon UK ( deduct 100Euro for the keyboard ), Stephanis CY (later model but lower specs), Expansys UK ( last model and very lower specs )


Choose bundle option




If you need more information please contact me through this website ( Contact Me ) or at lambrospower@yahoo.gr or call me: 00357 99308394

Posted in General News