Google Code offered in: English - Español - 日本語 - 한국어 - Português - Pусский - 中文(简体) - 中文(繁體)
Creating a battery of good unit test cases is an important part of ensuring the quality of your application over its lifecycle. To aid developers with their testing efforts, GWT provides integration with the popular JUnit unit testing framework and Emma code coverage tool. GWT allows JUnit test cases to run in either development mode or production mode.
The bulk of this page is dedicated to explaining how to unit test your GWT code via the GWTTestCase class, which at the end of the day must pay performance penalties for running in a browser. But that's not always what you want to do.
It will be well worth your effort to architect your app so that the bulk of your code has no idea that it will live in a browser. Code that you isolate this way can be tested in plain old JUnit test cases running in a JRE, and so execute much faster. The same good habits of separation of concerns, dependency injection and the like will benefit your GWT app just as they would any other, perhaps even more than usual.
For some tips along these lines take a look at the Best Practices For Architecting Your GWT App talk given at Google I/O in May of 2009. And keep an eye on this site for more more articles in the same vein.
This section will describe how to create and run a set of unit test cases for your GWT project. In order to use this facility, you must have the JUnit library installed on your system.
GWT includes a special GWTTestCase base class that provides JUnit integration. Running a compiled GWTTestCase subclass under JUnit launches the HtmlUnit browser which serves to emulate your application behavior during test execution.
GWTTestCase is derived from JUnit's TestCase. The typical way to setup a JUnit test case class is to have it extend TestCase, and then run the it with the JUnit TestRunner. TestCase uses reflection to discover the test methods defined in your derived class. It is convention to begin the name of all test methods with the prefix test.
The webAppCreator that GWT includes can generate a starter test case for you, plus ant targets and eclipse launch configs for testing in both development mode and production mode.
For example, to create a starter application along with test cases in the directory fooApp, where module name is com.example.foo.Foo:
~/Foo> webAppCreator -out fooApp -junit /opt/eclipse/plugins/org.junit_3.8.1/junit.jar com.example.foo.Foo Created directory fooApp/src Created directory fooApp/war Created directory fooApp/war/WEB-INF Created directory fooApp/war/WEB-INF/lib Created directory fooApp/src/com/example/foo Created directory fooApp/src/com/example/foo/client Created directory fooApp/src/com/example/foo/server Created directory fooApp/test/com/example/foo/client Created file fooApp/src/com/example/foo/Foo.gwt.xml Created file fooApp/war/Foo.html Created file fooApp/war/Foo.css Created file fooApp/war/WEB-INF/web.xml Created file fooApp/src/com/example/foo/client/Foo.java Created file fooApp/src/com/example/foo/client/GreetingService.java Created file fooApp/src/com/example/foo/client/GreetingServiceAsync.java Created file fooApp/src/com/example/foo/server/GreetingServiceImpl.java Created file fooApp/build.xml Created file fooApp/README.txt Created file fooApp/test/com/example/foo/client/FooTest.java Created file fooApp/.project Created file fooApp/.classpath Created file fooApp/Foo.launch Created file fooApp/FooTest-dev.launch Created file fooApp/FooTest-prod.launch Created file fooApp/war/WEB-INF/lib/gwt-servlet.jar
Follow the instructions in the generated fooApp/README.txt file. You have two ways to run your tests: using ant or using Eclipse. There are ant targets ant test.dev and ant test.web for running your tests in development and production mode, respectively. Similarly, you can follow the instructions in the README.txt file to import your project in Eclipse or your favorite IDE, and use the launch configs FooTest-dev and FooTest-prod to run your tests in development and production mode using eclipse. As you keep adding your testing logic to the skeleton FooTest.java, you can continue using the above techniques to run your tests.
If you prefer not to use webAppCreator, you may create a test case suite by hand by following the instructions below:
First of all, you will need a valid GWT module to host your test case class. Usually, you do not need to create a new module XML file - you can just use the one you have already created to develop your GWT module. But if you did not already have a module, you might create one like this:
<module> <!-- Module com.example.foo.Foo --> <!-- Standard inherit. --> <inherits name='com.google.gwt.user.User'/> <!-- implicitly includes com.example.foo.client package --> <!-- OPTIONAL STUFF FOLLOWS --> <!-- It's okay for your module to declare an entry point. --> <!-- This gets ignored when running under JUnit. --> <entry-point class='com.example.foo.FooModule'/> <!-- You can also test remote services during a JUnit run. --> <servlet path='/foo' class='com.example.foo.server.FooServiceImpl'/> </module>
Tip: You do not need to create a separate module for every test case, and in fact will pay a startup penalty for every module you do use. In the example above, any test cases in com.example.foo.client (or any subpackage) can share the com.example.foo.Foo module.
Suppose you had created a widget under the foo package, UpperCasingLabel, which ensures that the text it shows is all upper case. Here is how you might test it.
package com.example.foo.client; import com.google.gwt.junit.client.GWTTestCase; public class UpperCasingLabelTest extends GWTTestCase { /** * Specifies a module to use when running this test case. The returned * module must include the source for this class. * * @see com.google.gwt.junit.client.GWTTestCase#getModuleName() */ @Override public String getModuleName() { return "com.example.foo.Foo"; } public void testUpperCasingLabel() { UpperCasingLabel upperCasingLabel = new UpperCasingLabel(); upperCasingLabel.setText("foo"); assertEquals("FOO", upperCasingLabel.getText()); upperCasingLabel.setText("BAR"); assertEquals("BAR", upperCasingLabel.getText()); upperCasingLabel.setText("BaZ"); assertEquals("BAZ", upperCasingLabel.getText()); } }
Now, there are several ways to run your tests. Just look at the sample ant scripts or launch configs generated by webAppCreator, as in the previous subsection.
The main class in the test infrastructure is JUnitShell. To control aspects of how your tests execute, you must pass arguments to this class. Arguments cannot be passed directly through the command-line because normal command-line arguments go directly to the JUnit runner. Instead, define the system property gwt.args to pass arguments to JUnitShell.
For example, to run tests in production mode (that is, run the tests afer they have been compiled into JavaScript), declare -Dgwt.args="-prod" as a JVM argument when invoking JUnit. To get a full list of supported options, declare -Dgwt.args="-help" (instead of running the test, help is printed to the console).
When using the webAppCreator tool, you get the ability to launch your tests in either development mode or production mode. Make sure you test in both modes - although rare, there are some differences between Java and JavaScript that could cause your code to produce different results when deployed.
If you instead decide to run the JUnit TestRunner from command line, you must add some additional arguments to get your unit tests running in production mode. By default, tests run in development mode are run as normal Java bytecode in a JVM. To override this default behavior, you need to pass arguments to JUnitShell
-Dgwt.args="-prod"
Manual-mode tests allow you to run unit tests manually on any browser. In this mode, the JUnitShell main class runs as usual on a specified GWT module, but instead of running the test immediately, it prints out a URL and waits for a browser to connect. You can manually cut and paste this URL into the browser of your choice, and the unit tests will run in that browser.
For example, if you want to run a test in a single browser, you would use the following arguments:
-runStyle Manual:1
GWT will then show a console message like the following:
Please navigate your browser to this URL: http://<IP_ADDRESS>:58339/com.google.gwt.user.User.JUnit/junit.html?gwt.codesvr=<IP_ADDRESS>:42899
Point your browser to the specified URL, and the test will run. You may be prompted by the Google Web Toolkit Developer Plugin to accept the connection the first time the test is run.
Manual-mode test targets are not generated by the webAppCreator tool, but you can easily create one by copying the test.prod ant target in the build.xml file to test.manual and adding -runStyle Manual:1 to the -Dgwt.args part. Manual mode can also be used for remote browser testing.
Since different browsers can often behave in unexpected ways, it is important for developers to test their applications on all browsers they plan to support. GWT simplifies remote browser testing by enabling you to run tests on remote systems, as explained in the Remote Browser Testing page.
When developing a large project, a good practice is to integrate the running of your test cases with your regular build process. When you build manually, such as using ant from the command line or using your desktop IDE, this is as simple as just adding the invocation of JUnit into your regular build process. As mentioned before, when you run GWTTestCase tests, an HtmlUnit browser runs the tests. However, all tests might not run successfully on HtmlUnit, as explained earlier. GWT provides remote testing solutions that allow you to use a selenium server to run tests. Also, consider organizing your tests into GWTTestSuite classes to get the best performance from your unit tests.
The tests described above are intended to assist with testing client side code. The test case wrapper GWTTestCase will launch either a development mode session or a web browser to test the generated JavaScript. On the other hand, server side code runs as native Java in a JVM without being translated to JavaScript, so it is not necessary to run tests of server side code using GWTTestCase as the base class for your tests. Instead, use JUnit's TestCase and other related classes directly when writing tests for your application's server side code. That said, you may want both GWTTestCase and TestCase coverage of code that will be used on both the client and the server.
GWT's JUnit integration provides special support for testing functionality that cannot be executed in straight-line code. For example, you might want to make an RPC call to a server and then validate the response. However, in a normal JUnit test run, the test stops as soon as the test method returns control to the caller, and GWT does not support multiple threads or blocking. To support this use case, GWTTestCase has extended the TestCase API. The two key methods are GWTTestCase.delayTestFinish(int) and GWTTestCase.finishTest(). Calling delayTestFinish() during a test method's execution puts that test in asynchronous mode, which means the test will not finish when the test method returns control to the caller. Instead, a delay period begins, which lasts the amount of time specified in the call to delayTestFinish(). During the delay period, the test system will wait for one of three things to happen:
The normal use pattern is to setup an event in the test method and call delayTestFinish() with a timeout significantly longer than the event is expected to take. The event handler validates the event and then calls finishTest().
public void testTimer() { // Setup an asynchronous event handler. Timer timer = new Timer() { public void run() { // do some validation logic // tell the test system the test is now done finishTest(); } }; // Set a delay period significantly longer than the // event is expected to take. delayTestFinish(500); // Schedule the event and return control to the test system. timer.schedule(100); }
The recommended pattern is to test one asynchronous event per test method. If you need to test multiple events in the same method, here are a couple of techniques:
The GWTTestSuite mechanism has the overhead of having to start a development mode shell and servlet or compile your code. There is also overhead for each test module within a suite.
Ideally you should group your tests into as few modules as is practical, and should avoid having tests in a particular module run by more than one suite. (Tests are in the same module if they return return the same value from getModuleName().)
GWTTestSuite class re-orders the test cases so that all cases that share a module are run back to back.
Creating a suite is simple if you have already defined individual JUnit TestCases or GWTTestCases. Here is an example:
public class MapsTestSuite extends GWTTestSuite { public static Test suite() { TestSuite suite = new TestSuite("Test for a Maps Application"); suite.addTestSuite(MapTest.class); suite.addTestSuite(EventTest.class); suite.addTestSuite(CopyTest.class); return suite; } }
The three test cases MapTest, EventTest, and CopyTest can now all run in the same instance of JUnitShell.
java -Xmx256M -cp "./src:./test:./bin:./junit.jar:/gwt/gwt-user.jar:/gwt/gwt-dev.jar:/gwt/gwt-maps.jar" junit.textui.TestRunner com.example.MapsTestSuite
When using a test method in a JUnit TestCase, any objects your test creates and leaves a reference to will remain active. This could interfere with future test methods. You can override two new methods to prepare for and/or clean up after each test method.
The following example shows how to defensively cleanup the DOM before the next test run using gwtSetUp(). It skips over <iframe> and <script> tags so that the GWT test infrastructure is not accidentally removed.
import com.google.gwt.junit.client.GWTTestCase; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; private static native String getNodeName(Element elem) /*-{ return (elem.nodeName || "").toLowerCase(); }-*/; /** * Removes all elements in the body, except scripts and iframes. */ public void gwtSetUp () { Element bodyElem = RootPanel.getBodyElement(); List<Element> toRemove = new ArrayList<Element>(); for (int i = 0, n = DOM.getChildCount(bodyElem); i < n; ++i) { Element elem = DOM.getChild(bodyElem, i); String nodeName = getNodeName(elem); if (!"script".equals(nodeName) && !"iframe".equals(nodeName)) { toRemove.add(elem); } } for (int i = 0, n = toRemove.size(); i < n; ++i) { DOM.removeChild(bodyElem, toRemove.get(i)); } }
The webAppCreator tool provides a simple way to generate example launch configurations that can be used to run both development and production mode tests in Eclipse. You can generate additional launch configurations by copying it and replacing the project name appropriately.
Alternatively, one can also directly generate launch configurations. Create a normal JUnit run configuration by right-clicking on the Test file that extends GWTTestCase and selecting Run as > JUnit Test. Though the first run will fail, a new JUnit run configuration will be generated. Modify the run configuration by adding the project's src and test directories to the classpath, like so:
Launch the run config to see the tests running in development mode.
To run tests in production mode, copy the development mode launch configuration and pass VM arguments (by clicking the Arguments tab and adding to the VM arguments textarea)
-Dgwt.args="-prod"


So, again, the unknown facet represents what the other facets fail to encompass, as well as the mystery, which is unknowable. The first lines of the Tao Te Ching summarize it best.
ಲ The Modular Mind
ಲ Engineering Culture
ಲ Embracing Diversity
ಲ Humanity as the Sum of our Capacity for Thought
ಲ Diversity of Experience
ಲ What Bonsai Teaches Us About Life
ಲ Independence == Ownership
ಲ Could Anyone Spare a Donut for my Coccyx?
ಲ All In All, That’s Life!
ට The Modular Mind
A mind which is restricted to specialized tasks is less capable and less dynamic. This is because consciousness coordinates the modular features of the mind, dynamically, to perform higher level tasks. Therefore, if you’ve restricted the development of your mind to a smaller set of tasks, then it should follow that you have strengthened those modular features of your mind to a lesser extent. And therefore, your mind may be capable of a smaller space of available higher level tasks to some degree of efficiency.
I have thoroughly discussed this in Category Theory, Cognition and Epistemology.
Therefore, as technology replaces the day to day activities of our mind and completely replaces some required tasks, then it should also follow that our mind will become less capable. That is, unless we recognize that and utilize something like social engineering to ensure that as we embark on this transition, we do not find ourselves fatally cornered, surrendered completely to some simple facet of life, to which our connection was severed several generations ago. Some people like to bring up genetic engineering and brain-computer interfaces, but let me just state clearly: those technologies can go horribly wrong. And to some extent, there will be problems.
ට Engineering Culture
In Anticipation of the Singularity
As technology accelerates, we must adjust our culture so that we can retain the capacity to proficiently operate these base cognitive features. Short term memory and working memory are now less necessary than they used to be. So is awareness of one’s location. No one bothers to memorize directions or phone numbers any more. These high-level tasks leverage those modular cognitive functions. If you remove enough of the need for the tasks, then you gradually remove the need for the functions. And you end up with …
Idiocracy
Furthermore, not only do the cultural incentives disappear for these high-level tasks, but so do the economic incentives. To perform at school or work, technology displaces the human mind more and more. This isn’t something to fear, per se, but we do need to anticipate these changes, both to the average range of human lifestyles but also to the economy. Automation means more people will be out of work. As long as we stay on top of understanding how this transition will affect humanity and the economy, we’ll be OK, barring some catastrophic event or conflict.
Why is anticipation of the singularity important? For those of us who desperately want to build something in this transitionary world, then it is paramount to become aware of how that world will change, in order to anticipate how their energy would best be utilized. At least, to avoid the frustration that is …
Simpsons Did It
Nothing is more frustrating than working on a project for several months, just to find that some other team is more adequately positioned to seize that market.
ට Embracing Diversity
Of Body, Mind and Culture
Because our mind combinates various ideas and processes into higher-level ideas and behaviors, and because those people who face unique challenges are forced to cope with unique ideas and behaviors, then isn’t it in our interest to leverage to the fullest extent the experience that those people have to offer? By embracing those people who expand our minds by sharing difficult or unique experiences – those we can’t have or can’t completely relate to – doesn’t that make us stronger?
There is value in homogenizing some aspects of culture, but homogeny is the mother of weakness. Cultural homogeny means that members of a culture can be more simply and efficiently motivated towards some end. At the same time, homogeny leads to weakness by reducing our ability to provide robust cultural defenses. It limits the scope of ideas that we can combinate in order to discover new ones. And it makes us more vulnerable, since we are restricted to that set of ideas.
Furthermore, the degree of diversity distinguishes the United States from every other country on earth. There are plenty of other cultures with plenty of diversity, but none to the extent that the US does. So, while there is some conflict that arises surrounding diversity, with my points above, doesn’t that actually imply that diversity is a distinguishing strength of the US? A culture rich with diverse ideas and people is resilient against external factors. It is less vulnerable to internal or external subversion, for example.
It has actually been shown that cultural dissonance drives intelligence because of the struggle to understand and interoperate with a foreign culture eventually empowers the mind. This brilliant article from the Washington Post, The Secret to Immigrant Genius, describes some brilliant studies that elaborate on why this is. Another lesson to be learned is that, no matter what challenges you face, if you struggle to push harder, your mind will be strengthened and you will be rewarded. The degree to which your mind can be strenthened is highly variable, depending on your condition. I also wrote an article suggesting Language Therapy for Autism and Traumatic Brain Injury.
At the same time, diversity presents challenges. Multiculturalism isn’t easy and all too often the interests of one culture dominate that of others. It can be more difficult to unify people to fight or the convey the urgency of uniting towards a higher purpose. I t’s incredibly important for our world to retain and strengthen this ability to protect ourselves from the chaos resulting from strained relationships or turbulent economics or some catastrophe.
If anyone was wondering what my beliefs are, exactly. There you go.
America is a patchwork of various cultures, all assimilated to some varying degree. by assuming that we should all melt into a single culture, we will actually lose our greatest strength. Again, our cultural diversity is one thing that america has that no other culture on earth can match. It can be difficult at times, but that just means we need to identify the common thread that connects us all. We all bleed the same color. We do still face different challenges, but we all go to the same place eventually.
ට Embracing Our Differences
Far too many people associate being different with weakness. They consciously or subconsciously seek to identify what makes others different and they point it out, questioning it. Or provoking situations with exemplify it. Many people accept our differences, but occasionally people will try to use it in some way. Even those who claim to be advocates, which is sometimes used as a shield.
And, with respect to themselves, instead of embracing their unique differences or disabilities, too many of us try to hide from them. To each their own path. No one has the right to tell you to live one way or another. That is, IMO, if you respect the same right in others.
Some of us have quirks in how our minds function or have other minor differences. Too many of us seek to lie to oursives by distorting our true self to seek conformity. We assume that whatever it is that makes us different must make us weak, instead of stepping back and seeing it for what is is, which can often be a strength. Instead we see whatever part of us that doesn’t conform as being some unnecessary appendage that should be amputated and cauterized before it threatens our conformity. And possibly makes us a target by causing us to stick out or attract attention. By accepting this, we delude ourselves into robbing ourselves of our strengths.
As an example, blind and deaf people have minds that are fundamentally different than those of neurotypicals. This is usually considered a weakness by others and is no doubt difficult to endure. Yet, according to my theory of mind above and in previous articles, then because this person has a limited range of sensory input, then the rest of their mind develops different and utilizes their cognitive functions differently. Very differently and this can be evidenced in plenty of studies with fMRI data. And therefore, this person has a different perspective or a different shape to their mind, which is unavailble to the neurotypical or the “normal” person. Or at the least, this person as a wildly different range of experiences.
ට Humanity as the Sum of our Capacity for Thought
And if we consider humanity to be the product of all the ideas available to our collective minds, shouldn’t we embrace diversity of mind, body and culture as strengths? These people who have endured challenge after challenge in their lives and whose minds will no doubt contain a wholly different range of memories and ideas: we should see them as luminaries who can see things we could never imagine.
ට Diversity of Experience
Knowing how important diversity is to personal growth, it’s also important to recognize that a wide range of experiences and a self-directed life is crucial for ourselves and our children. People need to be able to think for themselves and make their own mistakes … most of the time. Sometimes it’s crucial to intervene, but too often and you’ll stagnate or interfere with or completely redirect that person’s development. Maybe that’s for the best, but who can be the judge? We must have the wisdom to respect the beauty of things being inherantly perfect as they are, where any form of intervention would only destroy that thing or mar it’s beauty. On the other hand, in the case of our children or friends, we need to balance that with the wisdom of knowing when to act.
There are lots of parallels with between specific artforms and other aspects of life.  Your mind is recognizing some of the epiphenomena found in the practice of that artform.
ට What Bonsai Teaches Us About Life
One artform that takes decades to master is that of bonsai trees. It requires tonnes of difficult-to-acquire experience on how environment, nutrition, genetics, trimming, tying, twisting, etc. affect the development of the trees. Any interference, intentional or not, results in the redirection of the tree’s energy, but you can’t actually control how the tree uses that energy. And too many such interventions end up impeding that tree’s ability to grow or causing it to die.
Bonsai is an art where one seeks to control change to meet some aesthetic goal, through an interface which restricts the set of actions. And this is a skill in itself. By practicing bonsai or some other skill that requires such a restricted interface, especially one in which large amounts of time are required, our mind can leverage this knowledge towards other high-level cogntitive behaviors. Or, I’d like to believe, at least. Another similar skill is building a ship in a bottle. You have a restricted interface to work with and it can be incredibly frustrating.
ට Independence Promotes Acceptance of Self-Culpability
It’s important to for someone to maintain an idea of independence in their development. And this is why maintaining authentic freedom is important for America. If you’re raising a child and you constantly intervene in an opaque manner, then it’s now obvious to that person that you’ve altered their course.
 It only served to solidify my sentiment towards it. Again, for me, it drove my urge to continue to rebel against drug policy in America. I simply used the extensive group therapy treatment programs as a platform to spread the message and strategies to resist the policies. Some of the people needed to be in those classes and didn’t need to hear what I had to say. I get the feeling that I was in those classes because of some interference, possibly politically motivated. And possibly due to my mom, who personally knew the “psychologist” who recommended the extensive treatment, which more than doubled my license suspension period…
It can be very difficult to intervene in such a way that is transparent and effective. Again, who should be the judge of what is effective for someone’s life and goals? But it’s worth the effort, as that person retains their sense of independence. Just as their sense of success will belong to them, so will their setbacks, struggles and sense failure. They will own it. One issue that overcomplicates everything for me is the fact that, over the past decade, I have had a license and a car for less than two years. That makes it nearly impossible for me to accomplish much of anything with my life. I have only overburdened my family and unnecessarily so. I have overutilized every person willing to help me out and because of continued persecution, I have given almost nothing in return.  It doesn’t matter how talented or smart I am, if I’m living on a proverbial island after burning every bridge I had.
ට Independence == Ownership
And finally, even though it’d be great to receive credit for the various things I may or may not have set in motion, it’s impossible to prove who set what in motion. The only credit I could claim is that I was smart enough to say the right (or wrong) things to some people who may have influence. And I’m not sure the good resulting from my actions outweighs the bad. It’s hard to be certain of anyone’s intent in any situation to be honest.
Honestly, in my case, while I’m bursting with creativity, there are so many other people who are far more capable of leading a team to take on some lofty pipe dream than I am. Who knows whether or not it’d work out and one should own both their successes and failures. And a corollary of this is that if you are hard at work on some project, then you also need to be aware of how your efferts are perceived, if you care about getting credit or recognized.
In my situation, it seems like people are quick to say that I’m not working hard enough.  If it was up to me, I’d work 12 hour days, six to seven days a week, without blinking. My problem is that – because of my god-forsaken life situation – I cannot actually utilize any more than 20% of my free time. And furthermore – again – I feel compelled to mention the fact that not a single person has contributed more than an hour to any idea that I’ve worked on in the past five years.  And basically, that nothing I ever did or said mattered. That, I should just give up and paint.  Bullshit doesn’t quite describe it.
A round of applause for the American Dream, please…
A word of advice, don’t mimic my behavior. I forgot that when you get raped in the ass, you’re not supposed to talk about it. I keep getting the feeling that ooooohhh something’s coming, but if life has taught me one thing: do not let yourself be played with your hopes and dreams, until someone gives you something you can see, touch or taste.  I wish I wasn’t. I really, realllly do.  I need one of these:
ට Could Anyone Spare a Donut for my Coccyx?
And it’d be much better to own my failures. However, as for startups, I can’t ever really say that I have tried. No one listened to me in 2011 or 2012 or 2013.
And remember, anything is possible! If your name isn’t David Conner.
For Fans of Kaizo Mario and Masochists in General, Amazon Recommends:
A Rubik’s Cube in a Klein Bottle
Here’s a Bonsai Shokunen
American Shokunin from Ryan Bush on Vimeo.
ට All In All, That’s Life!
Please don’t take anything I say too seriously.  My writing is often the only place to vent, as I am not actually allowed to express myself to another living human being.  I have literally been alluded to as a “cancer” by a very few people in some unnamed subculture. And the only person I have at home is my mom.  I can confidently say that the problems in my life are – to a minority of people – ABSO-FUCKING-LUTELY NOT INTENDED TO BE RESOLVED.
 It is bullshit, but I have no support system with which to talk to. I have been told by my family that, because of my reluctance to give up, I am “crazy” and I “belong in a hospital.”
Again, I challenge you to write 20,000 to 30,000 words on leadership. If you criticize me, then what do you have to say? Obviously, there are people out there who are more agreeable, but look honestly at what I have been through. And how can someone read the 20,000 words I have published in the past 48 hours and reasonably conclude that I am not in touch with reality, unless there is some aspect of reality I am not being shown. How can someone allude that I am delusional because I do not understand my own capabilities?  I have a lot to learn and a ton of room for growth, but I am absolutely not delusional about my skillset or range of experience.


Tottenham Hotspur appoint Jose Mourinho as manager
by AFPTottenham Hotspur has appointed Jose Mourinho as their new head coach after sacking Mauricio Pochettino, the club said on Wednesday.
The former Chelsea and Manchester United manager has signed a contract that runs until the end of the 2022/23 season, the north London club said in an online statement.
Spurs Chairman Daniel Levy said: "In Jose, we have one of the most successful managers in football. We believe he will bring energy and belief to the dressing room."


Networking Core
Networking support in TinyCLR OS is a subset of Microsoft's .NET Framework networking stack. More details will be added to this tutorial in the future. You might want to look at the Microsoft Sockets Class documentation to get started -- it should very closely resemble the TinyCLR sockets class.
MAC Addresses
Before using SITCore's built in PHY and ENC28 Ethernet networking, you have to set a MAC address or an exception will be raised. While you may not need a unique MAC address for internal testing, you will need to set a valid and unique MAC address before shipping your product. If you do not have access to an appropriate MAC address, you can either use an online MAC address generator, which is not ideal, or you can use a MAC address from an old computer or network card that is no longer used.
Not having a unique MAC address can be a problem. If two devices with the same MAC address are present on the same local network subnet, neither device will be able to communicate properly.
The WINC1500 WiFi module supported by SITCore devices ships with a manufacturer assigned unique MAC address. This address is used by default, although you can provide your own MAC address if desired.
Secure Sockets
TLS is natively support. See the TLS page for details.
.NET Sockets
TinyCLR OS's support of sockets is very similar to .NET socket support. Most .NET socket code should run with little modification. Socket support is provided as part of the TinyCLR OS core. Tiny CLR sockets work similar to .NET sockets -- most .NET examples are applicable to TinyCLR.
TCP/UDP
TCP and UDP are the core of the Internet protocols and are supported through standard .NET Sockets. The web is full of examples on using TCP and UDP Sockets that should work as is or with minor changes.
TCP example:
var s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)){
try {
var ip = IPAddress.Parse("<IP_ADDRESS>");
s.Connect(new IPEndPoint(ip, 80));
s.Send(System.Text.UTF8Encoding.UTF8.GetBytes("I am SITCore\n\r"));
}
catch {
}
}
UDP example:
var socket = new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
var ip = new IPAddress(new byte[] { 192, 168, 1, 87 });
var endPoint = new IPEndPoint(ip, 2000);
socket.Connect(endPoint);
byte[] bytesToSend = Encoding.UTF8.GetBytes(msg);
while (true) {
socket.SendTo(bytesToSend, bytesToSend.Length, SocketFlags.None, endPoint);
while (socket.Poll(2000000, SelectMode.SelectRead)){
if (socket.Available > 0){
byte[] inBuf = new byte[socket.Available];
var recEndPoint = new IPEndPoint(IPAddress.Any, 0);
socket.ReceiveFrom(inBuf, ref recEndPoint);
if (!recEndPoint.Equals(endPoint))// Check if the received packet is from the <IP_ADDRESS>
continue;
Debug.WriteLine(new String(Encoding.UTF8.GetChars(inBuf)));
}
}
Thread.Sleep(100);
}
IP Assignment
TinyCLR OS supports both static and dynamic IP addressing. With either method, an event is fired providing the local IP settings.
networkController.NetworkAddressChanged += NetworkController_NetworkAddressChanged;
// ...
private static void NetworkController_NetworkAddressChanged
(NetworkController sender, NetworkAddressChangedEventArgs e) {
var ipProperties = sender.GetIPProperties();
}
Tip
Static IP addressing does not work with PPP.
Static IP
With static IP addressing, the following settings must be provided.
networkInterfaceSetting.DhcpEnabled = false;
networkInterfaceSetting.Address = new IPAddress(new byte[] { 192, 168, 1, 122 });
networkInterfaceSetting.SubnetMask = new IPAddress(new byte[] { 255, 255, 255, 0 });
networkInterfaceSetting.GatewayAddress = new IPAddress(new byte[] { 192, 168, 1, 1 });
networkInterfaceSetting.DnsAddresses = new IPAddress[] { new IPAddress(new byte[]
{ 75, 75, 75, 75 }), new IPAddress(new byte[] { 75, 75, 75, 76 }) };
Dynamic IP
The following line of code enables dynamic IP, which start by trying to lease an IP from a DHCP server. If that fails, the system will self-assign an IP address through AutoIP mechanism. This can take a while but an event is fired when an IP is available.
networkInterfaceSetting.DhcpEnabled = true;
Tip
AutoIP addresses always fall within the 169.254.x.x range to determine if an IP was generated using AutoIP
DNS
The TinyCLR Dns class can be used to resolve a URL into its IP address by using the following code:
var hostEntry = Dns.GetHostEntry(hostName);
if ((hostEntry != null) && (hostEntry.AddressList.Length > 0)) {
var i = 0;
while (hostEntry.AddressList[i] == null) i++;
remoteIpAddress = hostEntry.AddressList[i];
}
else {
throw new Exception("Server not found."); ;
}
mDNS
Multicast DNS is a local name resolution service over local networks. Please note that not all operating systems support mDNS.
networkInterfaceSetting.MulticastDnsEnable = true;
networkController.Enable();
MulticastDns.Start("MyServer", TimeSpan.FromSeconds(1*60*60)); // TTL set to 1 hour


