This file contains 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
-record(abstract_message, { | |
clientId, | |
destination, | |
messageId, | |
timestamp, | |
timeToLive, | |
headers, | |
body | |
}). | |
-record(async_message, { |
This file contains 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
%% For each header file, it scans thru all records and create helper functions | |
%% Helper functions are: | |
%% setters, getters, fields, fields_atom, type | |
-module(record_helper). | |
-export([make/1, make/2]). | |
make(HeaderFiles) -> | |
make([ atom_to_list(X) || X <- HeaderFiles ], "."). |
This file contains 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
%% This is auto generated file. Please don't edit it | |
-module(record_utils). | |
-compile(export_all). | |
-include("messages.hrl"). | |
fields(abstract_message) -> | |
["clientId", "destination", "messageId", "timestamp", "timeToLive", "headers", "body"]; | |
fields(async_message) -> |
This file contains 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
%% To demonstrate tail recursion in Erlang | |
-module (tailrecursion). | |
-export ([fact/1, qsort/1, loop/0]). | |
%% Factorial | |
fact(N) -> fact(N, 1). | |
fact(0, A) -> 1*A; | |
fact(N, A) -> fact(N-1, N*A). |
This file contains 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
% Quick sort | |
-module (recursion). | |
-export ([qsort/1]). | |
qsort([]) -> []; | |
qsort([Pivot|T]) -> | |
qsort([X || X <- T, X < Pivot]) | |
++ [Pivot] ++ | |
qsort([X || X <- T, X >= Pivot]). |
This file contains 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
use strict; | |
use utf8; | |
# convert unicode to Decimal NCR format | |
sub convertUnicodeToDecimalNCR { | |
my ($self, $str) = @_; | |
# important | |
utf8::decode($str); | |
my $ret_str = ""; | |
while ($str =~ /(.)/g) { |
This file contains 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
class Attachment { | |
public byte[] data; | |
public String fileName; | |
public String contentType; | |
public Attachment(String fileName, byte[] data, String contentType) { | |
this.data = data; | |
this.fileName = fileName; | |
int id = contentType.indexOf(";"); | |
this.contentType = id > -1 ? contentType.substring(0, id) : contentType;; |
This file contains 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
// http://stackoverflow.com/questions/4715034/gwt-problem-with-handlerregistration/5275448#5275448 | |
final Set<HandlerRegistration> hack = new HashSet<HandlerRegistration>(); | |
((FocusWidget) sourceWidget).setFocus(true); | |
hack.add(((FocusWidget) sourceWidget).addBlurHandler(new BlurHandler() { | |
@Override | |
public void onBlur(BlurEvent event) { | |
ApplicationUtils.getTipsy().hide(); | |
for (HandlerRegistration hr : hack) { |
This file contains 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 xyz.com; | |
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.net.URL; | |
import java.util.zip.ZipEntry; | |
import java.util.zip.ZipInputStream; |
This file contains 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
variable "vpcId" { | |
default = "vpc-5f98eb36" | |
} | |
data "aws_route_table" "all" { | |
vpc_id = "${var.vpcId}" | |
filter { | |
name = "association.main" | |
values = ["true"] | |
} |
OlderNewer