Friday, May 6, 2011

Int in a simulated memory array of uchar

In C, in an Unix environment (Plan9), I have got an array as memory.

uchar mem[32*1024];

I need that array to contain different fields, such as an int (integer) to indicate the size of memory free and avaliable. So, I've tried this:

uchar* memp=mem;
*memp=(int)250; //An example of size I want to assign.

I know the size of an int is 4, so I have to force with casting or something like that, that the content of the four first slots of mem have the number 250 in this case, it's big endian.

But the problem is when I try to do what I've explained it doesn't work. I suppose there is a mistake with the conversion of types. I hopefully ask you, how could I force that mem[0] to mem[3] would have the size indicated, representated as an int and no as an uchar?

Thanks in advance

From stackoverflow
  • Like this:

    *((int*) memp) = 250;
    

    That says "Even though memp is a pointer to characters, I want you treat it as a pointer to integers, and put this integer where it points."

    Polar Geek : Ok, thanks, it does work. And I've got the point.
    Polar Geek : But, if I want to assign a pointer to another part of mem (the array of unsigned chars),at the beginning to nil. Could I do something like this?: *((void*) memp) = nil; It doesn't compile. :(
    ephemient : It is never possible to dereference a (void *) pointer.
    leander : Be careful when attempting to write things other than char/uchar to a uchar array, unless you know the address is aligned properly (i.e. for a 32-bit system, usually aligned to a 4-byte boundary). Many modern processors can handle unaligned writes (with a performance penalty -- and note that the compiler may assume the worst and use slower instructions to make the write), but some still can't -- see e.g. smaller processors like the early ARMs. You also may have aliasing issues to worry about...
  • Cast pointer to int, not unsigned char again!

    int * memp = (int *)mem;
    * memp = 250; //An example of size I want to assign.
    
  • Have you considered using a union, as in:

    union mem_with_size {
      int   size;
      uchar mem[32*1024];
    };
    

    Then you don't have to worry about the casting. (You still have to worry about byte-ordering, of course, but that's a different issue.)

  • As others have pointed out, you need to cast to a pointer to int. You also need to make sure you take alignment of the pointer in consideration: on many architectures, an int needs to start at a memory location that is divisible by sizeof(int), and if you try to access an unaligned int, you get a SIGBUS. On other architectures, it works, but slowly. On yet others, it works quickly.

    A portable way of doing this might be:

    int x = 250;
    memcpy(mem + offset, &x, sizeof(x));
    

    Using unions may make this easier, though, so +1 to JamieH.

How to solve lazy initialization exception using JPA and Hibernate as provider

I am working on a project for a customer who wants to use lazy initialization. They always get "lazy initialization exception" when mapping classes with the default lazy loading mode.

@JoinTable(name = "join_profilo_funzionalita", joinColumns = {@JoinColumn(name =    "profilo_id", referencedColumnName = "profilo_id")}, inverseJoinColumns = {@JoinColumn(name = "funzionalita_id", referencedColumnName = "funzionalita_id")})
//@ManyToMany(fetch=FetchType.EAGER) - no exceptions if uncommented
@ManyToMany 
private Collection<Funzionalita> funzionalitaIdCollection;

Is there a standard pattern using JPA classes to avoid this error?

Snippets are welcome, thanks a lot for your time.

From stackoverflow
  • OpenSessionInView is one pattern to deal with this problem. Some info here:

    http://www.hibernate.org/43.html

    What kind of application are you writing? If you're not dealing with remoting (no web services, no AJAX-based web client) then OSIV may work very nicely. Otherwise things get complicated quickly...

  • LazyInitializationException means that you are calling the collection after the hibernate session has closed, or after the object has been detached from the session.

    You need to either re-attach the object to hibernate session, change the place where you are calling the collection, or move the boundary of where the session gets closed to a higher layer.

  • There are many ways to pre-fetch properties, so they are there after session is closed:

    1. Just call appropriate getter. After field is fetched into bean it is there after session is closed.
    2. You may initialize field in EJBQL query , look for JOIN FETCH keyword.
  • Using JBoss Seam solves the problem LazyInitailizationException and not only. Seam does not close the hibernate session after each request but it binds to the conversation (Open session in Conversation) so you can really use the dirty checking in the long conversations like wizards (no merge only flash). View rendering phase is executed in a separate transaction so there is no problem if the commit fails as in OpenSessionInView.

