This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select n.nspname as enum_schema, | |
t.typname as enum_name, | |
e.enumlabel as enum_value | |
from pg_type t | |
join pg_enum e on t.oid = e.enumtypid | |
join pg_catalog.pg_namespace n ON n.oid = t.typnamespace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- PostgreSQL 9.1 and below: | |
SELECT pg_terminate_backend(pg_stat_activity.procpid) | |
FROM pg_stat_activity | |
WHERE pg_stat_activity.datname = 'TARGET_DB' | |
AND procpid <> pg_backend_pid(); | |
-- PostgreSQL 9.2 and above: | |
SELECT pg_terminate_backend(pg_stat_activity.pid) | |
FROM pg_stat_activity | |
WHERE pg_stat_activity.datname = 'TARGET_DB' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "<string>", line 1, in <module> | |
ImportError: No module named virtualenvwrapper.hook_loader | |
virtualenvwrapper.sh: There was a problem running the initialization hooks. | |
If Python could not import the module virtualenvwrapper.hook_loader, | |
check that virtualenv has been installed for | |
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is | |
set properly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
import random | |
def generate_tizen_app_id(self): | |
"""Generates a 10-character alphanumeric value used to identify | |
a Tizen application""" | |
chars = string.ascii_letters + string.digits | |
return ''.join(random.choice(chars) for x in range(10)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddHandler x-web-app-manifest+json .webapp | |
AddType application/x-web-app-manifest+json .webapp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
show variables like "max_connections"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example assumes these variables have been initialized | |
// above, e.g. as method parameters, fields, or otherwise | |
int min, max; | |
// nextInt is normally exclusive of the top value, | |
// so add 1 to make it inclusive | |
Random rand = new Random(); | |
int randomNum = rand.nextInt(max - min + 1) + min; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Context antiJARLocking="true" path="/"> | |
<Resource | |
name="jdbc/sample" | |
auth="Container" | |
driverClass="com.mysql.jdbc.Driver" | |
jdbcUrl="jdbc:mysql://localhost:3306/yourdbname" | |
user="your_user" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export WORKON_HOME=$HOME/.virtualenvs | |
source /usr/local/bin/virtualenvwrapper.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.playground.myapp.web; | |
import org.hibernate.SessionFactory; | |
import org.hibernate.cfg.Configuration; | |
import org.hibernate.service.ServiceRegistry; | |
import org.hibernate.service.ServiceRegistryBuilder; | |
import javax.servlet.ServletContext; | |
import javax.servlet.ServletContextEvent; | |
import javax.servlet.ServletContextListener; |
NewerOlder