text:
<div *ngIf="imageContainer" id="image-container">
    <div class="d-flex align-items-center justify-content-center">
        <div *ngIf="!containsOriginal(imageContainer)" class="alert alert-info" role="alert"
             i18n="@@image.originalNotFoundWarning">
            Die Original-Version des Bilds befindet sich nicht im Bilderverzeichnis.
        </div>
        <img [src]="containsOriginal(imageContainer) ? imageContainer.imgSrc : imageContainer.thumbSrc">
    </div>
</div>


text:
package org.analogweb.guice;

import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import org.analogweb.ModulesBuilder;
import org.analogweb.guice.GuiceContainerAdaptorFactory;
import org.analogweb.guice.GuicePluginModulesConfig;
import org.junit.Before;
import org.junit.Test;

/**
 * @author snowgoose
 */
public class GuicePluginModulesConfigTest {

    private GuicePluginModulesConfig config;
    private ModulesBuilder modulesBuilder;

    @Before
    public void setUp() throws Exception {
        config = new GuicePluginModulesConfig();
        modulesBuilder = mock(ModulesBuilder.class);
    }

    @Test
    public void testPrepare() {

        when(modulesBuilder.setInvocationInstanceProviderClass(GuiceContainerAdaptorFactory.class))
                .thenReturn(modulesBuilder);

        ModulesBuilder actual = config.prepare(modulesBuilder);
        assertSame(actual, modulesBuilder);

        verify(modulesBuilder).setInvocationInstanceProviderClass(
                GuiceContainerAdaptorFactory.class);
    }

}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

<title>  Acid3 Passed in 23 Days! - The Web Standards Project</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="The Web Standards Project is a grassroots coalition fighting for standards which ensure simple, affordable access to web technologies for all." />
<meta name="MSSmartTagsPreventParsing" content="true" />

<link rel="stylesheet" type="text/css" media="screen, projection" href="/wp/wp-content/themes/web-standards-project/styles.css" />
<link rel="stylesheet" type="text/css" media="print" href="/wp/wp-content/themes/web-standards-project/print.css" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="/feed/index.html" />
<link rel="alternate" type="text/xml" title="RSS .92" href="/feed/rss/index.html" />
<link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="/feed/atom/index.html" />
<link rel="pingback" href="/wp/xmlrpc.php" />
<link rel="Shortcut Icon" type="image/ico" href="/files/theme/wasp.ico" />
<link rel="home" title="Web Standards Project Home" href="/index.html" />
	<link rel='archives' title='March 2013' href='/2013/03/index.html' />
	<link rel='archives' title='February 2012' href='/2012/02/index.html' />
	<link rel='archives' title='December 2011' href='/2011/12/index.html' />
	<link rel='archives' title='November 2011' href='/2011/11/index.html' />
	<link rel='archives' title='March 2011' href='/2011/03/index.html' />
	<link rel='archives' title='February 2011' href='/2011/02/index.html' />
	<link rel='archives' title='January 2011' href='/2011/01/index.html' />
	<link rel='archives' title='August 2010' href='/2010/08/index.html' />
	<link rel='archives' title='June 2010' href='/2010/06/index.html' />
	<link rel='archives' title='March 2010' href='/2010/03/index.html' />
	<link rel='archives' title='February 2010' href='/2010/02/index.html' />
	<link rel='archives' title='January 2010' href='/2010/01/index.html' />
	<link rel='archives' title='November 2009' href='/2009/11/index.html' />
	<link rel='archives' title='June 2009' href='/2009/06/index.html' />
	<link rel='archives' title='May 2009' href='/2009/05/index.html' />
	<link rel='archives' title='April 2009' href='/2009/04/index.html' />
	<link rel='archives' title='March 2009' href='/2009/03/index.html' />
	<link rel='archives' title='February 2009' href='/2009/02/index.html' />
	<link rel='archives' title='January 2009' href='/2009/01/index.html' />
	<link rel='archives' title='December 2008' href='../../../12/index.html' />
	<link rel='archives' title='November 2008' href='../../../11/index.html' />
	<link rel='archives' title='October 2008' href='../../../10/index.html' />
	<link rel='archives' title='September 2008' href='../../../09/index.html' />
	<link rel='archives' title='August 2008' href='../../../08/index.html' />
	<link rel='archives' title='July 2008' href='../../../07/index.html' />
	<link rel='archives' title='June 2008' href='../../../06/index.html' />
	<link rel='archives' title='May 2008' href='../../../05/index.html' />
	<link rel='archives' title='April 2008' href='../../index.html' />
	<link rel='archives' title='March 2008' href='../../../03/index.html' />
	<link rel='archives' title='February 2008' href='../../../02/index.html' />
	<link rel='archives' title='January 2008' href='../../../01/index.html' />
	<link rel='archives' title='December 2007' href='/2007/12/index.html' />
	<link rel='archives' title='November 2007' href='/2007/11/index.html' />
	<link rel='archives' title='October 2007' href='/2007/10/index.html' />
	<link rel='archives' title='September 2007' href='/2007/09/index.html' />
	<link rel='archives' title='August 2007' href='/2007/08/index.html' />
	<link rel='archives' title='June 2007' href='/2007/06/index.html' />
	<link rel='archives' title='May 2007' href='/2007/05/index.html' />
	<link rel='archives' title='April 2007' href='/2007/04/index.html' />
	<link rel='archives' title='March 2007' href='/2007/03/index.html' />
	<link rel='archives' title='February 2007' href='/2007/02/index.html' />
	<link rel='archives' title='January 2007' href='/2007/01/index.html' />
	<link rel='archives' title='December 2006' href='/2006/12/index.html' />
	<link rel='archives' title='November 2006' href='/2006/11/index.html' />
	<link rel='archives' title='October 2006' href='/2006/10/index.html' />
	<link rel='archives' title='September 2006' href='/2006/09/index.html' />
	<link rel='archives' title='August 2006' href='/2006/08/index.html' />
	<link rel='archives' title='July 2006' href='/2006/07/index.html' />
	<link rel='archives' title='June 2006' href='/2006/06/index.html' />
	<link rel='archives' title='May 2006' href='/2006/05/index.html' />
	<link rel='archives' title='April 2006' href='/2006/04/index.html' />
	<link rel='archives' title='March 2006' href='/2006/03/index.html' />
	<link rel='archives' title='February 2006' href='/2006/02/index.html' />
	<link rel='archives' title='January 2006' href='/2006/01/index.html' />
	<link rel='archives' title='December 2005' href='/2005/12/index.html' />
	<link rel='archives' title='November 2005' href='/2005/11/index.html' />
	<link rel='archives' title='October 2005' href='/2005/10/index.html' />
	<link rel='archives' title='September 2005' href='/2005/09/index.html' />
	<link rel='archives' title='August 2005' href='/2005/08/index.html' />
	<link rel='archives' title='July 2005' href='/2005/07/index.html' />
	<link rel='archives' title='June 2005' href='/2005/06/index.html' />
	<link rel='archives' title='May 2005' href='/2005/05/index.html' />
	<link rel='archives' title='April 2005' href='/2005/04/index.html' />
	<link rel='archives' title='March 2005' href='/2005/03/index.html' />
	<link rel='archives' title='February 2005' href='/2005/02/index.html' />
	<link rel='archives' title='January 2005' href='/2005/01/index.html' />
	<link rel='archives' title='December 2004' href='/2004/12/index.html' />
	<link rel='archives' title='November 2004' href='/2004/11/index.html' />
	<link rel='archives' title='October 2004' href='/2004/10/index.html' />
	<link rel='archives' title='September 2004' href='/2004/09/index.html' />
	<link rel='archives' title='August 2004' href='/2004/08/index.html' />
	<link rel='archives' title='July 2004' href='/2004/07/index.html' />
	<link rel='archives' title='June 2004' href='/2004/06/index.html' />
	<link rel='archives' title='May 2004' href='/2004/05/index.html' />
	<link rel='archives' title='April 2004' href='/2004/04/index.html' />
	<link rel='archives' title='March 2004' href='/2004/03/index.html' />
	<link rel='archives' title='February 2004' href='/2004/02/index.html' />
	<link rel='archives' title='January 2004' href='/2004/01/index.html' />
	<link rel='archives' title='December 2003' href='/2003/12/index.html' />
	<link rel='archives' title='November 2003' href='/2003/11/index.html' />
	<link rel='archives' title='October 2003' href='/2003/10/index.html' />
	<link rel='archives' title='September 2003' href='/2003/09/index.html' />
	<link rel='archives' title='August 2003' href='/2003/08/index.html' />
	<link rel='archives' title='July 2003' href='/2003/07/index.html' />
	<link rel='archives' title='June 2003' href='/2003/06/index.html' />
	<link rel='archives' title='May 2003' href='/2003/05/index.html' />
	<link rel='archives' title='April 2003' href='/2003/04/index.html' />
	<link rel='archives' title='March 2003' href='/2003/03/index.html' />
	<link rel='archives' title='February 2003' href='/2003/02/index.html' />
	<link rel='archives' title='January 2003' href='/2003/01/index.html' />
	<link rel='archives' title='December 2002' href='/2002/12/index.html' />
	<link rel='archives' title='November 2002' href='/2002/11/index.html' />
	<link rel='archives' title='October 2002' href='/2002/10/index.html' />
	<link rel='archives' title='September 2002' href='/2002/09/index.html' />
	<link rel='archives' title='August 2002' href='/2002/08/index.html' />
	<link rel='archives' title='July 2002' href='/2002/07/index.html' />
	<link rel='archives' title='June 2002' href='/2002/06/index.html' />
	<link rel='archives' title='April 2002' href='/2002/04/index.html' />
	<link rel='archives' title='March 2002' href='/2002/03/index.html' />
	<link rel='archives' title='December 2001' href='/2001/12/index.html' />
	<link rel='archives' title='September 2001' href='/2001/09/index.html' />
	<link rel='archives' title='November 2000' href='/2000/11/index.html' />
	<link rel='archives' title='July 2000' href='/2000/07/index.html' />
	<link rel='archives' title='April 2000' href='/2000/04/index.html' />
	<link rel='archives' title='March 1999' href='/1999/03/index.html' />
	<link rel='archives' title='October 1998' href='/1998/10/index.html' />
	<link rel='archives' title='August 1998' href='/1998/08/index.html' />
<link rel="alternate" type="application/rss+xml" title="The Web Standards Project » Acid3 Passed in 23 Days! Comments Feed" href="feed/index.html" />
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="/wp/xmlrpc0db0.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="/wp/wp-includes/wlwmanifest.xml" />
<link rel='prev' title='New Initiative in Hyper-Localized Social Tagging' href='../../01/new-initiative-in-hyper-localized-social-tagging/index.html' />
<link rel='next' title='Showing Off My <body> and Loving It' href='../showing-off-my-body-and-loving-it/index.html' />
<meta name="generator" content="WordPress 3.3.1" />
<link rel='canonical' href='index.html' />
<link rel='shortlink' href='../../../../index9a65.html?p=1093' />

Working together for standards  The Web Standards Project

		Skip to content

				<form id="fm-search" method="get" action="http://www.webstandards.org/index.php">
			<fieldset>
				<legend>Search</legend>
				Search WaSP
				<input id="s" name="s" class="search" value="" />
				<input type="submit" class="submit" name="submit" value="Go!" />
			</fieldset>
		</form>

Home

About

Learn

Action

Buzz

Press

Acid3 Passed in 23 Days!

By Kimberly Blessing | April 7th, 2008 | Filed in Acid3, Browsers

On March 3, the Web Standards Project launched the Acid3 Browser Test. On March 26, two browser teams reported that their builds passed.

				Skip to comment form

Just over a month ago, WaSP announced the Acid3 Browser Test. At the time, we knew that some of the browser development teams were aggressively working to pass the test. What we didn’t know was how long it would take for a browser to pass the test.

<q cite="http://ln.hixie.ch/?start=1206565203&count=1">“When we released Acid2, the first browser passed it in about a fortnight. Acid3 is orders of magnitude more complicated. I really didn’t expect to see passing browsers this side of August, let alone within a month,”</q> wrote Ian Hickson, the architect of the test, on his blog.

Well, now we know: It took under a month for not one but two browsers to pass the test. On March 26, the WebKit team announced that their public build produced a 100/100 result; Opera announced that they had an internal build which passed on the same day and they released the build on March 28. Congratulations to both teams!