CONNECT
THRUSTER CONFIG
NAVIGATION
VEHICLE SUMMARY
NETWORK SETUP
SUMMARY
LIGHTS
CAMERA SETUP
POWER SETUP
PRIMARY CAMERA FEED
SECONDARY CAMERA FEED
ORIENTATION ANGLES
X:
Y:
Z:
ROLL
PITCH
YAW
DEPTH:
TEMP: 25.23C
LATITUDE: 43 23'N
LONGITUDE: 122 12'E
Canvas not available.


A framework for testing Qpid, built around a standard 'test circuit' design. The idea behind this framework is the
use of a test circuit which is configured by a set of test parameters, that may be projected onto a topology of
test nodes, with tests scripted to run over test circuits, making as few assumptions as possible about the underlying
topology. The standardization of the design, whilst limiting in some respectes, allows a large variety of test
scenarios to be written with minimal amounts of coding.
The standard consruction block for a test, is a test circuit. This consists of a publisher, and a receiver. The
publisher and receiver may reside on the same machine, or may be distributed. Will use a standard set of properties to
define the desired circuit topology.
Tests are always to be controlled from the publishing side only. The receiving end of the circuit is to be exposed
to the test code through an interface, that abstracts as much as possible the receiving end of the test. The interface
exposes a set of 'assertions' that may be applied to the receiving end of the test circuit.
In the case where the receiving end of the circuit resides on the same JVM, the assertions will call the receivers
code locally. Where the receiving end is distributed accross one or more machines, the assertions will be applied to a
test report gethered from all of the receivers. Test code will be written to the assertions making as few assumptions
as possible about the exact test topology.


