Skip to content

Instantly share code, notes, and snippets.

@flowersinthesand
flowersinthesand / test.html
Created April 4, 2012 15:55
Test data loss of the long polling transport
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=medium-dpi" />
<title>jQuery Socket Chat</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
<script type="text/javascript" src="jquery.socket-1.0a1.js"></script>
<script type="text/javascript">
$(function() {
package com.github.flowersinthesand.samples;
import javax.servlet.annotation.WebServlet;
import org.atmosphere.cpr.AtmosphereServlet;
@SuppressWarnings("serial")
@WebServlet(urlPatterns = "/test-with-atmosphere", loadOnStartup = 0)
public class MyServlet extends AtmosphereServlet {
}
@flowersinthesand
flowersinthesand / gist:5533229
Created May 7, 2013 14:55
Log from portal-chat-atmosphere
2013-05-07 23:35:39.382:INFO:oejs.Server:jetty-8.1.8.v20121106
2013-05-07 23:35:39.477:INFO:oejw.WebInfConfiguration:Extract jar:file:/C:/Users/DongHwan/git/portal-java/samples/chat-atmosphere/target/portal-chat-atmosphere.war!/ to C:\Users\DongHwan\git\portal-java\samples\chat-atmosphere\target\portal-chat-atmosphere
2013-05-07 23:35:39.922:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
Null identity service, trying login service: null
Finding identity service: null
2013-05-07 23:35:41.177:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,[file:/C:/Users/DongHwan/git/portal-java/samples/chat-atmosphere/target/portal-chat-atmosphere/, jar:file:/C:/Users/DongHwan/git/portal-java/samples/chat-atmosphere/target/portal-chat-atmosphere/WEB-INF/lib/portal-atmosphere-0.7-20130228.125522-9.jar!/META-INF/resources/, jar:file:/C:/Users/DongHwan/git/portal-java/samples/chat-atmosphere/target/portal-chat-atmosphere/WEB-INF/lib/portal-core-0.7-20
@flowersinthesand
flowersinthesand / portal.js-formatter.xml
Created July 18, 2013 15:39
Eclipse JavaScript code formatter for portal.js
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="11">
<profile kind="CodeFormatterProfile" name="portal.js" version="11">
<setting id="org.eclipse.wst.jsdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.indent_empty_lines" value="true"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.alignment_for_compact_if" value="16"/>
@flowersinthesand
flowersinthesand / with0.6
Last active December 20, 2015 14:19
portal-chat-atmosphere log
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Chat for Atmosphere 0.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> jetty-maven-plugin:9.0.4.v20130625:run-war (default-cli) @ portal-chat-atmosphere >>>
@flowersinthesand
flowersinthesand / migration.patch
Created October 2, 2013 06:54
Migration to Play 2.2
diff --git a/play/pom.xml b/play/pom.xml
index 1153e08..27c4100 100644
--- a/play/pom.xml
+++ b/play/pom.xml
@@ -16,7 +16,7 @@
<artifactId>portal-core</artifactId>
</dependency>
<dependency>
- <groupId>play</groupId>
+ <groupId>com.typesafe.play</groupId>
@flowersinthesand
flowersinthesand / code.js
Last active December 26, 2015 18:49
Creating a HTTP status const
$('#table-http-status-codes-1 tbody tr').each(function(i, elem) {
var code = elem.children[0].innerHTML;
var reason = elem.children[1].innerHTML;
if (!!+code && reason !== 'Unassigned') {
console.log('/**');
console.log(' * {@code '+code+' '+reason+'}');
console.log(' */');
console.log('public static final Status '+reason.toUpperCase().replace(/[\s\-]/ig, '_')+' = new Status('+code+', "'+reason+'");');
console.log('');
}
@flowersinthesand
flowersinthesand / App.java
Created November 1, 2013 13:44
Modified App class to avoid scan issue
/*
* Copyright 2012-2013 Donghwan Kim
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
import os.path
current_dir = os.path.dirname(os.path.abspath(__file__))
import cherrypy
import simplejson
import time
def RPC_handler(*args, **kwargs):
cherrypy.response.headers['Content-Type'] = 'text/javascript'
@flowersinthesand
flowersinthesand / Handler.java
Created January 18, 2014 05:40
Data type conversion example for Portal for Java with Jackson
public abstract class Handler<T> implements Action<Map<String, Object>> {
private final Class<T> desiredType;
@SuppressWarnings("unchecked")
public Handler() {
// Each casting is not safe. Improve if you want to use in production
// See org.springframework.core.GenericTypeResolver.resolveTypeArgument
ParameterizedType pt = (ParameterizedType) this.getClass().getGenericSuperclass();
desiredType = (Class<T>) pt.getActualTypeArguments()[0];