In the past month we’ve received plenty of feedback and questions about the test.  Thanks to the help of readers and browser developers, some bugs were identified and resolved. To learn more about the changes that were made as a result, read Ian’s post which lists the major changes.

Your Replies

#1 On April 7th, 2008 10:30 am liorean replied:

Just worth pointing out: Passing the 100/100 score does not mean the entire test is passed, unless it also passes the smoothness/performance test. Neither Opera not WebKit do that at the moment.

#2 On April 7th, 2008 10:47 am Simon Jessey replied:

As I understand it, the teams have mostly concentrated on trying to get their browsers to pass the test, rather than the more laudable goal of improving their standards support to make passing the test a by-product. Unfortunately, this reduces the effect of passing the test to that of a mere party trick. I would prefer to see efforts spent on creating and passing proper test cases – more like the first Acid test, in fact.

#3 On April 7th, 2008 11:34 am Vectorpedia(Rick) replied:

Congratulations to both the Opera and Webkit team for their dedicated work on this project. Its hard to believe they completed this task within such a short period of time. I would like to see the Safari team make the same progress.

#4 On April 7th, 2008 11:48 am Dušan Smolnikar replied:

From what I’ve read, the Opera build that first passed ACID3 was so skimmed down it had security issues as well as missing features. Have we really come to this? Is passing a “silly test” (sorry for the expression) really more important than security? Sure, who cares if the user’s machine gets a virus or a trojan, as long as the test is passed!

Don’t get me wrong, I do support the effort that has been made to provide the test as well as to pass it, but I’m afraid it was just a race of who passes it first, rather than helping developers build a true standards compliant browser.

To someone with a bit more information and knowledge – did all the work that was put into passing ACID3 (for both, Safari and Opera) really help them become a better browser as far as rendering goes, or were just these specific cases covered?

#5 On April 7th, 2008 11:49 am Chris replied:

Didn’t Eric Meyer say the test was largely bunk?

#6 On April 7th, 2008 2:17 pm liorean replied:

Simon: As for Opera they have not merely passed the test by fixing just the specific issues the test addresses – they’ve got pretty good support for all the technologies used in the test (a few notable new ones that are post-Kestrel additions however), for the most part they’ve been fixing bugs or given additional priority to fixes that were already planned, like CSS RGBA/HSLA colour support.

As for WebKit, their SMIL support is pretty bad, just enough to pass the test, so in that case there is some question of fixing it just to pass the test. That does not mean that WebKit devs aren’t sincere in their want to support SMIL fully however, just that they happen to have started with the parts that were necessary for this test. (AIUI, they’ve had approximately that level of SMIL support in the engine but disabled because it was considered not-fit-for-release yet.)

Dušan: The public Opera build that passes the test uses a variation on the interface that Opera use internally for testing and development of the Core components, GOGI (Generic Opera Graphics Interface). This interface does not have the security features of the desktop platform that Opera uses because it doesn’t need them – it’s purpose is testing the Opera core platform itself. The build is perfectly fine for proving that they have solved the rendering engine issues, however.

#7 On April 7th, 2008 2:29 pm WaSP Member ccasciano replied:

Chris (#5): The test is *a* test, not *the* test. Like the Acid2 test there’s certainly a danger in it getting too much focus and being looked at as too great a barometer of a browser’s capabilities.

Eric’s correct in many ways when he makes a case that Acid3 is coming at things a little differently and perhaps dancing around the edges of the specs more then Acid2 may have, but I don’t think that fact renders the test as bunk. Neither test was intended as a complete test suite, only as a spot check of some web functionality and techniques.

I also sympathize with the notion that Acid2 may be more practical to present day web builders. But overshadowing that fact I think is the fact that I see the nature of the interaction of of the document with CSS vs. that of JavaScript that results in a different end composition.

Basic test suites or unit testing against individual CSS properties can leave a lot to be desired — most of the implementation problems arise in the complex interaction of the different rules and that’s where Acid2 shined [repositioning, floating, etc]. On the flip side, test suites that hit individual JavaScript functions show a much more complete picture. There what is needed isn’t to show the compounding of many common functions or actions, but instead this dance around the edges and spot checking different areas of support that may just not have everyday use that I think is seen in Acid3.

#8 On April 7th, 2008 4:25 pm David Storey replied:

I’d like to reply to a few points, and reinforce what Liorean has said.  Opera and WebKit haven’t yet passed the Acid3 test, although we are both close.  Both browsers have announced (on the same day) that the standards part of the test has been passed (the DOM and rendering tests) but not the performance tests.  I believe the first two are the most important, as both Opera and WebKit are fast anyway.

In response to Simon, your statement is simply not true.  We (Opera) were already working on standards support before Acid3 was published (there is a graph somewhere showing the progress of all browsers stating before the test even existed – and Opera’s score rises well before we started working on Acid3).  For everything tested in Acid3, we support correctly (not to say bug free) and have workable real world support.  Try the CSS3.info selectors test or Daniel Glazman’s selectors test, Opera’s SVG support or DOM Level 2 Events for example.

Where this point probably came from is WebKits hacking in of SMIL animation,which is currently unusable except to pass the test.  This is very true, but I’d be surprised if they release a version of Safari with SMIL support at that level. They will either disable it or improve their support.

In response to Dušan, that statement you read is pure FUD.  As Liorean said, the release that passes the standards part of the Acid3 test is using our internal testing system, called Gogi.  We released it like that because the ACID3 work was done on a Core version after our next release, so there was no desktop build with it included.  Gogi does not suppose to be used as a browser on the real web and the Opera Labs post says as much.  A version of that engine will go into some undecided versions of Opera in the future.  It was released to let people see that we did in fact pass the parts of the test we claim we passed.  As such it is a proof of concept.

I’m just looking forward to seeing which browser will have a release version passing the standards part of the test, and which browser out of Firefox or IE will come in third.  It’ll be a great day when IE can handle CSS3 selectors and DOM 2 Events, not to mention SVG, RGBA and Web Fonts.

#9 On April 8th, 2008 6:02 am exclipy replied:

"When we released Acid2, the first browser passed it in about a fortnight.”

Where’s the reference for this statement?  According to Wikipedia, Acid2 was out for over 6 months before Safari became the first browser to pass it.

#10 On April 10th, 2008 2:57 am Big Brother replied:

Not sure if the latest Internet Explorer is up to the test, just know IE version 6.0 failed the link test miserably.

12/100

#11 On April 10th, 2008 5:46 am Wczasy replied:

Ian Hickson did a good job. I wonder when IE and Firefox will pass Acid 3

#12 On April 10th, 2008 1:09 pm Ed Hardy replied:

I’m really looking forward to the time the first actual release of a browser passis acid3. I guess it’ll be opera, but we’ll see.

#13 On April 10th, 2008 10:19 pm Dave replied:

Whats interesting is that Opera is leading the way on trying to get their browsers up to snuff. The others?

#14 On April 11th, 2008 3:04 am Lars Gunther replied:

Lessons learned in making tests. Every criteria must have a visual clue that says if it fails or not. The smoothness criteria have not got such a clue and people get it wrong all the time, claiming that browsers pass, even when the very people who program the browsers clearly say that they do not – yet!

#15 On April 22nd, 2008 3:05 am chiff replied:

It seems that there’s a problem with acid3 test : the page http://acid3.acidtests.org/ itself doesn’t pass the w3C CSS test

http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Facid3.acidtests.org%2F&profile=css21&usermedium=all&warning=1&lang=fr

#16 On April 22nd, 2008 6:13 pm Jordan Clark replied:

@ chiff:

I’m no expert on this matter, but I think that it is this way by design. I’m absolutely sure that Ian Hickson could serve a valid style sheet if need be!

Also, I notice that the CSS validator was set to the CSS 2.1 profile in the link you provided, resulting in 14 errors; however, many of the properties are CSS 3; a re-run of the test with this profile results in only 6 errors, which are (I assume) deliberate (see results).

#17 On May 25th, 2008 3:37 pm CableCom replied:

Firefox 3.0 RC1 does not pass the test. What about the final version? Opera passes the test as a beta version.

#18 On May 25th, 2008 11:46 pm diablofan replied:

The WinGogi Desktop build from Operas Dev team DOESN’T PASS. I’ve ran the test 10 times in a row and it always failed

Proof

Yes I know I altered the tabs, but the rest is Original I swear it

#19 On June 3rd, 2008 4:46 am Ed Hardy replied:

wrong! Firefox 3.0 RC1 does pass the test! i would like to see the safari team would do it,too

#20 On June 3rd, 2008 7:53 pm Thinboy00 replied:

Many people want IE to pass.  I’ve got news.  IE7 still doesn’t pass Acid2, isn’t particularly or notably better than IE6 (just slightly different) in terms of  coming close to passing, and its development team (or some leader or something…) has publicly stated they do not plan on worrying about standards support any time soon… so obviously if it did pass it would be due to one of the following:

1) An incredible compiler bug

2) A fake Acid3

3) Microsoft dropping everything (i.e. Vista) and focusing on standards compliance, for a change

4) An act of God

I wouldn’t hold my breath.

#21 On June 5th, 2008 11:27 am ToSensei replied:

How did the w3c-guys know the reference-rendering has no errors?

Did they calculate it in their heads, step by step, each time looking up if they “thought” it correct?

Or do they have a rendering engine especially for creating the reference rendering?

If yes, why don’t they release the source to improve every browser?

Sorry if I postet something stupid, but that’s a question not leaving my mind.

#22 On June 12th, 2008 6:10 am Pif replied:

@ToSensei :

Chicken-egg paradox here? Not quite.

I cannot specifically answer about the ACID tests, but the way every code test is done is by expecting an output according to the specs. W3C’s goal is certainly not to code a web engine, but you can use the specs as a pseudo language. That’s how you judge an implementation – what other way is there?

Wether they have made a good job of it or not is another point, but the test’s popularity and exposure should ensure pretty complete reviewing. What’s more, if there’s a flaw in the test, there’s a good chance MS will blame its failure to pass it on that!

#23 On June 16th, 2008 3:20 am Ujjwol replied:

opera and webkit(safari) didn’t pass the acid3 test in my testing but firefox got 78/100 and even Konquor doesn’t pass

#24 On June 18th, 2008 3:28 pm Maxx Kredit replied:

So many people said Acid3 will be a hard work for the most browser when it was published in March. Three and a half weeks later the hurdle is taken – by two browser.

The race around the test shows also its true meaning: to motivate the browser manufacturers for a better support in Webstandards too.

#25 On June 21st, 2008 6:44 pm Travis replied:

Latest nightly build of WebKit (the engine Safari uses) gets everything but test 26 perfect (which passes, but is below 30fps).

Is there a reason people have been challenging Safari to catch up to browsers like Firefox and IE when it’s always been far ahead in standards support?

#26 On June 25th, 2008 1:07 am Florian replied:

webkit passes the test here. Looks pretty smooth to me too using svn r32442 (libwebkit-1.0-1 version in debian testing)

with gecko 1.8 i got 53 and a completely different image. With 1.9 (ff3) 71/100.

screenshots:

http://static.ludwigf.org/stuff/acid3/gecko1.8.png

http://static.ludwigf.org/stuff/acid3/gecko1.9.png

http://static.ludwigf.org/stuff/acid3/webkit.png

			Return to top

Post a Reply

Comments are closed.

Back to Top

All of the entries posted in WaSP Buzz express the opinions of their individual authors. They do not necessarily reflect the plans or positions of the Web Standards Project as a group.

This site is valid XHTML 1.0 Strict, CSS | Get Buzz via RSS or Atom | Colophon | Legal


text:
namespace content {

BluetoothChooser::~BluetoothChooser() {}

bool BluetoothChooser::CanAskForScanningPermission() {
  return true;
}

}  // namespace content


text:
<!doctype html>

Sandboxing a frame puts it into a unique origin by default, which the
    containing document shouldn't have script access to. This test passes if an
    exception is thrown upon the access violation.


text:
// -----------------------------------------------------------------------------------------
// <copyright file="QueueRequestOptions.cs" company="Microsoft">
//    Copyright 2013 Microsoft Corporation
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//      http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
// </copyright>
// -----------------------------------------------------------------------------------------