About Us
Yes, we can do it!
Rental Riders is a self-ride bike and car rental platform.Rental Riders is the most affordable bike rental service where you can rent two-wheeler on an hourly, daily, weekly and monthly subscription. From your daily city commute to your inter-city travel plans –Rental Riders with its super economical pricing aims to create an alternate mode of commute in India.


Friend Finder
Take The Survey...
Then get added to the database & matched with other friends!
Go to Survey
API Friends List
|
GitHub Repo


{% extends 'base.html' %} {% load static %} {% block main %}
All problems in this area Recent comments ({{ most_recent_comments | length }})
{% for c in most_recent_comments %}
Problem {{c.problem.id}}: {{c.member.user.first_name}} commented {{c.created | timesince }} ago


{{ post.title }}
{{ post.excerpt }}
Read More
---
layout: default
---
Welcome to my blog.
I created this blog because there are a lot of great resources to lean Haskell like Learn you Haskell but not so many resources to learn to practice it. In this blog, I explain how I solved Codingame puzzles using Haskell.
Codingame is a great website where you can use your favorite programming language and solve puzzles or particapate in online programming contests.
What I recommend you is to try to solve a Codingame puzzle. No matter you succeeded or not you can after see how I solved it. I hope you will learn a lot thanks to this method.
The list of puzzles that I solved are :


