ubuntu date time calendar applet gone, invisible!

just run this:

pkill -f indicator-datetime-service

should fix it

Tagged with: , , , ,
Posted in important links, Linux, Tips And Tricks, Ubuntu

plone.restapi common errors

when writing a test I was getting errors like this when running it:

ConnectionError: HTTPConnectionPool(host=’nohost’, port=80): Max retries exceeded with url: /plone/@resultdbusers/noam (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.HTTPConnection object at 0x7fd8f5469ad0>: Failed to establish a new connection: [Errno -2] Name or service not known’,))

I just had to define the layer with z2.ZSERVER_FIXTURE

from plone.testing import z2

SOME_API_FUNCTIONAL_TESTING = FunctionalTesting(
bases=(SOME_BASE_API_FIXTURE,
z2.ZSERVER_FIXTURE),
name=’SomeApiLayer:FunctionalTesting’
)

then it works

Tagged with: , , , , ,
Posted in development, ploneCMS

Ionic step by step learning (in shortcut)

 

Install Ionic 2

npm install -g cordova

Install Ionic cli:

npm install -g ionic

NOTE To check the details of your installed ionic, simply run

ionic info


You need typescript, install here

npm install -g typescript

Now most important command to learn:

ionic start YOURPROJECTNAME tutorial –v2

The above command scaffolds an ionic project based on a tutorial template ionic provides. It then downloads the necessary npm packages. We’ll build the application using TypeScript, and that’s why we have a --ts flag.

Now you can go inside YOURPROJECTNAME and run this:

ionic serve

now you can browse the app here: http://localhost:8100/

now to make your own app first delete the folders in src/pages

then to add your own page:

ionic g page login

To add a provider

ionic g provider github-users

Ionic components

https://ionicframework.com/docs/v2/components/#alert

Posted in Uncategorized

https://pypi.python.org/pypi/zope.cachedescriptors

If we ask for the radius the first time:

>>> '%.2f' % point.radius
computing radius
'2.24'

We see that the radius function is called, but if we ask for it again:

>>> '%.2f' % point.radius
'2.24'

The function isn’t called. If we change one of the attribute the radius depends on, it will be recomputed:

>>> point.x = 2.0
>>> '%.2f' % point.radius
computing radius
'2.83'
Posted in Uncategorized

Learning SQLAlchemy – Quick references and notes for me

THIS IS JUST FOR MY PERSONAL LEARNING- so It is not detailed instruction.

I am just keeping this for future quick reference

http://docs.sqlalchemy.org/en/latest/orm/tutorial.html

Connecting

For this tutorial we will use an in-memory-only SQLite database. To connect we use create_engine():

>>> from sqlalchemy import create_engine
>>> engine = create_engine('sqlite:///:memory:', echo=True)

We create the base class using the declarative_base() function, as follows:

>>> from sqlalchemy.ext.declarative import declarative_base

>>> Base = declarative_base()

Now that we have a “base”, we can define any number of mapped classes in terms of it. We will start with just a single table called users, which will store records for the end-users using our application. A new class called User will be the class to which we map this table. Within the class, we define details about the table to which we’ll be mapping, primarily the table name, and names and datatypes of columns:

>>> from sqlalchemy import Column, Integer, String
>>> class User(Base):
...     __tablename__ = 'users'
...
...     id = Column(Integer, primary_key=True)
...     name = Column(String)
...     fullname = Column(String)
...     password = Column(String)
...
...     def __repr__(self):
...        return "<User(name='%s', fullname='%s', password='%s')>" % (
...                             self.name, self.fullname, self.password)


A class using Declarative at a minimum needs a__tablename__ attribute, and at least one Column which is part of a primary key [1].

http://docs.sqlalchemy.org/en/latest/orm/tutorial.html#building-a-relationship
To be continued...


Tagged with: ,
Posted in mysql, python, sqlalchemy

Awesome link to learn vagrant with ansible

https://sysadmincasts.com/episodes/45-learning-ansible-with-vagrant-part-2-4

Posted in Uncategorized

vagrant up!

to install vagrant:

  1. https://www.vagrantup.com/downloads.html go here
  2. download your needed version and install! is not rocket science

mkdir any_name_you_like

cd any_name_you_like

now you have to initialize vagrant, that is you will try to make a virtual machine

to be able to download virtual boxes you can login here: https://atlas.hashicorp.com/boxes/search and sign up

then you will need to login via your command line

vagrant login

you will need to give your username and password

Think we are still in any_name_you_like folder

ok now lets say we want to install ubuntu/trusty64 version in our vagrant

to do this:

vagrant init ubuntu/trusty64

then when you something like this:

/opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /opt in PATH, mode 040777
/opt/vagrant/embedded/gems/gems/bundler-1.10.6/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /opt in PATH, mode 040777
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

you are pretty sure its gonna work

now time for oding as the output suggest

vagrant up

This will download and install ubuntu virtual box trusty 64bit version

Then you can login to your newly created machine like this:

vagrant ssh

You will see output like this:

0 packages can be updated.
0 updates are security updates.
vagrant@vagrant-ubuntu-trusty-64:~$ ls

So thats it! its your new machine

Tagged with: , , , ,
Posted in Vagrant
Disclaimer
All content provided on this "tareqalam.com" blog is for informational purposes only. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner of [tareqalam.wordpress.com] will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.
July 2017
M T W T F S S
« Apr    
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 25 other followers