I hereby claim:
- I am oj on github.
- I am oj (https://keybase.io/oj) on keybase.
- I have a public key whose fingerprint is D64B 75C1 3A08 FB66 D196 4A56 D5DC 61FB 9326 0597
To claim this, I am signing this object:
public void SendMessage() | |
{ | |
lock(this) | |
{ | |
//do some sanity checking | |
if(host == null || host.Trim().Length == 0) | |
{ | |
throw new Exception("No host specified."); | |
} | |
if(from == null || from.Trim().Length == 0) |
XmlDocument doc = rs.BuildXmlDoc(); | |
System.IO.MemoryStream aMemoryStream = new System.IO.MemoryStream(); | |
XmlTextWriter aXmlTextWriter = new XmlTextWriter(aMemoryStream, System.Text.Encoding.UTF8); | |
//save the xml representation in a memory stream | |
doc.Save(aXmlTextWriter); | |
//pass the xml as a parameter | |
param[2] = System.Text.Encoding.UTF8.GetString(aMemoryStream.ToArray()); |
%% @author OJ Reeves <[email protected]> | |
%% | |
%% My first crappy attempt at Dave Thomas' 6th Code Kata | |
%% (located at http://codekata.pragprog.com/2007/01/kata_six_anagra.html) | |
%% | |
%% Extra bits are now done. | |
%% | |
%% Refactored some small bits, and made changes based on suggestions from | |
%% the guys on Google Wave. |
%% My second code kata. | |
%% This is the first part of the question listed at this URL: | |
%% http://codekata.pragprog.com/2007/01/kata_eight_conf.html | |
%% more to come later. | |
-module(words). | |
-author('OJ Reeves <[email protected]>'). | |
-export([composition/1]). | |
-define(WORDLENGTH, 6). | |
composition(FileName) -> |
let rec nums = seq { yield 1 | |
for n in nums do yield n+1 } | |
How does this work? | |
First thing to remember is that seq is a lazy sequence. It's an IEnumerable under the hood I believe. It'll only evaluate those values which you actually attempt to access. When you take the first element of the sequence, it'll return 1 (I'll assume you know the yield keyword already). The next time you hit the sequence it knows, thanks to yield, that it bypasses the first yield statement and makes it ways to the for loop. That loop iterates over the already-evaluated values in the sequence, which in our case is just 1. So the second item in the sequence is a yield of 1 + 1, whichi s 2. So yes, the two elements of the evaluated sequence are now 1 and 2. When you next access the sequence to get the next value, you are returned to the point where the yield statement was last called and hence we're back in the for loop. The loop has already taken the value of 1 from the previous iteration, but now the sequence |
ruler :: Int -> Int -> String | |
ruler h s = ruler' (2 ^ h * s + 1) h 1 [] [] | |
where | |
outChar c r = if (c `mod` (2 ^ r)) == 1 then '|' else ' ' | |
ruler' _ 0 _ _ a = unlines $ reverse a | |
ruler' w r c l a = let nl = (outChar c r) : l | |
in if c == w then ruler' w (r - 1) 1 [] (nl : a) | |
else ruler' w r (c + 1) nl a | |
-- to diplay results: |
I hereby claim:
To claim this, I am signing this object:
V0RXUwEAAAAAAAIAEAAEABkZGQAAAAAAAQACABAABADPzpoAAAAAAAIAAgAQAAQAb21+AAAAAAADAAIAEAAEAM/OmgAAAAAACAACABAABACAMToAAAAAAAkAAgAQAAQAb21+AAAAAAAKAAAAEAAEACAAAAAAAAAAEgAAABAABAABAAAAAAAAAAoAAgAQAAQA5h48AAAAAAALAAIAEAAEAFJUWAAAAAAAEAACABAABADPaUsAAAAAABEAAgAQAAQAdaaHAAAAAAASAAIAEAAEAHWmhwAAAAAAEwACABAABAB1h6YAAAAAABgAAgAQAAQAr8TbAAAAAAAZAAIAEAAEADOZ/wAAAAAAIwACABAABABSVFgAAAAAAAD/AgAQAAQAz86aAAAAAAAB/wIAEAAEABkZGQAAAAAAAv8CABAABACAMToAAAAAAAP/AgAQAAQAGRkZAAAAAAAI/wIAEAAEAM/OmgAAAAAACf8CABAABAAZGRkAAAAAAAr/AgAQAAQAz86aAAAAAAAL/wIAEAAEABkZGQAAAAAAEP8CABAABADPzpoAAAAAABH/AgAQAAQAGRkZAAAAAAAS/wIAEAAEAM/OmgAAAAAAE/8CABAABAAZGRkAAAAAADj/AgAQAAQAz86aAAAAAAA5/wIAEAAEABkZGQAAAAAAOv8CABAABADPzpoAAAAAAED/AgAQAAQAz86aACEGAABB/wIAEAAEABkZGQAlBgAAIwAAABAAAgAAAAAAAAAAADAAAAC4AK4AIgBDADoAXABVAHMAZQByAHMAXABiAHUAcgBsAHkAXABEAG8AYwB1AG0AZQBuAHQAcwBcAFYAaQBzAHUAYQBsACAAUwB0AHUAZABpAG8AIAAyADAAMQAwAFwAUAByAG8AagBlAGMAdABzAFwAUAByAG8AYwBlAHMAcwBJAG4AagBlAGMAdABpAG8AbgBcAGIAaQBuAFwAVwBpAG4AMwAyAFwARABlAGIAdQBnAAAAAAAiAAAAgAB0AHMAcgB2ACoA |
I hereby claim:
To claim this, I am signing this object:
alert('XSS in '+document.domain); |