JUST IN: Bill Seeking Social Media Regulation Passes Second Reading
Nigerians have been critical of the bill since its introduction on the floor of the Senate.
by SaharaReporters, New York
The 'Protection from Internet Falsehood and Manipulation' bill has now passed second reading at the Senate.
Sani Musa, a senator from Niger State, moved the motion for a debate on the bill at the plenary on Wednesday.
The bill seeks to regulate social media usage in Nigeria.
Nigerians have been critical of the bill since its introduction on the floor of the Senate.


|
ibisami
0.8
Public domain IBIS-AMI model creation infrastructure.
|
Abstract class providing the base functionality required by all IBIS-AMI models. More...
#include <amimodel.h>
Public Member Functions | |
| virtual | ~AMIModel () |
| virtual void | init (double *impulse_matrix, const long number_of_rows, const long aggressors, const double sample_interval, const double bit_time, const std::string &AMI_parameters_in) |
| Initialize the model. More... | |
| virtual void | proc_imp ()=0 |
| Process an incoming impulse response. More... | |
| virtual bool | proc_sig (double *sig, long len, double *clock_times)=0 |
| Process a signal. More... | |
| std::string & | msg () |
| Retrieve the model message. More... | |
| std::string & | param_str () |
| Retrieve the model parameter string. More... | |
Protected Member Functions | |
| ParseRes | parse_params (const std::string &AMI_parameters_in) |
| Parse the incoming AMI parameter string. More... | |
| std::string | get_param (const std::vector< std::string > &node_names) const |
| Get the string value of a parameter. More... | |
| long | get_param_int (const std::vector< std::string > &node_names, long default_val) const |
| Get the value of an integer parameter. More... | |
| double | get_param_float (const std::vector< std::string > &node_names, double default_val) const |
| Get the value of a floating point parameter. More... | |
| bool | get_param_bool (const std::vector< std::string > &node_names, bool default_val) const |
| Get the value of a Boolean parameter. More... | |
| void | gen_data (double *res_vec) |
| Generate random binary oversampled data. More... | |
| void | log (std::string msg) |
Protected Attributes | |
| std::string | msg_ |
| std::string | param_str_ |
| std::string | name_ |
| double | sample_interval_ |
| double | bit_time_ |
| double * | impulse_matrix_ |
| double | gen_data_last_ |
| long | number_of_rows_ |
| long | aggressors_ |
| long | samples_per_bit_ |
| unsigned long | gen_data_cnt_ |
| ibisami::ParamTree | param_tree_ |
| std::ofstream | clog_ |
| bool | log_ |
| int | shift_reg_ [PRBS_LEN] |
Abstract class providing the base functionality required by all IBIS-AMI models.
Definition at line 121 of file amimodel.h.
|
inlinevirtual |
Definition at line 123 of file amimodel.h.
|
protected |
Generate random binary oversampled data.
| res_vec | A pointer to an array of doubles to be overwritten. (It is assumed that, at least, number_of_rows_ elements have been allocated.) |
The default implementation uses PRBS-7, [7,6].
Definition at line 232 of file amimodel.cpp.
|
protected |
Get the string value of a parameter.
Returns the string value of a particular AMI parameter.
Inputs:
Returns:
Definition at line 190 of file amimodel.cpp.
|
protected |
Get the value of a Boolean parameter.
Returns the Boolean value of a particular Bool parameter.
Inputs:
Returns:
Throws:
Definition at line 158 of file amimodel.cpp.
|
protected |
Get the value of a floating point parameter.
Returns the floating point value of a particular Float parameter.
Inputs:
Returns:
Throws:
Definition at line 119 of file amimodel.cpp.
|
protected |
Get the value of an integer parameter.
Returns the integer value of a particular Integer parameter.
Inputs:
Returns:
Throws:
Definition at line 80 of file amimodel.cpp.
|
virtual |
Initialize the model.
(See AMI_Init() for parameter descriptions.)
Reimplemented in MyRx, AmiRx, and MyTx.
Definition at line 20 of file amimodel.cpp.
|
inlineprotected |
Definition at line 169 of file amimodel.h.
|
inline |
Retrieve the model message.
Definition at line 159 of file amimodel.h.
|
inline |
Retrieve the model parameter string.
Definition at line 160 of file amimodel.h.
|
protected |
Parse the incoming AMI parameter string.
Definition at line 46 of file amimodel.cpp.
|
pure virtual |
Process an incoming impulse response.
This function takes no arguments and returns nothing. It processes the array of doubles sent into init(), in place. The model already contains everything it needs to do this, via the init() call. The only reason this function isn't absorped into init() is to allow derived classes to add to the init() functionality, before the impulse response is processed.
|
pure virtual |
Process a signal.
| sig | A pointer to the array of doubles to be processed. |
| len | The number of samples to process. |
| clock_times | A pointer to the array of doubles used for storing the clock times. |
As per the IBIS standard, the user is allowed to presume that there has been enough storage allocated for clock_times, given the value of sig_len, sample_interval, and bit_time.
|
protected |
Definition at line 173 of file amimodel.h.
|
protected |
Definition at line 172 of file amimodel.h.
|
protected |
Definition at line 176 of file amimodel.h.
|
protected |
Definition at line 174 of file amimodel.h.
|
protected |
Definition at line 172 of file amimodel.h.
|
protected |
Definition at line 172 of file amimodel.h.
|
protected |
Definition at line 177 of file amimodel.h.
|
protected |
Definition at line 171 of file amimodel.h.
|
protected |
Definition at line 171 of file amimodel.h.
|
protected |
Definition at line 173 of file amimodel.h.
|
protected |
Definition at line 171 of file amimodel.h.
|
protected |
Definition at line 175 of file amimodel.h.
|
protected |
Definition at line 172 of file amimodel.h.
|
protected |
Definition at line 173 of file amimodel.h.
|
protected |
Definition at line 178 of file amimodel.h.


THE WATERBOY RATING: 5.5 / 10 --> Not good enough to recommend
For more reviews and movie trivia, visit http://www.joblo.com/
Another comedy pic starring the ever-loving, dumbass character that Adam Sandler's been portraying ever since he ended his days as a regular cast member of TV's "Saturday Night Live".
PLOT: An ignorant football waterboy from the Bayou suddenly discovers a unique talent for crunch-tackling the opposition, and against the orders of his overly-protective mother, joins the worst team in the league.
CRITIQUE: Uninspired, one-joke film gathers very little in momentum, is forgiven for its obviously standard plot, but not for its lack of constant humor or originality. This Cajun movie can't even hold a candle next to Sandler's best comedy up to date, HAPPY GILMORE (8/10). That movie was filled with jokes left and right, enjoyable characters all around, and many fresh ideas. Sandler is okay in this one, and does receive a wonderful supporting performance from Kathy Bates, in a role that seems to have been inspired by Elvis and his momma, but overall, this flick offers very few chuckles, many repeat gags, and Henry Winkler. I love "stupid comedies" as much as the next guy, but this Bourbon-bred story just doesn't have enough mustard to complete the sandwich. Mind you, if you're really in the mood for some fun, not-to-be-taken-seriously humor, check out the aforementioned HAPPY GILMORE, Woody Allen's classic BANANAS (8/10) or the Farrelly brothers' overlooked KINGPIN (8.5/10). Unfortunately for Sandler and crew, there is very little in comedic "whoop-ass" in this dud.
Little Known Facts about this film and its stars: This film grossed close to $160 million domestically, and is famous for turning actor Adam Sandler into the $20-million-salary-man. Look for Rob Schneider in an uncredited role as the "townie" who keeps shouting "You could do it!". The late comedian Chris Farley's two brothers both have roles in this film. John Farley plays the character of Tony Dodd, while Kevin Farley plays Jim Simonds. Many actual football personalities make appearances in this film as themselves, including Lawrence Taylor, Lynn Swann, Jimmy Johnson, Dan Fouts, Chris Fowler and Brent Musburger. The director of this film, Frank Coraci, also directed the Adam Sandler-vehicle, THE WEDDING SINGER (7/10). He also plays the role of Adam's crazy dad Roberto in this picture. Writer Tim Herlihy, producer on TV's "Saturday Night Live", has co-written four of Adam Sandler's films with Adam himself. They consist of this one, HAPPY GILMORE, BILLY MADISON, and the upcoming BIG DADDY. He was the only one credited for writing THE WEDDING SINGER. He is also a member of the New York State Bar. The writer, Tim Herlihy, director, Frank Coraci, and producer, Jack Giarraputo, of this film were all roommates with Adam during his days at New York University.
Review Date: March 28, 1999 Director: Frank Coraci Writers: Adam Sandler and Tim Herlihy Producers: Jack Giarraputo and Robert Simonds Actors: Adam Sandler as Bobby Boucher, Kathy Bates as Mama Boucher, Henry Winkler as Coach Klein Genre: Comedy Year of Release: 1998
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