namespace Microsoft.WindowsAzure.Storage.Queue
{
    using Microsoft.WindowsAzure.Storage.Core.Executor;
    using Microsoft.WindowsAzure.Storage.RetryPolicies;
    using System;

    /// <summary>
    /// Represents a set of timeout and retry policy options that may be specified for a request against the Queue service.
    /// </summary>
    public sealed class QueueRequestOptions : IRequestOptions
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueRequestOptions"/> class.
        /// </summary>
        public QueueRequestOptions()
        {
        }

        /// <summary>
        /// Clones an instance of QueueRequestOptions so that we can apply defaults.
        /// </summary>
        /// <param name="other">QueueRequestOptions instance to be cloned.</param>
        internal QueueRequestOptions(QueueRequestOptions other)
            : this()
        {
            if (other != null)
            {
                this.RetryPolicy = other.RetryPolicy;
                this.ServerTimeout = other.ServerTimeout;
                this.LocationMode = other.LocationMode;
                this.MaximumExecutionTime = other.MaximumExecutionTime;
                this.OperationExpiryTime = other.OperationExpiryTime;
            }
        }

        internal static QueueRequestOptions ApplyDefaults(QueueRequestOptions options, CloudQueueClient serviceClient)
        {
            QueueRequestOptions modifiedOptions = new QueueRequestOptions(options);

            modifiedOptions.RetryPolicy = modifiedOptions.RetryPolicy ?? serviceClient.DefaultRequestOptions.RetryPolicy;
            modifiedOptions.LocationMode = (modifiedOptions.LocationMode
                                            ?? serviceClient.DefaultRequestOptions.LocationMode)
                                            ?? RetryPolicies.LocationMode.PrimaryOnly;
            modifiedOptions.ServerTimeout = modifiedOptions.ServerTimeout ?? serviceClient.DefaultRequestOptions.ServerTimeout;
            modifiedOptions.MaximumExecutionTime = modifiedOptions.MaximumExecutionTime ?? serviceClient.DefaultRequestOptions.MaximumExecutionTime;

            if (!modifiedOptions.OperationExpiryTime.HasValue && modifiedOptions.MaximumExecutionTime.HasValue)
            {
                modifiedOptions.OperationExpiryTime = DateTime.Now + modifiedOptions.MaximumExecutionTime.Value;
            }

            return modifiedOptions;
        }

        internal void ApplyToStorageCommand<T>(RESTCommand<T> cmd)
        {
            if (this.LocationMode.HasValue)
            {
                cmd.LocationMode = this.LocationMode.Value;
            }

            if (this.ServerTimeout.HasValue)
            {
                cmd.ServerTimeoutInSeconds = (int)this.ServerTimeout.Value.TotalSeconds;
            }

            if (this.OperationExpiryTime.HasValue)
            {
                cmd.OperationExpiryTime = this.OperationExpiryTime;
            }
            else if (this.MaximumExecutionTime.HasValue)
            {
                cmd.OperationExpiryTime = DateTime.Now + this.MaximumExecutionTime.Value;
            }
        }

        /// <summary>
        ///  Gets or sets the absolute expiry time across all potential retries for the request.
        /// </summary>
        internal DateTime? OperationExpiryTime { get; set; }

        /// <summary>
        /// Gets or sets the retry policy for the request.
        /// </summary>
        /// <value>An object of type <see cref="IRetryPolicy"/>.</value>
        public IRetryPolicy RetryPolicy { get; set; }

        /// <summary>
        /// Gets or sets the location mode of the request.
        /// </summary>
        /// <value>A <see cref="LocationMode"/> object indicating the location mode of the request.</value>
        public LocationMode? LocationMode { get; set; }

        /// <summary>
        /// Gets or sets the server timeout interval for the request.
        /// </summary>
        /// <value>A <see cref="TimeSpan"/> containing the server timeout interval for the request.</value>
        public TimeSpan? ServerTimeout { get; set; }

        /// <summary>
        /// Gets or sets the maximum execution time across all potential retries for the request.
        /// </summary>
        /// <value>A <see cref="TimeSpan"/> representing the maximum execution time for retries for the request.</value>
        public TimeSpan? MaximumExecutionTime { get; set; }
    }
}


text:
package main

import (
	"encoding/json"
	"errors"
	"fmt"
	"strconv"
	"strings"
	"time"

	"github.com/hyperledger/fabric/core/chaincode/shim"
)

var quotePrefix = "qt:"
var propertyPrefix = "pt:"
var proposalPrefix = "pr:"
var agreementPrefix = "ag:"
var deedPrefix = "de:"
var notificationPrefix = "de:"

var cpPrefix = "cp:"
var accountPrefix = "acct:"
var accountsKey = "accounts"

var recentLeapYear = 2016

// SimpleChaincode example simple Chaincode implementation
type SimpleChaincode struct {
}

func generateCUSIPSuffix(issueDate string, days int) (string, error) {

	t, err := msToTime(issueDate)
	if err != nil {
		return "", err
	}

	maturityDate := t.AddDate(0, 0, days)
	month := int(maturityDate.Month())
	day := maturityDate.Day()

	suffix := seventhDigit[month] + eigthDigit[day]
	return suffix, nil

}

const (
	millisPerSecond     = int64(time.Second / time.Millisecond)
	nanosPerMillisecond = int64(time.Millisecond / time.Nanosecond)
)

func msToTime(ms string) (time.Time, error) {
	msInt, err := strconv.ParseInt(ms, 10, 64)
	if err != nil {
		return time.Time{}, err
	}

	return time.Unix(msInt/millisPerSecond,
		(msInt%millisPerSecond)*nanosPerMillisecond), nil
}

type Owner struct {
	Company  string `json:"company"`
	Quantity int    `json:"quantity"`
}

type Notification struct {
	NotificationId string `json:"notificationId"`
	Parameter1  string  `json:"parameter1"`
	Parameter2  string  `json:"parameter2"`
	Parameter3  string  `json:"parameter3"`
	Parameter4  string  `json:"parameter4"`
	Parameter5  string  `json:"parameter5"`
	Parameter6  string  `json:"parameter6"`
	Parameter7  string  `json:"parameter7"`
	Parameter8  string  `json:"parameter8"`
	Parameter9  string  `json:"parameter9"`
	Parameter10  string  `json:"parameter10"`

}

type Quote struct {
	QuoteNo     string  `json:"quoteno"`
	Item    string  `json:"item"`
	Qty    string  `json:"qty"`
	ShipTerm    string  `json:"shipterm"`
	ShipDate    string  `json:"shipdate"`
	ItemDetails    string  `json:"itemdetails"`
	Status    string  `json:"status"`
	Issuer    string  `json:"issuer"`
	IssueDate string  `json:"issueDate"`
	ModifiedOn    string  `json:"modifiedon"`
	RequesterOrg    string  `json:"requesterorg"`
	Country    string  `json:"country"`
}

type Property struct {
	PropId     string  `json:"propid"`
	PropOwner    string  `json:"owner"`
	Tax    string  `json:"tax"`
	PropType    string  `json:"proptype"`
	Measure    string  `json:"mesaure"`
	MesaureDisp    string  `json:"mesauredisp"`
	Address    string  `json:"address"`
	Location    string  `json:"location"`
	Latitude string  `json:"latitude"`
	Longitude    string  `json:"longitude"`
	Histories    []History `json:"history"`
	Litigations  []Litigation  `json:"litigations"`
	Parameter1 string  `json:"parameter1"`
	Parameter2 string  `json:"parameter2"`
	Parameter3 string  `json:"parameter3"`
	Parameter4 string  `json:"parameter4"`
	Parameter5 string  `json:"parameter5"`
	Parameter6 string  `json:"parameter6"`
}

type Proposal struct {
	ProposalNo string  `json:"proposalNo"`
	PropId     string  `json:"propid"`
	ProposedBy    string  `json:"proposedby"`
	ProposedPrice    string  `json:"proposedprice"`
	ProposedDate    string  `json:"proposeddate"`
	Parameter1 string  `json:"parameter1"`
	Parameter2 string  `json:"parameter2"`
	Parameter3 string  `json:"parameter3"`
	Parameter4 string  `json:"parameter4"`
	Parameter5 string  `json:"parameter5"`
	Parameter6 string  `json:"parameter6"`
}

type SaleAgreement struct {
	AgreementNo string  `json:"agreementno"`
	PropId     string  `json:"propid"`
	Parties []Party `json:"buyer"`
	Loan Loan `json:"loan"`
	Parameter1 string  `json:"parameter1"`
	Parameter2 string  `json:"parameter2"`
	Parameter3 string  `json:"parameter3"`
	Parameter4 string  `json:"parameter4"`
	Parameter5 string  `json:"parameter5"`
	Parameter6 string  `json:"parameter6"`
	SignedOn string  `json:"signedon"`
}

type SaleDeed struct {
	DeedNo string  `json:"deedno"`
	AgreementNo string  `json:"agreementno"`
	Registrar Registrar `json:"registrar"`
	Settlement []Settlement `json:"settlement"`
	SignedOn string  `json:"signedon"`
}

type History struct {
	HistoryOwner     string  `json:"owner"`
	Location    string  `json:"location"`
	From       string `json:"from"`
	To       string     `json:"to"`
}

type Litigation struct {
	Data     string  `json:"data"`
}

type Party struct {
	PartyName     string  `json:"name"`
	PartyDOB    string  `json:"dob"`
	PartyIDType    string  `json:"idtype"`
	PartyIDNumber    string  `json:"idnumber"`
	PartyAddress    string  `json:"address"`
	PartyType    string `json:"type"`
}

type Loan struct {
	Bank     string  `json:"bank"`
	Branch    string  `json:"branch"`
	LoanAmount    string  `json:"amount"`
	LoanType    string  `json:"type"`
	LoanPercentage    string  `json:"percentage"`
	ROI    string  `json:"roi"`
	Tenure string  `json:"tenure"`
	ApprovedOn string  `json:"aprovedon"`
	AppliedOn string  `json:"appliedon"`
}

type Registrar struct {
	Name     string  `json:"name"`
	Location    string  `json:"location"`
}

type Settlement struct {
	SettlementType     string  `json:"type"`
	SettlementAmount    string  `json:"amount"`
	SettlementRef		string `json:"ref"`
	SettlementDate		string `json:"date"`
}

type CP struct {
	CUSIP     string  `json:"cusip"`
	Ticker    string  `json:"ticker"`
	Par       float64 `json:"par"`
	Qty       int     `json:"qty"`
	Discount  float64 `json:"discount"`
	Maturity  int     `json:"maturity"`
	Owners    []Owner `json:"owner"`
	Issuer    string  `json:"issuer"`
	IssueDate string  `json:"issueDate"`
}

type Account struct {
	ID          string   `json:"id"`
	Prefix      string   `json:"prefix"`
	CashBalance float64  `json:"cashBalance"`
	AssetsIds   []string `json:"assetIds"`
}

type Transaction struct {
	CUSIP       string  `json:"cusip"`
	FromCompany string  `json:"fromCompany"`
	ToCompany   string  `json:"toCompany"`
	Quantity    int     `json:"quantity"`
	Discount    float64 `json:"discount"`
}

func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {
	// Initialize the collection of commercial paper keys
	fmt.Println("Initializing paper keys collection")
	var blank []string
	var blank1 []string
	var blank2 []string
	var blank3 []string
	var blank4 []string
	var blank5 []string

	blankBytes, _ := json.Marshal(&blank)
	err := stub.PutState("PaperKeys", blankBytes)
	if err != nil {
		fmt.Println("Failed to initialize paper key collection")
	}

	blankBytes1, _ := json.Marshal(&blank1)
	err1 := stub.PutState("PropertyKeys", blankBytes1)
	if err1 != nil {
		fmt.Println("Failed to initialize paper key collection")
	}

	blankBytes2, _ := json.Marshal(&blank2)
	err2 := stub.PutState("ProposalKeys", blankBytes2)
	if err2 != nil {
		fmt.Println("Failed to initialize paper key collection")
	}

	blankBytes3, _ := json.Marshal(&blank3)
	err3 := stub.PutState("AgreementKeys", blankBytes3)
	if err3 != nil {
		fmt.Println("Failed to initialize paper key collection")
	}

	blankBytes4, _ := json.Marshal(&blank4)
	err4 := stub.PutState("DeedKeys", blankBytes4)
	if err4 != nil {
		fmt.Println("Failed to initialize paper key collection")
	}

	blankBytes5, _ := json.Marshal(&blank5)
	err5 := stub.PutState("NotificationKeys", blankBytes5)
	if err5 != nil {
		fmt.Println("Failed to initialize paper key collection")
	}

	fmt.Println("Initialization complete")
	return nil, nil
}