Are there any good oracle podcasts?

Are there any good oracle podcasts around? The only ones I've found is produced by oracle corp, and as such are little more than advertising pieces pushing their technology of the moment.

I'm specifically interested in Database technologies.

From stackoverflow
  • Here's a list: http://www.oracle.com/podcasts/index.html

  • Oracle Podcast Center


    Green Enterprise Podcasts

    Host: Paul Salinger, VP Marketing

    Listen to discussions with customers, partners, and Oracle green experts, exploring topics that can help Oracle customers better understand how Oracle products can support their sustainability initiatives and enable a green enterprise.


    Oracle AppCasts

    Host: Cliff Godwin, SVP, Applications Technology

    Tune into "Live with Cliff" to hear from application technology experts, product and industry experts, and customers about what's saving Oracle customers time and money when using Oracle E-Business Suite, PeopleSoft, and JD Edwards applications.


    Oracle Customer SuccessCasts

    Tune into Oracle Customer SuccessCasts, where customers describe how Oracle helps them to run their businesses more successfully.


    Oracle Database Podcasts

    Tune into this podcast series to get the latest information on Oracle Database from Oracle technical experts.


    Oracle Fusion Middleware Radio

    Host: Rick Schultz, VP, Product Marketing for Oracle Fusion Middleware & Security Products

    Tune into this podcast series about Oracle Fusion Middleware to hear about Oracle's middleware product strategy and explore what middleware means to your business—growth, agility, insight, and reduced risk.


    Oracle Magazine Feature Casts

    Tune into conversations with Oracle Magazine editors, authors, and Oracle subject matter experts about featured articles in Oracle Magazine. Go beyond print with additional insight into Oracle products, technologies, customers, and more.


    Oracle PartnerNetwork (OPN) PartnerCast

    Tune in and learn how to grow your business with Oracle, exclusively for Oracle PartnerNetwork members.


    Oracle Technology Network Arch2Arch Podcast

    Host: Bob Rhubart, Manager, Architect Community, OTN

    Listen in as architects and other experts from across the Oracle community discuss the topics, tools, and technologies that drive the evolution of software architecture.


    Oracle Technology Network TechCasts

    Host: Justin Kestelyn, OTN Editor-in-Chief

    Tune into "fireside chats" with experts about new tools, technologies, and trends in application development.


    Oracle@Work

    Through Oracle@Work Video Podcasts you'll learn how Oracle customers from aerospace and automotive to travel and television address business and technical issues with the latest Oracle technology and applications solutions. Oracle@Works play like short television news magazine pieces shot on location, world wide. See Oracle customers in action, first hand, with Oracle@Work Video Podcasts.


    Profit Online Executive Briefing Audiocasts

    Every month, Profit Online presents conversations with Oracle executives, customers, and partners, discussing developments in their businesses and trends in their industries. Tune into and stay up to date on how IT and business leaders are expanding into new markets, improving business processes, and creating the future of the enterprise.


    Reference: Oracle Podcasts

  • Asking for an "Oracle podcast" that isn't going to be a product marketing focused is too broad. It's almost like asking for a "Microsoft Podcast." Anything you get is going to be broad and shallow. An introduction, nothing in depth.

    What are you looking for? DB, Middleware, Linux/OS, ERP, CRM, BI, Information Security, Identify Management, Integration, PL/SQL etc. . . . For what kind of audience? Developer, Sysadmin, DBA, Apps DBA (very diff believe it or not), Technology Manager, Accountant, Finance Director, White Hat security specialist, etc.

    Matthew Watson : Fair comment, I have updated the query slightly. Although, I haven't been able to find many non Oracle corp endorsed podcasts of any Oracle technology.

XSL Conversion XML->XML outputs only text?

Hi I have following XAML code which is the output from XamlWriter.Save():

