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 upload.test; | |
| import java.awt.Image; | |
| import javax.jws.WebMethod; | |
| import javax.jws.WebService; | |
| import javax.jws.soap.SOAPBinding; | |
| import javax.jws.soap.SOAPBinding.Style; | |
| @WebService |
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.neolitec.examples; | |
| import org.apache.commons.codec.binary.Base64; | |
| import org.apache.commons.lang.StringUtils; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import javax.servlet.*; | |
| import javax.servlet.http.HttpServletRequest; | |
| import javax.servlet.http.HttpServletResponse; |
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
| string_with_utf8 = "T\xc3\xa4ter" # str, no unicode | |
| correct_unicode = string_with_utf8.decode("utf-8") # interpret string as utf-8 | |
| print repr(correct_unicode) # T\xe4ter, correct unicode string | |
| string_with_utf8_new = correct_unicode.encode("utf-8") # make a utf-8 str() | |
| print repr(string_with_utf8_new) # equals repr(string_with_utf8), str() | |
| #correct_unicode.encode("ascii") # UnicodeEncodeError becuase ascii has no representation for this char! | |
| bad_unicode = unicode("T\xc3\xa4ter") |
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
| <ul class="list"> | |
| <li ng-repeat="location in locations"> | |
| <a href="#">{{location.id}}. {{location.name}}</a> | |
| </li> | |
| </ul> | |
| <map locations='locations'></map> |
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 httplib | |
| import urllib | |
| DATA = "Hello" | |
| connection = httplib.HTTPConnection("localhost:9999", timeout=20) | |
| connection.request("POST", "/stream", headers = {'content-length' : str(len(DATA))}) | |
| connection.send(DATA) | |
| response = connection.getresponse() |
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
| from org.apache.pylucene.analysis import PythonAnalyzer, PythonCharTokenizer | |
| from org.apache.lucene.analysis import Analyzer | |
| from org.apache.lucene.analysis.core import LowerCaseTokenizer, LowerCaseFilter, StopAnalyzer, StopFilter | |
| class LucTokenizer(PythonCharTokenizer): | |
| def __init__(self, version, input): | |
| PythonCharTokenizer.__init__(self, version, input) | |
| def isTokenChar(self, c): | |
| return c >= 48 and c <= 57 or c >=65 and c <= 90 or c >=97 and c <=122 |
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 de.example.controller; | |
| import org.springframework.stereotype.Controller; | |
| import org.springframework.web.bind.annotation.RequestMapping; | |
| import org.springframework.web.servlet.ModelAndView; | |
| @Controller | |
| public class Test { | |
| @RequestMapping("/test") |
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 NIOServlet extends HttpServlet implements CometProcessor { | |
| @Override | |
| public void event(CometEvent event) throws IOException, ServletException { | |
| HttpServletResponse response = event.getHttpServletResponse(); | |
| if (event.getEventType() == CometEvent.EventType.BEGIN) { | |
| new HandlerThread(event, response).start(); | |
| } else if (event.getEventType() == CometEvent.EventType.ERROR) { |
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
| var cheerio = require("cheerio"), | |
| fs = require("fs"); | |
| fs.readFile('bookmarks.html', "utf-8", function read(err, data) { | |
| if (err) { | |
| throw err; | |
| } | |
| var $ = cheerio.load(data); | |
| $("a").each(function(index, a) { |
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
| MetricRegistry metricRegistry = new MetricRegistry(); | |
| ctx.getServletContext().setAttribute("com.codahale.metrics.servlets.MetricsServlet.registry", metricRegistry); |