Skip to content

Instantly share code, notes, and snippets.

View mulander's full-sized avatar

mulander

View GitHub Profile
Example 1.2.2 The following code designates an anonymous class
new Iterator[Int]
{
private var x = 0
def hasNext = true
def next = { x += 1; x }
}
With an additional newline character, the same code is interpreted as an object creation followed by a local block:
[bits 32]
call n
n: pop eax
push eax
call where
db 'Code loaded at 0x%p', 0xa, 0
with Ada.Text_IO;
with Ada.Strings.Unbounded;
procedure Read
is
package TIO renames Ada.Text_IO;
package US renames Ada.Strings.Unbounded; -- this is line 7
File : TIO.File_Type;
Stored_Line : US.Unbounded_String;
with Ada.Text_IO;
with Ada.IO_Exceptions;
procedure Read
is
File : Ada.Text_IO.File_Type;
begin -- this is line 7
Ada.Text_IO.Open (File, Mode => Ada.Text_IO.In_File, Name => "read.adb");
Ada.Text_IO.Set_Line (File, 7);
declare
adam@byron:~/Ada/xlq$ ./test
Start of Test.
Foo_Access declared.
Foo allocated.
About to leave Foo_Access's master.
Left Foo_Access's master.
The Foo is still allocated.
adam@byron:~/Ada/xlq$ uname ia
uname: extra operand `ia'
Try `uname --help' for more information.
with Text_IO; use Text_IO;
procedure fibo is
type IntArray is array(Natural range <>) of Integer;
type IntArrayPtr is access IntArray;
function fibor(arr0:IntArrayPtr;n:Natural) return Integer is
begin
if n = 0 or n = 1 then
arr0.all(n) := 1;
return 1;
else
#include <stdio.h>
#include <stdlib.h>
#define NUM 45
int fibo(int *a,int n);
int main(){
int *a;
int i = 0;
a = malloc(NUM*100);
fibo(a,NUM);
for (i = 0; i <= NUM; i++){
GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :m +System.Time
Prelude System.Time> getClockTime
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.6 ... linking ... done.
Fri Jan 13 20:52:34 *** Exception: <stdout>: hPutChar: invalid argument (charact
-- The following query properly
-- returns an array of records in the items
-- column
example=# select id
example-# ,dr.x_id
example-# ,dr.name
example-# ,(select array(select sq
example(# from (select id
example(# ,name
example(# from example.items c
20:31 <mulander> I handle issues in trackers in 6 phases. 1. Gather info. 2. Diagnose. 3. Find solution. 4. Implement. 5. Test. 6. Close
20:34 <mulander> here is what I do with the wall of text problem (based on my regular day job)
20:34 <mulander> 1. Did the client tell us what went wrong
20:34 <mulander> 2. What did he expect
20:34 <mulander> 3. What exactly did he do
20:35 <mulander> 4. Did he provide the data we regularly ask during diagnostics (logs, version numbers etc)
20:35 <mulander> 5. Where did the issue happen (machine, specific software running on it etc - something that might influence us).
20:35 <mulander> that's the 'did they tell me everything' phase.