Simple ajax waiting layout in pure CSS

css:

#waiting {
top: 0;
left: 0;
display: none;
position: fixed;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.5) url(‘../default-loader.gif’) no-repeat center center ;
}

 

html:

<body>

..

</body>

js:

$(‘#waiting’).show();

or

$(‘#waiting’).hide();

Advertisements

close out port with iptables

iptables -I INPUT -d 127.0.0.1/8 -j ACCEPT
iptables -A INPUT -p tcp –dport 8080 -j DROP

If you wantpersistent:

The easy way is to use iptables-persistent.

Install iptables-persistent:

sudo apt-get install iptables-persistent

After it’s installed, you can save/reload iptables rules anytime:

sudo /etc/init.d/iptables-persistent save 
sudo /etc/init.d/iptables-persistent reload

postgres import export

Export

pg_dump -c -h 127.0.0.1 -U linkin –column-inserts linkin > dump.sql

IMPORT

in psql:
REVOKE CONNECT ON DATABASE linkin FROM public;

SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = ‘linkin’;

drop database linkin;
CREATE DATABASE linkin;
GRANT ALL privileges ON DATABASE linkin TO linkin;

 

in terminal:
psql –file=dump.sql –host=127.0.0.1 –port=5432 –username=linkin –dbname=linkin

java wsdl import for wsdl with java-reserved word

wsimport -keep -b bind.xml -J-Djavax.xml.accessExternalSchema=all https://policyrw.mtsbu.ua/v3/ChangeContracts.svc?wsdl

 

<?xml version=”1.0″ encoding=”UTF-8″?>
<jaxws:bindings wsdlLocation=”https://policyrw.mtsbu.ua/v3/ChangeContracts.svc?wsdl=wsdl0&#8243;
xmlns:jaxws=”http://java.sun.com/xml/ns/jaxws&#8221;
xmlns:wsdl=”http://schemas.xmlsoap.org/wsdl/”&gt;
<jaxws:bindings node=”wsdl:definitions/wsdl:portType[@name=’IDigitalPolicy’]/wsdl:operation[@name=’New’]”>
<jaxws:method name=”MyNewContract”/>
</jaxws:bindings>
</jaxws:bindings>

digitalocean spaces example

import boto3

# Initialize a session using Spaces
session = boto3.session.Session()
client = session.client('s3',
                        region_name='ams3',
                        endpoint_url='https://ams3.digitaloceanspaces.com',
                        aws_access_key_id='xxx',
                        aws_secret_access_key='yyy')

unique_name = ['play', 'strim', 'strim-in', 'crowd']
for s in unique_name:
    client.create_bucket(Bucket=s)

# List all Spaces in the region
# response = client.list_buckets()
# for s in [space['Name'] for space in response['Buckets']]:
#     print(s)

# Add a file to a Space
res = client.upload_file('/home/icdu/projects/link/amazonTest/test.docx', 'play', 'test2.docx')
print res