func (t *SimpleChaincode) createAccounts(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {

	//  				0
	// "number of accounts to create"
	var err error
	numAccounts, err := strconv.Atoi(args[0])
	if err != nil {
		fmt.Println("error creating accounts with input")
		return nil, errors.New("createAccounts accepts a single integer argument")
	}
	//create a bunch of accounts
	var account Account
	counter := 1
	for counter <= numAccounts {
		var prefix string
		suffix := "000A"
		if counter < 10 {
			prefix = strconv.Itoa(counter) + "0" + suffix
		} else {
			prefix = strconv.Itoa(counter) + suffix
		}
		var assetIds []string
		account = Account{ID: "company" + strconv.Itoa(counter), Prefix: prefix, CashBalance: 10000000.0, AssetsIds: assetIds}
		accountBytes, err := json.Marshal(&account)
		if err != nil {
			fmt.Println("error creating account" + account.ID)
			return nil, errors.New("Error creating account " + account.ID)
		}
		err = stub.PutState(accountPrefix+account.ID, accountBytes)
		counter++
		fmt.Println("created account" + accountPrefix + account.ID)
	}

	fmt.Println("Accounts created")
	return nil, nil

}

func (t *SimpleChaincode) createAccount(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {
	// Obtain the username to associate with the account
	if len(args) != 1 {
		fmt.Println("Error obtaining username")
		return nil, errors.New("createAccount accepts a single username argument")
	}
	username := args[0]

	// Build an account object for the user
	var assetIds []string
	suffix := "000A"
	prefix := username + suffix
	var account = Account{ID: username, Prefix: prefix, CashBalance: 10000000.0, AssetsIds: assetIds}
	accountBytes, err := json.Marshal(&account)
	if err != nil {
		fmt.Println("error creating account" + account.ID)
		return nil, errors.New("Error creating account " + account.ID)
	}

	fmt.Println("Attempting to get state of any existing account for " + account.ID)
	existingBytes, err := stub.GetState(accountPrefix + account.ID)
	if err == nil {

		var company Account
		err = json.Unmarshal(existingBytes, &company)
		if err != nil {
			fmt.Println("Error unmarshalling account " + account.ID + "\n--->: " + err.Error())

			if strings.Contains(err.Error(), "unexpected end") {
				fmt.Println("No data means existing account found for " + account.ID + ", initializing account.")
				err = stub.PutState(accountPrefix+account.ID, accountBytes)

				if err == nil {
					fmt.Println("created account" + accountPrefix + account.ID)
					return nil, nil
				} else {
					fmt.Println("failed to create initialize account for " + account.ID)
					return nil, errors.New("failed to initialize an account for " + account.ID + " => " + err.Error())
				}
			} else {
				return nil, errors.New("Error unmarshalling existing account " + account.ID)
			}
		} else {
			fmt.Println("Account already exists for " + account.ID + " " + company.ID)
			return nil, errors.New("Can't reinitialize existing user " + account.ID)
		}
	} else {

		fmt.Println("No existing account found for " + account.ID + ", initializing account.")
		err = stub.PutState(accountPrefix+account.ID, accountBytes)

		if err == nil {
			fmt.Println("created account" + accountPrefix + account.ID)
			return nil, nil
		} else {
			fmt.Println("failed to create initialize account for " + account.ID)
			return nil, errors.New("failed to initialize an account for " + account.ID + " => " + err.Error())
		}

	}

}

/* Added by Narayanan L for Trade Finance */

func (t *SimpleChaincode) issueQuote(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {

	//need one arg
	if len(args) != 1 {
		fmt.Println("error invalid arguments")
		return nil, errors.New("Incorrect number of arguments. Expecting Quotation record")
	}

	var quote Quote
	var err error
	var account Account

	fmt.Println("Unmarshalling Quote")
	err = json.Unmarshal([]byte(args[0]), &quote)
	if err != nil {
		fmt.Println("error invalid Quote issue")
		return nil, errors.New("Invalid Quote issue")
	}

	fmt.Println("Marshalling Quote bytes")
	quote.QuoteNo = account.Prefix + quote.QuoteNo

	fmt.Println("Getting State on CP " + quote.QuoteNo)
	cpRxBytes, err := stub.GetState(quotePrefix + quote.QuoteNo)
	if cpRxBytes == nil {
		fmt.Println("QuoteNo does not exist, creating it")
		cpBytes, err := json.Marshal(&quote)
		if err != nil {
			fmt.Println("Error marshalling quote")
			return nil, errors.New("Error issuing quote")
		}
		err = stub.PutState(quotePrefix+quote.QuoteNo, cpBytes)
		if err != nil {
			fmt.Println("Error issuing paper")
			return nil, errors.New("Error issuing quote")
		}

		// Update the paper keys by adding the new key
		fmt.Println("Getting Paper Keys")
		keysBytes, err := stub.GetState("QuoteKeys")
		if err != nil {
			fmt.Println("Error retrieving paper keys")
			return nil, errors.New("Error retrieving paper keys")
		}
		var keys []string
		err = json.Unmarshal(keysBytes, &keys)
		if err != nil {
			fmt.Println("Error unmarshel keys")
			return nil, errors.New("Error unmarshalling paper keys ")
		}

		fmt.Println("Appending the new key to Paper Keys")
		foundKey := false
		for _, key := range keys {
			if key == quotePrefix+quote.QuoteNo {
				foundKey = true
			}
		}
		if foundKey == false {
			keys = append(keys, quotePrefix+quote.QuoteNo)
			keysBytesToWrite, err := json.Marshal(&keys)
			if err != nil {
				fmt.Println("Error marshalling keys")
				return nil, errors.New("Error marshalling the keys")
			}
			fmt.Println("Put state on QuoteKeys")
			err = stub.PutState("QuoteKeys", keysBytesToWrite)
			if err != nil {
				fmt.Println("Error writting keys back")
				return nil, errors.New("Error writing the keys back")
			}
		}

		fmt.Println("Issue commercial paper %+v\n", quote)
		return nil, nil
	} else {
		fmt.Println("QuoteNo exists")

		var quoterx Quote
		fmt.Println("Unmarshalling CP " + quote.QuoteNo)
		err = json.Unmarshal(cpRxBytes, &quoterx)
		if err != nil {
			fmt.Println("Error unmarshalling cp " + quote.QuoteNo)
			return nil, errors.New("Error unmarshalling cp " + quote.QuoteNo)
		}

		quoterx.Qty = quoterx.Qty + quote.Qty

		cpWriteBytes, err := json.Marshal(&quoterx)
		if err != nil {
			fmt.Println("Error marshalling cp")
			return nil, errors.New("Error issuing commercial paper")
		}
		err = stub.PutState(quotePrefix+quote.QuoteNo, cpWriteBytes)
		if err != nil {
			fmt.Println("Error issuing paper")
			return nil, errors.New("Error issuing commercial paper")
		}

		fmt.Println("Updated commercial paper %+v\n", quoterx)
		return nil, nil

	}
}

/* Added by Narayanan L for Land Record Management*/

//Notification

func (t *SimpleChaincode) addNotification(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {

	//need one arg
	if len(args) != 1 {
		fmt.Println("error invalid arguments")
		return nil, errors.New("Incorrect number of arguments. Expecting Quotation record")
	}

	var notification Notification
	var err error
	//var account Account

	fmt.Println("Unmarshalling notification")
	err = json.Unmarshal([]byte(args[0]), &notification)
	if err != nil {
		fmt.Println("error invalid notification issue" + args[0])
		return nil, errors.New("Invalid notification issue" + args[0])
	}

	fmt.Println("Marshalling notification bytes")
	//notification.PropId = notificationPrefix + notification.NotificationId

	fmt.Println("Getting State on notification " + notification.NotificationId)
	cpRxBytes, err := stub.GetState(notificationPrefix + notification.NotificationId)
	if cpRxBytes == nil {
		fmt.Println("PropId does not exist, creating it")
		cpBytes, err := json.Marshal(&notification)
		if err != nil {
			fmt.Println("Error marshalling notification")
			return nil, errors.New("Error issuing notification")
		}
		err = stub.PutState(notificationPrefix+notification.NotificationId, cpBytes)
		if err != nil {
			fmt.Println("Error issuing paper")
			return nil, errors.New("Error issuing notification")
		}

		// Update the paper keys by adding the new key
		fmt.Println("Getting Paper Keys")
		keysBytes, err := stub.GetState("NotificationKeys")
		if err != nil {
			fmt.Println("Error retrieving paper keys")
			return nil, errors.New("Error retrieving paper keys")
		}
		var keys []string
		err = json.Unmarshal(keysBytes, &keys)
		if err != nil {
			fmt.Println("Error unmarshel keys")
			return nil, errors.New("Error unmarshalling paper keys ")
		}

		fmt.Println("Appending the new key to Paper Keys")
		foundKey := false
		for _, key := range keys {
			if key == notificationPrefix+notification.NotificationId {
				foundKey = true
			}
		}
		if foundKey == false {
			keys = append(keys, notificationPrefix+notification.NotificationId)
			keysBytesToWrite, err := json.Marshal(&keys)
			if err != nil {
				fmt.Println("Error marshalling keys")
				return nil, errors.New("Error marshalling the keys")
			}
			fmt.Println("Put state on NotificationKeys")
			err = stub.PutState("NotificationKeys", keysBytesToWrite)
			if err != nil {
				fmt.Println("Error writting keys back")
				return nil, errors.New("Error writing the keys back")
			}
		}

		fmt.Println("Issue commercial paper %+v\n", notification)
		return nil, nil
	} else {
		fmt.Println("QuoteNo exists")

		var notificationrx Notification
		fmt.Println("Unmarshalling CP " + notification.NotificationId)
		err = json.Unmarshal(cpRxBytes, &notificationrx)
		if err != nil {
			fmt.Println("Error unmarshalling cp " + notification.NotificationId)
			return nil, errors.New("Error unmarshalling cp " + notification.NotificationId)
		}

		//quoterx.Qty = quoterx.Qty + quote.Qty

		notificationrx = notification

		cpWriteBytes, err := json.Marshal(&notificationrx)
		if err != nil {
			fmt.Println("Error marshalling cp")
			return nil, errors.New("Error issuing commercial paper")
		}
		err = stub.PutState(notificationPrefix+notification.NotificationId, cpWriteBytes)
		if err != nil {
			fmt.Println("Error issuing paper")
			return nil, errors.New("Error issuing commercial paper")
		}

		fmt.Println("Updated commercial paper %+v\n", notificationrx)
		return nil, nil
	}
}

func GetAllNotifications(stub shim.ChaincodeStubInterface) ([]Notification, error) {

	var allNotification []Notification

	// Get list of all the keys
	keysBytes, err := stub.GetState("NotificationKeys")
	if err != nil {
		fmt.Println("Error retrieving Notification keys")
		return nil, errors.New("Error retrieving Notification keys")
	}
	var keys []string
	err = json.Unmarshal(keysBytes, &keys)
	if err != nil {
		fmt.Println("Error unmarshalling Notification keys")
		return nil, errors.New("Error unmarshalling Notification keys")
	}

	// Get all the cps
	for _, value := range keys {
		cpBytes, err := stub.GetState(value)

		var notification Notification
		err = json.Unmarshal(cpBytes, &notification)
		if err != nil {
			fmt.Println("Error retrieving cp " + value)
			return nil, errors.New("Error retrieving cp " + value)
		}

		fmt.Println("Appending CP" + value)
		allNotification = append(allNotification, notification)
	}

	return allNotification, nil
}

//property

func (t *SimpleChaincode) addProperty(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {

	//need one arg
	if len(args) != 1 {
		fmt.Println("error invalid arguments")
		return nil, errors.New("Incorrect number of arguments. Expecting Quotation record")
	}

	var property Property
	var err error
	//var account Account

	fmt.Println("Unmarshalling Property")
	err = json.Unmarshal([]byte(args[0]), &property)
	if err != nil {
		fmt.Println("error invalid Property issue" + args[0])
		return nil, errors.New("Invalid Property issue" + args[0])
	}

	fmt.Println("Marshalling Property bytes")
	//property.PropId = propertyPrefix + property.propid

	fmt.Println("Getting State on Property " + property.PropId)
	cpRxBytes, err := stub.GetState(propertyPrefix + property.PropId)
	if cpRxBytes == nil {
		fmt.Println("PropId does not exist, creating it")
		cpBytes, err := json.Marshal(&property)
		if err != nil {
			fmt.Println("Error marshalling property")
			return nil, errors.New("Error issuing property")
		}
		err = stub.PutState(propertyPrefix+property.PropId, cpBytes)
		if err != nil {
			fmt.Println("Error issuing paper")
			return nil, errors.New("Error issuing property")
		}

		// Update the paper keys by adding the new key
		fmt.Println("Getting Paper Keys")
		keysBytes, err := stub.GetState("PropertyKeys")
		if err != nil {
			fmt.Println("Error retrieving paper keys")
			return nil, errors.New("Error retrieving paper keys")
		}
		var keys []string
		err = json.Unmarshal(keysBytes, &keys)
		if err != nil {
			fmt.Println("Error unmarshel keys")
			return nil, errors.New("Error unmarshalling paper keys ")
		}

		fmt.Println("Appending the new key to Paper Keys")
		foundKey := false
		for _, key := range keys {
			if key == propertyPrefix+property.PropId {
				foundKey = true
			}
		}
		if foundKey == false {
			keys = append(keys, propertyPrefix+property.PropId)
			keysBytesToWrite, err := json.Marshal(&keys)
			if err != nil {
				fmt.Println("Error marshalling keys")
				return nil, errors.New("Error marshalling the keys")
			}
			fmt.Println("Put state on PropertyKeys")
			err = stub.PutState("PropertyKeys", keysBytesToWrite)
			if err != nil {
				fmt.Println("Error writting keys back")
				return nil, errors.New("Error writing the keys back")
			}
		}

		fmt.Println("Issue commercial paper %+v\n", property)
		return nil, nil
	} else {
		fmt.Println("QuoteNo exists")

		var propertyrx Property
		fmt.Println("Unmarshalling CP " + property.PropId)
		err = json.Unmarshal(cpRxBytes, &propertyrx)
		if err != nil {
			fmt.Println("Error unmarshalling cp " + property.PropId)
			return nil, errors.New("Error unmarshalling cp " + property.PropId)
		}

		//quoterx.Qty = quoterx.Qty + quote.Qty

		propertyrx = property

		cpWriteBytes, err := json.Marshal(&propertyrx)
		if err != nil {
			fmt.Println("Error marshalling cp")
			return nil, errors.New("Error issuing commercial paper")
		}
		err = stub.PutState(propertyPrefix+property.PropId, cpWriteBytes)
		if err != nil {
			fmt.Println("Error issuing paper")
			return nil, errors.New("Error issuing commercial paper")
		}

		fmt.Println("Updated commercial paper %+v\n", propertyrx)
		return nil, nil
	}
}

func GetAllProperties(stub shim.ChaincodeStubInterface) ([]Property, error) {

	var allProperties []Property

	// Get list of all the keys
	keysBytes, err := stub.GetState("PropertyKeys")
	if err != nil {
		fmt.Println("Error retrieving paper keys")
		return nil, errors.New("Error retrieving paper keys")
	}
	var keys []string
	err = json.Unmarshal(keysBytes, &keys)
	if err != nil {
		fmt.Println("Error unmarshalling paper keys")
		return nil, errors.New("Error unmarshalling paper keys")
	}

	// Get all the cps
	for _, value := range keys {
		cpBytes, err := stub.GetState(value)

		var property Property
		err = json.Unmarshal(cpBytes, &property)
		if err != nil {
			fmt.Println("Error retrieving cp " + value)
			return nil, errors.New("Error retrieving cp " + value)
		}

		fmt.Println("Appending CP" + value)
		allProperties = append(allProperties, property)
	}

	return allProperties, nil
}

//Proposal

func (t *SimpleChaincode) issueProposal(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {

	//need one arg
	if len(args) != 1 {
		fmt.Println("error invalid arguments")
		return nil, errors.New("Incorrect number of arguments. Expecting Quotation record")
	}

	var proposal Proposal
	var err error
	//var account Account

	fmt.Println("Unmarshalling Proposal")
	err = json.Unmarshal([]byte(args[0]), &proposal)
	if err != nil {
		fmt.Println("error invalid proposal issue" + args[0])
		return nil, errors.New("Invalid proposal issue" + args[0])
	}

	fmt.Println("Marshalling proposal bytes")
	//property.PropId = propertyPrefix + property.propid

	fmt.Println("Getting State on proposal " + proposal.ProposalNo)
	cpRxBytes, err := stub.GetState(proposalPrefix + proposal.ProposalNo)
	if cpRxBytes == nil {
		fmt.Println("proposalNo does not exist, creating it")
		cpBytes, err := json.Marshal(&proposal)
		if err != nil {
			fmt.Println("Error marshalling proposal")
			return nil, errors.New("Error issuing proposal")
		}
		err = stub.PutState(proposalPrefix + proposal.ProposalNo, cpBytes)
		if err != nil {
			fmt.Println("Error issuing proposal")
			return nil, errors.New("Error issuing proposal")
		}

		// Update the paper keys by adding the new key
		fmt.Println("Getting proposal Keys")
		keysBytes, err := stub.GetState("ProposalKeys")
		if err != nil {
			fmt.Println("Error retrieving proposalNo")
			return nil, errors.New("Error retrieving proposalNo")
		}
		var keys []string
		err = json.Unmarshal(keysBytes, &keys)
		if err != nil {
			fmt.Println("Error unmarshel proposalNo")
			return nil, errors.New("Error unmarshalling proposalNo ")
		}

		fmt.Println("Appending the new key to proposalNo Keys")
		foundKey := false
		for _, key := range keys {
			if key == proposalPrefix+proposal.ProposalNo {
				foundKey = true
			}
		}
		if foundKey == false {
			keys = append(keys, proposalPrefix+proposal.ProposalNo)
			keysBytesToWrite, err := json.Marshal(&keys)
			if err != nil {
				fmt.Println("Error marshalling proposalNo")
				return nil, errors.New("Error marshalling the proposalNo")
			}
			fmt.Println("Put state on proposalNo")
			err = stub.PutState("ProposalKeys", keysBytesToWrite)
			if err != nil {
				fmt.Println("Error writting proposalNo back")
				return nil, errors.New("Error writing the proposalNo back")
			}
		}

		fmt.Println("Issue commercial paper %+v\n", proposal)
		return nil, nil
	} else {
		fmt.Println("proposalNo exists")

		var proposalrx Proposal
		fmt.Println("Unmarshalling proposal " + proposal.ProposalNo)
		err = json.Unmarshal(cpRxBytes, &proposalrx)
		if err != nil {
			fmt.Println("Error unmarshalling proposal " + proposal.ProposalNo)
			return nil, errors.New("Error unmarshalling proposal " + proposal.ProposalNo)
		}

		//quoterx.Qty = quoterx.Qty + quote.Qty

		proposalrx = proposal

		cpWriteBytes, err := json.Marshal(&proposalrx)
		if err != nil {
			fmt.Println("Error marshalling proposal")
			return nil, errors.New("Error issuing proposal")
		}
		err = stub.PutState(proposalPrefix+proposal.ProposalNo, cpWriteBytes)
		if err != nil {
			fmt.Println("Error proposal")
			return nil, errors.New("Error issuing proposal")
		}

		fmt.Println("Updated commercial paper %+v\n", proposalrx)
		return nil, nil
	}
}

func GetAllproposal(stub shim.ChaincodeStubInterface) ([]Proposal, error) {

	var allproposal []Proposal

	// Get list of all the keys
	keysBytes, err := stub.GetState("ProposalKeys")
	if err != nil {
		fmt.Println("Error retrieving proposal Keys ")
		return nil, errors.New("Error retrieving proposal Keys")
	}
	var keys []string
	err = json.Unmarshal(keysBytes, &keys)
	if err != nil {
		fmt.Println("Error unmarshalling proposal keys")
		return nil, errors.New("Error unmarshalling proposal keys")
	}

	// Get all the cps
	for _, value := range keys {
		cpBytes, err := stub.GetState(value)

		var proposal Proposal
		err = json.Unmarshal(cpBytes, &proposal)
		if err != nil {
			fmt.Println("Error retrieving proposal " + value)
			return nil, errors.New("Error retrieving proposal " + value)
		}

		fmt.Println("Appending proposal" + value)
		allproposal = append(allproposal, proposal)
	}

	return allproposal, nil
}

//Agreement

func (t *SimpleChaincode) issueSaleAgreement(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {

	//need one arg
	if len(args) != 1 {
		fmt.Println("error invalid arguments")
		return nil, errors.New("Incorrect number of arguments. Expecting Quotation record")
	}

	var saleAgreement SaleAgreement
	var err error
	//var account Account

	fmt.Println("Unmarshalling Property")
	err = json.Unmarshal([]byte(args[0]), &saleAgreement)
	if err != nil {
		fmt.Println("error invalid saleAgreement issue" + args[0])
		return nil, errors.New("Invalid saleAgreement issue" + args[0])
	}

	fmt.Println("Marshalling saleAgreement bytes")
	//property.PropId = propertyPrefix + property.propid

	fmt.Println("Getting State on saleAgreement " + saleAgreement.AgreementNo)
	cpRxBytes, err := stub.GetState(agreementPrefix + saleAgreement.AgreementNo)
	if cpRxBytes == nil {
		fmt.Println("AgreementNo does not exist, creating it")
		cpBytes, err := json.Marshal(&saleAgreement)
		if err != nil {
			fmt.Println("Error marshalling saleAgreement")
			return nil, errors.New("Error issuing saleAgreement")
		}
		err = stub.PutState(agreementPrefix + saleAgreement.AgreementNo, cpBytes)
		if err != nil {
			fmt.Println("Error issuing saleAgreement")
			return nil, errors.New("Error issuing saleAgreement")
		}

		// Update the paper keys by adding the new key
		fmt.Println("Getting saleAgreement Keys")
		keysBytes, err := stub.GetState("AgreementKeys")
		if err != nil {
			fmt.Println("Error retrieving AgreementKeys")
			return nil, errors.New("Error retrieving AgreementKeys")
		}
		var keys []string
		err = json.Unmarshal(keysBytes, &keys)
		if err != nil {
			fmt.Println("Error unmarshel AgreementKeys")
			return nil, errors.New("Error unmarshalling AgreementKeys ")
		}

		fmt.Println("Appending the new key to AgreementKeys Keys")
		foundKey := false
		for _, key := range keys {
			if key == agreementPrefix+saleAgreement.AgreementNo {
				foundKey = true
			}
		}
		if foundKey == false {
			keys = append(keys, agreementPrefix+saleAgreement.AgreementNo)
			keysBytesToWrite, err := json.Marshal(&keys)
			if err != nil {
				fmt.Println("Error marshalling AgreementKeys")
				return nil, errors.New("Error marshalling the AgreementKeys")
			}
			fmt.Println("Put state on AgreementKeys")
			err = stub.PutState("AgreementKeys", keysBytesToWrite)
			if err != nil {
				fmt.Println("Error writting AgreementKeys back")
				return nil, errors.New("Error writing the AgreementKeys back")
			}
		}

		fmt.Println("Issue commercial paper %+v\n", saleAgreement)
		return nil, nil
	} else {
		fmt.Println("AgreementNo exists")

		var saleAgreementrx SaleAgreement
		fmt.Println("Unmarshalling saleAgreement " + saleAgreement.AgreementNo)
		err = json.Unmarshal(cpRxBytes, &saleAgreementrx)
		if err != nil {
			fmt.Println("Error unmarshalling saleAgreement " + saleAgreement.AgreementNo)
			return nil, errors.New("Error unmarshalling saleAgreement " + saleAgreement.AgreementNo)
		}

		//quoterx.Qty = quoterx.Qty + quote.Qty

		saleAgreementrx = saleAgreement

		cpWriteBytes, err := json.Marshal(&saleAgreementrx)
		if err != nil {
			fmt.Println("Error marshalling saleAgreement")
			return nil, errors.New("Error issuing saleAgreement")
		}
		err = stub.PutState(agreementPrefix+saleAgreement.AgreementNo, cpWriteBytes)
		if err != nil {
			fmt.Println("Error saleAgreement")
			return nil, errors.New("Error issuing saleAgreement")
		}

		fmt.Println("Updated commercial paper %+v\n", saleAgreementrx)
		return nil, nil
	}
}

func GetAllAgreement(stub shim.ChaincodeStubInterface) ([]SaleAgreement, error) {

	var allSaleAgreement []SaleAgreement

	// Get list of all the keys
	keysBytes, err := stub.GetState("AgreementKeys")
	if err != nil {
		fmt.Println("Error retrieving SaleAgreement Keys ")
		return nil, errors.New("Error retrieving SaleAgreement Keys")
	}
	var keys []string
	err = json.Unmarshal(keysBytes, &keys)
	if err != nil {
		fmt.Println("Error unmarshalling SaleAgreement keys")
		return nil, errors.New("Error unmarshalling SaleAgreement keys")
	}

	// Get all the cps
	for _, value := range keys {
		cpBytes, err := stub.GetState(value)

		var saleAgreement SaleAgreement
		err = json.Unmarshal(cpBytes, &saleAgreement)
		if err != nil {
			fmt.Println("Error retrieving saleAgreement " + value)
			return nil, errors.New("Error retrieving saleAgreement " + value)
		}

		fmt.Println("Appending saleAgreement" + value)
		allSaleAgreement = append(allSaleAgreement, saleAgreement)
	}

	return allSaleAgreement, nil
}

//Deeds

func (t *SimpleChaincode) issueSaleDeeds(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {

	//need one arg
	if len(args) != 1 {
		fmt.Println("error invalid arguments")
		return nil, errors.New("Incorrect number of arguments. Expecting Quotation record")
	}

	var saleDeed SaleDeed
	var err error
	//var account Account

	fmt.Println("Unmarshalling Property")
	err = json.Unmarshal([]byte(args[0]), &saleDeed)
	if err != nil {
		fmt.Println("error invalid saleDeed issue" + args[0])
		return nil, errors.New("Invalid saleDeed issue" + args[0])
	}

	fmt.Println("Marshalling saleDeed bytes")
	//property.PropId = propertyPrefix + property.propid

	fmt.Println("Getting State on saleDeed " + saleDeed.DeedNo)
	cpRxBytes, err := stub.GetState(deedPrefix + saleDeed.DeedNo)
	if cpRxBytes == nil {
		fmt.Println("DeedNo does not exist, creating it")
		cpBytes, err := json.Marshal(&saleDeed)
		if err != nil {
			fmt.Println("Error marshalling saleDeed")
			return nil, errors.New("Error issuing saleDeed")
		}
		err = stub.PutState(deedPrefix + saleDeed.DeedNo, cpBytes)
		if err != nil {
			fmt.Println("Error issuing saleDeed")
			return nil, errors.New("Error issuing saleDeed")
		}

		// Update the paper keys by adding the new key
		fmt.Println("Getting saleDeed Keys")
		keysBytes, err := stub.GetState("DeedKeys")
		if err != nil {
			fmt.Println("Error retrieving DeedKeys")
			return nil, errors.New("Error retrieving DeedKeys")
		}
		var keys []string
		err = json.Unmarshal(keysBytes, &keys)
		if err != nil {
			fmt.Println("Error unmarshel DeedKeys")
			return nil, errors.New("Error unmarshalling DeedKeys ")
		}

		fmt.Println("Appending the new key to DeedKeys Keys")
		foundKey := false
		for _, key := range keys {
			if key == deedPrefix+saleDeed.DeedNo {
				foundKey = true
			}
		}
		if foundKey == false {
			keys = append(keys, deedPrefix+saleDeed.DeedNo)
			keysBytesToWrite, err := json.Marshal(&keys)
			if err != nil {
				fmt.Println("Error marshalling DeedKeys")
				return nil, errors.New("Error marshalling the DeedKeys")
			}
			fmt.Println("Put state on DeedKeys")
			err = stub.PutState("DeedKeys", keysBytesToWrite)
			if err != nil {
				fmt.Println("Error writting DeedKeys back")
				return nil, errors.New("Error writing the DeedKeys back")
			}
		}

		fmt.Println("Issue commercial paper %+v\n", saleDeed)
		return nil, nil
	} else {
		fmt.Println("DeedNo exists")

		var saleDeedrx SaleDeed
		fmt.Println("Unmarshalling saleDeed " + saleDeed.DeedNo)
		err = json.Unmarshal(cpRxBytes, &saleDeedrx)
		if err != nil {
			fmt.Println("Error unmarshalling saleDeed " + saleDeed.DeedNo)
			return nil, errors.New("Error unmarshalling saleDeed " + saleDeed.DeedNo)
		}

		//quoterx.Qty = quoterx.Qty + quote.Qty

		saleDeedrx = saleDeed

		cpWriteBytes, err := json.Marshal(&saleDeedrx)
		if err != nil {
			fmt.Println("Error marshalling saleDeed")
			return nil, errors.New("Error issuing saleDeed")
		}
		err = stub.PutState(deedPrefix+saleDeed.DeedNo, cpWriteBytes)
		if err != nil {
			fmt.Println("Error saleDeed")
			return nil, errors.New("Error issuing saleDeed")
		}

		fmt.Println("Updated commercial paper %+v\n", saleDeedrx)
		return nil, nil
	}
}

func GetAllDeed(stub shim.ChaincodeStubInterface) ([]SaleDeed, error) {

	var allsaleDeed []SaleDeed

	// Get list of all the keys
	keysBytes, err := stub.GetState("DeedKeys")
	if err != nil {
		fmt.Println("Error retrieving saleDeed Keys ")
		return nil, errors.New("Error retrieving saleDeed Keys")
	}
	var keys []string
	err = json.Unmarshal(keysBytes, &keys)
	if err != nil {
		fmt.Println("Error unmarshalling saleDeed keys")
		return nil, errors.New("Error unmarshalling saleDeed keys")
	}

	// Get all the cps
	for _, value := range keys {
		cpBytes, err := stub.GetState(value)

		var saleDeed SaleDeed
		err = json.Unmarshal(cpBytes, &saleDeed)
		if err != nil {
			fmt.Println("Error retrieving saleDeed " + value)
			return nil, errors.New("Error retrieving saleDeed " + value)
		}

		fmt.Println("Appending saleDeed" + value)
		allsaleDeed = append(allsaleDeed, saleDeed)
	}

	return allsaleDeed, nil
}

/* Added by Narayanan L for Land Record Management*/

func (t *SimpleChaincode) issueCommercialPaper(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {

	/*		0
		json
	  	{
			"ticker":  "string",
			"par": 0.00,
			"qty": 10,
			"discount": 7.5,
			"maturity": 30,
			"owners": [ // This one is not required
				{
					"company": "company1",
					"quantity": 5
				},
				{
					"company": "company3",
					"quantity": 3
				},
				{
					"company": "company4",
					"quantity": 2
				}
			],
			"issuer":"company2",
			"issueDate":"1456161763790"  (current time in milliseconds as a string)

		}
	*/
	//need one arg
	if len(args) != 1 {
		fmt.Println("error invalid arguments")
		return nil, errors.New("Incorrect number of arguments. Expecting commercial paper record")
	}

	var cp CP
	var err error
	var account Account

	fmt.Println("Unmarshalling CP")
	err = json.Unmarshal([]byte(args[0]), &cp)
	if err != nil {
		fmt.Println("error invalid paper issue")
		return nil, errors.New("Invalid commercial paper issue")
	}

	//generate the CUSIP
	//get account prefix
	fmt.Println("Getting state of - " + accountPrefix + cp.Issuer)
	accountBytes, err := stub.GetState(accountPrefix + cp.Issuer)
	if err != nil {
		fmt.Println("Error Getting state of - " + accountPrefix + cp.Issuer)
		return nil, errors.New("Error retrieving account " + cp.Issuer)
	}
	err = json.Unmarshal(accountBytes, &account)
	if err != nil {
		fmt.Println("Error Unmarshalling accountBytes")
		return nil, errors.New("Error retrieving account " + cp.Issuer)
	}

	account.AssetsIds = append(account.AssetsIds, cp.CUSIP)

	// Set the issuer to be the owner of all quantity
	var owner Owner
	owner.Company = cp.Issuer
	owner.Quantity = cp.Qty

	cp.Owners = append(cp.Owners, owner)

	suffix, err := generateCUSIPSuffix(cp.IssueDate, cp.Maturity)
	if err != nil {
		fmt.Println("Error generating cusip")
		return nil, errors.New("Error generating CUSIP")
	}

	fmt.Println("Marshalling CP bytes")
	cp.CUSIP = account.Prefix + suffix

	fmt.Println("Getting State on CP " + cp.CUSIP)
	cpRxBytes, err := stub.GetState(cpPrefix + cp.CUSIP)
	if cpRxBytes == nil {
		fmt.Println("CUSIP does not exist, creating it")
		cpBytes, err := json.Marshal(&cp)
		if err != nil {
			fmt.Println("Error marshalling cp")
			return nil, errors.New("Error issuing commercial paper")
		}
		err = stub.PutState(cpPrefix+cp.CUSIP, cpBytes)
		if err != nil {
			fmt.Println("Error issuing paper")
			return nil, errors.New("Error issuing commercial paper")
		}

		fmt.Println("Marshalling account bytes to write")
		accountBytesToWrite, err := json.Marshal(&account)
		if err != nil {
			fmt.Println("Error marshalling account")
			return nil, errors.New("Error issuing commercial paper")
		}
		err = stub.PutState(accountPrefix+cp.Issuer, accountBytesToWrite)
		if err != nil {
			fmt.Println("Error putting state on accountBytesToWrite")
			return nil, errors.New("Error issuing commercial paper")
		}

		// Update the paper keys by adding the new key
		fmt.Println("Getting Paper Keys")
		keysBytes, err := stub.GetState("PaperKeys")
		if err != nil {
			fmt.Println("Error retrieving paper keys")
			return nil, errors.New("Error retrieving paper keys")
		}
		var keys []string
		err = json.Unmarshal(keysBytes, &keys)
		if err != nil {
			fmt.Println("Error unmarshel keys")
			return nil, errors.New("Error unmarshalling paper keys ")
		}

		fmt.Println("Appending the new key to Paper Keys")
		foundKey := false
		for _, key := range keys {
			if key == cpPrefix+cp.CUSIP {
				foundKey = true
			}
		}
		if foundKey == false {
			keys = append(keys, cpPrefix+cp.CUSIP)
			keysBytesToWrite, err := json.Marshal(&keys)
			if err != nil {
				fmt.Println("Error marshalling keys")
				return nil, errors.New("Error marshalling the keys")
			}
			fmt.Println("Put state on PaperKeys")
			err = stub.PutState("PaperKeys", keysBytesToWrite)
			if err != nil {
				fmt.Println("Error writting keys back")
				return nil, errors.New("Error writing the keys back")
			}
		}

		fmt.Println("Issue commercial paper %+v\n", cp)
		return nil, nil
	} else {
		fmt.Println("CUSIP exists")

		var cprx CP
		fmt.Println("Unmarshalling CP " + cp.CUSIP)
		err = json.Unmarshal(cpRxBytes, &cprx)
		if err != nil {
			fmt.Println("Error unmarshalling cp " + cp.CUSIP)
			return nil, errors.New("Error unmarshalling cp " + cp.CUSIP)
		}

		cprx.Qty = cprx.Qty + cp.Qty

		for key, val := range cprx.Owners {
			if val.Company == cp.Issuer {
				cprx.Owners[key].Quantity += cp.Qty
				break
			}
		}

		cpWriteBytes, err := json.Marshal(&cprx)
		if err != nil {
			fmt.Println("Error marshalling cp")
			return nil, errors.New("Error issuing commercial paper")
		}
		err = stub.PutState(cpPrefix+cp.CUSIP, cpWriteBytes)
		if err != nil {
			fmt.Println("Error issuing paper")
			return nil, errors.New("Error issuing commercial paper")
		}

		fmt.Println("Updated commercial paper %+v\n", cprx)
		return nil, nil
	}
}

func GetAllCPs(stub shim.ChaincodeStubInterface) ([]CP, error) {

	var allCPs []CP

	// Get list of all the keys
	keysBytes, err := stub.GetState("PaperKeys")
	if err != nil {
		fmt.Println("Error retrieving paper keys")
		return nil, errors.New("Error retrieving paper keys")
	}
	var keys []string
	err = json.Unmarshal(keysBytes, &keys)
	if err != nil {
		fmt.Println("Error unmarshalling paper keys")
		return nil, errors.New("Error unmarshalling paper keys")
	}

	// Get all the cps
	for _, value := range keys {
		cpBytes, err := stub.GetState(value)

		var cp CP
		err = json.Unmarshal(cpBytes, &cp)
		if err != nil {
			fmt.Println("Error retrieving cp " + value)
			return nil, errors.New("Error retrieving cp " + value)
		}

		fmt.Println("Appending CP" + value)
		allCPs = append(allCPs, cp)
	}

	return allCPs, nil
}

func GetCP(cpid string, stub shim.ChaincodeStubInterface) (CP, error) {
	var cp CP

	cpBytes, err := stub.GetState(cpid)
	if err != nil {
		fmt.Println("Error retrieving cp " + cpid)
		return cp, errors.New("Error retrieving cp " + cpid)
	}

	err = json.Unmarshal(cpBytes, &cp)
	if err != nil {
		fmt.Println("Error unmarshalling cp " + cpid)
		return cp, errors.New("Error unmarshalling cp " + cpid)
	}

	return cp, nil
}

func GetCompany(companyID string, stub shim.ChaincodeStubInterface) (Account, error) {
	var company Account
	companyBytes, err := stub.GetState(accountPrefix + companyID)
	if err != nil {
		fmt.Println("Account not found " + companyID)
		return company, errors.New("Account not found " + companyID)
	}

	err = json.Unmarshal(companyBytes, &company)
	if err != nil {
		fmt.Println("Error unmarshalling account " + companyID + "\n err:" + err.Error())
		return company, errors.New("Error unmarshalling account " + companyID)
	}

	return company, nil
}

// Still working on this one
func (t *SimpleChaincode) transferPaper(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {
	/*		0
		json
	  	{
			  "CUSIP": "",
			  "fromCompany":"",
			  "toCompany":"",
			  "quantity": 1
		}
	*/
	//need one arg
	if len(args) != 1 {
		return nil, errors.New("Incorrect number of arguments. Expecting commercial paper record")
	}

	var tr Transaction

	fmt.Println("Unmarshalling Transaction")
	err := json.Unmarshal([]byte(args[0]), &tr)
	if err != nil {
		fmt.Println("Error Unmarshalling Transaction")
		return nil, errors.New("Invalid commercial paper issue")
	}

	fmt.Println("Getting State on CP " + tr.CUSIP)
	cpBytes, err := stub.GetState(cpPrefix + tr.CUSIP)
	if err != nil {
		fmt.Println("CUSIP not found")
		return nil, errors.New("CUSIP not found " + tr.CUSIP)
	}

	var cp CP
	fmt.Println("Unmarshalling CP " + tr.CUSIP)
	err = json.Unmarshal(cpBytes, &cp)
	if err != nil {
		fmt.Println("Error unmarshalling cp " + tr.CUSIP)
		return nil, errors.New("Error unmarshalling cp " + tr.CUSIP)
	}

	var fromCompany Account
	fmt.Println("Getting State on fromCompany " + tr.FromCompany)
	fromCompanyBytes, err := stub.GetState(accountPrefix + tr.FromCompany)
	if err != nil {
		fmt.Println("Account not found " + tr.FromCompany)
		return nil, errors.New("Account not found " + tr.FromCompany)
	}

	fmt.Println("Unmarshalling FromCompany ")
	err = json.Unmarshal(fromCompanyBytes, &fromCompany)
	if err != nil {
		fmt.Println("Error unmarshalling account " + tr.FromCompany)
		return nil, errors.New("Error unmarshalling account " + tr.FromCompany)
	}

	var toCompany Account
	fmt.Println("Getting State on ToCompany " + tr.ToCompany)
	toCompanyBytes, err := stub.GetState(accountPrefix + tr.ToCompany)
	if err != nil {
		fmt.Println("Account not found " + tr.ToCompany)
		return nil, errors.New("Account not found " + tr.ToCompany)
	}

	fmt.Println("Unmarshalling tocompany")
	err = json.Unmarshal(toCompanyBytes, &toCompany)
	if err != nil {
		fmt.Println("Error unmarshalling account " + tr.ToCompany)
		return nil, errors.New("Error unmarshalling account " + tr.ToCompany)
	}

	// Check for all the possible errors
	ownerFound := false
	quantity := 0
	for _, owner := range cp.Owners {
		if owner.Company == tr.FromCompany {
			ownerFound = true
			quantity = owner.Quantity
		}
	}

	// If fromCompany doesn't own this paper
	if ownerFound == false {
		fmt.Println("The company " + tr.FromCompany + "doesn't own any of this paper")
		return nil, errors.New("The company " + tr.FromCompany + "doesn't own any of this paper")
	} else {
		fmt.Println("The FromCompany does own this paper")
	}

	// If fromCompany doesn't own enough quantity of this paper
	if quantity < tr.Quantity {
		fmt.Println("The company " + tr.FromCompany + "doesn't own enough of this paper")
		return nil, errors.New("The company " + tr.FromCompany + "doesn't own enough of this paper")
	} else {
		fmt.Println("The FromCompany owns enough of this paper")
	}

	amountToBeTransferred := float64(tr.Quantity) * cp.Par
	amountToBeTransferred -= (amountToBeTransferred) * (cp.Discount / 100.0) * (float64(cp.Maturity) / 360.0)

	// If toCompany doesn't have enough cash to buy the papers
	if toCompany.CashBalance < amountToBeTransferred {
		fmt.Println("The company " + tr.ToCompany + "doesn't have enough cash to purchase the papers")
		return nil, errors.New("The company " + tr.ToCompany + "doesn't have enough cash to purchase the papers")
	} else {
		fmt.Println("The ToCompany has enough money to be transferred for this paper")
	}

	toCompany.CashBalance -= amountToBeTransferred
	fromCompany.CashBalance += amountToBeTransferred

	toOwnerFound := false
	for key, owner := range cp.Owners {
		if owner.Company == tr.FromCompany {
			fmt.Println("Reducing Quantity from the FromCompany")
			cp.Owners[key].Quantity -= tr.Quantity
			//			owner.Quantity -= tr.Quantity
		}
		if owner.Company == tr.ToCompany {
			fmt.Println("Increasing Quantity from the ToCompany")
			toOwnerFound = true
			cp.Owners[key].Quantity += tr.Quantity
			//			owner.Quantity += tr.Quantity
		}
	}

	if toOwnerFound == false {
		var newOwner Owner
		fmt.Println("As ToOwner was not found, appending the owner to the CP")
		newOwner.Quantity = tr.Quantity
		newOwner.Company = tr.ToCompany
		cp.Owners = append(cp.Owners, newOwner)
	}

	fromCompany.AssetsIds = append(fromCompany.AssetsIds, tr.CUSIP)

	// Write everything back
	// To Company
	toCompanyBytesToWrite, err := json.Marshal(&toCompany)
	if err != nil {
		fmt.Println("Error marshalling the toCompany")
		return nil, errors.New("Error marshalling the toCompany")
	}
	fmt.Println("Put state on toCompany")
	err = stub.PutState(accountPrefix+tr.ToCompany, toCompanyBytesToWrite)
	if err != nil {
		fmt.Println("Error writing the toCompany back")
		return nil, errors.New("Error writing the toCompany back")
	}

	// From company
	fromCompanyBytesToWrite, err := json.Marshal(&fromCompany)
	if err != nil {
		fmt.Println("Error marshalling the fromCompany")
		return nil, errors.New("Error marshalling the fromCompany")
	}
	fmt.Println("Put state on fromCompany")
	err = stub.PutState(accountPrefix+tr.FromCompany, fromCompanyBytesToWrite)
	if err != nil {
		fmt.Println("Error writing the fromCompany back")
		return nil, errors.New("Error writing the fromCompany back")
	}

	// cp
	cpBytesToWrite, err := json.Marshal(&cp)
	if err != nil {
		fmt.Println("Error marshalling the cp")
		return nil, errors.New("Error marshalling the cp")
	}
	fmt.Println("Put state on CP")
	err = stub.PutState(cpPrefix+tr.CUSIP, cpBytesToWrite)
	if err != nil {
		fmt.Println("Error writing the cp back")
		return nil, errors.New("Error writing the cp back")
	}

	fmt.Println("Successfully completed Invoke")
	return nil, nil
}

func (t *SimpleChaincode) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {
	//need one arg
	if len(args) < 1 {
		return nil, errors.New("Incorrect number of arguments. Expecting ......")
	}

	if args[0] == "GetAllCPs" {
		fmt.Println("Getting all CPs")
		allCPs, err := GetAllCPs(stub)
		if err != nil {
			fmt.Println("Error from getallcps")
			return nil, err
		} else {
			allCPsBytes, err1 := json.Marshal(&allCPs)
			if err1 != nil {
				fmt.Println("Error marshalling allcps")
				return nil, err1
			}
			fmt.Println("All success, returning allcps")
			return allCPsBytes, nil
		}
	} else if args[0] == "GetCP" {
		fmt.Println("Getting particular cp")
		cp, err := GetCP(args[1], stub)
		if err != nil {
			fmt.Println("Error Getting particular cp")
			return nil, err
		} else {
			cpBytes, err1 := json.Marshal(&cp)
			if err1 != nil {
				fmt.Println("Error marshalling the cp")
				return nil, err1
			}
			fmt.Println("All success, returning the cp")
			return cpBytes, nil
		}
	} else if args[0] == "GetCompany" {
		fmt.Println("Getting the company")
		company, err := GetCompany(args[1], stub)
		if err != nil {
			fmt.Println("Error from getCompany")
			return nil, err
		} else {
			companyBytes, err1 := json.Marshal(&company)
			if err1 != nil {
				fmt.Println("Error marshalling the company")
				return nil, err1
			}
			fmt.Println("All success, returning the company")
			return companyBytes, nil
		}
	} else if args[0] == "GetAllProperties" {
		fmt.Println("Getting all CPs")
		allProperties, err := GetAllProperties(stub)
		if err != nil {
			fmt.Println("Error from GetAllProperties")
			return nil, err
		} else {
			allPropertiesBytes, err1 := json.Marshal(&allProperties)
			if err1 != nil {
				fmt.Println("Error marshalling allcps")
				return nil, err1
			}
			fmt.Println("All success, returning allcps")
			return allPropertiesBytes, nil
		}
	} else if args[0] == "GetAllproposal" {
		fmt.Println("Getting all Proposal")
		allProposal, err := GetAllproposal(stub)
		if err != nil {
			fmt.Println("Error from GetAllproposal")
			return nil, err
		} else {
			allProposalBytes, err1 := json.Marshal(&allProposal)
			if err1 != nil {
				fmt.Println("Error marshalling allProposal")
				return nil, err1
			}
			fmt.Println("All success, returning allProposal")
			return allProposalBytes, nil
		}
	} else if args[0] == "GetAllAgreement" {
		fmt.Println("Getting all Agreement")
		allSaleAgreement, err := GetAllAgreement(stub)
		if err != nil {
			fmt.Println("Error from GetAllAgreement")
			return nil, err
		} else {
			allSaleAgreementBytes, err1 := json.Marshal(&allSaleAgreement)
			if err1 != nil {
				fmt.Println("Error marshalling allSaleAgreement")
				return nil, err1
			}
			fmt.Println("All success, returning allSaleAgreement")
			return allSaleAgreementBytes, nil
		}
	} else if args[0] == "GetAllDeed" {
		fmt.Println("Getting all Deed")
		allSaleDeed, err := GetAllDeed(stub)
		if err != nil {
			fmt.Println("Error from GetAllDeed")
			return nil, err
		} else {
			allSaleDeedBytes, err1 := json.Marshal(&allSaleDeed)
			if err1 != nil {
				fmt.Println("Error marshalling allSaleDeed")
				return nil, err1
			}
			fmt.Println("All success, returning allSaleDeed")
			return allSaleDeedBytes, nil
		}
	} else if args[0] == "GetAllNotifications" {
		fmt.Println("Getting all Notification")
		allNotification, err := GetAllNotifications(stub)
		if err != nil {
			fmt.Println("Error from GetAllNotifications")
			return nil, err
		} else {
			allNotificationBytes, err1 := json.Marshal(&allNotification)
			if err1 != nil {
				fmt.Println("Error marshalling allNotification")
				return nil, err1
			}
			fmt.Println("All success, returning allNotification")
			return allNotificationBytes, nil
		}
	} else {
		fmt.Println("Generic Query call")
		bytes, err := stub.GetState(args[0])

		if err != nil {
			fmt.Println("Some error happenend")
			return nil, errors.New("Some Error happened")
		}

		fmt.Println("All success, returning from generic")
		return bytes, nil
	}
}

func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {
	fmt.Println("invoke is running " + function)

	if function == "issueCommercialPaper" {
		fmt.Println("Firing issueCommercialPaper")
		//Create an asset with some value
		return t.issueCommercialPaper(stub, args)
	} else if function == "transferPaper" {
		fmt.Println("Firing cretransferPaperateAccounts")
		return t.transferPaper(stub, args)
	} else if function == "createAccounts" {
		fmt.Println("Firing createAccounts")
		return t.createAccounts(stub, args)
	} else if function == "createAccount" {
		fmt.Println("Firing createAccount")
		return t.createAccount(stub, args)
	} else if function == "init" {
		fmt.Println("Firing init")
		return t.Init(stub, "init", args)
	} else if function == "issueQuote" { //Added for Trade finance
		fmt.Println("Firing issueQuote")
		return t.issueQuote(stub, args)
	} else if function == "addProperty" { //Added for Trade finance
		fmt.Println("Firing addProperty")
		return t.addProperty(stub, args)
	} else if function == "issueProposal" { //Added for Trade finance
		fmt.Println("Firing issueProposal")
		return t.issueProposal(stub, args)
	} else if function == "issueSaleAgreement" { //Added for Trade finance
		fmt.Println("Firing issueSaleAgreement")
		return t.issueSaleAgreement(stub, args)
	} else if function == "issueSaleDeeds" { //Added for Trade finance
		fmt.Println("Firing issueSaleDeeds")
		return t.issueSaleDeeds(stub, args)
	} else if function == "addNotification" { //Added for Trade finance
		fmt.Println("Firing addNotification")
		return t.addNotification(stub, args)
	}

	return nil, errors.New("Received unknown function invocation")
}

func main() {
	err := shim.Start(new(SimpleChaincode))
	if err != nil {
		fmt.Println("Error starting Simple chaincode: %s", err)
	}
}

//lookup tables for last two digits of CUSIP
var seventhDigit = map[int]string{
	1:  "A",
	2:  "B",
	3:  "C",
	4:  "D",
	5:  "E",
	6:  "F",
	7:  "G",
	8:  "H",
	9:  "J",
	10: "K",
	11: "L",
	12: "M",
	13: "N",
	14: "P",
	15: "Q",
	16: "R",
	17: "S",
	18: "T",
	19: "U",
	20: "V",
	21: "W",
	22: "X",
	23: "Y",
	24: "Z",
}

var eigthDigit = map[int]string{
	1:  "1",
	2:  "2",
	3:  "3",
	4:  "4",
	5:  "5",
	6:  "6",
	7:  "7",
	8:  "8",
	9:  "9",
	10: "A",
	11: "B",
	12: "C",
	13: "D",
	14: "E",
	15: "F",
	16: "G",
	17: "H",
	18: "J",
	19: "K",
	20: "L",
	21: "M",
	22: "N",
	23: "P",
	24: "Q",
	25: "R",
	26: "S",
	27: "T",
	28: "U",
	29: "V",
	30: "W",
	31: "X",
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Interface org.apache.hadoop.hbase.errorhandling.ForeignExceptionListener (HBase 0.94.19 API)
</TITLE>

<META NAME="date" CONTENT="2014-04-22">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Interface
org.apache.hadoop.hbase.errorhandling.ForeignExceptionListener

Packages that use ForeignExceptionListener

org.apache.hadoop.hbase.errorhandling

org.apache.hadoop.hbase.procedure

org.apache.hadoop.hbase.snapshot

Uses of ForeignExceptionListener in org.apache.hadoop.hbase.errorhandling

Classes in org.apache.hadoop.hbase.errorhandling that implement ForeignExceptionListener

 class
ForeignExceptionDispatcher

          The dispatcher acts as the state holding entity for foreign error handling.

Fields in org.apache.hadoop.hbase.errorhandling with type parameters of type ForeignExceptionListener

protected  List<ForeignExceptionListener>
ForeignExceptionDispatcher.listeners

Methods in org.apache.hadoop.hbase.errorhandling with parameters of type ForeignExceptionListener

 void
ForeignExceptionDispatcher.addListener(ForeignExceptionListener errorable)

          Listen for failures to a given process.

Constructors in org.apache.hadoop.hbase.errorhandling with parameters of type ForeignExceptionListener

TimeoutExceptionInjector(ForeignExceptionListener listener,
                         long maxTime)

          Create a generic timer for a task/process.

Uses of ForeignExceptionListener in org.apache.hadoop.hbase.procedure

Classes in org.apache.hadoop.hbase.procedure that implement ForeignExceptionListener

 class
Procedure

          A globally-barriered distributed procedure.

Uses of ForeignExceptionListener in org.apache.hadoop.hbase.snapshot

Methods in org.apache.hadoop.hbase.snapshot with parameters of type ForeignExceptionListener

static TimeoutExceptionInjector
TakeSnapshotUtils.getMasterTimerAndBindToMonitor(HBaseProtos.SnapshotDescription snapshot,
                               org.apache.hadoop.conf.Configuration conf,
                               ForeignExceptionListener monitor)

          Create a snapshot timer for the master which notifies the monitor when an error occurs

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2014 The Apache Software Foundation. All Rights Reserved.


text:
const mongoose = require('mongoose');
const faker = require('faker/locale/tr');
const config = require('../src/config/config');
const ObjectId = require('mongoose').Types.ObjectId;

var User = require('../src/models/User');

// {_id: new ObjectId('58d584e97a47a21f18092839') }
User.find(function (err, users) {
    if (err) {
        console.log(err);
    } else {

        users.forEach(function (user) {
            const image = faker.image.avatar();
            /*
            console.log('user', user._id);
            console.log('image: ', image);
            */
            User.update({ _id: new ObjectId(user._id.toString()) }, { image: image }, function (err,result) {
                console.log(err, result);
                if (err) {
                    console.log(err);
                } else {
                    console.log('ok');
                }
            });

        });
    }
});


text:
package com.coolweather.app.coolweather.db;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.coolweather.app.coolweather.model.City;
import com.coolweather.app.coolweather.model.County;
import com.coolweather.app.coolweather.model.Province;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by root on 2017/8/24.
 */

public class CoolWeatherDB {
    //数据库名
    public static final String DB_NAME="cool_weather";

    //数据库版本
    public static final int VERSION=1;

    //定义一个静态的当前类引用
    private static CoolWeatherDB coolWeatherDB;

    //定义一个SQLiteDatabase类的引用
    private SQLiteDatabase db;

    //将构造方法私有化,则不可继承
    private CoolWeatherDB(Context context){
        //获取一个SQLiteOpenHelper的派生类
        CoolWeatherOpenHelper dbHelper=new CoolWeatherOpenHelper(context,DB_NAME,null,VERSION);
        //调用该派生类父类的方法创建数据库
        db=dbHelper.getWritableDatabase();
    }

    //获取CoolWeatherDB的实例
   public synchronized  static CoolWeatherDB getInstance(Context context){
       if(coolWeatherDB==null){
           coolWeatherDB=new CoolWeatherDB(context);
       }
       return coolWeatherDB;
   }

   //将province实例存储到数据库

    public  void saveProvince(Province province) {
        if (province != null) {
            ContentValues values = new ContentValues();
            values.put("province_name", province.getProvinceName());
            values.put("province_code", province.getProvinceCode());
            db.insert("Province", null, values);
        }
    }

     //从数据库读取全国的省份信息
        public List<Province> loadProvinces(){
            List<Province> list=new ArrayList<Province>();
            Cursor cursor=db.query("Province",null,null,null,null,null,null);
            if(cursor.moveToFirst()){
                do {
                    Province province=new Province();
                    province.setId(cursor.getInt(cursor.getColumnIndex("id")));
                    province.setProvinceName(cursor.getString(cursor.getColumnIndex("province_name")));
                    province.setProvinceCode(cursor.getString(cursor.getColumnIndex("province_code")));
                    list.add(province);
                }while (cursor.moveToNext());
                }
            return list;
            }

    //将City实例存储到数据库
    public void saveCity(City city){
        if (city != null) {
            ContentValues values = new ContentValues();
            values.put("city_name", city.getCityName());
            values.put("city_code", city.getCityCode());
            values.put("province_id",city.getProvinceId());
            db.insert("City", null, values);
        }
    }

    //从数据库读取某省下所有城市的信息。

    public  List<City>  loadCities(int provinceId){
        List<City> list=new ArrayList<City>();
        Cursor cursor=db.query("City",null,"province_id=?",new String[] {String.valueOf(provinceId)},null,null,null);
        if(cursor.moveToFirst()){
            do {
                City city=new City();
                city.setId(cursor.getInt(cursor.getColumnIndex("id")));
                city.setCityName(cursor.getString(cursor.getColumnIndex("city_name")));
                city.setCityCode(cursor.getString(cursor.getColumnIndex("city_code")));
                city.setProvinceId(provinceId);
                list.add(city);
            }while (cursor.moveToNext());
        }
        return list;
    }

    //将county实例存储到数据库
    public void saveCounty(County county){
        if (county != null) {
            ContentValues values = new ContentValues();
            values.put("county_name", county.getCountyName());
            values.put("county_code", county.getCountyCode());
            values.put("city_id",county.getCityId());
            db.insert("County", null, values);
        }
    }

    //从数据库读取某城市下所有的县信息。
    public  List<County>  loadConties(int cityId){
        List<County> list=new ArrayList<County>();
        Cursor cursor=db.query("County",null,"city_id=?",new String[] {String.valueOf(cityId)},null,null,null);
        if(cursor.moveToFirst()){
            do {
                County county=new County();
                county.setId(cursor.getInt(cursor.getColumnIndex("id")));
                county.setCountyName(cursor.getString(cursor.getColumnIndex("county_name")));
                county.setCountyCode(cursor.getString(cursor.getColumnIndex("county_code")));
                county.setCityId(cityId);
                list.add(county);
            }while (cursor.moveToNext());
        }
        return list;
    }

}


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>jQuery custom scrollbar demo</title>

	<link href="../jquery.mCustomScrollbar.css" rel="stylesheet" />

		malihu
		Plugin home
		Plugin demo

iframe demo

Your browser does not support iframes.


text:
[![Build Status](https://travis-ci.org/Jingyu-Yao/elitetraderoutes.svg?branch=master)](https://travis-ci.org/Jingyu-Yao/elitetraderoutes)

www.elitetraderoutes.com

# Project setup

The following setup is for Linux / Windows. Installation scripts are available
for linux only. All commands should be run in the directory where manage.py is located.

## Required packages

### System packages

#### Linux:

    sudo bash linux_setup.sh

#### Windows:

- python3
- mysql 5.6+ (server only)

### Python packages

#### Linux / Windows:

    pip install -r requirements.txt

## Database settings

Create an user and a database for the user using the settings found in my.cnf file using the following command:

#### Linux:

    bash database_setup.sh

#### Windows:

Open mysql terminal as root@localhost:

    CREATE DATABASE elitetraderoutes CHARACTER SET utf8;
    GRANT ALL PRIVILEGES ON \*.\* TO 'elitetraderoutes'@'localhost' IDENTIFIED BY 'elitetraderoutespassword';

## Additional setup

#### Linux:

    bash project_setup.sh

#### Windows:

    python manage.py migrate
    python manage.py test
    python ingest_data.py
    python manage.py loaddata commodity system station

## Users

You should also create a super user for testing purposes using manage.py

    python manage.py createsuperuser

## EDDN

Start the connection to EDDN:

    python -m eddn.receiver

Licensed under the MIT license.

Copyright © 2015, Jingyu Yao.
All rights reserved.