Skip to content

Instantly share code, notes, and snippets.

View bojanrajkovic's full-sized avatar

Bojan Rajkovic bojanrajkovic

View GitHub Profile
using System;
using oracle.jdbc.driver;
using java.sql;
using System.Diagnostics;
using System.Collections.Generic;
namespace IKVMTest
{
class MainClass
{
csharp> using System.Runtime.InteropServices;
csharp> BitConverter.GetBytes (32);
{ 32, 0, 0, 0 }
csharp> var bytes = BitConverter.GetBytes (32);
csharp> var handle = GCHandle.Alloc (bytes, GCHandleType.Pinned);
csharp> int value;
csharp> Marshal.PtrToStructure (handle.AddrOfPinnedObject (), value);
csharp> value;
0
<xsl:template name="short-time">
<xsl:param name="date" /> <!-- YYYY-MM-DD HH:MM:SS +/-HHMM -->
<xsl:variable name='hour' select='substring($date, 12, 2)' />
<xsl:variable name='minute' select='substring($date, 15, 2)' />
<xsl:variable name='second' select='substring($date, 18, 2)' />
<xsl:choose>
<xsl:when test="contains($timeFormat,'H')">
<!-- 24hr format -->
<xsl:value-of select="concat($hour,':',$minute,':',$second)" />
</xsl:when>
sessionFactory = cfg != null ? Fluently.Configure (cfg).BuildSessionFactory () :
Fluently
.Configure ()
.Database (
OracleClientConfiguration.Oracle10.ConnectionString (c => c.FromConnectionStringWithKey ("OracleConnection"))
.Cache (c => c.ProviderClass<SysCacheProvider> ().UseQueryCache ())
.AdoNetBatchSize (100))
.Mappings (m => m.FluentMappings.AddFromAssemblyOf<Models.Affiliate> ())
.ExposeConfiguration (c => { c.SetProperty ("current_session_context_class", "web"); SaveConfiguration (c); })
.BuildSessionFactory ();
main[1] print tree.get ((Character)'F')
com.sun.jdi.InvalidTypeException: Can't assign primitive value to object
tree.get ((Character)'F') = null
main[1] print tree.get (new Character ('F'))
com.sun.tools.example.debug.expr.ParseException: No class named: Character
tree.get (new Character ('F')) = null
HuffmanNode F (Queue<HuffmanNode> q1, Queue<HuffmanNode> q2) {
return q2.Count == 0 || (q1.Count > 0 && q2.Count > 0 && q1.Peek ().v < q2.Peek ().v) ?
q1.Dequeue () :
q2.Dequeue ();
}
public HuffmanNode GetTree (string data) {
Queue<HuffmanNode> p = new Queue<HuffmanNode> (Frequencies (data));
Queue<HuffmanNode> q = new Queue<HuffmanNode> ();
while (p.Any () || q.Count > 1) {
[root@frameworker ~]# mono -V
Mono JIT compiler version 2.8.1 (tarball Sun Dec 12 15:15:58 EST 2010)
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: normal
Notification: Thread + polling
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
csharp> client.DownloadString ("https://graph.facebook.com/165007850204039")
> ;
"{\"id\":\"165007850204039\",\"name\":\"Douglas from the Late Late Toy Show's awesome fashion skills.\",\"picture\":\"http:\/\/profile.ak.fbcdn.net\/hprofile-ak-snc4\/hs425.ash2\/71077_165007850204039_2417684_s.jpg\",\"link\":\"http:\/\/www.facebook.com\/pages\/Douglas-from-the-Late-Late-Toy-Shows-awesome-fashion-skills\/165007850204039\",\"category\":\"Community\",\"description\":\"A self proclaimed \\"Star On The Rise!\\" We can't publish any updates as apparantly once you have 10,000 fans your comment rights get disabled! So disappointed that we can't keep Douglas's 14,000 fans up to date :-(\",\"likes\":14754}"
@bojanrajkovic
bojanrajkovic / test.cs
Created January 12, 2011 19:09
IL for the test program
using System;
using System.Collections;
using System.Collections.Generic;
class Test {
public static IEnumerable<int> TestA (int n) {
for (int i = 0; i < n; i++) {
yield return i;
}
}
using System;
using System.IO;
using System.Xml.Serialization;
using System.Collections.Generic;
namespace FlashDebugger
{
public class Util
{
public class SerializeXML<T>