<StackPanel Name="itemStack" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:mm="clr-namespace:MindManager;assembly=MindManager">
  <mm:Item Width="Auto" Height="Auto">
    <Border BorderThickness="10,10,10,10" Name="border1" Height="Auto">
      <DockPanel>
        <DockPanel LastChildFill="True" Name="dockPanel1" Height="33" DockPanel.Dock="Top">
          <Button Name="deleteItemButton" Width="26" Height="21.638" FlowDirection="LeftToRight" DockPanel.Dock="Right" Grid.IsSharedSizeScope="False">x</Button>
          <TextBox Name="tagsTextBox" Height="19">1</TextBox>
        </DockPanel>
        <TextBox TextWrapping="Wrap" MinLines="5" AcceptsReturn="True" AcceptsTab="True" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" AutoWordSelection="True" Name="contentTextBox" Width="Auto" MinWidth="600" Height="Auto" MinHeight="80">2</TextBox>
      </DockPanel>
    </Border>
  </mm:Item>
  <mm:Item Width="Auto" Height="Auto">
    <Border BorderThickness="10,10,10,10" Name="border1" Height="Auto">
      <DockPanel>
        <DockPanel LastChildFill="True" Name="dockPanel1" Height="33" DockPanel.Dock="Top">
          <Button Name="deleteItemButton" Width="26" Height="21.638" FlowDirection="LeftToRight" DockPanel.Dock="Right" Grid.IsSharedSizeScope="False">x</Button>
          <TextBox Name="tagsTextBox" Height="19">3</TextBox>
        </DockPanel>
        <TextBox TextWrapping="Wrap" MinLines="5" AcceptsReturn="True" AcceptsTab="True" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" AutoWordSelection="True" Name="contentTextBox" Width="Auto" MinWidth="600" Height="Auto" MinHeight="80">4</TextBox>
      </DockPanel>
    </Border>
  </mm:Item>
</StackPanel>

I want to convert it to simpler XML with the following XSL:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:mm="clr-namespace:MindManager;assembly=MindManager">  
  <xsl:output method="xml" indent="yes"/>
    <xsl:template match="/StackPanel">
      <mindcontainer>
        <xsl:for-each select="mm:Item">
          <minditem>
            <xsl:value-of select="/tagsTextBox"/>
            <xsl:value-of select="/contentTextBox"/>
          </minditem>
        </xsl:for-each>
      </mindcontainer>
    </xsl:template>
</xsl:stylesheet>

I want the output to have the following format:

<mindcontainer>
 <minditem>
   content of tagsTextBox
   content of contentTextBox
 </minditem>
 <minditem>
   content of tagsTextBox
   content of contentTextBox
 </minditem>
</mindcontainer>

But the problem is that all I get from it is:

  x
  1

2







  x
  3

4

One can see that there is only text, there are not text, also the filter doesn't work the x is the label of the close button which I do not want to be outputted.

This is the code Iam using to perform the transform:

    XmlWriterSettings settings = new XmlWriterSettings();
    settings.Indent=true;

    StringBuilder sb = new StringBuilder();
    using (XmlWriter wr = XmlWriter.Create(sb, settings))
    {
        XamlWriter.Save(scrollViewer1.Content, wr);
    }

    settings.ConformanceLevel = ConformanceLevel.Auto;
    using (XmlReader rd = XmlReader.Create(new StringReader(sb.ToString())))
    {
        XslCompiledTransform trans = new XslCompiledTransform();
        trans.Load("output.xsl");

        trans.Transform(rd, XmlWriter.Create("mindstore.xms", settings));
    }
