Friday 30 January 2015

flask introduction and installation

Standard
after more days i have came back for give you something if you are new in python and web development and also you are not good in django then i will prefer you FLASK framework this is a nice and more easy framework and also flask have a good Document.
so if you wan to hands on django then i prefer at first start flask then django

Flask is a small framework by most standards, small enough to be called a “micro-framework.” It is small enough that once you become familiar with it.
But being small does not mean that it does less than other frameworks. Flask was designed as an extensible framework from the ground up; it provides a solid core with the basic services, while extensions provide the rest. Because you can pick and choose the extension packages that you want.
Flask has two main dependencies. The routing, debugging, and Web Server Gateway Interface (WSGI) subsystems come from Werkzeug, while template support is provided by Jinja2.There is no native support in Flask for accessing databases, validating web forms, authenticating users, or other high-level tasks. These and many other key services most web applications need are available through extensions that integrate with the core packages.

this is a small introduction of flask so now i will tell you how install and cooked your project in flask

ok now start flask installation first of all open your terminal and go to your project folder and next type bellow command

$ pip install flask

after some process your flask installation will complete so now you can write your code
first test a program because of your flask install completely
open text editer and copy bellow program and save by "app.py" name


from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
    return '<h1>Hello World!</h1>'
if __name__ == '__main__':
    app.run(debug=True)

after save file open terminal and type

$python app.py

next open your browser and type 127.0.0.1:5000 then you will see your first flask project output

continue ............

Friday 28 November 2014

Monday 27 October 2014

create thumbnail on image upload in django

Standard
Django does not provide any standard way of organizing thumbnails.
Even though community has some applications to work with thumbnails, they are usually over kill if You only want to create a thumbnail for an ImageField. So here is my solution to handle thumbnails.

To hande thumbnails I over-wrote my model's save method to read original image field into a StringIO, manipulate the image and save it into a thumbnail image.
first of you need a python PIL library so first install it :

sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
pip install PIL 

Here is the code.

Monday 6 October 2014

x-mvc form validation

Standard
in new x-mvc i have added form validation it is so simple and usable

reference link : https://www.npmjs.org/package/x-mvc

How to use

Install from npm
npm install x-mvc
 
Instantiate a new form_validation object

req.library.load('form_validation');

/** construct a new form_validation object passing the data array to validate
  * date array should contain a set of objects formatted as following
  * {fieldName: value}
 */ 
var data = {
    name: 'foo bar',
    email: 'foo@bar.com'
}
var form_validation = new req.library.form_validation(data);
 

Saturday 27 September 2014

a pagination module/library for node.js (x-pagination)

Standard
today i have realize that this world not enough for future data then i think we need to hire MARS or other planet .

so can not all data in one page it will more time consumption and not reliable and page will open so slow and if you have more data then page will time out so then we need a mechanism where we can handle all data smoothly and systemically that we need pagination all data will split with a limit and show in different page.
so i have developed a module that will help create pagination in node.js
this is recently cooked by me you can find this in bellow link

https://www.npmjs.org/package/x-pagination
https://github.com/netai/x-pagination

bellow all detail

Friday 26 September 2014

x-image-processing a image processing package for node.js

Standard

x-image-processing

a simple image upload and processing module in node.js
and this image processing module under development but all time it usable
So hope this library help someone like me.

this module just cooked and i know this is not better test but i will try to give more better test so if you have any idea and suggestion so you can write in comment  i will be thank full for me
this image processing inherit from node gm package but this is more usable and simple and easy to use

Any ideas are appreciated.
 
follow bellow link

https://github.com/netai/x-image-processing
https://www.npmjs.org/package/x-mvc

Features

  • image crop
  • image resize
  • image upload

x-mvc a mvc package for node.js

Standard

x-mvc

today i will give a small description on a recent cooked mvc package this is developed for node.js and also this is so easy just download and use it and also it development on going for more better test you can check this in -

https://www.npmjs.org/package/x-mvc
https://github.com/netai/x-mvc

(if you have any idea or suggestion please write in comment it is very great full for me)

this is a simple node.js mvc structure this is a extended version of just-mvc it is more better of just-mvc. in this mvc we have added more feture like:
  • create slug
  • flush message
  • more comfortable structure