|
Bullet Collision Detection & Physics Library
|
#include "LinearMath/btVector3.h"
#include "btCharacterControllerInterface.h"
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
Go to the source code of this file.
Classes | |
| class | btKinematicCharacterController |
| btKinematicCharacterController is an object that supports a sliding motion in a world. More... | |


Sorry for the inconvenience but we’re performing some maintenance at the moment. we’ll be back online shortly!
— SASH Admin Team


The first step in PCA is to compute a covariance, or a correlation matrix. We can do this by populating a matrix pairwise the covariances between all the normalised attributes. This will help us understand the relationships between the various attributes later.
Covariance is "the joint variability of data". Given random variables X and Y is is defined as $$\small E[X-E[X]] - E[Y-E[Y]]$$ which, following some expectation algebra is equivalent to $$ \small E[XY] - E[X]E[Y] $$ Select two random variables using the buttons here.
This will then populate the covariance matrix. Whereas we are doing this through pairwise calculations, the way we do this in the background for the visualisation is by some linear algebra: $$ \small K_{XY} \\ = cov(X, Y) \\ = E[(X - \mu_X)(Y - \mu_Y)^T] $$ where $$ \\\mu_X = E[X] \\\mu_Y = E[Y] $$
Hit next page to go to the next page.


alFractal
Fractal noise pattern generator
Remap
These controls allow you to remap the shader result.
Contrast
None
Bias and gain
None
Clamp
None