From stackoverflow
  • In XPath/XSLT 1.0, to select (or match) an element that's in a namespace, you must declare a namespace prefix and use that prefix in your expressions (or patterns). Don't be fooled by the fact that <StackPanel> and other elements don't use prefixes in the input XML. It's using a default namespace, as determined by this default namespace declaration:

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    

    So you need a corresponding declaration in your stylesheet (as you did for the "mm" namespace), except that you need to pick a namespace prefix to use. Any prefix will do (just as you didn't actually have to use "mm").

    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      ...>
    

    Then, in your stylesheet, you need to update your expressions and patterns to use the prefix you chose ("x" in my example above):

    <xsl:template match="/x:StackPanel">
    

    The reason you're seeing the output you're getting is that your template rule isn't ever getting invoked (because the name doesn't match). Instead, the built-in template rules for each of the XPath node types is getting invoked. For the root node and element nodes, it's to just keep processing children. For text nodes, it's to copy them through. Thus, the behavior you're seeing is the same behavior you'd get with any empty stylesheet (that has no template rules): a dump of all the text nodes in the input document.

    It can be a pain to have to prefix every name test in every expression or pattern. That's why XSLT 2.0 introduced a feature called xpath-default-namespace, which makes it possible for XPath expressions and XSLT patterns to use a default namespace, just like elements can in XML. In that case, all you'd have to change is to add one line:

    <xsl:stylesheet version="2.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xpath-default-namespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      ...>
    

    But that's only if you you're using an XSLT 2.0 processor. (MSXML, for example, doesn't support XSLT 2.0.)

    Before I leave you, I see some more issues in your stylesheet (which you, no doubt, would have discovered next):

            <xsl:value-of select="/tagsTextBox"/>
            <xsl:value-of select="/contentTextBox"/>
    

    Starting an expression with "/" means "start from the document/root node". So these expressions are looking for a <tagsTextBox> document element and a <contentTextBox> document element, respectively. Based on what I see in your sample input document, I think what you meant to write is this:

            <xsl:value-of select=".//x:TextBox[@Name = 'tagsTextBox']"/>
            <xsl:value-of select=".//x:TextBox[@Name = 'contentTextBox']"/>
    

    Hope this helps! Let me know if anything needs further explanation.

  • You problems are in the XSLT, at the very least:

    1. You need to put your matching expressions in the right namespaces as they are to match. E.g.

      ... xml:xaml='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
      <xsl:template match='/xaml:StackPanel'>...
      
    2. The value-of expressions (match /tagsTextBox and /contentText) Boxseem to be intended to match within the StackPanel, but:

      • Also lack namespace qualification
      • Are matching immediate children of the document root, rather than descendent nodes of the current content node. Likely you need:

        <xsl:value-of select='descendent::xaml:TextBox'/>
        

    And possibly more.

Lazy choices in Django form

I have a Django my_forms.py like this:

class CarSearchForm(forms.Form):  
    # lots of fields like this
    bodystyle = forms.ChoiceField(choices=bodystyle_choices())

Each choice is e.g. ("Saloon", "Saloon (15 cars)"). So the choices are computed by this function.

def bodystyle_choices():  
    return [(bodystyle.bodystyle_name, '%s (%s cars)' %  
          (bodystyle.bodystyle_name, bodystyle.car_set.count()))  
          for bodystyle in Bodystyle.objects.all()]

My problem is the choices functions are getting executed every time I merely import my_forms.py. I think this is due to the way Django declares its fields: in the class but not in a class method. Which is fine but my views.py imports my_forms.py so the choices lookups are done on every request no matter which view is used.

I thought that maybe putting choices=bodystyle_choices with no bracket would work, but I get:

'function' object is not iterable

Obviously I can use caching and put the "import my_forms" just in the view functions required but that doesn't change the main point: my choices need to be lazy!

From stackoverflow
  • Try using a ModelChoiceField instead of a simple ChoiceField. I think you will be able to achieve what you want by tweaking your models a bit. Take a look at the docs for more.

    I would also add that ModelChoiceFields are lazy by default :)

  • Another solution is to move the bodystyle field to the class constructor:

    class CarSearchForm(forms.Form):
      def __init__(self, *args, **kwargs):
        super(CarSearchForm, self).__init__(*args, **kwargs)
        self.fields['bodystyle'] = forms.ChoiceField(choices=bodystyle_choices())
    
    Tom Viner : I think I will keep the class definition part, but have self.fields['bodystyle'].choices = bodystyle_choices() in the constructor.
  • You can use the "lazy" function :)

    from django.utils.functional import lazy
    
    class CarSearchForm(forms.Form):  
        # lots of fields like this
        bodystyle = forms.ChoiceField(choices=lazy(bodystyle_choices, tuple)())
    

    very nice util function !

Generate a commutative hash based on three sets of numbers?

I need to generate a commutative hash based on three sets of "score" structs.

Each score has a "start", an "end" and a "number".

Both start and end are usually huge numbers (8-9 digits) but number is just from 1 to 4.

I need them to be commutative so the order does not matter. I'm using XOR at the moment but it seems to be giving bad results.

