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
public class ShutdownListener implements ServletContextListener { | |
@Override | |
public void contextDestroyed(ServletContextEvent sce) { | |
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext()); | |
P p = (P) ctx.getBean("proc"); | |
p.shutdown(); | |
} | |
} |
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
k = 1 | |
r = 3 | |
c = 5 | |
# Correct way | |
A = [[ k ] * c for i in range(r)] | |
A[0][3] = 0 | |
#>>> A | |
#[[1, 1, 1, 0, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]] |
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
a = "12345" | |
# a[i:j:k] from i to j in steps k | |
s = a[::-1] | |
print s | |
# '54321' |
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
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin` | |
# Be sure to have rails and thin installed. | |
require "rubygems" | |
# We are not loading Active Record, nor the Assets Pipeline, etc. | |
# This could also be in your Gemfile. | |
gem "actionpack", "~> 3.2" | |
gem "railties", "~> 3.2" | |
# The following lines should come as no surprise. Except by |
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
require 'spec-helper' | |
describe UserController do | |
describe "Search user with name" do | |
it "should respond to search user route" | |
it "should call User model method to search user with same name" | |
it "should show view with the list of matching users" do | |
response.should render_template("matching_users") | |
it "should redirect to index page if not found" do | |
response.should redirect_to(:action => ) |
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 default_tablespace, temporary_tablespace | |
from dba_users | |
where username = 'g' | |
select sum(bytes) from dba_segments where owner='g' | |
select * from dba_segments where owner='g' | |
select * from dba_segments where owner='g' | |
select * from dba_free_space where tablespace_name = 'USERS' order by bytes desc | |
ALTER TABLESPACE USERS ADD DATAFILE '/oracle/product/11.1.0/oradata/ORA11G/users02.dbf' SIZE 5242880 AUTOEXTEND ON NEXT 268435456 MAXSIZE 65535M |
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
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
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
<link rel="import" href="../yt-video/yt-search-video.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
#yt_search_video { | |
width: 300px; | |
height: 300px; | |
left: 350px; |
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
gulp.src(sourceTsFiles) | |
.pipe(sourcemaps.init()) | |
.pipe(tsc({ | |
target: 'ES5', | |
declarationFiles: false, | |
noExternalResolve: true, | |
typescript: require('typescript') // Only required if you override the default typescript dependency | |
})); |
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
> tsd install firebase --save # Install the firebase definition | |
> tsd reinstall # Reinstall according to tsd.json |
OlderNewer