The recursion/machine.h
header defines the continuation machine.
#include <chaos/preprocessor/recursion/machine.h>
The CHAOS_PP_MACHINE
macro invokes the continuation machine.
CHAOS_PP_EXPR
(CHAOS_PP_MACHINE
(k))
The continuation to be executed.
This macro executes the continuation specified by k.
This macro may not be used inside a continuation machine instruction.
#include<chaos/preprocessor/arithmetic/dec.h>
#include<chaos/preprocessor/arithmetic/inc.h>
#include<chaos/preprocessor/config.h>
#include<chaos/preprocessor/control/if.h>
#include<chaos/preprocessor/recursion/expr.h>
#include<chaos/preprocessor/recursion/machine.h>
#ifCHAOS_PP_VARIADICS
#define CHAOS_PP_INSTRUCTION_add(p, x, y, ...) \CHAOS_PP_IF
(y)( \ (,CHAOS_PP_INC
(x), (add),CHAOS_PP_DEC
(y), p ## __VA_ARGS__), \ (, x, p ## __VA_ARGS__) \ ) \ /**/ #define ADD(x, y) \CHAOS_PP_EXPR
(CHAOS_PP_MACHINE
( \ (, x, (add), y, (0xchaos)(0xstop),) \ )) \ /**/ ADD(11, 13) // 24 #endif
The CHAOS_PP_MACHINE_ID
macro indirectly expands to CHAOS_PP_MACHINE
.
CHAOS_PP_MACHINE_ID
()
This macro effectively allows CHAOS_PP_MACHINE
to pass through itself without becoming disabled.
The CHAOS_PP_MACHINE_
macro expands to a λ expression representing CHAOS_PP_MACHINE
.
CHAOS_PP_MACHINE_
This macro is a shorthand form of the following λ binding:


{% extends 'ProjectSite/base.html' %} {% load static %} {% block title %}
So that you and yours can easily find social services, ParaDYM Academy, Inc. and the New Britain Housing Authority have partnered with Central Connecticut State University to build this website. We’ve combined an agency-supported community events calendar with a full menu of self-sufficiency services
With people lacking personal and social capital
A network of agencies and resources that can become social capital
Relationships grounded in collaboration, communication, & commitment


We only ask when donations are needed. If every surveyor reading this contributes a couple of dollars we can remove this block and begin moving to the new and improved BETA Land Surveyors United Platform. This message will be removed as soon as we are funded.
Dear Surveyor, Please donate what you can afford to help the Land Surveyors United Community stay alive. You may not know it, but we’re an independent website that the entire world of surveyors depend on. We are dedicated to staying free for all land surveyors but we still have bills to pay. Most users can’t afford to donate, but we hope you can. If everyone chips in $5, we can keep this going for free. For the price of a meal, we can preserve a website forever. We built the Land Surveyors United because open access to knowledge is fragile. If you find our site useful, chip in what you can today. Thank you. ~Justin Farrow
It costs roughly $470 per month to host and maintain this community. For over 15 years, Justin has paid for this out of pocket while surviving as graduate student. We do not sell your data or crowd your learning with distractions on the site.  If we are not able to raise the funds needs for operation, we will have to search for alternative means to meet financial requirements.
Monthly costs with maintaining Hosting, Network Maintenance, Live Support, Fees associated with monthly billing related all of the moving parts of LSU, Development of Real-Time support tools, Web Development, Mobile Version and Application Development, Out Reach, Development of Continuing Education Program for Surveyors and Online Training in Foreign Countries and more.
Our mission is to provide avenues of professional development for land surveyors worldwide. Students leaving school are most times not properly equipped to work in the field. They need the expertise and guidance from those who have been in the field in order to perform their jobs. On Land Surveyors United, we all learn from one another and support each other across borders.


Beta This is a test version of the layout of this page. Take the survey to help us improve it
Form
Information to help academy trusts to complete their 2015 to 2016 accounts return.
EFA requires all academy trusts preparing financial statements as at 31 August 2016 and/or with open academies at 31 August 2016 to submit an accounts return for 2015 to 2016 by 31 January 2017.
We’ve published an additional guide with hints and tips about registering for the Hub and setting up the online form.
This page has:
Please note that within the guide for ‘setting up the Hub for the accounts return’ we’ve:
made it clear that external auditors only have to choose one of their clients in order to register for the Hub and the superuser for that trust should allocate the auditor a role for completing the accounts return. All trusts must enter their auditor details on the auditor information screen of the online form
we’ve updated section 2.6 to describe how superusers allocate themselves a role for the completion of the online form
Within the ‘guide to completing the online form’ we’ve updated section 2.3 to confirm that once the auditor details are entered into the online form the button marked ‘next’ should be pressed.
You can now watch a recording the accounts return webinar which provides an overview of the main features of the return with a panel providing answers to questions from academy trusts.
EFA uses information in the accounts return to produce benchmarking data and the academies sector annual report and accounts (SARA) .


Battle Talent is a roguelite VR action game, brings you high quality Fight, Build and Run experiences.
Follow us on:


The sky didn’t darken until late in the afternoon that day in Amsterdam. It’s normal for it to rain at least once every day here but I had confused the shadow of the towering thunderheads with the coming of night since their coming coincided completely.
Our trio had hurried home from a stroll around the old center of town that had culminated in our stopping by our favorite Thai food place in Amsterdam, “The Bird”. We’d ordered the usual takeaway pad thai and other miscellaneous dishes. We went back up to my flat at the Nieuwmarkt and finished the hodgepodge we’d wandered out for earlier that night. Then we filled up the glasses on the table.  He and I also had small tumblers of bourbon that I was to keep wet. Jo had a glass of wine since she was wary of the Jim Beam I was pouring, and even more afraid of the unopened Jack Daniels that stood eagerly over the fridge.
I’d recently returned from my trip to Saudi Arabia, where I did business for two weeks straight plus another two weeks after a pause. I’d suffered in their heat and their strange customs for what seems like longer. I’d spent almost two months on the road, coming home for barely six hours at one point just to do laundry during a coincidental layover in Amsterdam. I’d strolled in Rome, hopped to New York, hung out in Barcelona, slaved in Riyadh, taught in Prague and then made a sale in Zurich, with a bit of time to head back to Amsterdam and take some sailing lessons. It had taken a brutal toll on my body.
It wasn’t the travel, though; I’ve been doing this for far too long for my body to complain about small confined spaces like economy seating and the perils of jetlag. I’ve been doing this for long enough to have withdrawal symptoms if I stopped, come to think of it. No; what was taking a toll on my body was a combination of stiffled desires and high levels of stress induced by the rigors of social mores in Saudi Arabia and a very serious lack of fun. Never knowing what’s appropriate and what’s not, not inclined to be the jackass American and start guffawing inappropriate questions left and right and no access to good information will drive a writing traveler insane in no time at all. I’ll get to that in a minute.
Because for a moment there I was back home and there we were, drinking ourselves silly under the pretext of discussing international politics and the place of culture in business and ethics in culture.
“Is it true that they have no women there?” Shane asked, only half joking.
“How do the women feel about how they’re treated?” Jo asked.
“You mean the ninjas.” Shane corrected her.
“Yes, Shane, the ninjas. How do the ninjas feel about how they’re ranked in society?”
“Well…” I started, already knowing it would make little sense. It never made sense to me and I had to go there just to understand why it would never make sense to me. “I asked around, because nothing I ever read made any sense to me. It still doesn’t, but I can tell you what they told me.
“I talked to these two women at the airport, foreigners, of course. A Brit and an Ozzy. They were wearing their abayas, though not covering their faces. I approached them at a coffee place at the terminal and using my charm and signature reporter’s notepad, told them I was writing a piece on women in the international marketplace. They must’ve assumed I was from the New York Times or something.” I paused, then looked up at Shane and Jo.
…
“Yeah. You must’ve been SOOOOO charming.”  She can do that. Shane smiled his goofy smile and waited for my comeback.
“Yeah, well. They talked to me, so, there. She didn’t retort but Shane looked disappointed, and rightfully so.
“They told me that their agency had told them to get abayas before coming and that they had to put it on before they got off the plane! Crazy, right?” I could see they agreed.
“Yeah, but how did they feel about it?” Jo asked. Obviously, her interest in the matter was more deeply rooted than Shane’s.
“Who? The foreigners or the Saudis?” I tried to clarify.
“Everyone!”
“Well, the foreigners are pretty much in accordance that they resent it and don’t understand it, but do it because it’s not their law and they don’t want to make a commotion. The locals don’t seem to love it, but that’s what they’re used to – taking it away from them would leave most of them in a distraught state of disarray. Not to mention that to them tradition is more important than history or happiness. Or at least maintaining the illusion of tradition. Understanding is not a requisite of obedience for them.”
Blank stares. I knew it. I didn’t understand it; how could I hope to explain it? I tried again.
“It’s like I heard the other day: ‘you’ve got to catch a girl without getting caught’…” I paused, hoping they would get it because a taxi driver had told me this with a lot of confidence, and I didn’t have time to have him explain it.
But, nothing.
“Look, as an example: I asked 3 cab drivers, 3 Saudi co-workers, 3 co-workers from Dubai and then did some reading…there’s no legal or acceptable way for a boy and a girl to meet.”
“WHAT?” snapped Shane, incredulous.
“I know. Crazy.”
“Does it have to be arranged, then?” Shane followed up.
“Legally, yes. But no one does it. You can imagine kids our age these days… our generation, as spread over the globe and facebook and myspace and all that… it is knows enough about the size of the world to realize that arranged marriages are about as good an idea as moving to Kansas City… it’s bound to fail.”
Shane laughed but Joanna didn’t get it and just mumbled, “… you American boys…”
“So how do they do it?” Shane asked.
“Well, there’s chat rooms online, but most people use bluetooth technology on their phones to find people within 10 meters of them and chat that way, and if they like each other they agree to meet secretly.

“In the airport, with parents and what not all around them… all I saw were children, between 10 and 16. The older girls were already old enough to cover themselves with veils and abayas… but a list of at least 40 different phones came up, with names like ‘so good to you’, ‘lonely and looking’, ‘girl unclaimed’, and ‘what’s your mobile nmbr sexy?’ I was appalled. I’ve never heard of such sexual frustration. Not even at an airport.”
“This is nuts!” Jo proclaimed.
“Everyone knows, of course, but the important thing is not to get caught. Parents supposedly facilitate it for their kids by looking the other way and giving them some privacy, but if caught, the fines and jail sentences are steep. It’s a savage place, man.
“Do people get out?” Shane asked. “You know – like the Dutch from Holland?”
“Some do, but it’s very difficult. You have to either be unemployed or else have permission from your employer to leave. And god help you if you’re a woman. Then you need a husband’s permission or a father’s… or you can go to Bahrain like the older men do for prostitutes.
“Surprised? You shouldn’t be. It’s like putting too much liquid in a glass bottle. You can’t try to stuff it in there; it’s got nowhere to go. People have needs, man.”
“Why do you keep calling me, ‘man’?” Jo asked. A fair question, I thought, but I ignored it all the same.
“But that’s just HYPOCRITICAL!” Shane announced. I agreed.
“I know. But it’s no different then those Catholic priests in Boston, man. These guys get on a plane in Riyadh on Wednesday nights (their Fridays) bound for Bahrain, a plane full of men in traditional and pious clothes. Everyone knows why. They get off in Bahrain, or Dubai, or wherever they went and their first stop is the duty-free shop, where they load up on whiskey, vodka, cognac and cigarettes. I’m talking CRATES.
These rich guys disappear into the prostitution houses of Bahrain and Dubai and when they come out on Friday (Sunday) they have their traditional clothes on, their heads covered and their smiles soft, likely like other parts of their bodies at this point. They get on a plane back to Riyadh and live out the rest of the week proclaiming how bad alcohol is for the spirit and so forth.”
“That disgusts me,” Jo said. I told her I understood.
“What’s really weird is how there is a lot that is similar to Brazilian society, at least on a detailed and fundamental level. You know, things like male-dominated structures, strong sense of religious propriety and favoritism for outsiders. Actually, that’s just like anywhere that has allowed religion to dominate the society…
I paused for a second, contemplating the fact.
“But nothing quite like Riyadh. Take this time, for example, just outside my hotel on like, the 2nd night that I’m there…
“I had gone to the food court at the mall across the way for some fish & chips and spring rolls (yeah, that’s a combination they’re into) and was going to eat them sitting in the middle of the grass. It was 11:30 at night and the heat was starting to get bearable. That and there was a fantastic full moon I wanted to get familiar with.
“I didn’t know whether it would be ok for me to sit on the grass in front of the hotel… I didn’t know if there was a policy or religious rule, you know, that said that that kind of thing is or is not ok… but I went and sat anyway.”
Shane scoffed at me. “You rebel.”
“I know, right? But soon I saw a handful of kids come running out onto the grassy area where I was sitting, doing cartwheels, sommersaults and basically being boys. They fell somewhere between 12 and 16 years of age but in that kind of crowd, boys will definitely be boys.
“They were chased off of the hotel’s grass suddenly and efficiently by 6 men in black suits that came out of nowhere. 4 men in desert fatigues came after them, armed with automatic rifles and vests that looked heavy with something or other. I froze, trying to reason that I couldn’t possibly be in any real danger there, right in front of the hotel but totally unsure of that.
“Well, on that day, 2 of them were arrested, it seemed. I guess all I know is what I saw. They were 14 or 15 years old and they were dragged off by a group of 6 to 8 armed men… who KNOWS where they’re being taken or what became of them?
“As I watched the kids go off in a dark sedan I noticed a black figure coming towards me across the lawn. Still sort of frozen, afraid to run and unsure of what to do if I stayed, I squinted until I could see that it was a thin black man in a dark suit, approaching me at a pretty committed pace. Even though his stature was small and his face was thin I was filled with a sudden panic. His stride was long, his steps, purposeful. It was definitely ME he was coming for and I didn’t know why. All I was doing was eating bad fish & spring rolls and drinking orange soda at 11:30 at night… but then, what were those kids doing?
“He walks with no swagger, but full of purpose – scrawny, unshaven, like so many of his ilk…
“My left hand shakes, ever so slightly. ‘Don’t let them see it, Pete’ I tell myself, unsure of what else to say. ‘Don’t let them smell the fear on you…’
“Another black suit approaches on my left. The air is warm. The night is fiercly dark and the dust is building in the atmosphere, but things are well-lit by the full moon. As the man on the right approaches he has a stern, slightly confused but genuine look on him of what-the-hell-do-you-think-you’re-doing? I remain silent, sure I’ve had it for good this time but still curious to know why, to know how deep this hole here goes. I must understand the obstinately obtuse resolution of these people. I say nothing. He says something in Arabic and I quiver but I don’t cower. How bad could this be?
“The man on my left approaches, smiling like he recognizes me. Must be a security guard from the hotel, I think, to kindly tell me to leave the hotel’s grass. That’s fine, I think to myself, having figured that I was pushing it anyways. But the other guy…
Uh-oh. The other guy is pretty upset, still.
“Then I hear the word ‘guest’ from the smiling man. He repeats it to the upset man, ‘hotel guest’. He smiles at me and tells me I can stay, ‘it’s ok, alright, please.’ he points to the place where I was sitting.
“‘Hot damn,’ I think. Thank God for preferential treatment for foreigners. They’re just like Brazilians in that sense. Man! I love a good string pull.”
Shane chimed in: “Yeah, I’ve heard the people there can be very angry-sounding.”
“Yeah,” I said.
“Yeah,” Shane replied.
“Totally,” I said. Joanna shook her head.
“So what about this heat?” Jo asked me with an urgency that suggested her next meal selection might depend on this knowledge.
“Well, it’s serious,” I said, trying to get it across. “I mean, 45 degrees isn’t a number to be taken lightly. And it’s DRY, you know? Sometimes at lunch time I have to walk something like, 5 blocks to get to the shopping mall where there’s food. In my work shirt and pants, I walk 5 blocks in 45 degree heat and don’t sweat a DROP. It’s nuts.
“And they keep the air conditioning in the office down to like, 4 degrees. That’s like a refrigerator, dude! These people have no concept of the term “comfortable work environment”. I have to take my suit to work because it’s too cold to work without it.  Shane asked me. I remembered back to the first time I’d seen a sand storm in Riyadh.
“Was there! The sky that morning had a yellowish hue to it, as if a field of mustard had exploded in the distance and spread over the horizon. Around the time I got to work and viewed it from the 13th floor of the al Anoud tower I could tell that whatever it was, it was closer than it had been before breakfast, and coming on fast. By noon time most of the city was covered as if by a thick desert fog, cutting visibility down to less than 200 meters. Riyadh had disappeared right before my eyes in the matter of a few morning hours.
“‘What IS that haze that’s covered the city?’ I asked no one in particular as I paused my work and stared out the window for a bit. The office didn’t even have cubicles, but was one of those ‘shared workspace’ environments that are getting more popular these days: just open desks all over the place. I suspect that it has to do with making people less apt to surf facebook or other such riff-raff, but anyone who walks around any IT office environment knows that hasn’t stopped.
“‘It’s a sand storm,’ said Hiatham, a friendly and deeply religious Saudi co-worker. ‘It’s the season for these. This is the 3rd one since you were last here.
“‘Sand storm…’ I mumbled to myself, remembering seeing these in films and having no idea there were this viscous. I’d always thought it was an exaggeration of Hollywood. But this thing was consuming radio towers and football fields and beginning to pile sand high against the corners of buildings still under construction. Nothing stays young for long in that place, man.”
“I’m glad you got back with your life,” Shane said.
“Me too,” I agreed.
“COME BACK ‘ERE WIT’ MY PANTS, MATE!” we heard some dripping wet English bloke yelling outside my window on the streets. I appreciated the distractions of Amsterdam, and was, surprisingly, still getting to know them well.
Outside there stirred our own great storm, fierce and violent like ancient angry gods. Whenever we saw the flashes we’d get giddy, and when the thunder roared, we cheered. When the sky brightened we jumped, laughing like hyenas and we felt like children staying up past their bedtime. It brought back memories of those afternoons in Brasilia and of those nights in São Paulo, where all the world was in a spiral around the tower of my hotel, where it seemed the very wind wanted to whisk me out by the throat, where the lightning wanted me saved for its own prickly little fingers. That was a turbulent time for me, when my divorce was still in its early stages of conception, when the trouble was brewing slowly and the bubbles hadn’t even reached the surface yet. And that lightning and that noise grounded me, gave me focus. I remembered it well.
But what I saw now only reminded me about the good parts of those days, like the fury and the texture of the violence in the wind that was such a rush to me. It brought back none of the loneliness or guilt or regret that I struggled with then because here, there was company. Good company.
Jo changed the subject, fumbling with a bowl of M&M’s and running her fingers through them like it was a beach full of sand: “I’m glad you’re back too,” she said, “you boys need to stop and stay in this town for longer than a day or two sometime. It could be fun, you know?”
Shane and I looked at each other.
“You didn’t tell her?” I accused him. “She’s gonna be pissed!” Shane shrugged, unsure of what to say.
“Tell me what?” Joanna asked, sort of innocently.
“Jesus. Jo, Shane lost his job and has to go back home.” Shane looked at me accusingly.
“Yeah, well, HE’s decided to move back to the States and start a business with me,” Shane said, putting what I thought was a little too much emphasis on the ‘HE’, but whatever.
“Oh,” she said, after some pause. We didn’t know what to say. I knew how badly the three of us needed each other’s company in this lonely place and I was afraid that with the two of us gone, Jo would either retreat into a corner somewhere or else blow her top and go absolutely nuts. Maybe she’d find a Dutch guy to hang with, or maybe she might even move to Belgium. You never know what a person will do in the throngs of sudden desperation, right?
“We need to get drunk, immediately,” she decided. I was relieved.
And then we did.


Log in with your Google+ account.
Find music from SoundCloud, images from Instagram or videos from YouTube.
Create albums with all that you find and share them with your friends.


曹雪芹其人
Cáo Xuěqín ([tsʰǎu̯ ɕy̯ètɕʰǐn]; Chinese: 曹雪芹); (1715 or 1724 – 1763 or 1764) was a Chinese writer during the Qing dynasty. He is best known as the author of Dream of the Red Chamber, one of the Four Great Classical Novels of Chinese literature. His given name was Cáo Zhān (曹霑) and his courtesy name was Mèngruǎn (simplified Chinese: 梦阮; traditional Chinese: 夢阮). ---- 来自《维基百科》
{{ book.heading.title }}
{{ book.heading.titleDetails }}


GitHub user
GitHub token
JIRA Project
GitHub Owner
Destination Repo
Import issues
Goto GitHub
IMPORTANT NOTICE
You need a COOR browser extension to run this. E.g. Chrome "Allow-Control-Allow-Origin
Console
Some text some message..


--- layout: post title: 'QuickTip: Right click to open terminal in current directory in Ubuntu' date: 2011-02-10 21:38:00.000000000 +05:30 type: post published: true status: publish categories: - Tech Bytes - Ubuntu tags: - GNU/Linux - QuickTip - stuff - Ubuntu meta: aktt_notify_twitter: 'yes' _edit_last: '1' _syntaxhighlighter_encoded: '1' _wp_old_slug: '' dsq_thread_id: '477781312' _thumbnail_id: '641' image: '' seo_follow: 'false' seo_noindex: 'false' dsq_needs_sync: '1' author: login: satyadeep email<EMAIL_ADDRESS>display_name: Satyadeep first_name: Satyadeep last_name: K ---
Wouldn't it be useful to open the terminal in the current directory from the GNOME file browser of Ubuntu? The following package gives an option to open the terminal from the right click menu in the nautilus file browser.
Install the package nautilus-open-terminal from the Synaptic package manager or by using the command
[bash]sudo apt-get install nautilus-open-terminal[/bash]
You may need to restart nautilus for the change to appear.
[bash] killall nautilus && nautilus[/bash]
By the way, what is nautilus?
Ans: It is the official file manager for the GNOME desktop, just like explorer is the file manager for Windows.


Low-level utilities used internally by NDB.
These are not meant for use by code outside NDB.
| def google.appengine.ext.ndb.utils.decorator |
( |
|
wrapped_decorator | ) |
|
Converts a function into a decorator that optionally accepts keyword
arguments in its declaration.
Example usage:
@utils.decorator
def decorator(func, args, kwds, op1=None):
... apply op1 ...
return func(*args, **kwds)
# Form (1), vanilla
@decorator
foo(...)
...
# Form (2), with options
@decorator(op1=5)
foo(...)
...
Args:
wrapped_decorator: A function that accepts positional args (func, args,
kwds) and any additional supported keyword arguments.
Returns:
A decorator with an additional 'wrapped_decorator' property that is set to
the original function.


@java Feature: Java homework @java1 Scenario: Converter Given I convert 1 foot to centimeters And I convert 1 US gallon to liters And I convert 0 Celsius to Fahrenheit @java2 Scenario: Use if/else statements Given I check if number “12” is odd or even Then I check if number “11” is odd or even @java3 Scenario: Check Grades Given I got 89 percent on my test @java4 Scenario: Calculating cost of fruit Given I want to know cost of 4 pounds of "grapefruits" @java5 Scenario: Print days of the week Given I print days


The GenDocumentControl handles interaction between the document control and the user. It maintains the File menu entries and manages the file selector. Its attributes all relate to these duties. A complete list of the attributes follows in GenDocumentControl Instance Data along with comments and the default values.
Some of these data fields can be examined but not set by the application. Data fields for purely internal use (which are neither examined, nor set, by applications) are not listed.
Code Display 13-1 GenDocumentControl Instance Data
/* The GDCI_documentToken field specifies the token characters and token ID of * files managed by this document control. All files created by the document * control will have these token characters, and the File Selector object will be * set to allow only such files to be selected. This attribute is ignored if DOS * files are being opened. */ @instance GeodeToken GDCI_documentToken = {};
/* GDCI_selectorType determines which files will be displayed by the File Selector * generated by this object. Only one of the options may be set. By default, only * documents are visible. */ @instance GenFileSelectorType GDCI_selectorType = GFST_DOCUMENTS; /* Types available: * GFST_DOCUMENTS, GFST_EXECUTABLES, * GFST_NON_GEOS_FILES, GFST_ALL_FILES */
/* GDCI_attrs specifies certain characteristics of the file to be opened. The * default setting is shown below. */ @instance GenDocumentControlAttrs GDCI_attrs = ((GDCM_SHARED_SINGLE << GDCA_MODE_OFFSET) | GDCA_VM_FILE | GDCA_SUPPORTS_SAVE_AS_REVERT | (GDCT_NEW << GDCA_CURRENT_TASK_OFFSET)) /* Attributes available: * GDCA_MODE: * GDCM_VIEWER, GDCM_SHARED_SINGLE, * GDCM_SHARED_MULTIPLE * GDCA_CURRENT_TASK: * GDCT_NONE, GDCT_NEW, * GDCT_OPEN, GDCT_USE_TEMPLATE, * GDCT_SAVE_AS, GDCT_COPY_TO, * GDCT_DIALOG, GDCT_TYPE, * GDCT_PASSWORD * Other fields: * GDCA_MULTIPLE_OPEN_FILES, GDCA_DOS_FILE_DENY_WRITE, * GDCA_VM_FILE, GDCA_NATIVE, * GDCA_SUPPORTS_SAVE_AS_REVERT, GDCA_DOCUMENT_EXISTS, * GDCA_DO_NOT_SAVE_FILES */
/* GDCI_features specifies certain extra features of the document control. The * default setting is shown below. */ @instance GenDocumentControlFeatures GDCI_features = (GDCF_READ_ONLY_SUPPORTS_SAVE_AS_REVERT | GDCF_SINGLE_FILE_CLEAN_CAN_NEW_OPEN | GDCF_SUPPORTS_TEMPLATES | GDCF_SUPPORTS_USER_SETTABLE_EMPTY_DOCUMENT | GDCF_SUPPORTS_USER_MAKING_SHARED_DOCUMENTS | GDCF_NAME_ON_PRIMARY); /* Flags available: * GDCF_READ_ONLY_SUPPORTS_SAVE_AS_REVERT, * GDCF_SINGLE_FILE_CLEAN_CAN_NEW_OPEN, * GDCF_SUPPORTS_TEMPLATES, * GDCF_SUPPORTS_USER_SETTABLE_EMPTY_DOCUMENT, * GDCF_SUPPORTS_USER_SETTABLE_DEFAULT_DOCUMENT, * GDCF_SUPPORTS_USER_MAKING_SHARED_DOCUMENTS, * GDCF_NAME_ON_PRIMARY */
/* GDCI_enableDisableList specifies objects which should be enabled whenever a * document is opened and disabled when all documents are closed. The field is the * handle of a chunk containing a list of optrs to the objects to be enabled and * disabled. The default value is a null handle.*/ @instance ChunkHandle GDCI_enableDisableList;
/* The GDCI_openGroup, GDCI_importGroup, GDCI_useTemplateGroup, GDCI_saveAsGroup, * GDCI_exportGroup, and GDCI_userLevelGroup attributes hold optrs to groups of UI * objects to be added to the "Open," "Import," "Use Template," "Save As," * "Export," and "User Level", dialog boxes, respectively. The GDCI_dialogGroup * field holds an optr to objects to be added to the opening dialog box. The optr * is to the head of a tree of UI objects. The top object in the tree should be * set "not usable." Default values are all null optrs. */ @instance optr GDCI_openGroup; @instance optr GDCI_importGroup; @instance optr GDCI_useTemplateGroup; @instance optr GDCI_saveAsGroup; @instance optr GDCI_exportGroup; @instance optr GDCI_dialogGroup; @instance optr GDCI_userLevelGroup;
/* If the GDCI_features field includes "displayNameOnPrimary" but no document is * open, the Primary's moniker is set to the string pointed to by the * GDCI_noNameText attribute. The default value is a null chunk handle. */ @instance ChunkHandle GDCI_noNameText;
/* If the GDCA_currentTask section of the GDCI_attrs field is set to * GDCT_NONE on startup, then the file specified by GDCI_defaultFile will be * opened (and, if necessary, created). The file is specified by a chunk handle of * a null-terminated string; this string should specify the file's path relative * to the SP_DOCUMENT standard path.The default value is a null chunk handle, * indicating that if the startup value of GDCA_currentTask is GDCT_NONE, no * documents should be opened. */ @instance ChunkHandle GDCI_defaultFile;
/* GDCI_templateDir is the chunk handle of a null-terminated text string which * specifies a directory to hold template documents. The directory is specified * relative to SP_TEMPLATE. If not set by you, this defaults to the SP_TEMPLATE * standard path. */ @instance ChunkHandle GDCI_templateDir;
/* GDCI_documentGroup is an optr to the GenDocumentGroup object. You must set * this field. */ @instance optr GDCI_documentGroup;
/* GDCI_targetDocName is a character array. It is set to contain the name of * the current target file. This field is automatically updated by the document * control. */ @instance FileLongName GDCI_targetDocName = "";
/* The Document Control automatically displays a big dialog box at startup which * lets the user choose to create, open, etc. a file. Each option has a button * (with a picture) and an explanatory text. You can override the default graphic * or text by setting any of the following fields: */
@instance ChunkHandle GDCI_dialogNewText; @instance ChunkHandle GDCI_dialogTemplateText; @instance ChunkHandle GDCI_dialogOpenDefaultText @instance ChunkHandle GDCI_dialogImportText; @instance ChunkHandle GDCI_dialogOpenText; @instance ChunkHandle GDCI_dialogUserLevelText;
@instance @visMoniker GDCI_dialogNewMoniker; @instance @visMoniker GDCI_dialogTemplateMoniker; @instance @visMoniker GDCI_dialogOpenDefaultMoniker @instance @visMoniker GDCI_dialogImportMoniker; @instance @visMoniker GDCI_dialogOpenMoniker; @instance @visMoniker GDCI_dialogUserLevelMoniker;
GDCI_documentToken, MSG_GEN_DOCUMENT_CONTROL_GET_TOKEN, MSG_GEN_DOCUMENT_GROUP_GET_TOKEN
The document control's file selector will display only those files whose document token matches the GenDocumentControl object's
GDCI_documentToken
attribute. All files created by the application will have the specified document tokens. There are no messages to alter the token attributes at run-time. (If the document control is used to manage DOS files, the file selector will show all non-GEOS files.)
A token is defined by a
GeodeToken
structure. The format of this structure is shown below. The first field,
GT_chars
, will vary for each document type. The second,
GT_manufID
, will be the same for the tokens of all applications and documents created by a given company.
typedef struct { char GT_chars[TOKEN_CHARS_LENGTH]; /* TOKEN_CHARS_LENGTH = 4 */ ManufacturerID GT_manufID; /* word-sized integer */ } GeodeToken;
The message
MSG_GEN_DOCUMENT_CONTROL_GET_TOKEN
instructs the GenDocumentControl object to write a copy of the document token to a specified address. The message has one argument: the address of a
GeodeToken
.
MSG_GEN_DOCUMENT_GROUP_GET_TOKEN
functions identically, but it is sent to the GenDocumentGroup object.
You can also find out the application's token by sending GEN_DOCUMENT_CONTROL_GET_CREATOR or GEN_DOCUMENT_GROUP_GET_CREATOR to the appropriate object. The application's token will be used as the "creator token" for any documents created by the document control.
void MSG_GEN_DOCUMENT_CONTROL_GET_TOKEN( GeodeToken * token); /* address to copy token to */
This message gets the document token values for all documents created by this document control.
Source: Unrestricted.
Destination:
Any GenDocumentControl object.
Parameters:
token
A pointer to an empty
GeodeToken
structure.
Return: The document
GeodeToken
is written to the variable whose address is passed.
Interception: You should not subclass this message.
void MSG_GEN_DOCUMENT_GROUP_GET_TOKEN( GeodeToken * token); /* address to copy token to */
This is the same as
MSG_GEN_DOCUMENT_CONTROL_GET_TOKEN
, except that it is sent to the GenDocumentGroup object instead of the GenDocumentControl object.
Source: Unrestricted.
Destination:
Any GenDocumentGroup object.
Parameters:
token
A pointer to an empty
GeodeToken
structure.
Return: The document
GeodeToken
is written to the variable whose address is passed.
Interception: You should not subclass this message.
void MSG_GEN_DOCUMENT_CONTROL_GET_CREATOR( GeodeToken * token); /* address to copy token to */
This message gets the token for the application; this token is the "creator token" for all files created by the document control.
Source: Unrestricted.
Destination:
Any GenDocumentControl object.
Parameters:
token
A pointer to an empty
GeodeToken
structure.
Return: The document
GeodeToken
is written to the variable whose address is passed.
Interception: You should not subclass this message.
void MSG_GEN_DOCUMENT_GROUP_GET_CREATOR( GeodeToken * token); /* address to copy token to */
This is the same as
MSG_GEN_DOCUMENT_CONTROL_GET_CREATOR
, except that it is sent to the GenDocumentGroup object instead of the GenDocumentControl object.
Source: Unrestricted.
Destination:
Any GenDocumentGroup object.
Parameters:
token
A pointer to an empty
GeodeToken
structure.
Return: The document
GeodeToken
is written to the variable whose address is passed.
Interception: You should not subclass this message.
GDCI_selectorType
The
GDCI_selectorType
field determines what files will be displayed by and can be opened with the file selector. The options are stored as a byte-sized enumerated type. The options are:
GDCI_attrs, MSG_GEN_DOCUMENT_CONTROL_GET_ATTRS, MSG_GEN_DOCUMENT_GROUP_GET_UI_ATTRS
The GenDocumentControl
object has eight attribute flags stored in the word-sized bitfield
GDCI_attrs
. They may be retrieved by sending
MSG_GEN_DOCUMENT_CONTROL_GET_ATTRS
to the GenDocumentControl
object or by sending
MSG_GEN_DOCUMENT_GROUP_GET_UI_ATTRS
to the GenDocumentGroup object. The attributes are set at coding time; there is no way for an application to change the attributes at run-time, although the GenDocumentControl will change some of the attributes to reflect its current state.
The attributes are
GDCI_attrs = (@default & ~GDCA_MODE) \ | (GDCM_VIEWER << GDCA_MODE_OFFSET);
GenDocumentClass
with handlers for
MSG_GEN_DOCUMENT_PHYSICAL_SAVE_AS
and
MSG_GEN_DOCUMENT_PHYSICAL_REVERT
, but this is not recommended. Ordinarily, this attribute should be off for DOS files.If a document is passed in to be opened at startup (as, for example, when a user launches an application by double-clicking a file created by the application), that file will be opened, and the initial setting of GDCA_CURRENT_TASK will be ignored. The document control automatically maintains this bitfield to correspond to whatever action the document control is currently taking. The application can find out what the document control is doing by reading the attributes and checking this field.
GenDocumentControlAttrs MSG_GEN_DOCUMENT_CONTROL_GET_ATTRS();
Use this message to find out what the GenDocumentControl object's
GDCA_attrs
flags are. The attributes cannot be changed by a message; they can only be read.
Source: Unrestricted.
Destination:
Any GenDocumentControl object.
Parameters: None.
Return: Returns a word-length bitfield containing GDCA
_attrs
record.
Interception: You should not subclass this message.
GenDocumentControlAttrs MSG_GEN_DOCUMENT_GROUP_GET_UI_ATTRS();
This message is the same as the
MSG_GEN_DOCUMENT_CONTROL_GET_ATTRS
message (see above) except that it is sent to the GenDocumentGroup object.
Source: Unrestricted.
Destination:
Any GenDocumentGroup object.
Parameters: None.
Return: A word-length record containing the GDCA
_attrs
field.
Interception: You should not subclass this message.
GDCI_features, MSG_GEN_DOCUMENT_CONTROL_GET_FEATURES, MSG_GEN_DOCUMENT_GROUP_GET_UI_FEATURES, MSG_GEN_CONTROL_CONFIGURE_FILE_SELECTOR
The
GDCI_features
attribute specifies whether certain optional functionality of the Document Control technology is enabled. The features are determined at coding time; there is no message to change features at run-time. To retrieve the features, send
MSG_GEN_DOCUMENT_CONTROL_GET_FEATURES
.
GDCA_MULTIPLE_OPEN_FILES
is on. If GDCF_SINGLE_FILE_CLEAN_CAN_NEW_OPEN is on and GDCA_MULTIPLE_OPEN_FILES is off, the "New" and "Open" triggers are enabled when the document is "clean" (i.e., the document has not been marked "dirty" since it was opened/created or saved); that is, "New" and "Open" are enabled whenever "Save" is disabled. If the user chooses "New" or "Open" when the document is "clean," the target document is closed and the new document is opened or created. If both GDCA_MULTIPLE_OPEN_FILES and GDCF_SINGLE_FILE_CLEAN_CAN_NEW_OPEN are off, the "New" and "Open" triggers are disabled whenever a document is open. By default, this attribute is on.
GDCI_noNameText
. By default, this attribute is on.
For an added degree of control, you can use
MSG_GEN_DOCUMENT_CONTROL_CONFIGURE_FILE_SELECTOR
to change the attributes of the document control's file selector.
GenDocumentControlFeatures MSG_GEN_DOCUMENT_CONTROL_GET_FEATURES();
Use this message to retrieve the current
GDCI_features
flags. The flags cannot be changed at run-time.
Source: Unrestricted.
Destination:
Any GenDocumentControl object.
Parameters: None.
Return: The GenDocumentControl's
GDCI_features
flags.
Interception: You should not subclass this message.
GenDocumentControlFeatures MSG_GEN_DOCUMENT_GROUP_GET_UI_FEATURES();
Use this message to retrieve the current
GDCI_features
flags. The flags cannot be changed at run-time.
Source: Unrestricted.
Destination:
Any GenDocumentGroup object.
Parameters: None.
Return: The GenDocumentControl's
GDCI_features
flags.
Interception: You should not subclass this message.
void MSG_GEN_DOCUMENT_CONTROL_CONFIGURE_FILE_SELECTOR( optr fileSelector, word flags); /* GenDocumentControlAttrs */
Configure file selector. This message can be sub-classed to modify the behavior of the file selectors that the document control uses.
GDCI_enableDisableList
The GenDocumentControl can be set to enable certain UI objects when documents are open. This is done using the
GDCI_enableDisableList
attribute. This attribute is the chunk handle of a list of object-pointers. Each of the referenced objects should start as disabled. Whenever a document is opened, a
MSG_GEN_SET_ENABLED
is sent to each object in the list. When the last document is closed, a
MSG_GEN_SET_NOT_ENABLED
is sent to each object in the list.
GDCI_openGroup, GDCI_importGroup, GDCI_useTemplateGroup, GDCI_saveAsGroup, GDCI_exportGroup, GDCI_dialogGroup, GDCI_userLevelGroup
The GenDocumentControl object manages the dialog boxes for many different user actions. The programmer can specify a tree of UI objects to be included with each of these dialog boxes. For example, to add a group of objects to the "Use Template" dialog box, the programmer should put them all in a tree (perhaps by making them all children of a
GenInteraction object) and store an object-pointer to the head of the tree in
the
GDCI_useTemplateGroup
attribute. The top object in the tree should be set "not usable."
GDCI_noNameText
The GenDocumentControl object can be set to display the name of the current target document in the moniker of the
GenPrimary
window. If this feature is enabled, and no document is opened, the
GenPrimary
will have its moniker change to the string specified by
GDCI_noNameText
. If the feature
GDCF_DISPLAY_NAME_ON_PRIMARY is disabled,
GDCI_noNameText
is ignored.
GDCI_defaultFile
If the attribute GDCA_CURRENT_TASK is initially set to GDCT_NONE and a default file is specified, the default file is automatically opened at startup. If GDCA_CURRENT_TASK is not initially set to GDCT_NONE, this attribute is ignored. This field holds the chunk handle of a null-terminated string. The string specifies the file's path relative to the SP_DOCUMENT. If the feature
GDCF_SUPPORTS_USER_SETTABLE_DEFAULT_DOCUMENT is enabled, this attribute can be changed by the user at run-time. If the file specified does not exist, it is created as an empty document; if the document exists but cannot be opened, no file is opened at startup. If the named document exists but is inappropriate (e.g. it was created by another application), no document is opened at startup.
GDCI_templateDir
If templates are supported, this is the default directory for opening and saving them. This string specifies a subdirectory to the standard path SP_TEMPLATE. If not explicitly set in the source code, the template directory will default to SP_TEMPLATE.
GDCI_documentGroup
The GenDocumentControl and the GenDocumentGroup communicate with each other via messages. To do this, each needs the optr of the other. GDCI
_documentGroup
is the optr of the
GenDocumentGroup
object for this application. It is set in the source code and may not be changed at run time.
GDCI_targetDocName
This attribute contains the name of the target document. The document control automatically sets and updates this field when necessary.