Since I'm working with large large datasets, I'd prefer a performance-friendly solution. Any suggestions? Thanks =]

 public static int getCustomHash(cnvRegion c1, cnvRegion c2, cnvRegion c3)
 {
  int part1 = (c1.startLocation * c2.startLocation * c3.startLocation);
  int part2 = (c1.endLocation * c2.endLocation * c3.endLocation);
  int part3 = (c1.copyNumber + c2.copyNumber + c3.copyNumber)*23735160;
  return part1 ^ part2 ^ part3;
 }
From stackoverflow
  • Thomas Wang has a discussion of hash functions here.

    • See the knuth's method, and the 64 to 32-Bit mix functions.

    Paul Hsieh also has a page on integer hashing, which describes his "SuperFastHash" function which got mixed feedback.

    EDIT

    Because you want your custom hash to be commutative (I assume between the cnvRegion params) you could probably write something like this:

    public int hash6432shift(long key)
    {
       key = (~key) + (key << 18); // key = (key << 18) - key - 1;
       key = key ^ (key >>> 31);
       key = key * 21; // key = (key + (key << 2)) + (key << 4);
       key = key ^ (key >>> 11);
       key = key + (key << 6);
       key = key ^ (key >>> 22);
       return (int) key;
    }
    
    public static int getCustomHash(cnvRegion c1, cnvRegion c2, cnvRegion c3)
    {
        int part1 = (c1.startLocation ^ c2.startLocation ^ c3.startLocation);
        int part2 = (c1.endLocation ^ c2.endLocation ^ c3.endLocation);
        int part3 = (c1.copyNumber ^ c2.copyNumber ^ c3.copyNumber);
    
        int hash1 = hash6432shift(((long)part1 << 0x20) | part2);
        return hash6432shift(((long)hash1 << 0x20) | part3);
    }
    

    However, in the end the task of finding a hash function that is both fast and provides good collision resistance is very dependent of the data you are processing.

    Let me give you an example:

    Let's say that the values you are hashing are large, 10 digit numbers, and they represent a UNIX timestamp (the time elapsed in seconds since 01/01/1970). In this case, hashing a lot of timestamps that occur within a limited time span - say over a month is simply a matter of eliminating the portion that doesn't change, and using only the portion of the timestamp that changes a lot. This is the same as saying that you are eliminating the portions that have low entropy.

    v1 = 1241536920   // 5/5/2009 3:22:00 PM
    v2 = 1241529720   // 5/5/2009 1:22:00 PM
    v3 = 1241270520   // 5/2/2009 1:22:00 PM
    v4 = 1242825720   // 5/20/2009 1:22:00 PM
    

    It is pretty clear that we could safely eliminate the first 3-4 digits and only use the remaining digits as the hash. Also, if these values usually occurred within a few minutes of each other you can also drop the last 2-3 digits.

    In this manner, you're left with only 4 digits that you can use as a hash with a pretty good collision resistance for our case example.

    My point is that hash functions can be highly optimized if you know the statistical distribution of the values your are trying to hash.

    DarkAmgine : I'm having a hard time understanding the crypto language, and the information doesnt seem to apply to my case (getting a COMMUTATIVE hash from THREE sources).
    DarkAmgine : so I was looking at the hashes that my original code generated and was surprised to see it fairly evenly distributed from -2147483648 to +2147483647 Turns out I'm just getting a lot of collisions because there's just too many data for using int. Thanks
    Miky Dinescu : Well, in that case you'll probably have to try Int64.. :)
    DarkAmgine : by the way, do you know what ">>>" means? c# doesn't seem to like it...
    DarkAmgine : nevermind, i used >> and it worked.
    Miky Dinescu : In Java, the ">>>" is an unsigned right shift and it is the same thing as doing a right shift on an UInt32 in C#. (Java doesn't have unsigned types)
  • First, I think the requirements are not quite clear. If you hash three datasets c1, c2 and c3. Then if you switch, c1.copyNumber and c2.copyNumber and hash again. Should that give the same result or not? If you switch c1.startLocation with c1.endLocation. Should that result in the same hash or not?

    I'm going to assume that you'd like to have different hash results in both cases and that the only permutation that should not change the hash result are permutations of the datasets c1, c2, c3.

    If that is the case then I'd propose to first hash the three datasets independently to smaller values. I.e. h1 = H(c1) h2 = H(c2) h3 = H(c3) where H can be any hash function (e.g., CRC32, Adler32, SHA1 etc) depending on how hard you want to avoid collisions.

    The next step would be to compute a commutative hash of h1, h2, h3. If you want to avoid collisions unless h1, h2, h3 are permuted then the following works. Compute the polynomial

    • P(x) = (x-h1)(x-h2)(x-h3)

    then hash the polynomial (rsp. its coefficients) with any good hash function. I.e. that would be

    • H(h1+h2+h3 || h1 * h2 + h1 * h3 + h2 * h3 || h1 * h2 * h3), where || is concatenation.

    If you want to avoid any unecessary collision at all cost then the coefficients should be computed as multiprecision integers and a collision resistant hash function such as SHA1 should be used. Because of the unique factorisation property of polynomials if follows that the coefficents of the polynomial are different if h1, h2 and h3 are different. But it seems that avoiding collisions at all cost is overkill in your case.

    So rather than computing a polynomial P(x) symbolically one could just evaluate it at a arbitrary value R. I.e. if h1, h2, h3 are just 32-bit values then computing the following might be enough: (some C type pseudocode follows. I'm don't know what C# uses for 64-bit integers)

    const long long R = SOME_RANDOM_64_BIT_CONSTANT;
    long long hash0 = (R - h1) * (R - h2) * (R - h3);
    int hash = (int) (hash0 >> 32);
    

    I'm 64-bit multiplication here, because they are fast enough on modern CPUs and I'm using the upper 32-bit of hash0 rather than the lower 32 bit because the lower 32 bits are somewhat biased. I.e., the least significant bit is much more likely to be 0 than 1.

Can I 'open source' the sources to my site and still copyright the contents?

I have put up the sources of my site on GitHub for easy maintenance. While the majority of the content is in a wordpress database, there are a few html files which contain some content. Since these files are in a open source repository, I was wondering if I can enforce a copyright on them.

From stackoverflow
  • Open Source does not mean that you will not have any copyright. Mostly, it is about transparency by distributing the source so that the receiver can have a look and modify the program should need be, should he want to. What happens to the derivative work depends on the exact clauses of the license. There are quite a few licenses you can choose from like MIT, BSD, GPL, Creative Commons etc. Choose one that fits your needs the best.

    sandesh247 : @dirkgently: "Open Source does not mean that you will not have any copyright." I don't know how I missed that. Thanks.
  • Sure you can. The right to retain copyright is completely independent of the availability of the source code. Open-source, closed-source, freeware, or shareware, it is simply a mark of intellectual property. If you observe many (most?) of the projects on such project hosting sites as SourceForge and CodePlex, or even articles on CodeProject, the author(s) have declared copyright. Creations released into the public domain cannot have be copyrighted of course (or their copyright has expired), but this is only a subset of the much wider open source category.

    I would recommend that you just place your appropiate copyright notice in each file that you own (whether they interact with WordPress does not matter of course) and additionally place the full notice in a separate file (Readme or Copyright is standard), including explicit attribution to all the authors (team or individuals).

    As a side note, the wikipedia article on copyright law should give you a good idea of more precisely what copyright entails internationally and in various countries/regions. Finally, it's worth just observing that the Perens' principle states that open source material should have very relaxed or even no copyright restrictions. Of course, this is only a principle, and in reality most authors want to put some limited restrictions on their creations, as the widely used GPL (and to a lesser degree LGPL) licenses provide, while others (such as the BSD I believe) license practically allow any use as far as distribution and derivative works go, as far as I know.

    Jon Rimmer : You may want to check GitHub's policy on storing non Open Source licensed content in a public repository though. While you would retain copyright, you might be in violation of their terms and conditions (I only speculating here though, I have never used GitHub).
    Noldorin : @Jon: Yeah, you have a fair point. I haven't used GitHub either, so it's worth checking into. I know there are no problems with SourceForge, CodePlex, Launchpad, among other hosts, but they do all have their own rules to varying degrees.
    sandesh247 : @Jon: Thanks for the advice, I'll make sure.