- 浏览: 190358 次
- 性别:
- 来自: 上海
最新评论
文章列表
Good Admin Html Template for Back End Developers
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title> ADMIN Portal HTML TEMP ...
引用一个表有三列,id,name,score,现在要取得每个人分数最高的两门课程
create temp table tmp_xxx
as
select 1 id,'A' name,80 grade
UNION ALL
select 2,'A',90
UNION ALL
select 3,'A',60
UNION ALL
select 4,'B',100
UNION ALL
select 5,'B',90
UNION ALL
select 6,'B',50;
select id,name,grade
from
(
select id,name,gr ...
Binary Tree
- 博客分类:
- Arithmetic
public class BinaryTree
{
Node root;
public void addNode(int key, String name)
{
// Create a new Node and initialize it
Node newNode = new Node(key, name);
// If there is no root this becomes root
if (root == null)
{
...
Eigenclass in Ruby
- 博客分类:
- Ruby&Rails
obj = Object.new
def obj.singleton_method
end
eclass = class << obj
self
end
puts eclass.class
puts obj.class
class Object
def eigenclass
class << self; self; end
end
end
puts "abc".eigenclass
puts obj.eigenclass
test_event.rb
event "an event that always happens" do
110 > @target_sales
end
setup do
puts "Setting up sky"
@target_sales = 100
end
main.rb
proc {
events={}
setups=[]
send :define_method, :event do |name, &block|
...
class Resource1
def dispose
@disposed = true
end
def disposed?
@disposed
end
end
module Kernel
def using1(resource)
begin
yield
ensure
resource.dispose
end
end
end
r = Resource1.new
...
This is the sample to integrate SSO to Java web app with spring security, typical authentication process:
In this case, Web app sever is not proxyed, and recieve request directly, so the user's request arrive to Web app server firstly
Core Spring security config:
<?xml version="1.0" ...
Requirement: we want to filter out the rows which is with empty value("", or " ") when sorting, always leave the rows with empty value column to the bottom of the data table.
jQuery.fn.dataTableExt.oSort['customstring-asc'] = function(x,y) {
var retVal;
x = $.trim(x);
y ...
引用Ganymed SSH-2 for Java is a library which implements the SSH-2 protocol in pure Java, more details http://www.ganymed.ethz.ch/ssh2/
引用Here is a full sample for how to do UsernamePasswordInteractive Login and run scp/shell comamnd
import java.io.BufferedReader;
import java.io.IOException;
import ...
引用This is an sample to start Jersey rest api with embedded Jetty, embedded jetty is easy for packaging in linux
public class JerseyStart
{
public static void main(final String[] args) throws IOException
{
ServletContextHandler context = new ServletContextHandler(ServletContextH ...
引用In linux system. only root user can use the port small than 1024, so if you change tomcat port to 80 and start without root account, then you will see the following error:
java.net.BindException: Permission denied <null>
引用The solution is to use iptables to map port 80 with the default port ...
这是一个简单集成微信api的的例子,使用这个Gem:https://github.com/lanrion/weixin_rails_middleware
1. 下载这个rails4例子到本地
https://github.com/caiwenhn2008/weixin_rails_middleware_example
2.运行
bundle exec bundle install
3. 启动服务器,http://localhost:3000/
rails server
4. 根据下面的例子安装,启动 localtunnelling :
http://caerun.iteye.com/ ...
引用Localtunnel will assign you a unique publicly accessible url that will proxy all requests to your locally running webserver. it's really helpful when we doing some testing like third-party login like QQ login, weibo login etc, as they need an call back server to send back response.
Steps:
1. Inst ...
public static String formatXMLContent(final String message)
{
try
{
final InputSource src = new InputSource(new StringReader(message));
final Node document =
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(src).getD ...
Rails4个人开源小博客
介绍: https://ruby-china.org/topics/24666
Github: https://github.com/caiwenhn2008/rails4blog
Heroku Demo: https://wilsonsblog.herokuapp.com/articles