text stringlengths 20 1.01M | url stringlengths 14 1.25k | dump stringlengths 9 15 ⌀ | lang stringclasses 4
values | source stringclasses 4
values |
|---|---|---|---|---|
Android may be one of the most popular operating systems in the world, but it’s far from the only mobile operating system. If your app is going to reach the widest possible audience, then you’ll need to make it available on other platforms, including iOS.
Read Next: Cross-platform mobile development — challenges, options, and why you should consider it
Porting your Android app to iOS requires time and effort. Along the way you may start to wonder whether this is really the best use of your time — wouldn’t it make more sense to concentrate on polishing the work you’ve done so far, rather than simply re-creating it on another platform? Ideally, you’d be able to cut your development time by creating a single app that can run across multiple platforms.
Google Flutter is a user interface (UI) toolkit that promises to do exactly that, giving you a way to develop UIs for Android and iOS from a single codebase.
By the end of this article you’ll have added Flutter support to your Android Studio installation, explored some of its core features, and created a “Hello World” application, written entirely in Google Flutter.
Why should I use Google Flutter?
Google Flutter isn’t based on Kotlin or Java. If you want to develop for it, you’ll need to learn Dart.
While the thought of learning yet another programming language may be off putting, there are some pretty compelling reasons to give Flutter a try:
- Cross-platform: By using the same renderer, framework, and libraries, Flutter lets you create a single UI to run on both Android and iOS. To ensure your application feels equally at home on either platform, Flutter provides widgets styled according to Cupertino (iOS) and Material Design (Android) guidelines, plus a number of Flutter packages that give you access to some platform-specific services and APIs.
- Compatible with other programming languages: Flutter integrates with Java code on Android, and ObjectiveC and Swift on iOS, so you don’t have to completely rewrite your existing applications to start using Flutter.
- Hot reload. It’s common practice to work on your application’s code while the application itself is running on an Android device to test changes as you make them. The time it takes Android Studio to push each set of changes to the running application can really eat into your development time. To help you be more productive, Flutter has a “hot reload” feature that can inject updated source code into a running Dart Virtual Machine (VM)..
Installing Google Flutter and Dart
The Google Flutter SDK includes pretty much everything you’ll need to get started with Flutter, including the Dart SDK. However, it’s hosted on GitHub, you should probably clone this SDK using Git, rather than downloading it.
One of the major benefits of cloning a project, is that it’s much easier to keep up to date with new releases.
Once you’ve installed the latest version of Git, you’re ready to clone Flutter:
- Head over to Flutter’s GitHub page.
- Click “Clone or download,” and then copy the URL.
- Open a Command Prompt (Windows) or Terminal (Mac) window, and type “git clone,” followed by “-b beta” (since we’re cloning Flutter’s beta branch), and the project’s URL:
git clone -b beta
- Next, add Flutter to your path using the following command:
export PATH=$PWD/flutter/bin:$PATH
- Check whether there’s any missing dependencies or outstanding tasks you need to perform by running the following Command Prompt/Terminal command:
flutter doctor
- If the subsequent report warns you that your Flutter installation is “x” days old, then run the following:
Flutter upgrade
Google Flutter may also warn that your Xcode installation is incomplete. You only need Xcode if you’re developing for iOS. If you’re only interested in Android, save yourself some time and disk space by ignoring this warning.
Adding Google Flutter and Dart to Android Studio
You can use Google Flutter with any text editor, but it’s far easier to use Android Studio’s dedicated Flutter and Dart plugins.
Assuming you’re running Android Studio 3.0 or later:
- Select “Android Studio > Preferences…” from the toolbar.
- Select “Plugins” from the left-hand menu.
- Give the “Browse repositories…” button a click.
- Search for “Flutter.” When the plugin appears, click its accompanying “Install” button.
- At this point, a popup should prompt you to install Dart. Click “Yes.”
- Restart Android Studio.
Creating your first Google Flutter app
The best way to learn a new technology, is to use it, so let’s create a “Hello World” app using Flutter and Dart:
- Select “New > New Flutter Project…” from the Android Studio toolbar.
- Select “Flutter application > Next.”
- Give your project a name and specify where it should be stored.
- Point Android Studio in the direction of your Flutter SDK by clicking the little “…” icon and navigating to the “Flutter” folder (on Mac, this is typically stored in your Home directory). Click “Open.”
- Enter your company domain, and then click “Finish.”
Open your project’s flutter_app/java/main.dart file. The “Flutter application” template contains lots of code (which we’ll be exploring later) but for now let’s keep things simple and create an app that displays a “Hello World” message. Delete everything in this file and replace it with the following:
import 'package:flutter/material.dart'; void main() => runApp(new MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Welcome to Flutter', home: new Scaffold( appBar: new AppBar( title: new Text('This is the title text'), ), body: new Center( child: new Text('Hello World'), ), ), ); } }
To run this app, follow these steps:
- Launch an Android Virtual Device (AVD) or attach a physical Android device to your development machine.
- Open the “Flutter Device Selection” dropdown (where the cursor is positioned in the following screenshot) and select your device.
- Select “Run > main.dart” from the Android Studio toolbar.
This app may be simple, but it demonstrates some of the core concepts of developing with Flutter, so let’s break it down:
void main() => runApp(new MyApp());
In Dart, the => expression is shorthand for { return expression; }.
class MyApp extends StatelessWidget {
In Flutter, almost everything is a widget. Some Flutter widgets are the rough equivalent of Android’s Views. For example the Text widget is equivalent to a TextView. However, in Flutter rows, columns, padding, and even the application itself are also classed as widgets, which is why our application class extends from something called StatelessWidget.
StatelessWidgets are widgets that contain no State. All of a StatelessWidget’s values are final and cannot change at runtime, so the StatelessWidget simply renders what’s passed to its constructors.
The opposite of StatelessWidget is a StatefulWidget, which can change at runtime.
@override Widget build(BuildContext context) {
The build() method describes how to display a widget. Flutter calls build() when it inserts a widget into the widget hierarchy, and then re-runs build() every time that widget needs to be updated.
return new MaterialApp(
Flutter comes with an implementation of Material Design that you can apply by declaring “MaterialApp” as your app’s top level widget.
Here, we’re using the MaterialApp theme out-of-the-box, but you can customize this theme by creating a new ThemeData() instance that contains your desired changes, for example:
import 'package:flutter/material.dart'; void main() => runApp(new MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Welcome to Flutter', theme: new ThemeData( primaryColor: Colors.white, ), home: new Scaffold( appBar: new AppBar( title: new Text('This is the title text'), ), body: new Center( child: new Text('Hello World'), ), ), ); } }
home: new Scaffold(
The “home” argument references the widget that defines the main UI, which in this instance is Scaffold.
A Scaffold widget gives your app a structure that follows Material Design guidelines, by providing an app bar, title, and background color. It also provides APIs for displaying drawers, snackbars, and bottom sheets.
appBar: new AppBar( title: new Text('This is the title text'), ),
Here, we’re setting the text for our app bar. While apps like Scaffold and AppBar are specific to Material Design apps, Text is a generic widget that you can use in any app.
body: new Center( child: new Text('Hello World'),
Center is a layout widget that takes a single child and positions it in the middle of the screen, similar to a LinearLayout with a central gravity.
Creating our second Flutter app: User interaction and StatefulWidgets
We’ve created our first Google Flutter application, but it’s not exactly an exciting app. Learning a new toolkit and an entire programming language is slightly beyond the scope of this article, so for our second application let’s cheat and use a template:
- Select “New > New Flutter Project…”
- Select the “Flutter application” template, and then click “Next.”
- Complete the standard project setup.
- Run this app, by opening the “Flutter Device Selection” dropdown and selecting your device from the list.
- Select “Run > main.dart” from the Android Studio toolbar.
This app counts how many times you’ve tapped the Floating Action Button.
If you open the flutter_app/java/main.dart file, you’ll see the following:
import 'package:flutter/material.dart'; void main() => runApp(new MyApp()); class MyApp extends StatelessWidget { ; //Prefixing an identifier with an underscore makes it private to its class// @override _MyHomePageState createState() => new _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { int _counter = 0; //Increment the counter following the click// void _incrementCounter() { setState(() { _counter++; }); } @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( //Set the appbar’s title, by passing the .title defined in MyHomePage// title: new Text(widget.title), ), body: new Center( //Column is a layout widget, similar to Center// child: new Column( //mainAxisAlignment position the widgets inside the Column// mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ new Text( 'You have pushed the button this many times:', ), new Text( '$_counter', style: Theme.of(context).textTheme.display1, ), ], ), ), floatingActionButton: new FloatingActionButton( onPressed: _incrementCounter, //Similar to Android’s contentDescription, tooltips provide text labels for// //assistive technologies such as screen readers// tooltip: 'Increment', //Display the ‘Add’ icon. See the Icons class docs for a list of supported icons// child: new Icon(Icons.add), ), ); } }
This automatically-generated code demonstrates a number of Flutter features we haven’t touched on yet:
StatefulWidgets
In Google Flutter, widgets are either stateless or stateful. A StatefulWidget has State information that can change at runtime, in response to user interaction.
A StatefulWidget consists of these things:
- A widget that extends the StatefulWidget class, which is immutable. The actual StatefulWidget is a temporary object used to construct the app in its current state.
- A State class, which contains some mutable data that might change over the widget’s lifetime. State objects persist between calls to build(), so they can retain information.
You insert the State object into the widget tree, by calling createState.
You also need to define a setState method, which informs Flutter when the widget’s State changes, causing the framework to rebuild this particular widget.
class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override //Override the createState() method to attach the _MyHomePageState class// _MyHomePageState createState() => new _MyHomePageState(); } //Add the _MyHomePageState class// class _MyHomePageState extends State<MyHomePage> { int _counter = 0; void _incrementCounter() { setState(() { _counter++; }); }
Rows and columns
In Flutter, you arrange widgets by placing them inside other widgets, most commonly in two orientations:
- A Row takes a list of child widgets and displays them horizontally.
- A Column takes a list of child widgets and displays them vertically.
Both Rows and Columns have various properties that let you control exactly where each child appears onscreen, and how much space they occupy within the Row or Column. Here, we’re using a mainAxisAlignment property to specify that the child widgets should be centered along the parent’s main axis:
child: new Column( mainAxisAlignment: MainAxisAlignment.center,
If the parent is a Column, then the main axis is the vertical axis. If the parent is a Row, then the main axis is the horizontal axis.
Detecting user interaction
There’s another big difference between this application and our “Hello World” project — it can detect user input!
If a widget already supports event detection, you just need to pass a function that can handle the desired interaction, for example:
floatingActionButton: new FloatingActionButton( //Pass the onPressed parameter, which is essentially the equivalent of onClick// onPressed: _incrementCounter, tooltip: 'Increment', child: new Icon(Icons.add), ), ); } }
The easiest way to check whether a widget supports event detection, is to review its documentation. For example, the FloatingActionButton page makes it clear this widget supports onPressed.
If a widget doesn’t support event detection, you can make it interactive by wrapping it in a GestureDetector widget, which can detect gestures like taps, presses, and drags.
In this snippet, GestureDetector responds to user input by calling onTap and then printing a message to the Console:
class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new Scaffold( body: new Center( child: new GestureDetector( child: new FlutterLogo( size: 300.0, ), //When the child widget is tapped....// onTap: () { //...print the following// print("onTap!"); }, ), )); } }
Push changes to your application in under a second
If you’re familiar with Android Studio’s “Instant Run,” then you’ll know just how much time you can save by selectively pushing changes, rather than building a new APK every time you tweak your application code.
Google Flutter has a similar “Hot Reload” feature which lets you push updated code and resources to a running Dart VM while maintaining the application’s state. This application is perfect for demonstrating hot reload:
- Click the FAB button a few times so the counter is displaying anything other than 0.
- Make an arbitrary change to the project’s code, for example changing:
home: new MyHomePage(title: 'Flutter Demo Home Page'),
To:
home: new MyHomePage(title: 'Flutter'),
- Click the little “Flutter Hot Reload” button in the Android Studio toolbar (it uses exactly the same icon as Instant Run).
- Take a look at your application. The title should have changed without resetting the counter to zero, demonstrating that the application state has been preserved.
Wrapping up
In this article, we got an introduction to Google Flutter and Dart — what it is, how to set it up, and how to create some simple apps.
Will you be adding Dart to the list of languages you use for Android development? Or are you sticking with Java (or Kotlin?) Let us know in the comments below!
Save 60% on our Introduction to Android Development CourseAndroid Authority has created a course to help you learn how to develop Android Apps! No Coding Experience Required. Start Your Journey on Becoming an Android Developer today.
| https://www.androidauthority.com/create-google-flutter-app-854337/ | CC-MAIN-2019-51 | en | refinedweb |
I was quite pleased with yesterday's simple Bash script to “de-cache” Dart packages for deployment to my simple GitHub pages site. It seemed a nice, concise solution to a problem in need of a bit of automation. I was almost proud. And then Kasper Lund told me about
pub deploy.
In my defense, I did know of
pub deploy, but after brief examination, had decided it was not likely a good candidate for my use-case. But I did not actually try it to make sure. Tonight I do so.
On the pages web site, I have two sub-directories:
iceand
ice-beta. These contain different versions of the ICE Code Editor at and. Both of these sub-directories are nearly identical with an
index.htmlpage, a
main.dartscript that starts the application, and a bunch of Dart packages in the
packagessub-directory created by the Dart Pub tool: filesThere is other stuff in there as well, but that (I think) is the most important bit for tonight. The
index.htmlneeds to reside there because it enables GitHub pages to serve up a page when the directory is accessed (e.g.). The
main.dartis important because it imports the ICE package:
import 'package:ice_code_editor/ice.dart' as ICE; main()=> new ICE.Full();Last night's
decache.shconverted the symbolic links in the
packagessub-directory into local copies so that they will still work once pushed to GitHub (GitHub pages do not work with symbolic links).
So will
pub deploywork with this?
As is, the answer would seem to be “no”:
➜ ice-beta git:(gh-pages) ✗ pub deploy There is no '/home/chris/repos/gamingjs/ice-beta/web' directory.This error would seem to refer to the pub layout convention for Dart web applications.
Perhaps if I copy the
index.htmlfile into a
websub-directory?
➜ ice-beta git:(gh-pages) ✗ mkdir web ➜ ice-beta git:(gh-pages) ✗ cp index.html web ➜ ice-beta git:(gh-pages) ✗ pub install Resolving dependencies......... Dependencies installed! ➜ ice-beta git:(gh-pages) ✗ pub deploy Finding entrypoints... Copying web/ → deploy/ ➜ ice-beta git:(gh-pages) ✗ ls deploy index.htmlThat did not seem to do anything useful. Perhaps if I also place my
main.dartentry point in there?
➜ ice-beta git:(gh-pages) ✗ cp main.dart web ➜ ice-beta git:(gh-pages) ✗ pub deploy Finding entrypoints... Copying web/ → deploy/ Compiling web/main.dart → deploy/main.dart.js ➜ ice-beta git:(gh-pages) ✗ ls deploy index.html main.dart main.dart.jsAh, that is pretty nice. Compiling my application to JavaScript and moving it into the
deploydirectory is quite useful. But not in my particular use-case.
I need to have the main entry point for ICE directly in the
icesub-directory. I even need this locally so that I can test things out with a local Jekyll server. Placing my
index.htmlapplication page and the associated
main.dartentry point down a level are not going to serve the correct URLs. So I think I have a handle on
pub deploy, but I think my custom built
decache.shwill still be of use.
Day #822
One option you could try is to put another entrypoint in web/ that just imports your "real" entrypoint in the "ice" directory and then invokes main() on it. That would let pub deploy find it while still leaving it where you want it. | https://japhr.blogspot.com/2013/07/getting-started-with-dart-pub-deploy.html | CC-MAIN-2017-47 | en | refinedweb |
Are you sure?
This action might not be possible to undo. Are you sure you want to continue?; this thesis has not been submitted previously in full or partial fulfilment of the requirements for an equivalent or higher qualification at any other recognised educational institution.
________________________________ SIGNATURE
January 2003 DATE
i
Acknowledgements
Acknowledgements
This thesis would not have been possible without the support, advice and encouragement of many individuals. I would like to express my sincere thanks to the following people for their contributions: To Mary West, my supervisor, for her guidance in the field of study To Dr Michael Marais for his constructive comments and valuable recommendations To Prof Chris Jeffery for his sound advice and words of encouragement To my mother who typed the bulk of this thesis and who was always willing to help in any way possible To Franz for his continued encouragement and support
ii
Emma. her work retains an undying appeal. Northanger Abbey. it is possible to explore the legacy that modern women have inherited. During the last decade the English-speaking world has experienced an Austen renaissance as it has been treated to a number of film and television adaptations of her work. Women’s experiences in Austen’s time are compared to women’s experiences in society today in order to illustrate. Literary critics such as André Brink (1998). In addition. however. Mansfield Park and Sense and Sensibility. Nancy Armstrong writes in Desire and Domestic Fiction (1987) that Austen’s objective is not a critique of the iii .Pride and Prejudice.Abstract Abstract Although many might consider Jane Austen to be outdated and clichéd. the tremendous progress the feminist movement has made. and Gilbert and Gubar (1979) believe Austen to create feminist awareness in her novels. Mansfield Park. This thesis follows a gynocritical approach and applies a feminist point of view when reading and discussing Austen. Austen’s novels . The reasons for viewers and readers enjoying and identifying with Austen’s fiction are numerous. Readers of varying persuasions have different agendas and hence different views and interpretations of Austen. by examining what Austen reveals about the material reality of women in her time. in some way. who do not view Austen as necessarily feminist in her writing. Sense and Sensibility. Film critics such as Bill De Lapp (1996) and Sherry Dean (1996) have commented on the phenomenal response these productions received and have been amazed by Austen’s ability to compete with current movie scripts. and Persuasion – are re-read and reevaluated from a feminist perspective in order to call attention to Austen’s awareness of women’s second-class position in her society. including Pride and Prejudice. There are critics. Emma. Claudia Johnson (1988).
My own reading of Austen takes into consideration her social milieu and patriarchal inheritance. they failed to produce great women artists like Chaucer or Cézanne. it illustrates some of the realities and pitfalls of marriage. and women’s identity. leaving women powerless and without any means of self-protection in a male-dominated world. In Culture and Imperialism (1993) Edward Said implicates Austen in the rationale for imperial expansion. Austen’s fiction draws our attention to issues such as women’s (lack of) education. Austen’s fiction also exposes the economic and social system (of which education constitutes a major part) for enforcing marriage and for enfeebling women. Her fiction reveals the effects of educating women for a life of domesticity. While Austen only subtly refers to iv . her critique needs to be covert. and illustrates that such an education is biased. believe Austen’s fiction primarily to be about marriage since all her novels end with matrimony. In addition. It argues that Austen writes within the framework of patriarchy (for example by marrying off her heroines) possibly because she is aware that in order to survive as a woman (writer) in a male-favouring world and in a publishing world dominated by men. such as Patricia Beer (1974). If read from a feminist perspective. Feminist writers such as Flis Henwood (2000) show that contemporary women believe certain areas of expertise belong to men exclusively. while Barbara Seeber argues in “The Schooling of Marianne Dashwood” (1999) that Austen’s texts should be understood as dialogic. marriage as a patriarchal institution of entrapment. Others such as Linda Nochlin (1994) reveal that because women did not have access to higher education for so many years. the effects of not being given access to knowledge. Others.Abstract old order but rather a redefinition of wealth and status. they suffer the consequences of a legacy which denied them access to a proper education. Although contemporary women in the Western world mostly enjoy equal education opportunities to men.
v . In addition. are not merely novels of powerlessness but of empowerment. one could argue that she contributes. we are made aware of the social construction of power. contemporary feminist scholars such as Germaine Greer (1999) and Arnot. bell hooks comments in Feminist Theory: From Margin to Center (2000) on the importance of revealing unfair power relations in order to eliminate oppression of any kind. to the transformation of existing power relations and to the eradication of women’s servile position in society. Deliyanni. and this makes us aware of women’s lack of power in her time. From her fiction we can infer that male power is enshrined in the very structure of society.Abstract women’s disempowerment within marriage. Because she suggests ways in which women might empower themselves. albeit within patriarchal parameters. The issue of marriage as a patriarchal institution has been thought important and has been addressed by feminists because it contributes to women’s powerlessness. in a small way. By creating rounded women characters and by giving them the power to judge. Austen does not necessarily express the wish to eradicate forms of power or oppression in her novels. to refuse and to write. if we read her work from a feminist point of view. Yet. Austen’s novels. her novels seem to question women’s inherited identity and to suggest that qualities such as emotionality and mothering are not natural aspects of being a woman. Araújo. and Ivinson (2000) explicitly warn women that marriage is a patriarchal institution of entrapment and that it often leaves women feeling unfulfilled. Austen challenges the stereotyped view of woman as either overpowering monster or weak and fragile angel. Feminist scholars today find it imperative to expose all forms of power in order to eradicate women’s subordination. however.
en Persuasion. Gedurende die laaste dekade het die Engelssprekende wêreld met die verfilming van onder andere Pride and Prejudice. Edward Said impliseer in vi . Verskillende tipe lesers het verskillende agendas en derhalwe uiteenlopende interpretasies van Austen. en Gilbert en Gubar (1979) glo dat Austen ‘n feministiese bewussyn in haar romans laat blyk. In hierdie verhandeling word Austen se werke vanuit ‘n feministiese oogpunt beskou. soos André Brink (1998). Rolprent resensente soos Bill De Lapp (1996) en Sherry Dean (1996) het al kommentaar gelewer oor die geweldige reaksie wat hierdie produksies gekry het. Austen se grootste werke. en het hul verbasing uitgespreek oor Austen se vaardigheid om met huidige draaiboeke te kompeteer. insig kry in die tipe erfenis waarmee kontemporêre vroue gelaat is. en nie om die ou orde te kritiseer nie. Emma. Northanger Abbey. Daarbenewens kan ons. word herlees en her geëvalueer in ‘n poging om Austen se bewussyn van vroue se tweede-klas posisie in die samelewing uit te lig. Mansfield Park en Sense and Sensibility ‘n Austen-renaissance beleef. Emma. naamlik Pride and Prejudice. Daar is verskeie redes dat Austen se fiksie aanklank by kykers en lesers vind. Mansfield Park. Literêre kritici. het haar werk nog steeds geweldige trefkrag vir die een-en-twintigste eeu en sy mense. deur te kyk na wat Austen aan die lig bring oor agtiende-eeuse vroue en hulle probleme. Daar is egter diegene wat nie daarvan oortuig is dat Austen noodwendig feministies is nie. Vroue se ondervindinge in Austen se tyd word vergelyk met hoe vroue in vandag se tyd die samelewing ondervind om aan te dui watter vooruitgang die feministiese beweging gemaak het. Sense and Sensibility. Nancy Armstrong skryf in Desire and Domestic Fiction (1987) dat dit Austen se doel is om rykdom en status te her definieer.Uittreksel Opsomming Alhoewel Jane Austen deur sommige as konserwatief en vervelig beskou mag word. Claudia Johnson (1988).
Wanneer ons kyk na wat haar fiksie te sê het oor die gevolge van ‘n opvoeding wat vrouens op ‘n lewe van huishouding voorberei. is van die mening dat. glo dat Austen se fiksie primêr oor troues handel. Huidige feministiese skrywers soos Flis Henwood (2000) wys dat vroue glo dat sekere studierigtings eksklusief aan die man behoort. omdat vroue vir baie jare toegang tot ‘n hoër opvoeding geweier is. Ander. die huwelik as ‘n patriargale institusie van gevangenskap. Indien ons Austen vanuit ‘n feministiese oogpunt lees. en Barbara Seeber is van die mening in The Schooling of Marianne Dashwood (1999) dat Austen se boeke as dialoë verstaan moet word. Alhoewel die moderne vrou in die Westerse wêreld meestal gelyke regte het tot ‘n opvoeding as die man. soos Linda Nochlin (1994). soos Patricia Beer (1974). en vroue se identiteit. Ander. en stel voor dat Austen binne die patriargale raamwerk skryf (soos wanneer sy haar heldinne laat trou) moontlik omdat sy besef wat sy moet doen om te oorleef in ‘n samelewing en in ‘n publisiteitswêreld wat deur mans bestem word. die gevolge daarvan om van kennis weerhou te word. dui haar romans op die gebrek aan opvoeding vir vroue. My evaluasie van Austen se oeuvre hou haar sosiale milieu asook haar patriargale erfenis in rekening.Uittreksel Culture and Imperialism (1993) dat Austen die prinsiepe van imperialisme deur haar werke ondersteun. Austen se fiksie ontbloot ook die ekonomiese en sosiale stelsel (waarvan opvoeding ‘n wesentlike deel opmaak) omdat dit ‘n getroude lewe op vrouens afdwing en omdat dit vii . hulle daarin misluk het om vroulike kunstenaars en skrywers soos Chaucer of Cézanne te produseer. blyk dit dat so ‘n opvoeding partydig is en dat dit vrouens magteloos en sonder enige middel van selfverdediging laat in ‘n wêreld wat deur mans bestem word. ly sy onder die gevolge van ‘n erfenis wat haar van ‘n behoorlike opvoeding weerhou het. siende dat al haar boeke eindig met die vereniging van die hoofkarakters in die huwelik.
as ons haar werke vanuit ‘n feministiese oogpunt beskou. Die kwessie van die huwelik as patriargale institusie word as belangrik geag en word aangespreek. Deur geronde vroue karakters daar te stel. Nogtans. die mag om te weier en die mag om te skryf te gee. Boonop skyn haar werke vroue se identiteit te bevraagteken en stel dit voor dat eienskappe soos emosionaliteit en moederlikheid nie ‘n natuurlike aspek van vrou-wees is nie. Waar Austen slegs subtiel na vroue se magteloosheid verwys. waarsku huidige feministe soos Germaine Greer (1999) en Arnot. en deur aan hulle die mag van onderskeiding. Ons kan van haar romans aflei dat die manlike mag in die struktuur van die samelewing verweef is. bell hooks verwys in Feminist Theory: From Margin to Center (2000) na die belangrikheid daarvan om onregverdige magsverhoudinge te openbaar sodat onderdrukking van enige aard geëlimineer kan word. tot ‘n klein mate. Austen se romans gaan egter nie slegs oor magteloosheid nie. Deliyanni. en Ivinson (2000) vroue eksplisiet dat die huwelik ‘n patriargale institusie van gevangenskap is en dat dit dikwels vrouens onvervuld laat voel. maar ook oor bemagtiging. Daarby illustreer dit die realiteite en valstrikke van die huwelik. Araújo. al is dit binne-in die patriargale raamwerk. maak hulle ons bewus van die sosiale konstruksie van mag. aangesien dit bydrae tot vroue se magteloosheid. Feministe vandag vind dit van uiterste belang om alle vorme van mag bloot te lê sodat die onderdanige rol van vroue beëindig kan word.Uittreksel daardeur vrouens verswak. en dit maak ons bewus van vroue se tekort aan mag teen die einde van die agtiende eeu. om by te dra tot die transformasie van bestaande magsverhoudinge en tot die eliminering van vroue se onderdanige posisie in viii . daag sy die stereotipe van vrou as dominerende monster of van vrou as magtelose engel uit. slaag sy daarin. Omdat sy maniere voorstel waarop vroue hulle-self kan bemagtig. Austen skyn nie te wens dat alle vorme van mag en onderdrukking geëlimineer word nie.
ix .Uittreksel die samelewing.
2 Laying Down the Harp 3.1 Catching Men 2.Index Index Introduction Chapter One – Women and Education Introduction 1. Marriage as Entrapment 1. Investigating Knowledge 4. Unequal Education Opportunities 6.3 Approval and Acknowledgement 1. Self-Deprecation 5. Privileged Education for Boys 5.1 Economic Security 1. Silly Women and Men Chapter Three – Women and Marriage Introduction 1. Empty Conversation. Finding a New Discourse 3. Trite Remarks and the Conduct Books 2. Consequences of a Poor Education Chapter Two – Women and Knowledge Introduction 1. Cultivating Accomplished Ladies 2.4 Surviving Patriarchy 1 17 17 20 25 27 29 32 35 38 39 46 46 50 55 58 60 65 71 76 76 78 83 88 94 96 x . Self-knowledge 4.2 Escaping Home 1. Sweet Orderings of Domesticity 2. Literariness 6.
3 The Power to Write 4.2 The Power to Refuse 4.1 Marrying for Money 2.1 The Power to Judge 4. Fairytale Endings Chapter Four – Women and Identity Introduction 1.Index 2.2 Unfulfilled Wives 2. Rationality and Emotion 3. Dissident Views on Marriage 2.1 Male Texts 1. Women Empowered 4.3 Husband-Hunting 3.2 Austen’s Texts 2.4 Domestic Power(lessness) Conclusion Bibliography 100 100 105 111 113 119 119 123 123 126 131 135 139 141 144 147 148 153 163 xi . Women’s Representation 1. Natural Mothers 4.
(Edward Said. but they keep disappearing. They do re-emerge. but that she hides this consciousness behind a decorous façade. Yet others believe Austen to address women’s issues. omissions. sometimes strong ones. stories that do not make sense. Amongst them there are those who argue that Austen does not only display a feminist awareness. I Married Him) …Austen makes us aware of gaps. (Barbara Seeber. in a different guise: as the ambiguities. discrepancies and illogic of a creative artist… (Patricia Beer. stories that sense cannot tell. The Schooling of Marianne Dashwood) There is a paradox here in reading Jane Austen which I have been impressed by but can in no way resolve. and contradictions. Reader. Culture and Imperialism) I had always considered Jane Austen to be an unequivocal advocate for women’s emancipation until statements such as the above decidedly confused me when I started doing my reading for this dissertation. I found that the ideology of Austen’s work is not clear-cut and that it has been interpreted in different ways throughout the years. however. thus giving us a glimpse of the polyphonic world that the dominant ideology…needs to repress. While some scholars maintain that Austen’s novels are mostly concerned with matters of courtship and marriage. By incorporating contradictions. that [Jane Austen] is dissatisfied with the traditional status of woman. 1 . Austen incorporates contrary discourses.Introduction Introduction There are hints. others have implicated her work in the rationale for imperial expansion.
While Claudia Johnson has mentioned that women writers in the late eighteenth/early nineteenth century often felt “too marginal as women in their society [so that they had to] smuggle in their social criticism” (1988:xxiii). their work remains seminal since it offers one of the first feminist readings of Austen’s novels. Austen may have found it necessary in her time to hide her dissatisfaction with women’s status in a man-made and male-favouring world. Johnson and Brink call attention to the fact that the society Austen was living in was one which favoured men. Although Sandra Gilbert and Susan Gubar’s The Madwoman in the Attic (1979) may be considered outdated. then surely this does not mean that she accepts it. so much so that it may seem that she accepts quite uncritically the social prescriptions of her time” (43. Rosalind Miles seems to agree when she writes in The Female Form: Women Writers and the Conquest of the Novel (1987) that “[m]arriage in all its variations is the cornerstone of [Austen’s] moral and imaginative structures. Those who support the theory of Austen’s concealment posit that. If we entertain the notion that Austen hides her defiance behind the façade of seemingly endorsing the status quo. Austen manages to subvert existing power relations in society without arousing the suspicion of a literary world dominated by male publishers. Gilbert and Gubar argue that Austen hides her feminist consciousness behind the façade of submitting to patriarchy. Claudia Johnson has called it “double plotting” (xxiv) and “strategies of subversion and indirection” (19) in Jane Austen: Women Politics and the Novel (1988).Introduction Indeed. While André Brink has referred to this as Austen’s “double play” (115) in The Novel: Language and Narrative from Cervantes to Calvino (1998). André Brink has commented on 2 . my emphasis). They suggest that she only adds the traditional elements of marriage and happy endings to her novels in order to hide her dissent (169). by appearing to submit to patriarchy.
Introduction
Austen’s “acute awareness of her position as a woman trying to demarcate her own space in a man’s world” (1998:112). Nancy Armstrong notes in Desire and Domestic Fiction (1987) that Austen was fully aware of the fact that patriarchal society required women writers to produce “a non-aristocratic kind of writing that was both polite and particularly suitable for a female readership” (97). Because Austen knew that intellectual women in her time were treated with suspicion and that women novelists were ostracized from the community if they did not admit their writing to be a mere diversion (Gilbert and Gubar, 1979:10), it is possible that she made a deliberate effort to conceal her dissent. In A Literature of Their Own: British Women Novelists from Brontë to Lessing (1977) Elaine Showalter comments on the necessity for late eighteenth/early nineteenth-century women writers to hide their intellectualism (21). They published anonymously, wrote under a male pseudonym or were self-deprecating, in the hope that “[their] female audience would both read the messages between [their] lines and refrain from betraying what they deciphered” (16). Owing to the “far-reaching and vigorous moral censorship upon [the middle class’s] chief entertainment, fiction” (Watt, 1971:465), it could very well be that Austen realised she too had to write within the patriarchal framework of marriage and women’s subordination in general, or else run the risk of not being published. In order, then, to have her work published, as well as protect herself from the kind of ostracism that Gilbert and Gubar suggest would be her fate, Austen may have concealed her feminist awareness. As modern readers we should keep in mind, as Andrea Nye has pointed out in Feminist Theories and the Philosophies of Man (1988), that “the situations in which women struggle have a history, a familial history both social and individual, and [that] their reactions are shaped in that history” (115). Austen was struggling in the context of a patriarchal world
3
Introduction
which, according to Jackie Stacey’s definition in “Untangling Feminist Theory” (1993), refers to “the systematic organisation of male supremacy and female subordination” (53). Claudia Johnson mentions that the society Austen was living in was one which dictated “fundamentally different codes of morality for men and women” (1988:14). André Brink writes that underlying a novel such as Emma is “the crude and inescapable fact that the social code by which all the characters exist and survive is different for men and women” (1998:123). The social code for women, as Judith Lowder Newton shows in “Women Power and Subversion” (1981), included submitting to patriarchal institutions such as marriage in order to survive financially (119-129). Jane Austen was not exempt from the code by which her women characters had to exist and survive. Another possibility then, and one which I would favour, is not so much that Austen deliberately hides her rebellion behind the façade of submission but that she submits to patriarchy because she has no other choice if she wants to survive in a male-dominated society. There are quite a number of critics who disagree with the view that Austen is necessarily feminist in her writing. Nancy Armstrong clearly states that she does “not subscribe to the view of Austen as a proto-feminist rebel who thrashed against the constraints that bound an author of her sex unwillingly to convention” (1987:156). She believes “Austen’s objective is not to dispute the hierarchical principle underlying the old society, but to redefine wealth and status as so many signs that must then be read and evaluated in terms of the more fundamental currency of language” (138). Armstrong seems to suggest that Austen could not escape the ideology she was born into when she comments that Jane Austen “appeared more than willing to leave the rest of the world alone and deal only with matters of courtship and marriage”
4
Introduction
(135). In addition, she maintains that Austen’s work shows how social status has the power to define individuals and thereby disrupt the stability of the community (155). In Culture and Imperialism (1993:58-59) Edward Said argues that it is Austen’s interest in imperial England which comes to the fore in Mansfield Park. According to Said, Austen in this novel shows how colonies are important “to the process of maintaining a particular style of life in England” (66). Though he focuses on Mansfield Park, he extends his findings to Austen’s work as a whole by suggesting that Mansfield Park “defines the moral and social values informing her other novels” (62). Said also mentions that authors are shaped by the history of their societies and by their social experiences (xxii). It is possible that Jane Austen was unaware of the ideology of her society and that she therefore remained a product of her times. This could possibly explain why her work, according to Said, consolidates the
authority of the status quo, including the hierarchy of the patriarchal family, while only rarely challenging institutions such as private property and marriage (77-79). Published in the mid-seventies, Patricia Beer’s Reader I Married Him: A Study of the Women Characters of Jane Austen, Charlotte Brontë, Elizabeth Gaskell and George Elliot (1974) may have been superseded by the above readings by Armstrong and Said. Her work, however, provides us with yet another way in which Austen can be read. The seventies are of significance since Austen’s work had been regarded up to this time as that of an essentially conservative writer, as Isobel Armstrong shows in Jane Austen: Mansfield Park (1988:95). Patricia Beer does not regard Austen as being radically or even liberally feminist in her approach. She feels that Austen “not only accepted the limitations of women’s scope but seems in her own life to have found happiness within them” (1974:25). Though Beer
mentions an occasionally “suspicious piece of bravado about husband-hunting” (2) in
5
she feels. This. with some exceptions. including Jane Austen as satirical writer and as feminist writer (101-103). she believes her interpretation of this specific novel “sets a precedent for dialogism in Austen” (223). Armstrong discusses the essentially conservative interpretation of Austen which was assumed. 6 . and suggests that. and dedicates a section of her book to informing the reader “about the ways in which Jane Austen has been discussed and to strike a cautionary note” (95). up to the 1970s. In addition. In “I See Every Thing As You Desire Me To Do”: The Scolding and Schooling of Marianne Dashwood (1999) Barbara Seeber makes a case for a dialogic reading of Austen’s work. is unfortunate since it “obscures the text’s dialogism” (224) and restricts it to a single truth. she sees Austen’s ‘ambivalence’ as the result of a conflict between Austen’s ideals for women and her acceptance of a male-dominated society (82). Although she focuses on Sense and Sensibility in order to expose what she calls “Austen’s polyphonic vision” (225). “it is possible to mediate between…opposing interpretations” (103). Isobel Armstrong concurs that there is no single truth when reading and interpreting Austen. she believes Austen does not examine women’s role in society (46). She explains how this was followed by all kinds of interpretations. She writes “[i]t is clear that there can be no single view about a novel of such complexity [as Mansfield Park]” (1988:10). Seeber notes that readers of Austen often place great emphasis on her heroines and believe their values to be those of Jane Austen herself. She ends off by warning scholars “against the hubris of believing that ‘their’ historical methodology is the only one which will lead to a ‘correct’ reading” (102).Introduction Austen’s work. alternatively.
I looked for signs of women’s subordination in the late eighteenth/early nineteenth century. Sense and Sensibility. In What Does a Woman Want? (1993) Shoshana Felman takes issue with the accentuation of feminist awareness in texts written by women.women’s subjugated position in society. He believes that “none of us is outside or beyond geography” (1993:7). He suggests that we as readers should keep in 7 . Claudia Johnson similarly calls attention to the necessity of adopting historical approaches to Austen’s work so that feminists may “reconceptualize the stylistic and thematic coherence of Austen’s fiction” (1988:xix). extend. While I reread and re-evaluated Austen’s work. and that writers are shaped by their history and by the society they live in. feminists need to enter old texts from new critical directions (5-6). I do not want to suggest that it is the only way. and limited my field of study to Austen’s six novels – Pride and Prejudice. Being fully aware that this type of reading is one possible way of interpreting Austen. Northanger Abbey. As I examined Austen’s novels. while Edward Said comments on the urgent need “to draw out.and accentuating . One of my aims while writing this thesis was to emphasise the ways in which Austen’s novels address women. give emphasis and voice to what is silent or marginally present” (1993:66) in canonical texts.Introduction This thesis will provide a feminist reading of Austen’s work. trying to pinpoint which women’s issues she addresses. Often this entailed delineating . Toril Moi states in Sexual/Textual Politics: Feminist Literary Theory (1985) that feminists “strive to make explicit the politics of the socalled ‘neutral’ or ‘objective’ works of their colleagues” (87). Mansfield Park. Persuasion and Emma. To this end she suggests the “elaboration and the reinvention – of new (feminist) strategies of reading…[and] new procedures of approach” (7). in order to amplify the intention of women writers. She states that. I found that Said offers further valuable insight into reading and interpreting texts.
the ‘ruling class’” (Johnson. Hence. I shall be drawing from a number of disparate feminisms including popular best sellers such as the work of Germaine Greer as well as scholarly work by feminists such as Nancy Armstrong.Introduction mind the historical and social background of a writer and focus on drawing out or making explicit underlying meanings in texts (66-67). I shall in addition be crossing discipline boundaries between feminist literary theory and sociology. there are points of common interest and relevance which can be used in identifying some of the ‘shared’ as opposed to ‘universal’ aspects of women’s experience. This entailed remembering that Austen was a woman of European descent who lived and wrote in England at the end of the eighteenth/beginning of the nineteenth century. Since this thesis aims at reconsidering the longevity and relevance of Austen’s work. One might wonder. I shall consider white and black feminist perspectives in order to demonstrate that. despite the plurality evident in feminist discourse(s). Clearly. she has a very different political agenda to that of white Western women in academe. It was therefore important to keep Austen’s geographical and social background in mind while reading and assessing her work. 1988:xviii). and that her work first and foremost addresses them. Because I believe there is a relevancy beyond the distinctions imposed by the academe. 1993:66). While being “a socially confident member of the landed gentry and. Though it is apparent that Austen’s work is aimed at white women of the Western world and that it primarily 8 . and between popular culture (film adaptations) and ‘high art’ (canonised narrative fiction). she “wrote with an exclusively Western audience in mind” (Said. how someone like bell hooks (from whom I shall be quoting quite a bit) can be used in support of my reading of the Austen oeuvre. I am aware that her message comes across most loudly to white middle-class women of the Western world. with that. when I argue in this thesis that Austen addresses women’s issues. then.
in order to reveal what may be regarded as her feminist consciousness. there are areas that overlap in disparate fields of feminist study and I shall be drawing from these to illustrate some of the ways in which feminist politics has developed since Austen’s day. which offers a re-reading and deconstruction of three novels written by women: Jane Eyre. Applying such a deconstructive approach leads her. While deconstruction in poststructuralist terms refers to the “‘free play’ of meaning in literary texts” (Weedon. By applying her knowledge of the history of Britain’s imperialist reign. She argues that “[i]t should not be possible to read nineteenth-century British literature without remembering that imperialism. such as taking into account the historical. and in feminist terms. was a crucial part of the cultural representation of England to the English” (896). as she has been generally understood. understood as England’s social mission. Gayatri Spivak does something similar in her paper “Three Women’s Texts and a Critique of Imperialism” (1985). 1993:66). to pulling apart “the ways in which the different meanings of femininity have been cemented together” (Stacey. I have used some of the principles of deconstruction. to consider the figure of Bertha Mason in Jane Eyre as “a figure produced by the axiomatics of imperialism” (899) and not merely as Jane’s dark double. 1987:19). Just as Spivak believes that an informed critique of imperialism will lead to new insight into novels such as Jane Eyre. Wide Sargasso Sea and Frankenstein. she is able to uncover and emphasise the underlying ideology of imperialism in these texts. for example. 9 .Introduction addresses their needs. geographical and especially social background against which Austen was writing. I feel that re-reading Jane Austen against the background of the male-dominated and malefavouring world in which she was living and writing may lead to a new understanding of her awareness of the disempowerment of women in her society.
Introduction My reading of Austen takes into account that she not only lived in a male-favouring society. her novels are. which can be described as a “‘dual voice’…in which the voices of the narrator and character are blended” (Schellinger. and seeking “to interpret elements of authentic female experience in women’s writing” (235) is known as ‘gynocritics’. and male mastery over the text. 1987:35). literature was for Austen and her contemporaries a medium through which they could express the need for change (Miles. 1998:320). applying specifically a woman’s perspective. Writing and Language: Making the Silences Speak” (1993) Gill Frith addresses that feminist criticism which asks what “men’s texts. “not already the territory of men” (1988:xiv). seen from the heroine’s perspective. as Claudia Johnson has suggested. According to the Encyclopedia of Feminist Theories (2000). edited by Lorraine Code. Austen makes full use of the narrative structure of the novel in order to create feminist awareness. In an article entitled “Women. While she alternates between limited omniscience and limited third-person point of view. women” (1988:xxiv). The novel proved to be a popular site precisely because it was. to a large degree. This narrative strategy “reinforce[s] the reader’s empathetic identification with a character” (320). and allows Austen to turn the reader’s attention towards her women protagonists and their needs. [have] done to women’s heads” (153). the practice of delimiting one’s field of study to exclusively women writers. Claudia Johnson states that Austen employs the “device of centering her novels in the consciousness of unempowered characters – that is. Despite being born into a world where women were at a disadvantage in more than one way. but that she had to confront an almost exclusively male literary tradition. Austen thus employs the narrative technique of free indirect discourse. Following a gynocritical approach I have 10 .
in some way. I have attempted to evaluate her fiction within the framework of her social milieu and patriarchal inheritance. while the BBC’s television production of Pride and Prejudice enjoyed “a phenomenal reception” in the UK. art-house audiences flocked to Persuasion last fall. many of her books are current movie hits”. and just last month TV's Arts & Entertainment channel broadcast an acclaimed British miniseries based on Pride and Prejudice. My primary undertaking is then to offer a re-reading of Austen’s oeuvre in order to account. essentially. She adds that the film adaptation of Sense and Sensibility was one of the contenders for the 1996 Best Picture Academy Award.believe it or not from Austen's Emma.Introduction included a wider consideration of Austen’s work. the celebrated 19th-century author who's enjoying a brisk renaissance of her classic works: Last summer's teen hit Clueless was culled . Alicia Silverstone and Sandra Bullock? None other than Jane Austen. One only has to do a Jane Austen search on the Internet to be presented with loads of information on film and television adaptations of her work in the last ten years. we need to consider the Austenian renaissance of the past decade. In order to understand how Austen’s two hundred year-old work could have any impact on especially women in Britain. for her continued relevance and popularity in the twentyfirst century. Furthermore. the United States and in former colonies of Britain. Although Austen…died 179 years ago. CNN correspondent Sherry Dean (1996) writes “Hollywood…has made Jane Austen one of the hottest novelists of the '90s. I have drawn on current sociological and feminist theory since. While Don Harlow notes that this production “follows the story with much faith and attention to detail 11 . this thesis seeks to relate her findings in the late eighteenth/early nineteenth century to how women in our own time experience society. Film critics such as Bill De Lapp (1996) comment on Austen’s extraordinary ability to compete with current film scripts: Who's on the Hollywood fast track these days next to John Travolta.
believes “the ruthless business of money. who wrote the screenplay for the 1996 film version of Sense and Sensibility as well as portrayed the role of Elinor Dashwood. One possibility relates to the ‘comforting fiction’ and distance maintained in ‘period piece’ narratives. marriage and family fortune is brilliantly illustrated” (141) in the big screen adaptation of Mansfield Park. Here it needs to be noted that this thesis does not engage with reader response theory. for example. That South African women’s magazine Fair Lady should write a review on one of Austen’s works simply reinforces the appeal she has to white women of the Western world. The question remains why. neither does it offer statistics in support of Austen’s ‘comeback’. My supposition is based on continued academic research on Austen and on the spate of film adaptations in the last two decades. 1996). Though such a comparison may be regarded as a futile exercise. believes “[Austen’s] work survives because she wrote about subjects that never die” (Dean. I believe 12 . In this thesis I shall be comparing women’s position in the twenty-first century to that of women in the late eighteenth/early nineteenth century. some film critics have used what I call ‘Hollywood rhetoric’ to attract moviegoers.Introduction [and] never deviates from the general tone of the dialogue in the book”. While there is a distinction to be made between fictional characters in novels and real life experiences of women. I believe that it could give us some idea of the extent to which feminism has developed since the beginning of the nineteenth century. It would seem that contemporary women remain interested in the way in which women experienced society in Austen’s time. Another possible answer (and one which this thesis engages in particular) might be that Austen’s subject matter continues to be of interest. In the film review of Fair Lady of 26 April 2000 Karena du Plessis. Emma Thompson. We know that Austen is enjoying renewed popularity.
I was able to identify four main issues that are of interest to readers of a feminist persuasion: women’s education. as Andrea Nye (1988:5) reports. Moreover. After rereading Austen’s novels. [and] the prohibitions on female labour” (141) as some of the key issues identified by feminist writers. and women’s identity. the “lack of education. It does not privilege women over men. among others. Alexander lists. marriage as a patriarchal institution of economic and social entrapment. feminist writers became explicit in their struggle to end sexist oppression1.Introduction there are significant contrasts between the experiences of Austen’s women characters and the experiences of women living in today’s society. In contrast to Austen’s subtle reference to women’s issues. It has the power to transform in a meaningful way all our lives ” (20-21). investigating the role women played in society at the end of the eighteenth century could help us understand the legacy contemporary women have inherited. any particular race or class of women.…‘domestic drudgery’. In Austen’s fiction reference is made to some of 1 bell hooks states in Feminist Theory From Margin to Center (2000) that “[F]eminism is the struggle to end sexist oppression. while during the twentieth century. the first great wave of feminist activity in the 1840s was characterized by an open discussion of issues such as property rights and marriage reform. and that I needed to make assumptions about women’s subjugation in the late eighteenth/early nineteenth century. Sally Alexander writes in Becoming a Woman and Other Essays in 19th and 20th Century Feminist History (1994) that feminists from the seventeenth century up until the twentieth had similar starting points of dissatisfaction (101). In this regard I found Austen to be extremely subtle in her approach. for example that the male-favouring social system of the time often not only denied women the right to a proper education but also left them with no choice but to get married. women’s access to knowledge. Its aim is not to benefit solely any specific group of women. 13 .
Introduction
these issues. Being made aware of women’s disempowerment in patriarchal society in the early nineteenth century could help us understand why women were dissatisfied and why they started insisting on equal rights later on in that century. It could also help explain the legacy contemporary women have been left with. If we look for example at what Austen’s novels reveal about women’s education in the late eighteenth century, it is evident that a decent education and certain areas of expertise were the prerogative of men. Comparing this to education today, it would appear that maleprivileged education belongs to the past2. In most of the contemporary Western world, men and women have access to equal educational opportunities. Yet signs of a legacy, which kept women from enjoying equal educational opportunities to men, can be seen in the present day. In scholarly feminist journals such as the February 2000 edition of The European Journal of Women’s Studies, edited by Magda Michielsens and Mary Evans, the ways in which modern women suffer the effects of having been deprived of an education equal to that of men are explored. In “Balancing Gender in Higher Education: A Study of the Experience of Senior Women in a ‘New’ UK University”, one of the articles which features in this journal, Sue Ledwith and Simonetta Manfredi comment on the marginal position of women in the higher educational sector. In another article, entitled “From The Woman Question in Technology to the Technology Question in Feminism: Rethinking Gender Equality in IT Education”, Flis Henwood mentions that patriarchal discourse excludes women from certain academic terrains. A feminist reading of Austen sheds some light on the ways in which women were kept from empowering themselves, such as being denied access to a proper education and
2
Rosalind Miles mentions that, while women in the nineteenth century lost their educational advantage, women in the twentieth century generally had access to free public education (1987:27).
14
Introduction
knowledge, thereby ensuring an imbalance of power. In addition, it would seem that Austen questions general assumptions about women’s identity. She, for instance, seems to subvert the view that all women are born natural mothers and that they find fulfillment in marriage. Once again Austen is not blatantly critical, and therefore her dissatisfaction with gender roles needs to be inferred. Today, in contrast, feminists are very outspoken when it comes to predetermined gender roles and are constantly warning women against having their identity prescribed for them. Contemporary feminist scholars such as Patricia Waugh in Feminine Fictions: Revisiting the Postmodern (1989) focus on the social construction of gender and reject assumptions about the ‘natural’ predisposition of women (3-8). In Knowing Women: Feminism and Knowledge (1992), the first of a series of four books on women and society published by Polity Press, Helen Crowley and Susan Himmelweit point out that society expects women to play a specific role and in this way determines their identity for them (1718). Barbara Darby comments in an article entitled “The More Things Change: ‘The Rules’ and Late Eighteenth-Century Conduct Books for Women” (2000) that today women’s identity is often prescribed, or at least partly determined, by society and the media (333-343). Mary Eagleton writes in Working with Feminist Criticism (1996) that women novelists and theorists are able to re-construct and re-define the subject ‘woman’ by what they write (189). From Austen’s novels we can infer that women were rendered weak by being relegated to wife- and motherhood and by being subjected to patriarchal institutions such as education and marriage. In addition to creating an awareness of women’s disempowerment, possible ways in which women might empower themselves are hinted at (as I shall show in this study). The kind of power available to women, Austen seems to suggest, can only be exercised within patriarchal parameters. This type of moderate empowerment differs greatly from current
15
Introduction
feminist writing which emphasises the importance of bringing to an end women’s subordination. Toril Moi defines feminism as “a struggle mainly concerned with social and political change” (1985:23), “a political criticism, sustained by a commitment to combat all forms of patriarchy and sexism” (52). bell hooks - though she is writing against white Western feminist discourse which seeks to homogenise women’s experience - stresses in Feminist Theory: From Margin to Center (2000) that feminism needs to aim at eradicating domination and at transforming society (26). Austen’s texts could be read as questioning male domination and as subtly suggesting women’s empowerment. Some scholars may argue that Austen hardly succeeds in offering women the prospect of empowerment since all her heroines end up submitting to their traditional role and to patriarchal authority when they marry. It is possible, however, that Austen lets her heroines marry for the sake of her own survival in a male-favouring society. This does not mean that we should discard her feminist awareness. Instead, it would seem useful to infer from Austen’s novels women’s second-class position in society in the late eighteenth/early nineteenth century. By doing so, we may begin to see the ways in which feminism has progressed as well as start to understand the kind of legacy contemporary women have inherited.
16
edited by Linda Schmittroth and Mary Reilly McCall. the narrator patiently explained that women at this time were enrolled for special household courses that would teach them the finer art of home-making. Included in the programme was archival footage of a television commercial broadcast at the time. and states that although “small changes” (410) have been recorded in men’s domestic services. in contemporary society. In addition. 3 17 . no longer exists. Despite this type of progress. The idea was that such wives would transform their homes into a refuge. As if it were a concept alien to modern viewers. women in the Western world are not educated to lead exclusively domestic lives but mostly have access to the same type and level of education as their male counterparts3. the point is made that although women and men enjoy equal levels of education. salaries for men continue to be significantly higher than salaries for women who are doing the same work (405). 5 The Routledge International Encyclopedia of Women: Global Women’s Issues and Knowledge (2000) is edited by Cheris Kramarae and Dale Spender. such blatant propaganda encouraging women to lead a life of domesticity. and refers to the “increasingly important role [women] play as economic providers for families/households” (321). “men’s involvement in domestic labor has not increased to match women’s involvement in the labor market” (410). 4 Janet Chafetz mentions in the Handbook of the Sociology of Gender (1999) that in 1999 women represented almost one half of the labour force in industrial nations. featuring women stuffing turkeys in home domestic classes and the voice of a man in the background reminding the ladies that the way to a man’s heart is through his stomach. women have increasingly become part of the world’s workforce4 and have started sharing household duties with their husbands or partners5. which would have women believe In Women’s Almanac (1997). traces of a legacy. Perhaps. Today. which in turn would boost the morale of their soldier husbands who had returned from the war.Chapter One: Women and Education Chapter One – Women and Education Introduction Recently I was watching a German documentary on women’s education in post Second World War Germany.
Notice the qualities of light and the variations of shadow. move with deliberation. is seen as a very efficient. One might wonder what this has to do with Jane Austen. can be found. 18 . feeling both the support of the floor beneath your feet and the protection of the ceiling overhead. And experience the fragility and strength of your own body as it goes about its work. In this chapter I shall be investigating the late eighteenth-century practice of educating women to lead a life of domesticity. According to the writer.Chapter One: Women and Education that it is their duty and calling to take care of the home and the family. cost-saving form of therapy: Next time you sweep a floor. entitled “Dust Your Way to Nirvana”. I shall be positing that traces of such a practice can be seen in contemporary society. purpose and ease of motion that is exhibited in a timeless piece of choreography. In addition. the point is that he has managed to have it published in one of South Africa’s most popular women’s magazines and that it has been read by thousands of women all over the country. While it is clear that women today are no longer explicitly encouraged to develop their domestic talents in order to attract a husband (as they were in Austen’s day). Sweeping the floor. An article in Fair Lady of 25 April 2001. (58) Even if Thorp’s ‘theory’ that domestic chores are fulfilling might be dismissed by those who read this dissertation as quite silly. housework should not be regarded as some mundane activity but seized as an opportunity to come to oneself. features an extract from a book written by Gary Thorp called Sweeping Changes (2001). for instance. The uncomplicated act of moving a broom back and forth across the floor can contain all the grace. there are still some individuals who would have them believe that overseeing the housework is their responsibility.
It will be argued that her work reveals such an education to be biased and debilitating. she advocates one which will help women discover who they really are and one which in this way will empower them.Chapter One: Women and Education I believe Austen’s novels. create an awareness of the consequences of educating women for a life of domesticity. is that she shows a concern for women’s education in her novels. it may become apparent that modern women have inherited a particularly compromised educational legacy. we may begin to understand the effects that such a legacy has had. More recently. leaving women powerless and without any means of self-protection in a male-dominated world. by looking at what feminists are currently writing about. Not all critics would agree that Jane Austen encourages women’s education. Moreover. as well as become aware of just how much things have changed from Austen’s period until our own. In addition I shall be suggesting that. if read from a feminist point of view. Patricia Beer maintains that “Austen distrusted intelligence in women and the learning which an intelligent mind can hardly help acquiring” (1974:26). 19 . and which I shall be focusing on. Rather. One way of interpreting Austen. Upon closer examination of Austen’s depiction of the educational system in her time. as an alternative to the existing education system. Nancy Armstrong posited that Austen is not critical of Emma’s failure to observe “the strictures of female education…[and of] her failure to read” (1987:149). a refusal to be written by culture” (149). Austen’s work seems to lend itself to different kinds of interpretations. she believes Austen regards Emma’s lack of diligence in this respect as “a virtue.
The general attitude towards women’s intellect seemed to be. 1988:6) and that they should receive a practical and religious training for their domestic role. The narrator in Sense and Sensibility (1811) seems to be critical of Lady Middleton whose only resources are her children and her home: Lady Middleton piqued herself upon the elegance of her table. They believed that because the business of a woman was marriage. Nancy Armstrong argues that these men assumed in their writing that “an education ideally made a woman desire to be what a prosperous man desires…[and that] her desirability hinged upon an education in frugal domestic practices” (1987:59). They were of the popular and entrenched opinion that women were to be educated “to please men and to be mothers” (Nye. and of all her domestic arrangements… (30) and 20 . she should be taught those things that would attract a husband. 1979:24). She notes that influential eighteenth-century educational writers like John Locke and Jean-Jacques Rousseau insisted that “the goal of education for women [was] the development of good nature” (135). as John Ruskin so quaintly put it. In her novels we are presented with women whose minds have not been enhanced by their education. but for sweet orderings of domesticity” (Gilbert and Gubar. “Sweet orderings of domesticity” Training women for their domestic role is one of the results of an inequality of education and one of the causes of an inequality of intellectual achievement. It is the notion of education as preparation for a domestic life and its effects that Austen appears to expose. that it was meant to function “not for invention or creation. Barbara Horwitz provides valuable background information on the state of women’s education in Austen’s time in her essay “Women’s Education During the Regency: Jane Austen’s Quiet Rebellion” (1994).Chapter One: Women and Education 1.
Chapter One: Women and Education
Lady Middleton seemed to be roused to enjoyment only by the entrance of her four noisy children… (33) Although her traditional education prepares her for a life of domesticity, it appears neither to enhance her mind nor teach her social skills. We are told that “though perfectly well-bred, she was reserved, cold and had nothing to say for herself beyond the most common-place inquiry or remark” (29). In Pride and Prejudice (1813) Mrs Bennet’s education helps her only to find a husband. It fails to improve her understanding which, in turn, places a strain on the couple’s relationship. We are told that Mr Bennet was captivated by his wife’s “youth and beauty, and that appearance of good humour, which youth and beauty generally give” (262), but that her weak understanding had soon put an end to any affection he had for her. Mrs Bennet then is subjected to the double bind of ‘femininity’: first she is deprived of an education, and then she is punished for not having one. Judith Lowder Newton, however, seems neither to hold Mrs Bennet, nor the type of education she received, responsible for her being unhappily married. Instead, she believes Mr Bennet is to blame and writes that “Mr Bennet’s own imprudence must account for his unhappy domestic life” (1981:128). Emma’s sister, Isabella Knightley, provides the perfect example of a woman’s “sweet nature” that Locke and Rousseau were writing about. Her education has made her a specimen of the ideal wife for she is described as “a pretty, elegant little woman, of gentle, quiet manners, and a disposition remarkably amiable and affectionate; wrapt up in her family; a devoted wife, a doating mother” (Emma, 1816:72). Yet, as is the case with Mrs Bennet, her education does not improve her mental abilities, rendering her a woman of weak
21
Chapter One: Women and Education
understanding. Her slow wit leads to irritations in her marriage and verbal abuse by her husband: [Mr John Knightley] had all the clearness and quickness of mind which [his wife] wanted, and he could sometimes act as ungracious, or say a severe thing. (73) In Northanger Abbey (1819) we are presented with another couple who are not intellectually matched. Although Mr Allen does not explicitly get irritated with his wife’s “vacancy of mind, and incapacity for thinking” (48), the narrator apparently does. She comments that Mrs Allen “had neither beauty, genius, accomplishment, nor manner” (7), and argues that “[t]he air of a gentlewoman, a great deal of quiet, inactive good temper, and a trifling turn of mind, were all that could account for her being the choice of a sensible, intelligent man, like Mr. Allen” (7-8). Mrs Allen’s lack of insight and weak understanding may be attributed in part to the limited education to which she, as a middle-class woman living in the late eighteenth century, had access. When Catherine and Mr Allen discuss the propriety of young men and women driving about the country in open carriages, Mrs Allen is not able to follow the conversation (92). She seems incapable of having her own opinion, while often thinking Mr Allen’s expression “quite good enough to be immediately made use of again by herself” (222). Mary Musgrove’s education appears to be a double disaster in Persuasion (1818): she not only lacks understanding (33), but fails to achieve domestic happiness. While her husband uses any excuse to go hunting (34) or dine out (49-50), leaving her home alone, her children (though they may love her) respect her sister Anne more (39). Her education, then, does not seem to have equipped her, in particular, for her domestic life.
22
Chapter One: Women and Education
All these examples serve to illustrate the shortcomings of an education aimed at teaching women how to take care of their family and home.6 Although such an education belongs to the past, it remains of interest since it is part of women’s heritage. If we compare women’s education in the twenty-first century to women’s education in Austen’s time, we can appreciate the progress women have made. Today women are no longer formally educated to be home-makers and mothers. Girls have the same subject choices as boys do, at school, and attend the same universities7. Despite these crucial steps forward, feminist writers believe women not to be wholly liberated from their domestic role. Feminists seem concerned about the fact that many women are primed at an early age to accept a life of domesticity. This means that they will end up taking responsibility for the household and the children one day while their husbands will further their own careers. Germaine Greer believes this to be true and argues in The Whole Woman (1999) that, as a result, women are not only kept from climbing the rungs at work, but that they earn less than their male counterparts. She seems to assign it all to gender role socialization which starts at home: When I was a little girl, little girls were kept in to do the housework while little boys were sent out to play. (155) Feminists aim at raising awareness among contemporary women that they (mostly) believe it
6
Writing a century after Austen, Cicely Hamilton openly states in Marriage as a Trade (1909) that “ [t]he insistent and deliberate stunting of woman’s intellectual growth is…the best proof of her essentially servile position in the household” (39). 7 Kramarae and Spender argue that “[a]lthough girls and boys in coeducational schools usually begin their schooling in the same classrooms and study the same curriculum, as they get older, and as options become available in the school system, they move into different curriculum ‘tracks’ or ‘streams’ or ‘programs’” (2000:498). They also mention that, despite the fact that women are often enrolled in subjects like languages and the humanities, in wealthy industrialized nations such as the United States and Australia, and in parts of Europe, female university participation in recent years has matched or slightly exceeded that of men (500).
23
(339) Paula Wilcox maintains in an article published in “Women’s Studies International Forum and called ‘Me Mother’s Bank and Me Nanan’s. Cyborgs and Women” (2000). as the pure space of ‘home’” (339). Irene Gedalof ascribes this state of affairs to so-called identity narratives which “repeatedly position ‘Woman’ as place. In her study on the displacement of Kosovo women refugees across Europe she found that these women were expected to sacrifice themselves in order to re-create a home for their family: Women’s domestic responsibilities mean that their activities are bound up with materially creating and recreating that home/place. 24 . fortunately. This may be attributed largely to the efforts of feminist scholars who created an awareness of an education which. husband and children” (182). such as keeping the family together” (36). In an article entitled “Identity in Transit: Nomads. In Austen’s time women were explicitly told to be selfless and to take care of their home and their family. even when violence. which appeared in the sociological journal The European Journal of Women’s Studies. migration or dispersal oblige them to make that place in the context of displacement.Chapter One: Women and Education is their duty to do the domestic chores. the practice of having overtly prescriptive norms for women. Over the years. died out. You Know. in the words of Nancy Armstrong. Support!’: Women who left Domestic Violence in England and Issues of Informal Support” (2000) that “[w]omen’s lower status in the gender hierarchy leads them to experience greater pressure to conform to social norms. In the early nineties feminist scholar Stevi Jackson published an essay entitled “Women and the Family in Introducing Women’s Studies: Feminist Theory and Practice” (1993) in which she comments that “even today…the idea persists that a woman’s purpose in life is to care for home.
Western Europe and the United States. Cultivating ‘accomplished’ ladies In addition to training women for a domestic life.Chapter One: Women and Education “subordinate[s] the body to a set of mental processes that [guarantee] domesticity” (1987:76). another 38% were in ‘two-housekeeper’ couples in which wives were employed full time and did 60% or less of the unpaid work” (679). edited by Judith Worell. and Deviance as Discourses of Voluntary Childlessness (2000) that “[i]n the United Kingdom. sing. Disregard. It reminds us of the variability in couples’ domestic work sharing. the efforts of feminists over the years have paid off. 8 25 . be attributed to the legacy which persistently prepared women for domesticity. labeled ‘drudge-wives’. women are having fewer children and having them later in life” (23). or speak modern languages. states that “[f]rom 1970 to the present. 9 The Encyclopedia of Women and Gender: Sex Similarities and Differences and the Impact of Society on Gender (2001). a fact that may. especially when these women manage a full-time job9. and states that “[f]indings from a representative sample of dual-earner households showed that while 29% of the sample. Contemporary life sees wives increasingly sharing the household chores with their partners. The aim of such a ‘curriculum’ for girls was to produce marriageable daughters by making them desirable to men (Armstrong. play music. However. individual choice” (16). while Rosemary Gillespie notes in an essay entitled When No Means No: Disbelief. women today are (mostly) aware of their right to decline such a life8. Austen seems to be critical of the notion of accomplishments Chris Weedon writes in Feminist Practice and Poststructuralist Theory (1987) that Liberal feminists “argue that family life and the decision to have children should result from free. in part. many women still choose to give up their careers and become housewives. 2. attitudes regarding gendered family roles have become increasingly egalitarian” (678-679). such as the ability to draw. had full-time jobs and did more than 60% of the housework. 1987:19-20). While women in the late eighteenth/early nineteenth century seemed to casually accept their domestic role. although most women continue to become mothers at some time in their lives. Though the world is yet to experience an overall transformation of attitude regarding women’s role as domestic caretaker. education of the ‘genteel’ classes in the late eighteenth/early nineteenth century was often the acquisition of ‘accomplishments’.
in all spheres of social life. Judith Lowder Newton writes that Austen’s novels show that women “are prepared for nothing but display [since] their goal is not to accomplish but to be ‘accomplished’” (1981:120). 10 26 . middle-class interests. (xiii. Whereas nineteenth-century readers of Austen’s fiction in all probability were oblivious to the intersectedness of gender. it was necessarily a strategy in preserving white. his views on Austen’s endings provide insight into the traditional way of reading Jane Austen’s fiction. as Chow. Given that the notion of accomplishments was limited to women of the Western world and of the middle class. and then subverting this convention by making her heroines indifferent to being accomplished. and other cultural groups. Firstly. Wilkinson and Baca Zinn (1996) point out in Race. Halperin does make some valid points (such as the one mentioned above). critiques of feminist scholarship have provided intellectual challenges to reassess the salience and influence of race and class. should be aware of their interrelatedness and of the implication that these narratives foreground the predicament of the (rising) middle-class woman at the expense of the working classes. my emphasis) Here it would seem necessary to account briefly for quoting from what may be considered an outdated source.10 This she achieves by illustrating the tradition of using one’s accomplishments to attract suitors. race and class politics we. During the past two decades debates in feminist theory have highlighted the unavoidable intersectedness of class. Class & Gender (1996): Feminist scholarship has illuminated the significance of gender as a basic principle of social organisation and as a central category in theoretical analysis. Western. Secondly. as twenty-first century readers. Since the 1980s.Chapter One: Women and Education in her work. as well as gender. race and gender. John Halperin mentions in The Life of Jane Austen (1984) that Austen takes “an impatient swipe” (85) at ladies’ accomplishments in all of her novels.
Mary Crawford realises that of all the accomplishments music especially can 27 . feminists have the task of making society aware of their interrelatedness in an attempt to end all forms of oppression: Feminism as a movement to end sexist oppression directs our attention to systems of domination and the interrelatedness of sex. In an article entitled “Pandora’s Box: Subjectivity. Maria Bertram seems “by her amiable qualities and accomplishments. gender. Similarly. race. According to bell hooks. the best adapted to make [her son] happy” (38. according to Kaplan.Chapter One: Women and Education Since we live in a society characterised. ethnic and national strata” (7) we can no longer separate class. conversely. “by the oppression of subordinate class. steeped in and spoken through the language of sexual differentiation” (957). Class. In Mansfield Park (1814) Mrs Rushworth feels that of all the young ladies she has ever seen. accomplished girl” (42. sex and race. and Sexuality in Socialist Feminist Criticism” (1985) Cora Kaplan argues that a feminist literary criticism which privileges gender in isolation from class and race offers only a “partial reading of the role played by sexual difference in literary discourse” (957). as Douglas Kellner points out in “Cultural Studies. handsome. and this appears to be a central concern in Austen’s novels. good-humoured. Mrs Grant thinks Julia Bertram would make Henry Crawford very happy if he married her for she is “a nice. and class oppression…The foundation of future feminist struggle must be solidly based on a recognition of the need to eradicate the underlying cultural basis and causes of sexism and other forms of group oppression. my emphasis). This is because. race.1 Catching Men Patricia Beer states that accomplishments were “all aimed at catching men” (1974:64). Multiculturalism and Media Culture” (1995). my emphasis). “class and race ideologies are. (2000:33) 2.
even if he thinks he has Elinor’s interests at heart.Chapter One: Women and Education be construed as a “sexual gesture” (Miles. In Persuasion Anne Elliot indicates her indifference to appearing accomplished when she professes to be “a very poor Italian scholar” (165). Mr Dashwood is trying to make a sale. for she played it with the greatest obligingness…Edmund was at the Parsonage every day. Possibly because John Dashwood wants to see his sister marry and settle in life. 1987:64) between the sexes when she courts Edmund by playing his favourite pieces on the harp: The harp arrived. the otherwise talented Emma Woodhouse never achieves excellence in either drawing or singing. In effect. 2). Mr Owens. 65) The narrator concludes tongue-in-cheek that a woman as well accomplished as Miss Crawford will inevitably succeed in catching “any man’s heart” (65). music or learning French and shirks her lessons whenever she can (Northanger Abbey. wit. to be indulged with his favourite instrument… (Mansfield Park. 17). and when Mary is anxious to know from Fanny whether the Miss Owens are very accomplished. and rather added to her beauty. Austen seems to challenge this very convention by making her heroines indifferent to being accomplished. 28 . he calls Brandon’s attention to Elinor’s drawing skills in Sense and Sensibility (229). presumably for fear of Edmund’s being attracted to one of them (292-293). The practice of using one’s accomplishments to attract a husband is illustrated when Edmund Bertram visits his friend. Similarly. 35). Catherine Morland for example shows no interest in drawing. and is “not much deceived as to her own skill either as an artist or a musician” (Emma. and good humour. while Fanny Price is ridiculed by her cousins for not wanting to learn either music or drawing (Mansfield Park. Having illustrated the convention of using one’s accomplishments to attract suitors.
however. and the modern languages” (85) in order to be accomplished.Chapter One: Women and Education Although the narrator in Sense and Sensibility draws our attention to Marianne’s musicality (33) she does not omit to mention that Marianne practises music for the love of it (45). The narrator comments. singing. Furthermore. nor affecting to be so” (243). Elizabeth Bennet’s music performance in Pride and Prejudice is judged to be “pleasing. Elizabeth “had been listened to with much more pleasure” (71). nor do they necessarily contribute to enhancing her mind. when she states that the room which Elinor and Marianne are given 29 . While Marianne loves music. though by no means capital” (71). It is therefore likely that Marianne does not see music as a means of catching a husband. Being accomplished. stop practising them once they are married. and therefore desirable to men. 33. Likewise. Darcy chooses Elizabeth to be his wife. Lady Middleton is admonished for giving up singing after her marriage: …the chief of the songs which Lady Middleton had brought into the family on her marriage…perhaps had lain ever since in the same position on the pianoforte. then. drawing.2 Laying down the harp Austen shows that often women who only use their accomplishments to catch a husband. Austen appears to be suggesting that accomplishments can neither guarantee any woman a husband. for her ladyship had celebrated that event by giving up music… (Sense and Sensibility. 2. had taught Mary “neither genius nor taste” (71). her sister Elinor is “neither musical. my emphasis) The narrator also seems to be critical of schools in which girls (like Mrs Palmer) are taught only to be accomplished. dancing. that despite her sister Mary’s effort to be accomplished. even though Miss Bingley says that “[a] woman must have a thorough knowledge of music.
In Emma Mrs Elton seems to imply that women should master music and drawing for their own sakes when she comments that “there is a sad story against [married women] in general [that they] are but too apt to give up music” (209). In comparison with this kind of pre-occupation with finding a husband. contemporary studies show that being married does not ensure women of a fulfilled and happy life11. What I am suggesting is that. In addition. married men as well as single people of both genders “reported greater positive affect than did married women” (2001:674). it was believed that women needed to marry in order to lead a meaningful life. there remains a difference at the level of representation when one compares the ways in which Austen’s fictional characters and women in real life experience society. and writes that in a novel such as Pride and Prejudice “the action in almost the entire first volume of the novel consists of very little but women talking or thinking or scheming about men” (1981:129). Feminists are currently concerned with women’s preoccupation with cosmetic Judith Worell writes that. I do not mean to elide the history of feminism by comparing women’s obsession with male attention in Austen’s time to our own. my emphasis). Not only has two centuries passed since Austen wrote her last novel. the quality of their relationships with their children is highly related to their level of satisfaction with their life overall” (674). 11 30 .Chapter One: Women and Education in London. Yet many women seem to be obsessed with men and especially male attention. Judith Lowder Newton comments on women’s obsession with men as portrayed by Austen. While in the late eighteenth century. in proof of her having spent seven years at a great school in town to some effect” (154. in twenty-first century studies on married life and life satisfaction. despite the tremendous strides the feminist movement has made. women still show some signs of a legacy which taught them they needed men in order to survive in this world. “having children does not appear to increase people’s life satisfaction…for those who have children. women today appear to be less compromised. features “a landscape in coloured silks of [Charlotte’s] performance.
(212) It is possible that Austen illustrates how in her own time the female body is made an object of male desire when Mary Crawford plays the harp obligingly and Edmund watches her with indulgence (Mansfield Park. They add that patriarchy is largely to be blamed for this: The female body is made object. a spectacle for (hetero)sexual voyeurism. By making her heroines indifferent to being accomplished and by criticising married women who “celebrate their marriage by giving up music altogether” (Beer. the tininess of their waists. Women then become. Alison and Schneider comment in a sociological essay entitled “The Lived Body Experience of Domestic Violence Survivors: An Interrogation of Female Identity” (2000) that women have become preoccupied with their bodies. Germaine Greer is critical of contemporary women who spend their time and energy making themselves attractive for men.Chapter One: Women and Education surgery because they believe it is an indication of their obsession with male attention. the longness of their legs and the size and shape of their breasts. undergo cosmetic surgery and have their breasts enlarged in an attempt to attract male attention: Women are illusionists. colour and curliness of their hair. absurdly. Instead of acquiring 31 . These women. Men do not seem to have demanded this of them. girlishness and orgasm. 65). according to Greer. both estranged and obsessed with their bodies. rather women seem to have bedizened themselves in an all-out last-ditch attempt to grab the attention of otherwise uninterested males. Making oneself attractive for men seems to be an age-old custom among women. they also fake the roses in their cheeks. (1999:33) Wesely. They fake light-heartedness. 1974:65) Austen appears to show contempt for this convention. the thickness. the male spectator’s gaze upon her becomes her own critical gaze upon herself.
women struggle with identity: Women as a group in our society are both produced and inhibited by contradictory discourses. In Mansfield Park it appears that she perceives education to play a role in this regard: instead of teaching young girls how to become wives it should. Very broadly. generosity. She argues that women’s ‘self’ is inevitably constructed and that. and having many feminist precursors to refer to. relative inadequacy and irrational intuition. against the prescription imposed on them by patriarchy. 3. “ in everything but . In Austen’s novels there are subtle references to what could be interpreted as her encouraging women to discover their own identities. “it is not very wonderful that. living and writing in the twentieth century. The attempt to locate a single and coherent subject-position within these contradictory discourses…can create intolerable pressures. clearly has the confidence and the freedom to speak plainly on the need for women to discover their own identities. partly at least. The narrator in Mansfield Park comments that. Self-knowledge Catherine Belsey states in “Constructing the Subject: Deconstructing the Text” (1985) that the cultural construction of women’s subjectivity is one of the central concerns for feminism. aim at equipping them with self-knowledge. we participate both in the liberal-humanist discourse of freedom. self-determination and rationality and at the same time in the specifically feminine discourse offered by society of submission.Chapter One: Women and Education skills in order to be desirable to men. and humility” (18). with all [Maria’s and Julia’s] promising talents and early information. they should be entirely deficient in the less common acquirements of self-knowledge. she seems to suggest that women should practise the art of music or of drawing for its own sake. owing to contradictory discourses. 32 According to her. (661-662) Belsey.
when Henry Crawford prefers Maria to her. she fails to see their true intentions. much research by feminist scholars in the twentieth century has shown that rigid sociallyconstructed gender roles are responsible for women and men not knowing themselves. Sir Thomas realises too late that “elegance and accomplishments [have] no moral effect on the mind” (468). Fanny Price sees Henry Crawford for what he is and resists his charms because of her deep-rooted love for Edmund (Mansfield Park. Although she is an intelligent girl. they were admirably taught” (18). This makes her misjudge both Darcy and Wickham (Pride and Prejudice. Julia’s misery. Emma. 353-358). Possibly because she herself loses the man she loves to another woman. Barbara Horwitz writes that in Austen’s novels “it is the heroines who do not know their own hearts who are blind to the emotions of others” (1994:142). In Sense and Sensibility Elinor Dashwood knows her own heart and realises how much she loves Edward Ferrars. 294-295). on the other hand. is attributed to the fact that “knowledge of her own heart…had not formed any essential part of her education” (92). In 1967 in an essay entitled “Sex Roles and the Socialization Process” Sverre Brun-Gulbrandsen 33 . While Austen possibly attributes the lack of self-knowledge to an inadequate education. In addition. While Edmund believes “the most valuable knowledge we could any of us acquire [is] the knowledge of ourselves” (464). she shows compassion and understanding for Marianne’s suffering (180-184). The want of self-knowledge causes her to misinterpret Mr Elton’s affections and blinds her to Frank Churchill’s and Jane Fairfax’s conspiracy.Chapter One: Women and Education disposition. only realises that she loves Mr Knightley right at the end of the novel. Elizabeth Bennet does not know her own heart either.
one becomes one” (1985:65). into the particular positions allocated to each sex in any specific way” (Crowley and Himmelweit. This view is echoed by Shoshana Felman: Becoming a feminist is undertaking to investigate what it means to be a woman and discovering that one is not a woman but rather becomes (somewhat interminably) a woman. now young men and women. discovering. whether as a social/political practice. that one is not born a woman. masculine or feminine. one has become (perhaps never quite sufficiently) a woman. behaviour deviating from these norms is punished. or as a literary/theoretical enterprise. Behaviour conforming to these norms is rewarded. Feminist writers of varying persuasions 34 . 1992:18). or Sex and Class as Culture” (2000) that we are all gendered as male or female. Feminism. and socialized into being men or women. (1993:12) In the Spring/Summer 2000 issue of the journal Women: A Cultural Review. (61) When they grow up these children. Regenia Gagnier argues in her article “The Functions of Class at the Present Time: Including Taste. They learn these norms through innumerable environmental influences but particularly from their rearers as these ‘norm-senders’ encourage certain forms of behaviour on the part of the ‘norm-receivers’. edited by Isobel Armstrong. or a relationship of inequality between things that might not on the surface have to do with masculine or feminine” (37). through others’ reading and through the way in which other women are addressed by one’s own writing.Chapter One: Women and Education explained the ways in which little boys and girls are first introduced to their gender roles at home: Children must learn to behave in certain ways in certain situations. aims at making women aware of their socially-constructed gender roles. Toril Moi writes “‘[f]emininity’ is a cultural construct: one isn’t born a woman. She points out that “[g]ender is a role. “fit into the structures of society.
96). She constantly refers to the fact that higher education is a man’s prerogative by mentioning that many of her male characters attended either a university or a private school. not only because it produces dull-witted women whose sole interests are their homes and their families. middle class boys had the opportunity to attend educational institutions. and that in this way prevent them from developing a sense of self. over time and space. The inequality of education leads to 35 . 206). is of great importance. It could be argued that Austen is critical of domestic education. Privileged education for boys I believe Austen to expose the late eighteenth-century educational system for women as unfair by focusing our attention on the biased nature of higher education. 4. rather as a preparation for motherhood [that] Jane Austen may be considered as a feminist writer” (1994: 145). It would seem that for feminist scholars in the twenty-first century. Whereas Henry Tilney went to Oxford (Northanger Abbey. Austen seems aware of women’s educational deficit when she has Anne Elliot say that “[e]ducation has been [the men’s] in so much higher a degree” (Persuasion. as Barbara Horwitz puts it. Catherine Morland received her education from her parents (2).Chapter One: Women and Education and from many discipline bases expose gender roles and patriarchally-constructed norms that dictate to women how they ought to behave. While girls were mostly taught at home either by their parents or a governess. In Austen’s work we can find early signs of what may be regarded as the concern for the lack of self-knowledge among women. It is therefore. knowing oneself and realising that one is constituted out of different discourses. but also because it keeps women from knowing their own minds. by “stressing women’s education for its own sake.
She emphasises the informal education girls receive at home by making Lady Catherine react in utter disbelief to the fact that the Bennet sisters had no governess (Pride and Prejudice. “the deficiency of nature had been but little assisted by education” (114). sends money only for Mrs Price’s sons to be educated. His brother. In Sense and Sensibility we learn that Edward Ferrars was “entered at Oxford” (100). Though the educational bias of the late eighteenth/early nineteenth century has been eradicated. and not her daughters (19). While he sends Edmund to Eton and then to Oxford. He does not encourage them as he does his sons when he listens to them enacting Julius Caesar and wishes them “as schoolboys. Here Austen may be implying that though a tertiary education does not guarantee quick understanding. is that women enter neither. to speak well” (130). my emphasis) in Mansfield Park.Chapter One: Women and Education Henry’s pedantic attitude and enables him to correct Catherine’s grammar constantly (96-98). his own daughters receive their education at home. But the narrator also points out that even though Mr Collins attended one of the universities. In this novel Austen seems to imply that being a woman means being deprived of a decent education. a staunch patriarch. Because they were deprived of a higher education equal to that of men. The underlying implication. introduces the debate as to whether a private or a public school aids a man best (244). Sir Thomas. women did 36 . Robert Ferrars. 199). the lack of one guarantees a subordinate role in society. By having Edmund and Henry discuss the neglect of reading in “the ordinary school-system for boys” (343) Austen implicitly draws attention to the absence of such a system for girls. of course. Isobel Armstrong argues that although Austen’s critique “of women’s education is oddly akin to that of a more radical writer” (1988:10) it remains an “indirect concern” (9. it would seem to have had some long-term effects on women and their position in society.
It would seem plausible that contemporary women have no legacy of great women artists precisely because they were subjected to a prejudiced education system for many years. male. 5. in the arts as in a hundred other areas. 1999:155). a don was heard to sardonically remark. women among them. Cambridge.Chapter One: Women and Education not feature in literature for many years. our hormones. her work may help us understand the ways in which women were kept from developing their intellectual abilities. composers and mathematicians equivalent to male artists like Chaucer or Cézanne. Unequal education opportunities In Mansfield Park Austen calls attention to the patriarchal grand narrative of her time which would have it that extensive education creates vanity in women. but in our institutions and education… (96) Since Austen’s novels provide us with an account of the biased nature of education in the late eighteenth/early nineteenth century. who did not have the good fortune to be born white. are stultifying. race and sex works effectively to keep women from developing their artistic capabilities: …things as they are and as they have been. She comes to the conclusion that discrimination based on class. preferably middle class and. The fault lies not in our stars. Germaine Greer points out that women were only fairly recently granted equal educational opportunities and allowed to attend universities12. 12 37 . oppressive and discouraging to all those. or our empty internal spaces. above all. Sir Thomas expresses the This was such a novel idea to some patriarchal stalwarts that “when women were admitted to King’s College. ‘Now the men will get their laundry done free’” (Greer. philosophers. our menstrual cycles. In an essay entitled “Why Have There Been No Great Women Artists?” Linda Nochlin (1994) asks why the Western world has failed to produce women writers.
or an establishment. the franchise. public life and the labour market have been on terms designed to meet the needs of individual men…” (1987:2). In the years that followed Austen’s writing.Chapter One: Women and Education generally held viewpoint that “self-conceit. Fanny answers it is “[t]he effect of education” (272). women are prevented from a proper education. or any thing which professed…to combine liberal acquirements with elegant morality…. without any danger of coming back prodigies. Today. When Edmund mentions to Fanny that Mary Crawford’s conversation and opinions sometimes have a tinge of wrong. The narrator’s observation regarding Mrs Goddard’s “old-fashioned Boardingschool” (17) could be a condemnation of the patriarchal system for preventing women from receiving a decent education: Mrs Goddard was the mistress of a School . old-fashioned Boarding-school.but a real. and every tendency to that independence of spirit…in young women is offensive and disgusting” (320-321). honest. In Emma Austen refers to the fact that because education is believed to lead to vanity. While the male monopoly has been eliminated in most Chris Weedon points out that although “[m]any of the social and political gains made by women over the last 100 years have been the result of struggles to include women in the rights and privileges which men have instituted to serve their own interests…women’s inclusion in education. women and men of the Western world mostly enjoy an equality of education. my emphasis) Austen seems to suggest that men deliberately keep women from an extensive education in order to render them weak. feminists increasingly demanded equal educational opportunities13. where a reasonable quantity of accomplishments were sold at a reasonable price and where girls might be sent to be out of the way and scramble themselves into a little education.not of a seminary. 13 38 . (17.and where young ladies for enormous pay might be screwed out of health and into vanity .
Nevertheless. particularly in the industrial sector” (268). is class specific. since only women belonging to the middle-class had governesses or attended schools (Levine. Seeing that the effects of a poor education would be felt by the middle-class women of the late eighteenth/early nineteenth century. 6. 1987:26-27) her criticism. her criticism of women’s limited education creates a consciousness of Margaret McFadden writes in Ready Reference: Women’s Issues (1997) that by 1990 “[m]ost professions remained under male control…[and that] women still faced a glass ceiling…barring them from higher-level authority positions. Biased education. Austen is almost exclusively addressing their needs. it should be kept in mind that Austen writes with a specific readership in mind. However.Chapter One: Women and Education of the educational realm. once again.14 Linda Schmittroth and Mary Reilly McCall show in Women’s Almanac (1997) that women with similar levels of education to men still earn less than their male counterparts (405). Consequences of a poor education I believe Austen illustrates the consequences of an inadequate education for women in her novels. Germaine Greer found as recently as 1997 that “across all types of work in higher education…62 per cent of the jobs done by women were consistently undervalued as against 37 per cent of the jobs done by men” (1999. feminist writers believe it has spilt over into the workplace. “tend to predominate in higher-level occupations…while women tend to be concentrated in lower professional and clerical jobs” (499). 157). as Lorraine Code remarks. Throughout the following section. 14 39 . Because men had the educational monopoly for so many years they now. then. appears to have had far-reaching consequences: it not only favoured boys at the time but weakened girls for many years to come.
In Northanger Abbey Austen may be implying the absence of a women’s literary canon by listing male poets only. Because men had privileged access to writing and producing knowledge (as I illustrate in Chapter Two). Thompson and Shakespeare (3-4). including Pope. In Mansfield Park Austen comments on the god-like powers of the author when she informs the reader that she personally likes restoring her characters to reasonable comfort (466). he was assuming her subordinate position in society. Gray. Austen herself appears to see the pen as a symbol of power when she equates a person’s writing to strength of character in Emma (224). She shows how writing can establish a woman’s subordination by quoting a single line of poetry: it is clear that when the poet compared a wife to “Heaven’s last best gift” (42). they were able to keep women subjugated and to maintain their powerful position in society. That men had privileged access to writing has further consequences. they were able to control 40 . Sandra Gilbert and Susan Gubar see the pen as “an instrument of generative power like [the] penis” (1979:6) and therefore as “essentially a male ‘tool’” (8). Austen’s findings show an awareness of what French psychoanalyst Jacques Lacan has identified as ‘the law of the father’. It would seem that men in the late eighteenth/early nineteenth century experienced the act of writing as threatening.Chapter One: Women and Education the type of legacy contemporary women have inherited and an awareness of some of the ways in which this has affected them. In Ecrits (1966) he states that the phallus represents the law of the father – la loi primordiale – and fixes meaning in language (277). By reserving education solely for men. Being rendered powerless is one of the first consequences of a poor education.
the sexual harassment of schoolgirls. Chris Weedon argues that “women’s absence from the active production of most theory within a whole range of discourses over the last 300 years…[is] a mark of the particular conditions under which prestigious and powerful bodies of knowledge were and are produced” (1987:13. 16 Rosalind Miles writes that by the late twentieth century “[t]housands of women [were] writers who would previously have thronged with the ranks of the illiterate” (1987:27). my emphasis).Chapter One: Women and Education what was written and in so doing keep women subordinated. bell hooks comments on the implications that this type of patriarchal discourse has for women: . Writing on the theoretical and political influences which have helped constitute current poststructuralist theory. 15 41 . it has proved extremely difficult to improve the plight of girls and women… (2000:161) Flis Henwood contributes to Code’s findings when he argues that the falling number of women entering computer science courses is due to dominant discourse which offers women “only marginal or outsider status within technological cultures” (2000:213).15 Though in our own time women have just as much right to the act of writing as men16. a hidden curriculum in misogyny and anti-domesticity. among them: a chill coeducational classroom climate for girls and women…the androcentric bias of the subjects of the liberal curriculum. and to modern society in which “the acquisition of technical skills by women is perceived by many as a threat to the masculinity of men and to the gender order more generally” (210). prevails in the educational realm. Feminist writers have identified some of the consequences that women’s literary legacy has led to. Despite the advent of women’s studies programmes. the underrepresentation of women in the higher ranks of the professorate. contemporary schoolgirls continue to suffer the consequences of what she calls an “education-gender system”: Feminist research and scholarship has uncovered many elements of this education-gender system. Lorraine Code comments that since Western ideology. which associates men with mind and women with emotionality. they have been left with a very different type of literary inheritance to that of their male counterparts.
race. it would appear that they suffer the consequences of a 42 . 1987:2). (2000:7-8) Diane Reay writes in “‘Drim Dros’: Marginalised Women both Inside and Outside of the Academia” (2000) the reason for the academic status quo is that the higher education sector is “a territory ruled by men. This deprivation leads women to feel insecure about intellectual work and to fear grappling with new ideas and information. Elaine Showalter comments in “Laughing Medusa: Feminist Intellectuals at the Millennium” (2000) that women rarely come up in debates about the dilemma of the intellectual in society since the woman intellectual “is camouflaged by her gender” (132). Contributing to the idea of the invisibility of women. There has been much presentation of data and increasing feminist analyses and commentary on the position of women in the higher education sector. Though women have managed to eradicate male-dominated education and despite the fact that they enjoy equal education opportunities to men (Schmittroth and Reilly McCall. 1997:362.Chapter One: Women and Education As a group. where the vast majority of women if they count at all count for less” (14). Weedon. Most women are deprived of access to modes of thought that promote the kind of critical and analytical understanding necessary for the liberation struggle. and class exploitation and oppression) the right and privilege to develop intellectually. (2000:114-115) Sue Ledwith and Simonetta Manfredi express their concern about the under-representation of women in the higher education sector in general: The poor showing of women in the higher reaches of universities across Europe is seen as being among the worst in the labour market. which becomes “reconstituted as a low-level activity…in which women undertake invisible labour which services men and contributes to relations of ruling” (15). women have been denied (via sex. She goes on to argue that many women are employed as contract researchers only.
which was usually around the age of seventeen (Cruse. as She pays their education “not the smallest illustrated in Austen’s novels. By then. Instead. she 43 . to be caused by the lack of a proper education.Chapter One: Women and Education male-dominated education legacy. The Bertram sisters in Mansfield Park feel there is a great deal for them to learn. 1931:78). and a very frequent ignorance of grammar” (15). Because of the inattention to academic development. being under-represented in the higher education sector and the belief that certain academic terrains are the prerogative of men. These include a male-favouring education system. In Northanger Abbey Henry Tilney believes women to display in their usual style of letter-writing “[a] general deficiency of subject. Where an inadequate education does not cause ignorance. Another aspect of late eighteenth and early nineteenth-century education which Austen seems concerned about is the view held by most women of the time that they need only study until they ‘come out’. does not believe women’s boredom. remains ignorant and illiterate precisely because “her powers had received no aid from education” (123-124). ignorance and deficient grammar were often found among women of the middle class. attention” (18). though she is naturally clever. Judith Lowder Newton. but only up to their seventeenth birthday (17). it may be responsible for women being bored. they would know everything a girl needed to know in order to fulfill her domestic role. In Sense and Sensibility we are told that Lucy Steele. however. In Northanger Abbey Austen more directly addresses the issue of girls studying only until their seventeenth birthday when the narrator comments that Catherine’s mind is “about as ignorant and uninformed as the female mind at seventeen usually is” (6). it would seem. Their lack of interest in acquiring knowledge is partly their mother’s doing. a total inattention to stops.
She welcomes new inhabitants to the country for she has grown used to the absurdities of people like Sir William Lucas whom she has known all her life. Emma relishes gossip (130) and enjoys meddling in other people’s affairs. it is no wonder that she finds amusement in the domestic and the mundane. She has a lively disposition and delights “in anything ridiculous” (59). Elizabeth Bennet admits to being a “studier of character” (Pride and Prejudice. 269). 88) to keep herself amused. Austen draws our attention to the intellectual loneliness of married women by having Mrs Elton say that even if a woman has “ever so many resources. She is easily bored and even gets agitated with Frank Churchill and Harriet for being “dull” (278). She admits that playing matchmaker to people like the Westons “is the greatest amusement in the world” (10). Grant. The narrator comments that Mrs Grant welcomed the news that Mary was to come and live with her “for Mrs. it is not possible for her to be shut up at home” (Emma. having by this time run through the usual resources of ladies residing in the country without a family of children – having more than filled her favourite sitting-room with pretty furniture. Educated for domesticity. We are told that Emma suffers from “intellectual solitude” (Emma. Newcomers like the Bingley sisters provide welcome entertainment for Elizabeth whose “quickness of observation” (63) enables her to recognize their superciliousness (68). In Mansfield Park Mrs Grant is pitied for the monotonous duties that make up a married woman’s life. and to laugh at especially Caroline Bingley’s desperate attempt to attract Darcy’s attention (92). and made a choice collection of plants and poultry – was very much in want of some variety at home” 44 . To alleviate the boredom.Chapter One: Women and Education sees it as a result of “women’s usual state [which] is not to move at all but to hear news or to read letters about the arrivals and departures of males” (1981:126). 6) since her father cannot provide stimulating conversation.
Austen creates an awareness of the importance of an equality of education between men and women. being ignorant and deficient in grammar. In the following chapter it will be shown that Austen seems to be aware and critical of the fact that knowledge has been produced by men for centuries. being interested in only the domestic and the trivial. not being intellectually stimulated. Mary Crawford’s response to her sister’s plight possibly reflects that of the narrator: ‘The sweets of housekeeping in a country village!’ said Miss Crawford. In addition to investigating the type of education women receive and the effects thereof. The consequences of such an education system for women include not having access to the power of the pen. ‘Commend me to the nurseryman and the poulterer. It can therefore be argued that by showing how a limited education debilitates women in many different ways. and that it has always excluded women. and finally being bored . Austen could also be read as exposing the access that women have to knowledge (or the lack thereof).Chapter One: Women and Education (40). 45 . and a world in which women are subjected to an inferior education.’ (215) Austen’s novels depict a world in which men enjoy the privilege of having access to a higher education. archly. We see that Mrs Grant’s main concerns in life consist of nothing more than cultivating her plants and deciding on which meal to cook her husband (214).especially within the marriage state.
It is not In 1987 Chris Weedon wrote that “[t]he last fifteen years [had] seen the beginnings of a radical shift in the degree to which women are represented in knowledge production and in the production of theory both inside and outside official education and research” (13-14). and not at all applicable to our modern world. expected women to be ignorant and to “minister men’s conversation” (1974:65). provided they did not display their knowledge. Instead of being told to agree with men. It is possible that Austen is being critical of a society which. “can offer women alternative perspectives on negotiation techniques and communication styles…[and] can educate women to be more expressive and candid” (2000:95). edited by Rhoda Unger.Chapter Two: Women and Knowledge Chapter Two – Women and Knowledge Introduction In Austen’s day women were not expected to know about politics or history – these topics were reserved for men – nor were they expected to make intelligent conversation. 1931:15). [she] should conceal it as well as she can” (99) may be interpreted as tongue-in-cheek. Kramarae and Spender comment that assertiveness training. The narrator’s observation in Northanger Abbey that “if [a woman] have the misfortune of knowing anything. “it was not thought proper for a young lady to study very conspicuously” (Cruse. they are encouraged (and often praised) for displaying assertive and independent characters18. 18 The Handbook of the Psychology of Women and Gender (2001). She adds that girls were allowed to study the classics. In the early nineteenth century. Barbara Horwitz mentions that renowned eighteenth-century educational writer Fenelon “had declared woman’s intellect was normally feebler than a man’s [and] that learning would make a girl vain” (1994:137). 17 46 . states that “American society today is more accepting of women who display assertive and independent characteristics” (413). In contemporary society women are not forbidden to display their knowledge17. which was popular in particularly the United States in the 1970s and 1980s. as Patricia Beer has shown. then. Yet feminist scholars have found that women today often defer to men in conversation. These social prescriptions may seem very far removed from the twenty-first century.
however. while Mary Eagleton suggests that “social and cultural pressures…undermine [women’s] confidence and make them hesitant about speaking” (1996:16). Sally Alexander believes “[w]omen are subordinated and silenced because they live in a world shaped in the interests of and dominated by men” (1994:101). Araújo. Andrea Nye suggests it is on account of men generally wielding more power than women in relationships that women feel they have to “listen. There are also other explanations for women’s reluctance to speak out. While Catherine Belsey refers to the “feminine discourse offered by society of submission. and further develop [men’s] ideas” (1988:173). but not too good. Mort and Weedon postulate in their article “Psychoanalysis and the Cultural Acquisition of Sexuality and Subjectivity” (1978) that owing to “the social structuring of the unconscious through language” (115) women are silenced. relative inadequacy and irrational intuition” (1985:662). to appear quiet and mysterious (2000:343). Arnot. my emphasis) Barbara Darby. dress well but not too expensively. that is.Chapter Two: Women and Knowledge implausible that the reluctance of women to disagree with male arguments and views has its origins in the conduct books of the late eighteenth century. instead. to something inherently spoken for” (1993:24). Changing Concepts of 47 . Germaine Greer points out how this discourse expects women to exist in relation to their husbands only: The politician’s wife is expected to display all the wifely virtues. Burniston. mentions that in our own time women are advised by certain writers not to start up a conversation with men but. and Shoshana Felman argues that by “the oppressive gesture of representation…man has reduced the woman to the status of a silent and subordinate object. (1999:322. come when she is called and laugh at her husband’s jokes. Deliyanni and Ivinson suggest in “Changing Femininity. make comments. she must look good. speak when she is spoken to. writing on the ways in which women’s identity is determined by society.
as Henry moves on from discussing the landscape to politics. the narrator comments that from there “it was an easy step to silence” (100). crown lands and government – he shortly found himself arrived at politics… (Northanger Abbey. I would argue that the narrator is critical of Henry’s abusing his power. When he talks to Catherine and arrives at the subject of politics. However. from her novels we can infer that she lived in a society which rendered women ignorant and which expected them to be passive when conversing with men.Chapter Two: Women and Knowledge Citizenship in Public and Private Spheres” (2000) that women today are not operating “on the same terms as men” (152). Austen never overtly challenges patriarchy for rendering women silent. and the withered oak…to oaks in general – to forests. In their study on women’s subordination in society. 100) 48 . In accordance with their findings. the enclosure of them. While contemporary feminist scholars openly blame society for women keeping quiet when men speak. “the narrator. Whereas Sandra Gilbert and Susan Gubar suggest that. Janet Saltzman Chafetz comments in Handbook of the Sociology of Gender (1999) that “the mere knowledge of another’s sex…has been shown to affect willingness to accept influence from that person” (263). The narrator’s disapproval of his dominating the conversation is evident in her rendition of the rapid and illogical progression of his discourse: …by an easy transition from a piece of rocky fragment. In Northanger Abbey we see that such a society enables a man like Henry Tilney to abuse his privileged male education. like Catherine keeps still [because] etiquette. it seems. they found that men and women regard the male sex as having more control over decision-making in various areas (2000:153). would forbid such discussions” (1979:134). waste lands.
women who may never carry out programs of reading literature” (1987:150). There are critics. who seem to disagree with the above-mentioned view. partly at least. My aim is not to speculate about Austen’s personal views. Whatever her intent may have been. but to show that depicting the type of conversation generally found among women raises an awareness. 49 . It would seem possible that women’s ignorance led. She argues that Austen thereby manages to grant “priority to the verbal practices of women. of women’s general ignorance during the time in which her novels were written and of the dire need for intelligent conversation among them.Chapter Two: Women and Knowledge Nancy Armstrong argues that women narrators of Austen’s time were identified by their gender as having no claim to especially political knowledge and power (1987:29). it was just a few decades earlier that Mary Wollstonecraft posited in A Vindication of the Rights of Woman (1792) that women were politically incompetent because they had not been educated like men (265). Indeed. amongst feminist scholars at least. Austen appears to encourage stimulating conversation among women by creating intelligent women characters who yearn for interesting conversation and who are not afraid to disagree with what men have to say. Nancy Armstrong believes Austen’s writing to support gossip and conversation among women. and there is some evidence to suggest that she is critical of empty women-talk. conversation makes up an essential part in Jane Austen’s novels. I believe Austen to show an awareness of the fact that many women in her time were uninformed about subjects beyond their domestic sphere (such as politics and current affairs). however. Austen vividly illustrates the type of conversation generally found among women. In addition. to empty conversation among them.
Isabella and Mr Woodhouse. and one subject only engaged the ladies till coffee came in. and [that] nothing could be less interesting than the whole of their discourse” (137). and Lady Middleton’s second son. and to laugh at girls who can talk of nothing but “dress.Chapter Two: Women and Knowledge 1. William. flirtations and quizzes” (20). and breaking horses – but then it was all over. In Sense and Sensibility the narrator is undoubtedly critical of women who busy themselves with uninteresting conversation: When the ladies withdrew to the drawing-room after dinner. whose conversation can be classified as ‘typically female’ owing to his hypochondria (Horwitz. In contrast. the women talk about people and fashion (59). she ironically thinks she is faring better herself by talking about the house and the furniture. discuss their respective apothecaries (Emma. In Northanger Abbey Austen shows that to talk does not mean to be having a conversation. 50 . The narrator seems to be critical of women’s “maternal effusions” (19) when Mrs Thorpe and Mrs Allen meet in Bath. Trite Remarks and the Conduct Books By contrasting topics of conversation generally found among men and women. this poverty was particularly evident. While men discuss political and news-making events. In Emma Mr John Knightley and his brother talk about the law and about farming (78). 1994:140). balls. Once again Austen contrasts ‘men-talk’ to ‘women-talk’. inclosing land. (228) While Lucy Steele criticises her sister Anne for talking “of nothing but beaux” (120). who were nearly of the same age. for the gentlemen had supplied the discourse with some variety – the variety of politics. Austen alerts us to the lack of stimulating discourse among women in the early nineteenth century. which was the comparative heights of Harry Dashwood. 78-79). Empty conversation. When Elinor dines with the Miss Steeles and Lady Middleton she feels that their meeting “produced not one novelty of thought or expression.
326). it is not to add her own view but merely to stop Mr John Knightley from making any further hurtful remarks to Isabella (Emma. Even Emma’s allegorical interpretation of Elton’s poem is.ironically often written by women19 . When the Knightley brothers discuss legal issues Emma does not partake. as long as they were not too far-ranging or assertive. limited and dreary. This often led to empty conversation among them.was prescribed to women and dictated what they should say. Emma says “[j]ust what she ought [for a] lady always does” (Emma. We see how even an intelligent girl like Emma Woodhouse at times indulges in trite remarks. stereotyped. The lack of intellectual conversation among women may be linked to the kind of literature available to them. 19 51 . Furthermore. “perfectly in keeping with the conduct book’s suggestions about the proper use of classical mythology and history within a female curriculum” (1987:146). as Nancy Armstrong puts it. a conversation in which there is “scarcely ever any exchange of opinion” (23) is hardly a conversation at all. they often evince attitudes Nancy Armstrong writes that the conduct books of the eighteenth and nineteenth centuries “often written by women and directed at female readers…rewrote the female subject for an eighteenth century audience” (1987:94). to show in their conversation that they had read. When she eventually does join in. were held to be perfectly feminine… (1974:66) Austen’s work illustrates the effects of these prescriptive books on women. 81). were published alongside other details of required behaviour. as Patricia Beer points out: Women were allowed. While one might expect Austen’s heroines to be more defiant of patriarchal convention. The various lists of books recommended for them in Jane Austen’s day. even encouraged. when Mr Knightley declares he loves her.Chapter Two: Women and Knowledge To her. The notorious conduct book of the late eighteenth/early nineteenth century . Literary allusions.
In addition. one cannot but notice that the narrator ridicules Mrs Allen for not being able to utter little more than a few standard phrases. This changes to “How glad I am we have met Mrs Thorpe” (23) by Chapter Five. When Catherine and Elinor meet in the Pump Room. She seems to ridicule clichéd idioms like “Despair of nothing we would attain” and “Unwearied diligence our point would gain” (18). Barbara Horwitz writes that Mary “demonstrates her own obtuseness by parroting Mr Villar’s speech 52 . While the narrator refers to Mrs Allen’s “remarks and ejaculations…vacancy of mind. When they first arrive at Bath she keeps on repeating “I wish we had a large acquaintance here [in Bath]” (10).Chapter Two: Women and Knowledge other than a feminist sensibility. In Northanger Abbey Austen most overtly criticises the conduct books and their effects. and appears to be critical of Catherine’s use of “pretty expressions” (20). not an expression used by either which had not been made and used some thousands of times before” (60). Nancy Armstrong has noted that in Pride and Prejudice Austen mocks those novels which observed “all the same sense-making procedures as the conduct book…when she [has] Mary Bennet speak the conduct-book clichés in all their tiresome perfection” (1987:108). though one could argue that Austen allows her heroines to utter clichés and empty remarks in order to illustrate that even spirited women know what they have to do and how they have to behave in order to survive in patriarchal society. Henry Tilney describes having only her as company as “a picture of intellectual poverty” (67). the narrator comments that “in all probability not an observation was made. The narrator refers to the abundance of trite remarks (very possibly a result of having recommended books) when she says the heroine of any story should supply her memory “with those quotations which are so serviceable and so soothing” (3). and incapacity for thinking” (48).
Gilbert and Gubar point out that “Marianne is extremely sensitive to language. Lady Bertram is In Sense and Sensibility Austen characterized by speaking “entirely by rote” (196). She has her own ideas and would rather say nothing at all than use “worn and hackneyed” (94-95) language. and make extracts. and read great books. Lady Middleton for example has “nothing to say for herself beyond the most common-place inquiry or remark” (29). repelled by clichés. while the conduct books occasionally enabled women to make an appropriate remark. 55) It would seem that. In the same novel. Marianne admits that she abhors “every common-place phrase by which wit is intended” (Sense and Sensibility. rather than repeating what they have been told. Mary prides herself on being bookish yet has nothing sensible to say. but knew not how. as in the others. that one is sorry to see them give way to the reception of more general opinions” (54). they did not ensure that they would always have something sensible to say. as Mr Bennet is quick to point out: ‘What say you. challenges empty expressions. 210-211) reflects the narrator’s irritation with hackneyed expressions. Colonel Brandon makes a case for young people having their own opinions. when he states that “there is something so amiable in the prejudices of a young mind. This renders her incapable of making 53 . Patricia Beer has made the point that in Mansfield Park Fanny Price recites a speech on memory which comes “almost straight from Dr Johnson” (1974:66). 43) and that she detests “jargon of every kind” (94). and impatient with the polite lies of civility” (1979:156). we see that women often fail to have their own views.Chapter Two: Women and Knowledge from Fanny Burney’s ‘Evelina’” (1994:139). In this novel.’ Mary wished to say something very sensible. (Pride and Prejudice. It is possible that Mary Crawford’s evident boredom with Fanny’s speech (Mansfield Park. Mary? for you are a young lady of deep reflection I know.
[Lady Middleton] could not believe them goodnatured. When Fanny contemplates whether being married to Edmund would change Mary Crawford’s character. and easily given. it creates an awareness of the devastating effects of prescribing reading material for women.Chapter Two: Women and Knowledge interesting conversation (52-53) and of understanding popular clichés. and because they were fond of reading. she fancied them satirical: perhaps without exactly knowing what it was to be satirical. She echoes what Thorpe says (52-53). (240) In Mansfield Park the idea is expressed that women often do not have their own views. think 54 . It was censure in common use. Since her “youthful female mind [is] fearful of hazarding an opinion of its own in opposition to that of a self-assured man” (35) Catherine Morland accepts the views of Henry Tilney and Mr Thorpe. has no views of her own but uses those of her husband (222). but that did not signify. in addition to her trite remarks. though it does not deter her from using them: Because [Elinor and Marianne] neither flattered herself nor her children. material which dictates what they ought to do. we read “impartiality would not have denied to Miss Crawford’s nature that participation of the general nature of women which would lead her to adopt the opinions of the man she loved and respected as her own” (372). She is so dependent on Sir Thomas’s views that she even lets him decide which game she should play (241) and whether or not she can do without Fanny (219). Lady Bertram provides a good example of a woman who has adopted the opinions of the man she loves. In addition. In Northanger Abbey Mrs Allen. Austen’s depiction of women’s deferral to men provides us with insight into the powerful position men held at the time. and starts to see things from Henry’s perspective (100) because she assumes that he “must know best” (137).
2. Elinor Dashwood is one of Austen’s women characters who yearns for intelligent conversation (52). When talking to Captain Benwick her “seniority of mind” (90) puts her in a position to recommend that he read more prose. While Frederick 55 . The effects include women engaging in empty conversation.Chapter Two: Women and Knowledge and say. well-informed people. uttering trite remarks. When Sir Walter and Mr Shepherd talk about the rich Navy Officers returning to England. She remarks that women of any class who are intelligent. Elinor. who feels that “nothing could be less interesting” (Sense and Sensibility. Anne adds her own view on the navy (Persuasion. She finds him “capable of giving [her] much information on various subjects” (49) and derives “more satisfaction from conversing with him than from any other daily occurrence” (162). enjoys Brandon’s company. Finding a new discourse Austen not only depicts empty talk among women. Anne’s idea of good company is “clever. who have a great deal of conversation” (134). I would agree with Patricia Beer who believes that Austen manages to create “considerable equality between the sexes in conversation” (1974:66). 137) than typical women-talk. 18-19). which contradicts the ideology of the time that women should not know about politics. and failing to have their own views. Anne’s ability to make intellectual conversation comes to the fore especially when she converses with members of the opposite sex. Austen challenges the view that women should not argue with men by having women characters like Anne Elliot disagree with the opposite sex. not having anything sensible to say. “may well be worth listening to” (139). In addition she makes Anne au fait with public affairs. She achieves this by introducing intelligent conversation among women and by having her heroines argue with men. she also shows that there are women who engage in stimulating conversation.
While Elizabeth joins in Darcy’s and Bingley’s conversation and offers her own views. at [Elizabeth’s] manner of talking to her brother…[she] by Elizabeth’s instructions…began to comprehend that a woman may take liberties with her husband” (395). of course. the narrator informs us that Elizabeth continued to engage in a “lively. she argues that Elizabeth renounces all her pertness and liveliness of mind the instant she agrees to marry Darcy (51). Elizabeth’s outspoken. Armstrong believes that this apparent discontinuity within Elizabeth’s character “demonstrates this novel’s reliance on the figure of sexual exchange” (51). They. what he really wants is for her to agree with everything he says and 56 . Once married.Chapter Two: Women and Knowledge Wentworth values her sound advice (105). Elizabeth Bennet similarly manages to hold her own with men. Although Nancy Armstrong agrees that Elizabeth has been endowed with “rational intelligence…and especially a command of the language”(1987:50). she successfully defends women against Captain Harville’s view on women’s fickleness (206). Tony Tanner writes in Jane Austen (1986) that Elizabeth also “disconcerts Wickham with a nice irony” (115). 85) and exchanges erudite arguments on poetry (90). Though Armstrong’s point is valid. Although Edmund Bertram ostensibly asks Fanny’s advice and wishes to confide in her. 260-261). and he is never quite sure what to make of her words (Pride and Prejudice. She disagrees with Darcy on what makes an accomplished woman (Pride and Prejudice. In Mansfield Park we see the heroine fitting into convention by being quiet and modest and by not arguing with men. sportive. manner of talking” (395) to her husband. the Bingley sisters remain silent (9496). She also mentions that although Georgina at first “listened with an astonishment bordering on alarm. selfassured repartee throughout the novel remains memorable. subscribe to the tradition that women should be seen and not heard. and not argue with men.
For this reason she offers her judgement and opinion very modestly (158). At times she purposefully disagrees with him. Fanny is not used to opposing people. In the following section I shall show that by asking how knowledge was produced and by whom. When she openly disagrees with Henry Crawford. especially when they are men. just for the sake of arguing (Emma. We always say what we like to one another. you know – in a joke – it is all a joke. That they enjoy quarrelling is clear: Mr Knightley loves to find fault with me. I believe that if we read Austen from a feminist point of view. Austen shows that not all women subscribe to the view that they should be ignorant and fail to have their own opinion. 111). (9) By creating women who argue with men and who yearn for intelligent conversation. Austen’s work also gives us a good idea of the type of knowledge women could obtain. her work exposes knowledge to be man-made and leads us to consider how this has affected women’s lives. the experience is so foreign to her that she trembles and blushes “at her own daring” (228). Emma discusses Harriet’s refusal of Robert Martin and talks to Knightley about women’s issues with “all the familiarity of an equal” (223). 57 . we are able to gain insight into the ways in which women were restricted in the past.Chapter Two: Women and Knowledge to quiet his conscience (156-157). Austen appears to create some equality between the sexes in Emma when she presents us with good-humoured bantering between Emma and Mr Knightley. As Rosalind Meyer shows in “Mr Knightley’s Education: Parallels in Emma” (1998). In addition to making us aware of the fact that women in the beginning of the nineteenth century had limited access to knowledge.
and…what counts as knowledge” (1987:7). “ways of producing knowledge. not even in the act of knowing. Investigating ‘knowledge’ In Feminist Practice and Poststructuralist Theory (1987) Chris Weedon states that feminist theory should ask “how and where knowledge is produced and by whom. the child must enter into the symbolic order. Kadiatu Kanneh reminds us in an essay entitled “Love. as stated by this theory. Jane Moore mentions in “An Other Space: A Future for Feminism?” (1992) that postmodern theory. According to Foucault “all knowledge rests upon injustice…there is no right. far less of demonstrating. Mourning and Metaphor: Terms of Identity” (1993) that language is “a legacy of male power” (136). In “Extreme Fidelity” (1984) Hélène Cixous writes that since “we are born into language” (15). the set of signifying systems of culture of which the supreme example is language. and Francois Lyotard in particular. Catherine Belsey reinforces this poststructuralist concern with language: If [a child] is to participate in the society into which it is born. and ways of shaping the world according to that knowledge” (Crowley and Himmelweit. to be able to act deliberately within the social formation. Discourses are. initiated “a rethinking of the status of knowledge and of its relation to the knower” (1992:66). 1982:237) so that “no text is capable of representing determinately. (1985:660) Michel Foucault’s work on the plurality and ‘differance’ of meaning suggests that language is not neutral but that it constructs reality. and used to produce (and shape) knowledge. the ‘truth’ about any subject” (Abrams. Toril Moi’s contention that “the dominant power group at any given time will dominate the intertextual production of meaning” 58 .Chapter Two: Women and Knowledge 3. to truth or a foundation of truth” (1977:163). language plays a vital role in constructing our subjectivity. 1988:203).
206. Anne Elliot points out that books prove nothing since all stories have been written by men: Yes. in Edward Said’s words. emotions. although Mr Tilney. historical sense. If we read Austen from a feminist point of view it becomes possible to perceive a society in which men shaped knowledge and ‘truth’. Education has been theirs in so much higher a degree. Sally Alexander points out that women’s history has to be argued for: 59 . “we all speak from a specific position shaped by cultural. Taking a strong stance when arguing about women’s fickleness with Captain Harville. Catherine Morland. the men all so good for nothing. and hardly any women at all” (97. (Persuasion. no reference to examples in books. my emphasis) As Toril Moi has rightly suggested. it could be argued. with wars or pestilences in every page. She suggests that. “its own perspective. political and personal factors” (1985:43). Mr Allen. a knowledge that excludes women. social. the pen has been in their hands. she herself finds it tiresome because it features “quarrels of popes and kings. yes. Men have had every advantage of telling us their own story.Chapter Two: Women and Knowledge (1985:158) implies that men have used language to produce knowledge . my emphasis). André Brink comments that in Emma “Knightley’s privileged access to truth is based on his position in society as a male” (1998:114). and traditions” (1993:11). This means that each group of people will have its own interpretation of the past and. if you please. her father and two of her brothers like history.a knowledge that passes itself off as truth. 97). I will not allow books to prove anything. anticipates poststructuralist and feminist theory that aims at deconstructing the master narrative of history when she ascertains that a great deal of history “must be invention” (Northanger Abbey.
and that it was ‘unnatural’ for women to write. (Miles. Women were in this way discouraged from writing literature and history. history. when the suggestion was made at a History Workshop session that people working on women’s issues should meet later in the day. 1987:6) In fact. amongst other factors. Gilbert 60 . and hence excluded from producing knowledge: …by the nineteenth century. 4. (1994:141) Language.Chapter Two: Women and Knowledge It is well known that women receive little or no attention in traditional history writing. they managed to hold on to their authority in patriarchal society. but even among radical and socialist historians they are all too often mentioned as an afterthought. delightful” (1988:xv). by extension. surprise or roguish gallantry on all sides. there was a roar of laughter. her novels (especially Northanger Abbey and Persuasion) make us aware of the fact that women in Austen’s time were left powerless by. Because men were in the powerful position of writing (producing) knowledge. Barbara Horwitz mentions that “learned ladies who exhibited their knowledge were made to appear unnatural and therefore ridiculous” (1994:137). wispy. the fear of the intellectual woman was so great that she was labelled a freak. Self-Deprecation Early nineteenth-century women were left with the belief that writing was a man’s domain. the idea that the novel was man’s ‘proper sphere’ was so entrenched that the very idea of a ‘lady novelist’ was enough to rouse suspicion. knowledge have historically worked together to keep women subordinated. if at all. Claudia Johnson writes that fiction by women writers was expected to be “modest. tagged on rather than present in their own right. scorn. As recently as 1971. delicate. having been denied the right to produce knowledge. literature and. If we read Austen with a feminist agenda in mind.
quite undermining their claims about the attractiveness of mind” (1974:50).Chapter Two: Women and Knowledge and Gubar comment that. (1979:61-62) Austen. in light of the above. Patricia Beer has remarked that “[Austen’s] heroines react in the same way [as Austen]. or at least be occasionally abundant in quotations and allusions which a woman…like me…would be totally without the power of giving. because it was believed that it was not normal for women to write. women writers were ostracized if they did not acknowledge their writing to be a mere diversion: If [the woman writer] refused to be modest. 99) could. of which I know nothing.. (Lascelles. One cannot therefore be sure whether her well-known response to James Stanier Clarke. must have been aware of the fact that intellectual women were treated with suspicion. self-deprecating. and that this is all part of her cover story 61 . humiliated. even bullied into sense” (1979:159).. being an early nineteenth-century woman novelist herself. refused to present her artistic productions as mere trifles designed to divert and distract readers in moments of idleness. she could expect to be ignored or (sometimes scurrilously) attacked.and I think I may boast myself to be…the most unlearned and uninformed female who ever dared to be an authoress. that because of her ignorance she cannot accept his suggestions for the hero of her next story. Sandra Gilbert and Susan Gubar believe Austen endows many of her women characters with intelligence and/or strong imaginative powers for which they are later apparently “mortified. Some critics believe that in Austen’s novels self-deprecating remarks are often made in relation to the heroines themselves. subservient. was intended sincerely or not: Such a man’s conversations must at times be on subjects of science and philosophy. 1939:41) Her statement that “imbecility in females is a great enhancement of their personal charms” (Northanger Abbey. be meant ironically.
When she finally discovers the truth. only fully realises the dangers of a wild imagination when she wrongfully assumes the General had killed his wife. We see Henry Tilney making fun of Catherine’s gullibility and fanciful expectation of what the Abbey should look like (Northanger Abbey. 142-145). a result of her ardently reading Gothic novels. restless. she considers Austen to defy. in her intelligent and attractive heroines. No less than three times does her fancy blind her to the truth and 62 . 5). The narrator in Northanger Abbey appears to reprimand Catherine Morland for her “raised. Her first disappointment comes when she discovers nothing more than a washing-bill in the old cabinet (157). Even though Emma is praised for being a clever girl (Emma. Critics such as Judith Lowder Newton and Claudia Johnson do not agree that Austen renounces her heroines or their deeds. and frightened imagination” (39). It would seem that Austen’s heroines do err from time to time and that they are shown to suffer the consequences. Lowder Newton writes that “[w]hen Austen allows Elizabeth [Bennet] to express critical attitudes and to act upon them without penalty. she is shown to make quite a number of mistakes. Claudia Johnson similarly believes that Austen is not being deprecating when she endows Elizabeth Bennet and Emma Woodhouse with “rich and unapologetic senses of self-consequence” (1988:xxiii). She. John Halperin believes that in this novel Austen “attacks the distortions of an overactive imagination” (1984:105). every cliché about women and decorum that was advocated in the conduct books (xxiii). Rather. In addition. she is moving against early nineteenth-century ideologies about feminine behaviour and feminine fate” (1981:135). we witness Catherine’s double humiliation. her humiliation is exacerbated as Henry (whom she wants to impress) realises what she has been thinking all along (181-182). however.Chapter Two: Women and Knowledge (154-159).
Austen seems to contrast Marianne’s rashness to Elinor’s cautiousness and good sense. Barbara Seeber has written on the “parallel situations” (1999:231) and the juxtaposing of Elinor and Marianne. Emma also errs when she assumes with “an ingenious and animating suspicion” (120) that Jane Fairfax and Mr Dixon are in love. could have no moderation” (5). Finally Emma wrongfully assumes Harriet to be of honourable descent. Elinor’s prudence (5). Knightley’s concern that Emma “will never submit to…a subjection of the fancy to the understanding” (29) is justified when she wrongfully assumes that Mr Elton and Harriet are in love. and in so doing “illuminates a world of contesting ideas” (223). Marianne is made to feel the consequences of her “imprudence and want of thought” (55) most severely when Willoughby betrays her (170). She believes the key to making sense of Sense and Sensibility is reading it as a dialogic text. according to the narrator.Chapter Two: Women and Knowledge cause her to make blunders. but eager in everything. In Sense and Sensibility Marianne Dashwood acts emotionally and irrationally and has to suffer the consequences of her actions. and even more so when she makes this suspicion known to Frank Churchill. does Emma fully realise the possible consequences of her vanity and overactive imagination (312-313). She manages to convince Harriet that she is too good for Robert Martin and to refuse his proposal. According to Seeber. her joys. Austen’s novel presents the reader with two heroines who experience the world very differently. We are told that Marianne is “sensible and clever. her sorrows. Only once Harriet falls in love with Mr Knightley. Although her abilities are “quite equal to Elinor’s” (5) Marianne lacks. In 63 . As a result Emma has to ward off Elton’s attentions and also needs to tell Harriet that he has no intention of marrying her. Emma is deeply embarrassed (299). and almost costs Emma her future happiness. When it is finally revealed that Frank and Jane are in fact engaged.
her stubbornness (363-368). The narrator informs us that “[Anne’s] attachment and regrets had. and is able to alleviate Captain Benwick’s pain by recommending prose (90-91). It would appear that the narrator feels sorry for Anne. clouded every enjoyment of youth. Anne is praised for her “elegance of mind and sweetness of character” (7) which she puts to good use: she gives sound financial advice (1314). Anne Elliot is another heroine whom Austen seems to approve of. and when she realises how grossly she has misjudged Darcy. the narrator comments: [Elizabeth] was humbled. she seems to have suffered enough for it. and an early loss of bloom and spirits had been their lasting effect” (Persuasion. or even Marianne. By doing so. a model of female excellence” (142). manners. she repented. What is more. keeps her wits about her when Louisa is injured (98-99). 26). Even when she disagrees with Captain Harville. for a long time. Elizabeth Bennet is known and loved for her intelligence (Pride and Prejudice. she seems to regard her highly. mind. 63). she was grieved. Anne is described by Mr Elliot as being “in her temper. When she discovers the truth about Wickham. and for arguing with men (102). though she hardly knew of what.Chapter Two: Women and Knowledge addition. [but] instead…explores the struggle to achieve ideological dominance” (223). her literariness (90). it “does not side with Elinor. her outspokenness on social conventions (200). he says he cannot argue with her for she is “a good soul” (207). Though she might have erred when she broke off her engagement to Frederick Wentworth. Austen may be suggesting that women ought not to be reduced to comforting stereotypes. Yet she too seems to make mistakes and to be reprimanded for them. (325) 64 .
In Northanger Abbey the narrator claims to have a “wild imagination” (227) and encourages women novelists to display their imaginative powers20. are conveyed to the world in the best chosen language. in which the most thorough knowledge of human nature. She states that women writers are “an injured body” (24) and. only some work in which the greatest powers of the mind are displayed. or at least . in short. riding on horseback. “Yes. 24). Perhaps she is illustrating the complexities of human responses in order to critique the damaging stereotypes inherent in the binary logic of ‘sense’ and ‘sensibility’. 20 65 . of degrading…the very performances to the number of which they are themselves adding…Let us leave it to the Reviewers to abuse such effusions of fancy at their leisure…let us not desert one another…for our foes are almost as many as our readers” (Northanger Abbey. 25) In addition to urging women novelists to write. as Gilbert and Gubar have pointed out. 5. and makes a case for the novel as a literary genre in its own right: [The novel is]. Literariness In her novels Austen appears to encourage literariness among women. (Northanger Abbey. ‘pride’ and ‘prejudice’. for I will not adopt that ungenerous and impolitic custom. She insists that women writers should stand together.Chapter Two: Women and Knowledge Austen’s work features heroines who make mistakes. the liveliest effusions of wit and humour. base-ball. Austen seems to be encouraging literariness among women in general when she reprimands some of her women characters for not being bookish. The narrator appears to be critical of Catherine Morland who prefers “cricket. and running around the country…to books. so common with novel writers. the happiest delineation of its varieties. gently criticises them for being embarrassed about their status as novelists (1979:146). novels.
with sweetness of manner” (55). 85). said Elizabeth.Chapter Two: Women and Knowledge books of information” (Northanger Abbey. 3). silly ones would bore him (359). I really cannot be plaguing myself for ever with all the new poems and states of the nation that come out. he gradually begins to regard her appearance as “uncommonly intelligent” (70). In Mansfield Park Edmund is attracted to Mary’s “lively mind” (65) and feels that. Here it is worth mentioning that Nancy Armstrong is of a different opinion: she believes that Austen is not critical of Emma’s ignorance as a reader. ‘…you may take back that tiresome book she would lend me. When Elizabeth asks him why he 66 . This could be interpreted as Austen encouraging intelligence and literariness among women. he judges Elizabeth’s features as being “tolerable” (59). He is disappointed that Emma is not interested in steady reading (29) and wishes Little Emma to be “infinitely cleverer” (77) than her aunt. 50). when a man has known sensible women. Patricia Beer has suggested that Austen “consistently makes her male characters in speech put greater value on [women’s] minds” (1974:47) than on their beauty or domestic talents. Mr Darcy values a woman whose mind has been improved “by extensive reading” (Pride and Prejudice. In Persuasion Elizabeth Elliot is not only shown to be arrogant and selfish (16) but also to lack the patience to read: ‘Very well’. Instead. In Persuasion Frederick Wentworth pictures the ideal wife as having “[a] strong mind. and pretend I have read it through. Austen has Emma renounce her novelistic practices in order to purify women’s speech of all traces of writing (1987:150). Whereas. Lady Russell quite bores one with new publications. while Mr Knightley feels “[m]en of sense…do not want silly wives” (Emma.’ (190) The narrator in Emma seems wary of Emma’s preference for riddles as opposed to reading (54). at their first meeting.
In Persuasion she displays a familiarity with the poetry of Scott and Byron (90).21 In Northanger Abbey she adds the genre of Gothic novels to her list by mentioning Mrs Radcliffe (36). 231. exposes the fictionality of her characters (7. 227). 231). and draws attention to the art of writing novels (24-25. 234). Despite displaying this type of inevitable blind spot at times. refers to her god-like power as authoress (7. complex treatment of the theme of fiction” (89). while Mansfield Park affords her the opportunity to refer to Cowper (56). She shows that she is intellectual and well-read herself by referring to other writers in her novels. 7. 5. Austen on the whole appears to encourage women to read and study. and not to mention Mrs Inchbald. In addition to referring to other artists. She directly addresses the reader (Northanger Abbey. An implication which cannot be overlooked is that Austen. 234. In Mansfield Park she displays what Edward Said has called “a bit of meta-fictional impatience” (1993:91): 21 In Jane Austen: Mansfield Park (1988) Isobel Armstrong quotes an extract from “The Improper Play. Mrs Inchbald’s Lovers’ Vows” (12-19). 235). living and writing in the late eighteenth/early nineteenth century. Toril Moi states that any writer will inevitably carry with her some of the ideology according to which she was raised.Chapter Two: Women and Knowledge had fallen in love with her. Pope (164). 17. Shakespeare (134). 67 . he answers for the liveliness of her mind (388). and that there “will always be unstated blindspots. Katrin Burlin notes in “‘The Pen of the Contriver’: The Four Fictions of Northanger Abbey” (1975) that especially in this novel Austen “comes to terms with her art in a single. fundamental presuppositions and ‘pre-understandings’ of which [they] are unaware” (1985:44). 227. cannot get away from the patriarchal ideology that it is all about what men want and that it their right to choose. Austen focuses on herself as a writer and on the storytelling process.
Narcissus has always been self-aware. as seen in the still water-mirror – “the shadow of a reflected form”. 22 68 . there is much evidence to suggest that the novel has always been a self-conscious genre to some extent. impatient to restore everybody. Linda Hutcheon in Narcissistic Narrative: The Metafictional Paradox (1980) traces self-aware narrative as far back as Cervantes. has in fact been a characteristic of the novel since its inception” (1998:6-7). not kind. the novel has always displayed an element of self-consciousness: The “narcissistic” change is one of degree. the practice is as old (if not older) than the novel itself” (5). 23 In If Upon a Winter’s Night a Traveller (1993) Italo Calvino especially focuses on the process of writing novels. and to have done with all the rest. 466) Although such artistic self-awareness is usually not ascribed to nineteenth-century writers of fiction. André Brink writes that “what has so persistently been regarded as the prerogative of the Modernist and Postmodern novel…namely an exploitation of the storytelling properties of language. I quit such odious subjects as soon as I can.Chapter Two: Women and Knowledge Let other pens dwell on guilt and misery. not greatly in fault themselves. Richardson and Defoe (9). (13) John Fowles calls attention to the fictionality of his characters and to his god-like powers as author in The French Lieutenant’s Woman (1969). While metafiction is often associated with postmodern writers such as John Fowles22 and Italo Calvino23. (Mansfield Park. In Metafiction: The Theory and Practice of Self-Conscious Fiction (1984) Patricia Waugh argues that “although the term ‘metafiction’ might be new. She argues that even though it has become more evident in the postmodern era. he merely became more physically conscious of his own existence and charm. Similarly. to tolerable comfort.
While for Anne Elliot the “idea of Louisa Musgrove turned into a person of literary taste.’ said Darcy. and sentimental reflection. In Mansfield Park she gives a comic account of the amateur actors fighting over which piece to enact (124-139) and of Mr Rushworth struggling to learn his lines (168).Chapter Two: Women and Knowledge While Austen calls attention to the process of writing. Every thing nourishes what is strong already. was amusing” (149). she also seems to ridicule people who display sentimental attitudes towards literature.’ (90) In Persuasion we are told that Captain Benwick and Louisa “had fallen in love over poetry” (149). stout. an awareness of the general lack of interest in literature among late eighteenth-century women. 69 . albeit implicitly. I am convinced that one good sonnet will starve it entirely away. the narrator is clearly making fun of Benwick’s mawkishness when she says: …he shewed himself so intimately acquainted with all the tenderest songs of the one poet…he repeated. ‘Of a fine. the various lines which imagined a broken heart…and looked so entirely as if he meant to be understood. But if it be only a slight. that [Anne] ventured to hope he did not always read only poetry… (90) It appears that Austen in her novels creates. uncovers some of the ways in which women are often alienated from literary and textual production and engagement. and in examining a variety of responses to reading. and appears to encourage literariness among women. healthy love it may. In Pride and Prejudice Elizabeth ridicules sentimentalists like Darcy who consider poetry as “the food of love”: ‘I have been used to consider poetry as the food of love. thin sort of inclination. with such tremulous feeling.
and finds enjoyment in marrying off her daughters (51). Elizabeth especially is critical of Lydia’s “emptiness of mind” (258) and of her being “idle and vain” (241). Even though Isabella Woodhouse is said to be “slow and diffident” (29). What is more. Silly Women and Men Judith Lowder Newton believes that because Austen undermines the force of economic realities in her novels she makes “most women. Mrs Bennet shares Lydia’s disappointment and remembers “what she had herself endured on a similar occasion. in their helpless fixation on men and marriage. look perverse and merely silly” (1981:132). she features men who are just as silly. Though she creates many ignorant women. to 70 . five and twenty years ago” (256). When the regiment is to leave Meryton. His excessive servility (119) provides so much entertainment especially to Elizabeth and her father that one begins to understand why she believes “stupid men are the only ones worth knowing” (189). In the first chapter the narrator informs the reader of Mrs Bennet’s dull wit (53). Collins’s character illustrates that men can be just as silly as women. Mr Collins is laughed at for being “not a sensible man…[but] a mixture of pride and obsequiousness. Lydia Bennet resembles her mother in more than one way. Harriet to be “certainly…not clever” (21) and Miss Bates to have “no intellectual superiority” (17).Chapter Two: Women and Knowledge 6. We are presented with another stupid man in Emma. self-importance and humility” (114). She has a “weak understanding and illiberal mind” (262). Pride and Prejudice features many silly characters of both sexes. Austen counterbalances intelligent women with silly ones. if not more so. she often ridicules their silliness. Although. and by so doing seems to subvert the view that stupidity is solely a woman’s trait. In addition we are told that Lydia and Kitty “could talk of nothing but officers” (75). none of them is mocked like Mr Elton.
with cordial. 111-112). Elton seems a gentleman. it would seem that gender roles in the late eighteenth/early nineteenth century dictated that men were smart bell hooks has investigated the role women are expected to play and has noted that many women “passively absorb sexism. The narrator is clearly making fun of Elton when she relates his marriage to Miss Hawkins. it is not necessarily what she writes but what we may infer from her writing which remains of interest. makes him more laughable (133). and willingly assume a pre-determined sex role” (2000:87). now addressing all the young ladies of the place. a few weeks ago. fearless smiles. instead. A phenomenon that today is known as socially-reinforced gender roles24 seems to have been prevalent in Austen’s time. Although he has good intentions he is not exempt from stupidity when he fails to understand Marianne and yet laughs “as heartily as if he did” (43). and was just the happy man he ought to be. he had not thrown himself away – he had gained a woman of 10. His marrying into some money does not enhance his reputation but.Chapter Two: Women and Knowledge many. Austen reveals what a silly man he really is. Likewise. talking only of himself and his own concerns – expecting to be congratulated – ready to be laughed at – and. Once again. Sir John is presented as silly because he is overly-gallant and friendly and perseveres to a point “beyond civility” (28). ostensibly from his point of view: …the story told well. Judging by her novels. to whom. (137) In Sense and Sensibility the narrator seems critical of women like Mrs Jennings and Mrs Palmer for finding their solace in gossip and visiting. Margaret McFadden has pointed out how gender roles “impose second-class status on women” (1997:794). he would have been more cautiously gallant. and especially for embarrassing friends and acquaintances by saying silly things (58-62. 24 71 . The women however are not the only ones to bear the brunt.000£ or thereabouts…He had caught both substance and shadow – both fortune and affection.
1984:303) and extremely silly. to some extent. moderation. such as Helen Crowley and Susan Himmelweit. The fact that Croft and Wentworth are ‘unable’ to distinguish between the two sisters. Luce Irigaray claims in Speculum of the Other Woman (1974) that women are denied their subjectivity because they subject themselves to objectivization (133). and both fall in love with Frederick Wentworth (Persuasion. In Persuasion she seems to reverse the typical masculine and feminine role: while Sir Walter Elliot is described as silly and conceited (6-7). In the same novel. as subjects and not objects” (1992:183). Wesely. Whereas. 58-64). Alison and Schneider have suggested that the “female body is…fetishized in its reduction to an object of (hetero)sexual desire” (2000:211). while Lady Elliot lived.Chapter Two: Women and Knowledge and women stupid. Perhaps. making them either the unsuspecting victim or the uncritical perpetrator of the male gaze. Feminist scholars. and economy” (10). the silliness of some of Austen’s characters is related to the rigid gender roles they are forced to play out. Admiral Croft seems to be just as confused by their resemblance when he says that a person can “hardly know one from the other” (83). Henrietta and Louisa both aim at finding a husband. have consistently called upon women to acknowledge this practice and to “claim their status as persons. his wife is said to have been “of very superior character to any thing deserved by his own” (6). By saying men and women are stupid at times Austen manages to subvert rigid gender roles. Sir Walter displays little financial sense and incurs great debts. has the possible implication that these women are not regarded as individuals but are reduced to objects of male desire. as people capable of self-definition. 72 . “there had been method. But the sisters are so much alike that it is “quite doubtful” (67) which of the two he prefers. the Musgrove sisters are shown to be incapable of serious thought (Halperin.
48). on a sopha. Sir Thomas realises that he is “an inferior young man as ignorant in business as in books. Catherine notices his shallowness and concludes with a “bold surmize” (55) that his company is not completely agreeable. with opinions in general unfixed. capable of retaining and uttering only a couple of standard sentences (18.Chapter Two: Women and Knowledge Mrs Allen is a good example of a woman who has not yet discovered her own subjectivity. and spends her days “sitting. Rushworth manages to confuse himself when trying to please Lady Bertram (55) and struggles enormously to learn his forty-two speeches for the play (168). doing some long piece of needlework” (18). pertain to women only. he would be a very stupid fellow” (39). 23). She is known for her “vacancy of mind. Her languor not only makes her incapable of remembering anyone’s dress or place at supper during the ball the night before. Edmund Bertram feels that if Rushworth “had not twelve thousand a year. nicely dressed. Sir Thomas’s own wife is characterized by “incompetency and languor” (342). and is presented as almost dysfunctional. and incapacity for thinking” (Northanger Abbey. In Mansfield Park Mr Rushworth is depicted as an extremely silly man. decisive sentence of praise or condemnation on the face of every woman they met… (35) While the narrator refers to Thorpe’s discourse as “rattle” (53) and as “idle assertions and impudent falsehoods” (53-54). to nothing more than a short. Being silly does not. it also prevents her from making interesting conversation (286-287). Lady Bertram shows no interest in anything much. and without seeming much aware of himself” (201). The narrator is clearly irritated with John Thorpe for making unintelligent remarks: [Mr Thorpe’s] discourse now sunk from its hitherto animated pitch. Ironically. 73 . however.
74 .Chapter Two: Women and Knowledge From Jane Austen’s work we can deduce that women and men in the late eighteenth/early nineteenth century were subjected to rigid gender roles. it could be argued that she dismisses the perception that femininity is aligned with ignorance and masculinity with intelligence. In the following chapter I shall be looking at what Austen’s work reveals about women’s role within marriage. Because Austen presents the reader with foolish women and men. she manages to challenge the view that women are intellectually inferior to men. By doing so. By showing how stupidity can manifest itself in either sex. her work subverts the rigidity of patriarchallyconstructed gender roles.
1995) 75 . “Another Cup Of Coffee”.Chapter Three: Women and Marriage Chapter Three – Women and Marriage Introduction And she pours herself another cup of coffee As she contemplates the stain across the wall and it's in between the cleaning and the washing That's when looking back's The hardest part of all And she always did her best to try and please him While he always did his best to make her cry And she got down on her knees to stop him leaving But he always knew one day he'd say goodbye Where are your friends Where are your children Is this your house Is this your home Does nothing ever last forever Does everybody sleep alone And he tears the business tags from his old suitcase As he packs away the pieces of his life They all love him but they always try to change him That's what happens when a girl becomes a wife And she pours herself another cup of coffee As the pictures leave a clean space on the wall and it's in between the leaving and the loving That's when looking back's The hardest part of all Where are your friends Where are your children Is this your house Is this your home Does nothing ever last forever Does everybody sleep alone Don't look back Don't give up Pour yourself another cup (Mike Rutherford.
primogeniture. There seems to be. Sarah Gamble is in agreement when she maintains in The Routledge Critical Dictionary of Feminism and Postfeminism (1999) that marriage remains an “enduring institution…a form of compulsory heterosexuality. to some extent at least. patriarchy – which patently do not serve her heroines well” (1988:xxiv). A possible reason for contemporary women favouring marriage may be found as far back as Austen’s time. Judith Lowder Newton argues that Austen’s work shows an 76 . general consensus among critics that Austen’s novels deal with marriage. and since husbands seem to receive more psychological support from their wives than they return (545). marriage in most cases is an institution which favours men. Much recent feminist scholarship focuses on the fact that marriage is a patriarchal institution of entrapment and that it more than often leaves women feeling unfulfilled. and the means by which the oppression of women is perpetuated sexually. André Brink argues that Austen shows how marriage describes women’s fortune in Emma (1998:125). Stevi Jackson argues that marriage “binds many women into unequal relationships with men…[and that it] is linked to wider social and economic structures and is sanctioned by the power of the state” (1993:182). Margaret McFadden claims in Ready Reference: Women’s Issues (1997) that since wives are often expected to do the housework as well as maintain a full-time job. economically.Chapter Three: Women and Marriage A song like the one quoted above by popular artist Mike Rutherford illustrates that to many it remains a mystery that women opt to get married. and Claudia Johnson believes “Austen to expose and explore those aspects of traditional institutions – marriage. Looking at what Austen’s fiction tells us about women and marriage could help us understand the legacy of women wanting to get married. Nancy Armstrong feels Austen’s novels “bring to culmination a tradition of ladies fiction that concentrated on the finer points of conduct necessary to secure a good marriage” (1987:134). and socially” (269).
Austen’s novels illustrate some of the reasons that most women of that time decided to get married. I shall examine the notion that Austen may be suggesting perfect matrimonial bliss to be highly improbable. Basing her argument on Austen’s letters. the constraint on women to marry was very considerable. 1994:102) are not restricted to repressing women’s intellectual growth (as I show in the first chapter). was an economic necessity for women. 1. As Judith Lowder Newton (1981:119-123) has shown. she considers Austen’s personal attitude towards the pressure on women to marry as “amused and uncomplaining” (1981:123). Mary Evans argues in Jane Austen and the State (1987) that Austen’s work reveals marriage to be enforced upon women by the type of society they live in: Jane Austen…vividly represents the point which many social historians have made: that marriage. I shall also investigate Gilbert and Gubar’s contention that Austen conceals her ideas on matrimony by ending her novels with having the hero and heroine live happily ever after (1979:169). Far from being a matter of romantic or personal choice. Marriage as entrapment The effects of “an education which fitted women exclusively for marriage and the pleasures of men” (Alexander. and that her fairytale endings should not be taken seriously. in the eighteenth and nineteenth centuries. (46) In this chapter I shall examine the ways in which Austen’s work reveals the malefavouring social and economic system women were living in.Chapter Three: Women and Marriage awareness of the necessity for women to marry. women did not have access to the same level of education 77 . but have far-reaching consequences. It will be shown that this system often enforced marriage on women and rendered them passive recipients of male largesse.
Isabella seems to be oblivious to her husband’s meanness. and discontent of her husband gave her no pain. (1987:114) Nancy Armstrong points out that eighteenth-century Puritan treatises on marriage did not only claim sovereignty for the husband over his home. many women found they had less power than before since the man was traditionally held to be master over his wife.in the nineteenth century. His indifference does not seem to bother her in the least but rather it appears to amuse her: The studied indifference. within marriage. the law defined married women as the property of their husbands. but also “represented the family as a self-enclosed social unit in whose affairs the state could not intervene” (1987:18). (109) 78 . Women therefore often had to submit to patriarchal institutions such as marriage if they wanted to survive financially. Since they could not support themselves financially. she was highly diverted.. In the same way Mrs Palmer patiently endures her husband’s occasional rudeness in Sense and Sensibility.Chapter Three: Women and Marriage as men. In Emma we are confronted with male power within the marital state. What is worse. Ironically. he often makes rude and hurtful remarks (73. autonomous subjectivity. 81). denying them the benefits of legally constituted. and when he scolded or abused her. as Chris Weedon has noted: . We are told that while Emma “was quick in feeling the little injuries to Isabella…Isabella never felt [them] herself” (73). Mr John Knightley seems to be aware of his own powerful position as patriarchal head of the family. As a result they were left economically and socially powerless. and were not expected to have their own career.. insolence. most middle-class women realised the importance of marrying a man who had either inherited some money or who had a profession that did not pay too badly. Irritated by his wife’s hypochondriacal and fragile nature.
may be teazed. women have felt the consequences of being rendered physically powerless. Being a man enables him to own a carriage and to come and go as he pleases. The narrator states that Catherine had “no power of getting away. and kept at a distance from those she wants to be with. as not to be able to spend a week with his father. but one cannot comprehend a young man’s being under such restraint. my emphasis). It also gives him the power to keep on driving when Catherine pleads with him to turn back. We see how John Thorpe abuses his power when he deters Catherine from keeping her engagement with Elinor Tilney. while women are ‘fixed’ by their economic situation. as Linda 79 . A young woman.Chapter Three: Women and Marriage In Pride and Prejudice Elizabeth professes she does not know “any body who seems more to enjoy the power of doing what he likes than Mr Darcy” (216. if she falls into bad hands. [and] was obliged to give up…and submit” (75). they can enter a neighbourhood and presumably leave it at will” (1981:120). In Emma the narrator draws our attention to women’s immobility by having Emma react in disbelief to Frank Churchill’s claim that it is impossible for him to spend a week with his father: …one can hardly conceive a young man’s not having it in his power to do as much as that. Austen seems to comment on the forceful nature of men’s power when she refers to “the violence of such noblemen and baronets as delight in forcing young ladies away to some remote farmhouse” (6). She states that “[s]ingle men appear at liberty. Judith Lowder Newton comments that the first two sentences of this novel illustrate the mobility men used to have. (95) In Northanger Abbey we see that women are physically rendered powerless when men will not allow them to do as they wish. but it is only recently that women have started speaking openly about it. if he likes it. Across the ages.
Germaine Greer points out that often in contemporary society “husbands are meant to take over the role of fathers and assume authority over their wives” (1999:283). This is partly owing to concerted efforts by dedicated feminist activists. while Linda Schmittroth and Mary Reilly McCall argue that in the past. (1999:167) Violence against women has received so much attention in the last two decades that.Chapter Three: Women and Marriage Schmittroth and Mary Reilly McCall report (1997:446). authorities often turned a blind eye to domestic violence owing to “the old and mistaken notion that the man is master of his family and his home” (1997:446). feminist scholars in the current century reveal its damaging effects in an effort to eradicate it altogether. One could say that. it has “increasingly been seen world wide as an important public policy issue” (2000:35). Janet Saltzman Chafetz argues that women today lack power since they are “relegated to the subordinate world of home. as Barbara Schulman points out in “The Unsettling Subject of Violence in Women’s Lives: Encouraging Notes from the Classroom Front” (1999): Nearly three decades of feminist activism and research have demonstrated that some form of gender-related violence is present in the autobiographies of what may be a majority of women around the globe. Wesley. Allison and Schneider believe domestic violence against women to be “a social problem born of patriarchy” (2000:211). although domestic violence is not a new phenomenon. according to Paula Wilcox. Whereas Austen only touches on the tremendous domestic power men have. contemporary society is much more aware of its existence and sensitive to its devastating effects than society in Austen’s time (446-447). For these reasons amongst others. recent feminist scholarship has identified marriage as a means of subjugating women and leaving them weak. 80 . a means by which men maintain control over women.
which are crucial to the maintenance of women’s general subordination and economic dependence. (1992:33. as Helen Tierney reports in Women’s Studies Encyclopedia (1999:892). men have. Patricia Waugh believes gender roles are “a mode of social control” (1989:9) for men whereby they might gain autonomy and marginalise women. and family” (1999:156). reinforced the metanarrative that being a mother and a wife is ‘natural’ for women. In the nature of the institution women are required to surrender that autonomy essential to the practice of any art. is hindered by popular (male) discourses which dictate women’s role as mother and wife. Araújo. in turn. as Rosalind Miles points out: Marriage has in general posed a major threat to the flowering of female talent. The work of feminists to eliminate oppression within marital relations. Women are.Chapter Three: Women and Marriage domestic labour. some feminists regard the abolition of marriage as the only way to end women’s oppression. For these and other reasons marriage today is generally considered to restrain women. and the social beliefs which support them. as Arnot. Helen Crowley and Susan Himmelweit are of the same opinion: …it is women’s mothering and nurturing activities. Since male authority is so deeply entrenched in patriarchal society. but to all men through political and economic dominance” (2000:152). ensures male dominance. (1987:22) 81 . motherhood. 1987:121). albeit sometimes unconsciously. Deliyanni and Ivinson point out. Coaxing women into wife.and motherhood means keeping them in a subservient position and. “subordinated not just to individual men through the marriage contract. my emphasis) Since “power is tolerable only on condition that it mask a substantial part of itself” (Weedon.
and the reason she must marry is that the family inheritance has been settled on a male. She must marry. to escape the confinement at home.Chapter Three: Women and Marriage Whereas contemporary feminist scholars explicitly link women’s powerlessness to marriage. Elaine Showalter reminds us that in the late eighteenth century women “were not accustomed to choosing a vocation [since] womanhood was a vocation in itself” (1977:21). From her writing it can be inferred that marriage is enforced by patriarchy and its laws: women feel compelled to get married in order to have economic security. we need to reread Austen from a feminist point of view in order to infer that women were weakened by patriarchy and by the institution of marriage. simply so that they may survive in a male-dominated world. she must marry with an eye to money. 1. While it was not considered proper for women to have a 82 . Reading Austen from a feminist perspective means being made aware of the necessity for women to get married. as Judith Lowder Newton (with specific reference to Pride and Prejudice) explains: Elizabeth Bennet has no decent fortune whatsoever. (1981:120) The “conditions of economic life” in Austen’s time included an inequality of career opportunities between men and women. Sandra Gilbert and Susan Gubar believe Austen’s work shows that “women have been imprisoned more effectively by miseducation than by walls and more by financial dependency…than by any verbal oath or warning” (1979:135). or even to acquire society’s approval.1 Economic Security The economic conditions of Austen’s time upheld women’s oppression. It would be hard to make a more central point of the fact that the conditions of economic life favoured men and restricted women. in short.
Chapter Three: Women and Marriage career. and then she had to be totally subservient to her husband. 1930:80). claims that her three sons are all “beloved and respected in their different stations” (19). Jane Austen indicates she herself is “fully alert to the social miseries and injustices of her age – including the acute miseries of the governess situation” (1986:186) when she describes the bleak future awaiting Jane the day she will no longer be in the Campbell’s care and will have to eke out an 83 . then. From Austen’s novels we can construe that men and women did not have equal access to career opportunities. while mentioning only the beauty of her daughters. then her life became totally useless. 1987:236. If she did not marry. Nancy Armstrong mentions that although in Austen’s day the governess “belonged to the cast of respectable women…[she] was commonly represented as a threat to the well-being of the household” (1987:78-79). Judith Lowder Newton mentions that Austen illustrates that men “no matter how hapless and undeserving. must be given every opportunity to earn their way [while] women…are prepared for nothing but display” (1981:119-120). As Tony Tanner has noted. it was almost impossible for women to achieve financial prosperity on their own. As a result they were obliged to marry: The only opportunity for achievement for a middle-class woman was to marry and have children. In Sense and Sensibility Edward Ferrars lists the church. and while “almost the only way in which a gently born woman could earn her living was by teaching” (Cruse. the law and the navy as some of the occupations he as a man can choose from (99). must be provided for. being an orphan. men had a number of occupations to choose from. (Potter. is left with no choice but to become a governess. In Austen’s time. for it was not considered proper for a respectable woman to have a career. Jane Fairfax. my emphasis) We see how circumstances can render women powerless and how a woman’s life can become “totally useless” in Emma. and in Northanger Abbey Mrs Thorpe.
He points out that if she refuses him and gets no other offer of marriage. on Mr Bennet’s demise. which generally left the bulk of the estate to the eldest son. peace and hope.Chapter Three: Women and Marriage existence (Emma. on a distant relation” (75). The narrator seems to wonder at fate’s fickleness as Miss Campbell manages for no apparent reason to secure a comfortable future by marrying a wealthy man. she is likely to end up poor and forlorn (Pride and Prejudice. 84 . to penance and mortification forever. turn the Bennet family out of their own home (106) reinforces the tremendous power patriarchy gives men. The mere fact that Collins may. Sense and Sensibility demonstrates the injustice of the inheritance laws. while Jane faces having to be paid a pittance and earning little respect as governess. and retire from all the pleasures of life. (124) According to Sandra Gilbert and Susan Gubar. It is clear that Collins realises the power with which patriarchy has endowed him when he proposes to Elizabeth. With the fortitude of a devoted noviciate. of rational intercourse. and which necessitated that women marry. That the narrator has empathy with her is clear: [Jane] had long resolved that one-and-twenty should be the period. equal society. 124). It is possible that Austen comments on the senselessness of a convention which would have John Dashwood as the only son inherit almost everything despite the fact that he is already wealthy and that his sisters are in far greater need of their father’s money (1-2). she had resolved at one-and-twenty to complete the sacrifice. Jane Austen explores “the specific ways in which patriarchal control of women depends on women being denied the right to earn or even inherit their own money” (1979:136). Roger Gard justifiably refers to Collins in Jane Austen’s Novels: The Art of Clarity (1992) as a symbol of “the reality of male oppression” (100). In Pride and Prejudice the Bennet girls are in a financial predicament since their father’s estate is “entailed in default of heirs male.
for example. and when Charlotte Lucas marries Collins since it is “the only honourable provision for well-educated young women of small fortune” (163). Mrs Ferrars would never approve of a match between her and Edward (129). unable 85 . In Northanger Abbey it is possibly Isabella Thorpe’s small fortune (108) which makes her so determined to find a husband.Chapter Three: Women and Marriage 150-151). however. and even threatens to disinherit him (258-259). must be in want of a wife” (51).almost succeeds in laying her hands on the Tilney fortune by marrying Frederick Tilney. because she has no fortune. After having secured James Morland she . If she had none and failed to find a rich enough husband to provide for her. The plight of the single woman is illustrated. In Sense and Sensibility a woman’s eligibility is defined in terms of her fortune. Mrs Ferrars is so determined that her sons marry well and not be drawn in by any woman (21) that she tries to persuade Edward not to marry Lucy. It could be argued that Austen’s fiction demonstrates that a woman’s inheritance can make or break her. “living in a very humble way. It thus gradually becomes apparent in this and Austen’s other novels why it is “a truth universally acknowledged. Juliet McMaster notes in “Emma Watson: Jane Austen’s Uncompleted Heroine” (1994) that Austen’s novels draw our attention “to the unjustly difficult plight of the single woman who is not in possession of a good fortune” (227). prevents the marriage from taking place.disappointed with his four hundred pounds (121) . the chances were she would end up like Mrs Smith. Persuasion illustrates the sad reality that a girl needed a dowry in order to attract good offers of marriage. Lucy Steele realises that. On account of her “want of consequence and fortune” (192) the General. in Pride and Prejudice when Mr Bennet firmly states Lydia will not be “an object of prey” (258) to any man since she is of no great fortune. that a single man in possession of a good fortune.
“an institution involving lifelong and serious obligations” (16). The middle sister (Mrs Norris) had married “on a narrower income than she had been used to look forward to” (6) so that strict economy in her marriage was necessary. marriage had to make financial sense. while a very young girl. the future baronet. circumstances should have made so much” (414). as soon as she had known [her cousin] to be. William Elliot. While the eldest. made the mistake of marrying a man with neither education. realises that it is her duty to marry her cousin in order to keep the money in the family: She had. Fanny compares the destinies of Lady Bertram and her own mother. a reasonable and a poor match. Not only 86 . Throughout Mansfield Park Austen seems to create an ironic awareness of the reality that it is every woman’s duty to marry as well as she can. in the event of her having no brother. Elizabeth. The match between Maria Bertram and Rushworth is viewed as advantageous by Sir Thomas.Chapter Three: Women and Marriage even to afford herself the comfort of a servant. and wonders at the fact “that where nature had made so little difference. she had to endure poverty and hardship (1-3). In Mansfield Park we see that women’s destiny often depends on how well they marry. Maria. meant to marry him… (8-9) Economic consideration ensured that marriage in Austen’s time was. Marriage is seen by some of the characters as a business transaction from which both parties should benefit. Since many women were not economically provided for. As a result. as David Cecil remarks in A Portrait of Jane Austen (1978). Fanny. fortune nor connections. had the good fortune of marrying Sir Thomas and was raised to the rank of a baronet’s lady (1). and of course almost excluded from society” (136). her sisters were not so lucky. The Elliott sisters could easily share Mrs Smith’s fate since their father’s estate is to be inherited by their cousin. Sir Walter’s eldest daughter. The three Ward sisters illustrate the consequences of a good. the youngest.
87 . While Sir Thomas tells Fanny that “it is every young woman’s duty to accept a very exceptional offer [such as Henry Crawford’s]” (336). Since she believes a “large income is the best recipe for happiness” (215).2 Escaping Home Judging from Austen’s novels it would seem that young women often married in order to escape the confinement at home. but also add “respectability and influence” (203) to the Bertram name. not the only reason women decided to marry. however. and thus the need to escape from home. Neither would she ever consider marrying Edmund since he would most probably stay a penniless clergyman his whole life (Donoghue. motivated women to marry. 1968:43). the low wages of governesses. we are told that “[m]atrimony was [Mary Crawford’s] object. In Northanger Abbey Eleonor Tilney’s marriage to a man of 25 Marilyn Butler mentions in Jane Austen and the War of Ideas (1987) that Austen exposes “[women’s] terribly limited opportunities for employment. [and] the wife’s loss of property rights” (127). In the next section I shall examine the ways in which stifling parental authority. 1. The “true London maxim. Mary argues that “everybody should marry as soon as they can do it to advantage” (43). A feminist reading of Austen draws our attention to the economic injustices suffered by women and the consequences thereof. that everything is to be got with money” (59) is illustrated when Maria agrees to marry a man she finds terribly annoying and dull.25 One of the consequences of the male-favouring economic and social system of Austen’s time was that women felt forced to marry. Economic dependency was. provided she could marry well” (41).Chapter Three: Women and Marriage would it ensure Maria of a large income (37) and Rushworth of a beautiful and accomplished wife (37-38). she cannot comprehend how Fanny could reject Henry.
In the same novel Brandon’s cousin Eliza is forced by her guardian to marry his eldest son (198-199). for instance. Maria Bertram is “prepared for matrimony by an hatred of home” (Mansfield Park. 1988:26). 88 . In Pride and Prejudice Elizabeth and Jane would be spared the embarrassment of their mother’s tactlessness if they were to be married (141-3.’ Elinor. calmly replied – ‘The lady. For Anne Elliot marrying means escaping the “imprisonment” (Persuasion.’ said Mr Dashwood. after a short pause. In Sense and Sensibility Mrs Jennings decides that her daughter should not marry Colonel Brandon (113) but Mr Palmer. In Austen’s time middle-class parents had tremendous power over their children. 204). The Concise Oxford Dictionary defines a bully as “a person who uses strength or power to coerce others by fear”. especially their daughters. would be forced into marriage by fathers and mothers who cared less about their daughters’ needs or wishes (Johnson. I suppose.’ (289) The number of patriarchal bullies that feature in Austen’s fiction focuses our attention on the enormous power men (and especially fathers) used to have.Chapter Three: Women and Marriage her choice is seen as a “removal from all the evils of such a home as Northanger” (234). Young women. 123) at home brought on by her father’s favouring of Elizabeth. 355). Similarly. ‘of Robert’s marrying Miss Morton. smiling at the grave and decisive importance of her brother’s tone. In Emma we see that Jane Fairfax and Frank Churchill are prevented from getting married while Mrs Churchill lives (301). Elinor cannot help but laugh at the absurdity of parents who see women as objects that are to be pawned and swopped at will: ‘We think now. When the wealthy Miss Morton is traded off between the Ferrars brothers. while Lucy Steele and Edward Ferrars keep their engagement a secret for fear of Edward’s mother (127-129). has no choice in the affair.
‘What will become of us? what is to be done now?’ It was a terrible pause… (176) After returning home. for example. Even when he is abroad his family is governed by his rule. every other heart was suggesting. Lady Bertram wants him to wait until his father returns so that “Sir Thomas might settle it all himself” (35). it is “rather from submission…than conviction” (375) that Lady Bertram agrees. when the young people want to put on a play.Chapter Three: Women and Marriage and it is this coercive force that Austen’s work exposes. The narrator comments that “[u]nder his government. Similarly. The narrator seems to use this opportunity to criticise all fathers who do not wish to love their daughters but only to govern them: 89 . His daughters are also made aware of his power from an early age and are said to be “in greater awe of their father” (11) than their brothers are. they know their father would not approve. my emphasis). When he persuades his wife to let Fanny visit her family. It is especially the women in the family who suffer Sir Thomas’s tyranny. In Mansfield Park the authority men automatically assume as head of the family is neatly illustrated by Sir Thomas. Sir Thomas quickly re-establishes his powerful position when he resumes “his seat as master of the house at dinner” (192). Mansfield was an altered place” (197. When he leaves for Antigua they are delighted to be freed from his tyranny for a short while. even though they try to convince themselves otherwise (128-130). Being the head of the family entitles him to make all the decisions. When Edmund wants to buy Fanny a horse. When Sir Thomas unexpectedly arrives at Mansfield Park they realise that it means the end of their show: …but every other heart was sinking under some degree of self-condemnation or undefined alarm. When Yates comes to visit he professes to have “known many disagreeable fathers before…but never…[one] so infamously tyrannical as Sir Thomas” (193).
but for their want of it. The narrator comments on his powerful hold over Fanny when she remarks that his was no ordinary advice but “the advice of absolute power” (285). Henry Crawford believes Sir Thomas “to stand in the place of her parents” (316). Mary Crawford as an outsider immediately notices the power Sir Thomas has over his family. ‘Do you remember Hawkins Browne’s “Address to Tobacco”. Mrs. I will parody them – Blest Knight! whose dictatorial looks dispense To Children affluence. Although Fanny is not his daughter.’ (164) 90 . (31) Because they fear their father. Maria especially is pitied “for to her the father brought a husband” (109). not for their sorrow. the month of his return to England is described as a “black month” (109) for the girls.Chapter Three: Women and Marriage The Miss Bertrams were much to be pitied on the occasion. She fears her uncle from the very start (14) and is probably more relieved than her cousins when he leaves for Antigua (31). Grant? Everything seems to depend upon Sir Thomas’s return. to Rushworth sense.’ said Mary. and indeed he expects her to obey him at all times (279). after a pause. She makes fun of his powerful hold when talking to her sister. to Parsons sense. in imitation of Pope? Blest leaf! whose aromatic gales dispense To Templars modesty. possibly because she realises that his power is patriarchally-engendered: ‘Sir Thomas is to achieve many mighty things when he comes home. She consequently blames him for Edmund’s decision to become a clergyman (251). Will not that do. Patriarchy has made him powerful.
140). Austen’s novels do not only depict fathers and husbands who abuse their power but also show that even all-important men like Sir Thomas and the General are at times rendered powerless. When she and Eleanor disobey him as they snoop around the forbidden chambers. who consider it their sole right to be “happy and indulgent” (187) at home. While all Sir Thomas’s clout cannot re-establish the Bertram family name when Maria runs off with 91 . General Tilney similarly abuses his power as head of the family. and dictates to them whom they should marry (192-193. Edward Said makes the point that “Sir Thomas’s infrequent trips to Antigua as an absentee plantation owner reflect the diminishment in his class’s power” (1993:94). She is not allowed to make any decision on her own and is even told when to go for a walk (161) and which route to take (163). Catherine is filled with “terror upon terror” (176) at the sight of the General himself in the gallery. 228). Catherine quickly realises that the General is not to be contradicted and grows “every moment more in awe of him” (140). He is constantly “a check upon his children’s spirits” (Northanger Abbey. and who enjoy being the one “on whom all [depends]” (435).Chapter Three: Women and Marriage When Austen later on has Mary say that Sir Thomas “is just what the head of such a family should be” (363) it is likely that she is being critical of men like himself who take their resolutions “in quiet independence” (255). that [her] real power is nothing” (209). Once at Northanger. his departure for London gives her “the first experimental conviction that a loss may be sometimes a gain” (203). Eleanor especially bears the brunt of her father’s tyranny. she obeys his orders. Eleanor realises that she is “but a nominal mistress of [Northanger]. While his presence appears “to lengthen…two hours into four” (140) and makes her feel fatigue (151). Because she in all probability fears her father and feels powerless.
It would be incompatible with what she owed to her father. would not do for her. he always manages to have his way. General Tilney is thwarted when Henry marries Catherine. In Persuasion we are presented with a less forceful (but just as effective) bully. and with what she felt for him. induces Anne to call off the engagement. Claudia Johnson believes Austen’s commentary on 92 . Ironically. Despite his delicate disposition. He has such a hold on Emma that she believes her future not to belong to her alone: Marriage. When he decides the family should move to Bath. That women had a limited choice when considering a partner for life can be seen in Austen’s novels. Anne has no say in the matter and is forced to abide by his decision (14). Being made aware of the immense power men have means. One could say that Sir Walter Elliot renders Anne powerless by what he does not do. Since almost the only way a woman could escape her parents’ authority was to marry the man they had chosen for her. even if she were asked by Mr Knightley. She would not marry. Together with Lady Russell’s opposition.Chapter Three: Women and Marriage Crawford and Julia with Yates. (314) Claudia Johnson mentions that Austen was living in a society which “[prohibited] women from making choices about their own lives” (1988:14). his “professed resolution of doing nothing for his daughter” (24). Austen comments tongue-in-cheek that it is up to the reader to decide whether “the tendency of [her] work be altogether to recommend parental tyranny or reward filial disobedience” (Northanger Abbey. women had less free will than is generally assumed. Nothing should separate her from her father. women who married in order to get away from home inevitably subjugated themselves to a substitute form of authority. in fact. in most cases. should she marry Wentworth. being made aware of women’s powerlessness. Although Mr Woodhouse in Emma loves his daughter he loves himself even more. 236).
an attack on ideological state apparatuses (a concept borrowed from Louis Althusser to which I shall return later in this study) which enable men to abuse their power: Considered from within the compelling rhetorical structures conservative novelists build. In Sense and Sensibility Lucy Steele is secretly married to Robert Ferrars (358). to suggest. It can be argued that. possibly a consequence of women trying to escape the confinement at home. The Bertrams are dealt a double blow in Mansfield Park when Maria (a married woman) runs off with Henry Crawford (444-445). in fact. (1988:10. the only way of achieving affluence and thereby society’s approval: 93 . and brothers themselves may be selfish. Though these women believe they have escaped the confinement at home they have in fact merely exchanged it for the enduring confinement of marriage. sons. while Lydia Bennet (Pride and Prejudice) causes her family much embarrassment by eloping with Wickham (291-294). and that the “bonds of domestic attachment” are not always sweet. frequently does.3 Approval and Acknowledgement For most women in Austen’s time marriage was. among others. and by featuring women who elope. as Sandra Gilbert and Susan Gubar have noted. is to attack the institutions which make morality possible and so to contribute to the dissolution of the government. that fathers. 1. and Julia elopes with Yates (447). bullying and unscrupulous. as Austen.Chapter Three: Women and Marriage patriarchal bullies is. by introducing fathers who bully their daughters into marriage. my emphasis) Austen’s novels feature a number of elopements. Austen depicts a society which forces young women from one institution into the next.
one might begin to understand where the stigma surrounding spinsterhood comes from. In Persuasion the narrator remarks tongue-in-cheek that “Mary had acquired a little artificial importance. The average age for women to marry increased. handsome. ‘singlehood’ included feminists. unmarried mothers. In Emma our attention is drawn to the fact that women often need to be married in order to enjoy esteem when Emma jokingly considers getting married so that she no longer has to stand second to Mrs Elton (245). (1979:127) In Mansfield Park Henry Crawford views marriage as the only way for women to acquire “happiness. she would have gained “consideration among her friends” (361). In Sense and Sensibility Elinor states that if Lucy had married Edward. If one considers the important role marriage used to play in women’s acceptance in their society. lesbians.Chapter Three: Women and Marriage [Austen’s] implication is clear: marriage is crucial because it is the only accessible form of self-definition for girls in her society. 26 94 . honour. As the women’s movement gained momentum. In addition. Though today it may be quite ‘normal’ for women to remain single26. and dignity in the world” (301). and those women who were in relationships but who chose not to marry. the narrator seems to be ironic when she comments that Miss Bates “enjoyed a most uncommon degree of popularity for a woman neither young. by becoming Mrs. Just as her mother gained prestige by marrying Sir Thomas and becoming Lady Bertram (1). contemporary Margaret McFadden reports that “[t]he 1960s saw a rise in the number of American women who remained single. Maria intends becoming Rushworth’s wife in order to achieve “fortune and consequence” (204). nor married” (17). while Isabella Thorpe in Northanger Abbey imagines how marriage would win her “the gaze and admiration of every new acquaintance at Fullerton” (111). Charles Musgrove” (7). rich. comfort. and the divorce rate rose dramatically” (1997:805).
Austen is possibly showing that even strong-willed girls do not live in isolation. Anne and Wentworth. (1998:125) 95 . many women feel compelled to marry. but need to adhere to social conventions in order to survive. 1. According to Gamble. and a potential threat to society in her freedom” (1997:819). marriage describes her horizon. Although some feminists have tried to reclaim the image of the spinster. Many women see marriage as the easiest means of integration into the community. Elinor and Edward. 1999: 312-313). This has been noted by André Brink: …no amount of ‘success’ can essentially alter a woman’s fortune: even for Emma with her fierce if often misguided and deftly ironicised sense of independence. women who remain single are often regarded as not fully integrated into the community. still need to marry in order to manage financially and be accepted socially. incapable of finding a husband or respectable work. she remains. Emma and Knightley. as Sarah Gamble reports (1999:269). to be culturally stereotyped as “the unchosen woman who is unattractive to men. no matter how strong or independent they are. all Austen’s heroines get married: Elizabeth and Darcy. For fear of being labelled as such. and have even been described as “wastage” (269). according to Margaret McFadden. Fanny and Edmund. By making her heroines marry.4 Surviving Patriarchy In keeping with the prerequisite that most women. Marianne and Brandon are all shown to tie the knot. even if it means being placed under male authority. Catherine and Henry.Chapter Three: Women and Marriage women often feel pressurized to marry in order to avoid being associated with spinsterhood (Greer.
Similarly. does not openly declare her love for Frederick Wentworth but merely hints at it when she is talking to Captain Harville and is certain that Wentworth is listening (Persuasion. they know that an open defiance would have them ostracized. she patiently waits for him to take it up again (356-357). 352-356). Isobel Armstrong has referred to “Jane Austen’s delicate and probing exploration of the psychology of the dependent woman and the social and emotional constraints upon her” (1988:10). Fanny shares her predicament because she has to wait for Edmund to forget Mary Crawford. This may not indicate that she believes this is the way things should be done. In Sense and Sensibility Elinor Dashwood keeps her feelings for Edward a secret until he declares his love for her (37. at times. Elizabeth. or a great deal better ” (475). 193) as she impatiently waits for Henry Crawford to declare himself. Jane has to infer from Bingley’s absence that he has lost all interest in their relationship (184). does not approach him when she realises that she has erred but waits for him to propose (374-375). Austen’s heroines can get away with covertly challenging some of patriarchy’s traditions. and to consider whether “a very different kind of woman might not do just as well.Chapter Three: Women and Marriage While. We also see other women waiting for men to make the first move. for instance. 205-207). We see Austen’s women characters adhering to convention not only when they decide to marry but also when they wait for the men they are interested in to initiate a relationship. as much as it shows that she knows how to protect herself in a world dictated by male convention. In Pride and Prejudice both Jane and Elizabeth wait for the men they love to propose. who first rejects Darcy (221-222). when Emma 96 . Maria Bertram is in “a good deal of agitation” (Mansfield Park. A feminist reading of Austen’s fiction creates an awareness of the fact that women were left with no choice but to follow social convention in order to survive in a male-dominated world. Anne Elliot. When he finally returns.
has illustrated: As recently as August 1995 Imogen Edwards-Jones agonized in The Times over the fact that a woman still cannot ask a man out for a date. Judging by its popularity. and have initiated relationships and. Right28. Nearly a million copies of the book were in print shortly after its publication. by extension. Some of them have managed to shed this legacy completely.Chapter Three: Women and Marriage realises she loves Knightley. but leaves it up to him to make the first move (Emma. The Rules: Time-tested Secrets for Capturing the Heart of Mr. She only admits that she loves him once he assures her of his affection (227). 325-326). 28 The Rules: Time-Tested Secrets For Capturing the Heart of Mr Right (1995) is by Ellen Fein and Sherrie Schneider. as recent popular feminist writing. They posit that “[s]exually experienced women are more likely to be independent and to take the initiative in dating and sex…[and to] use strategies previously reserved for men” (2000:244). arrange the date. as seen. it seems that many twenty-first century women identify with and Kramarae and Spender note that. make the first phone call. (1999:316) In an aforementioned article. Others still wait for the man to make the first move. In Northanger Abbey the conventional view that “no young lady can be justified in falling in love before the gentleman’s love is declared” (17) is illustrated by having Catherine remain silent about her feelings for Henry Tilney. by its women writers. pay for it. there are observable changes to old norms. Modern women have inherited a legacy of waiting to be asked. Barbara Darby draws parallels between eighteenth-century conduct books (which prescribed women’s role in society) and a book written in 1995. bring presents. These writers believe that it is “the male prerogative to say hello first. marriage and families27. The Rules clearly stipulates the role men and women play in society. she dare not mention it. and propose” (2000:343). 27 97 . such as that of Germaine Greer. although traditional gender roles prevail in dating relationships. interestingly enough. while sequels are in progress.
Though they might have a different appearance they still manage to dictate women’s identity: And although today we find authors neither designing curricula to educate young women at home nor writing fiction to demonstrate the properties of feminine conduct. (1987:62) It is possible that contemporary women are embarrassed to initiate a relationship because they have inherited a legacy of leaving the courting up to men. By “[d]ramatizing the necessity of female submission for female survival” (Gilbert and Gubar. it would seem. 1979:154).Chapter Three: Women and Marriage adhere to this type of prescribed behaviour in the hope that it might attract a husband. While it is possible that Austen. 98 . in order to survive in a male-dominated world. The tradition of waiting to be asked is illustrated in Austen’s novels. need to follow certain conventions. there are also home economics courses that most women must take before graduating from high school. Dissident views on marriage Austen’s fiction offers ideas on marriage that deviate from the (patriarchal) norm: it appears to be critical of marrying for money. Even strong-minded women. Despite these criticisms Austen appears to support domesticity by ending her novels with marriage. such as marriage and leaving the courting up to men. Austen’s work seems to account for most women’s eventually succumbing to patriarchy. and portrays women who chase after men as ridiculous. Nancy Armstrong mentions that ‘conduct books’ continue to exist in the modern era. Besides all the books and advice columns telling women how to catch and keep a man. and besides numerous magazines imaging the beautiful home. the conduct book is still alive and well. shows that wives are often unfulfilled women. 2. I have argued that Austen’s fiction presents us with women who presumably know what they need to do and how they need to behave in order to secure their financial future and be accepted by the society they live in.
she does not stop loving him. Though the marriages of all Austen’s women protagonists are only ever hinted at as a possibility since the novels end before they are enacted. is that Austen’s endings serve as a “blotter” (1979:169). from fairy tale to film” (1999:269). which is favoured by critics such as Sandra Gilbert and Susan Gubar. which enshrines it as the fitting end for all narratives. In Mansfield Park love is said to make up an essential part of a happy marriage. Because she refuses Charles Musgrove. 29 99 . 24-25). This romantic notion of ‘mutual love’ may be a metanarrative that Austen fails to acknowledge as a patriarchal construct29 but at least she is not endorsing the view that marriage should make economic sense. is still “very much in the history of [her] society” (1993:xxii). Another plausible explanation for her apparent inconsistency. Even though she is persuaded to end the relationship. Austen states that women should have the right to marry for love at least once in their lives (Halperin. by doing so. 2. it is also possible that she. and therefore encourages women to lead a domestic life. submits to patriarchy in order to survive. Here it is worth mentioning that although Anhalt’s character from Lovers’ Vows is quoted as saying “[w]hen two sympathetic hearts meet in the Sarah Gamble comments on the popularity of the notion of romantic love in today’s society and states that “marriage remains an enduring institution…[which] is shored up by the ideology of romance. Anne Elliot falls in love with Wentworth despite his having no fortune (Persuasion. This argument entails that when Austen makes her heroines live happily ever after they do so in perfectly dubious matrimonial bliss. 1984:299). these women apparently agree to marry because they are in love. she is free to marry Wentworth when he proposes a second time.Chapter Three: Women and Marriage as Edward Said points out when referring to authors in general.1 Marrying for money In a letter to her sister Cassandra.
and how wicked it [is]. Seemingly for this reason she rejects Collins and initially even refuses Darcy. are seen by Willoughby as deserving no compassion (322). She loves Edmund so sincerely that she repeatedly refuses Henry Crawford. to marry without affection” (327). In Sense and Sensibility a loveless marriage is seen as emotional entrapment. from a woman whom he had long ceased to love” (354). She is ready to accept Darcy’s hand in marriage only when she realises that she loves him (375). In Emma Austen deviates 100 . does not marry Miss Morton. we are never actually shown these ‘happy marriages’. While Mrs Dashwood wants to see her daughters engage in loving relationships (13). Edward. women who marry. Because he feels Jane is indifferent. despite his being hopelessly in love with Mary. Elizabeth herself appears to be resolute in her commitment to marrying for love. how hopeless. despite his promises of fortune. Marianne is concerned that she will never find a man whom she can truly love (16). despite her large fortune. Marrying for love is also supported by other characters in the novel. in turn. While Darcy wants Elizabeth (who has neither money nor connections) to be his wife. he persuades Bingley not to marry her (Pride and Prejudice. Even the no-nonsense Mr Darcy seems to believe in marrying for love. matrimony may be called a happy life” (362). knowing their partners do not love them. She wishes that her uncle would realise “how wretched. and how unpardonable. In addition. The narrator endorses love as the only reason to marry by having Edward (although he is poor) happily married to Elinor (371). 228). Austen’s novel seems to illustrate the strength and the “enthusiasm of a woman’s love” (268-269) when Fanny keeps on loving Edmund.Chapter Three: Women and Marriage marriage state. we read that Edward “was released…from an entanglement which had longed formed his misery. When Lucy marries Robert Ferrars. Fanny seems to value love in a relationship.
in Northanger Abbey.Chapter Three: Women and Marriage from her own norm when she creates a heroine with a large fortune. nobly settled” (Mansfield Park. Towards the end we are told that he became “[s]ick of ambitious and mercenary connexions. Despite Sir Walter’s good looks and his station in life. who marries for financial security (162-166). Similarly. Sir Thomas’s own attitude to his wife. 108) is echoed throughout Austen’s novels. In addition we are shown that marrying for any other reason ruins relationships. further reveals their loveless relationship. It may be argued that partly as a result of Lady Bertram’s marrying Sir Thomas for his money (1). is pitied for being entrapped in 101 . Lady Elliot is said to have been “not the very happiest being in the world” (6). and does not seem anxious for him to return (129). The idea that “[w]here people are really attached. poverty itself is wealth” (Northanger Abbey. his daughter’s unhappy marriage compels him to reconsider his views on matrimony. Despite her firm resolution to remain single (66-67). Because Emma has enough money she does not need to marry for any other reason than love (66). In Pride and Prejudice we once again see how money cannot make a person happy. Although Sir Thomas initially feels that being “eligibly. although she might have gained money and esteem by marrying the General. Like her mother. In Persuasion it becomes clear that a loveless marriage can make one miserable. Charlotte Lucas. prizing more and more the sterling good of principle and temper” (477). Mrs Tilney often “had much to bear” (182). she falls in love with Knightley and agrees to marry him. honourably. she is “not disturbed by any alarm for his safety” (31) when he goes to Antigua. Because she neither loves nor respects Rushworth their marriage is doomed to fail. Maria marries for money and social prestige (37). as when he ponders that “it would not much amuse him to have her for a partner” (242) when playing whist. 321) in life brings happiness.
In Sense and Sensibility Edward Ferrars realises that marrying a girl “inferior in connections” (134) will bring about difficulties and could ruin him (291). she realises that she had chosen such a life “with her eyes open” (244). Rosalind Miles feels that Austen “endorses…marriages which are not really so acceptable or respectable” (1987:44). Austen seems to dispute the view that an “inequality of situations” (193) should keep two people from getting married when she has Henry offer Catherine his hand in marriage (232). Mrs Palmer does not marry Brandon (113). when 102 . In Pride and Prejudice the convention that it is disgraceful to marry beneath one’s station in life is undercut when Darcy proposes to Elizabeth. and how he at times completely ignores her (107-110). Austen implies that domestic happiness is out of the question when one marries for money by showing how Mr Palmer verbally abuses his wife. Austen’s fiction often presents us with matches between two people of different fortunes. Yet he goes ahead and marries Elinor. Although Darcy knows that by marrying Elizabeth he will acquire relations “whose condition in life is so decidedly beneath [his] own” (224) he still wants her to be his wife. Owing to her mother’s mercenary motives. Nancy Armstrong has made a good case that for Austen “status seems to matter as much as the essential qualities of a person” (1987:141). should be the most important consideration when choosing a partner for life. and not money. She suggests that in Persuasion Austen demonstrates how wrong a ‘right’ marriage could be since this enables her “to make some of her sharpest and most derogatory comments on the hollowness of rank and position” (1987:45). and may therefore be implying that love.Chapter Three: Women and Marriage a loveless marriage. Similarly. In Northanger Abbey Catherine assures Isabella that “the difference of fortune can be nothing to signify” (108). Money also leads to unhappiness in Sense and Sensibility. Though Elizabeth feels sorry for Charlotte.
“the wickedest thing in existence” (Northanger Abbey. as Mrs Jennings says. and that she really does not know. like his sister is. 113). By having them marry men of superior rank Austen could be suggesting that difference of fortune should not keep any two people from getting married. Austen still manages to unite two people from different social backgrounds when she has her marry Edmund. Austen is at least creating an awareness of some of the class constraints affecting her heroines’ choices in marriage partners. Austen is suggesting that a marriage based on financial consideration only more often than not leads to unhappiness. It would appear that. 2.Chapter Three: Women and Marriage he proposes to Fanny. 295). 251). Though the implication that women need to marry into financial security cannot be overlooked. In Pride and Prejudice Charlotte Lucas believes “[h]appiness in marriage is entirely a matter of chance” (69) and that “it is better to know as little as possible of the defects of the person with 103 . while women need to marry in order to secure their financial future. in Catherine Morland’s words. why people make “such a to-do about money and greatness” (Sense and Sensibility. Austen’s work seems to imply that marriage should not necessarily make financial sense and that marrying for money is. that he will be “marrying a little beneath him” (Mansfield Park.2 Unfulfilled wives In most of Austen’s novels the narrator and even some of the characters seem to display a cynical attitude towards the notion that marriage for women means ultimate fulfillment. Henry Crawford must be aware. It could be argued that. Although Fanny refuses Henry. by showing how marrying for money ruins relationships. this should not be the only consideration when choosing a partner for life.
In Mansfield Park Mary Crawford pities her sister for having to endure a fastidious husband (113-4). She could not come. but must go and keep house together” (65). Because she in all probability feels unfulfilled she deserts her husband and runs 104 . 30). Grant. professing an indisposition. and doing as you were bid” (Emma. as becomes evident when she is kept from coming to see the young people’s rehearsal of Lovers’ Vows: They did not wait long for the Crawfords.Chapter Three: Women and Marriage whom you are to pass your life” (70). but there was no Mrs. for which he had little credit with his fair sister-in-law. Dr. His explanation seems to account for the “strange unsuitabilities which often [exist] between husband and wife” (Sense and Sensibility. 365). 114) and which Austen illustrates with relish. To her it is a “manoeuvring business” (45) which invariably leaves one of the partners disillusioned. Grant. while Edmund notes the “desperate dull life [Mrs Grant’s] must be with the doctor” (122). In Northanger Abbey Henry Tilney destroys all romantic illusions about marriage by asserting that married people have a duty to persevere and that they “can never part. Mary Crawford believes most married people to be unfulfilled when she claims to “look upon the Frasers to be about as unhappy as most other married people” (Mansfield Park. cynical view of marriage and only to have married Collins in order to secure her financial future (165). Being married to a selfish man has brought Mrs Grant no joy but a life of entrapment. While Mr Knightley describes matrimony as “submitting your own will. Charlotte appears to have a pragmatic. Maria Bertram cannot stand being unhappily married. could not spare his wife. Mary sees marriage as a business transaction in which either of the sexes is usually taken in. (174) While Mrs Grant manages to console herself by believing “[t]here will be little rubs and disappointments” (46) in most marriages.
following standard media representations of the patriarchal nuclear family as a perfect unit.Chapter Three: Women and Marriage away with Henry Crawford (444-446). owing to woman’s anatomy. It is possible that. her parish and her poultry” (Pride and Prejudice. (1999:892) It would seem indeed that contemporary feminist writers are concerned with reforming marriage and that they pay special attention to the reasons that many women believe being someone’s wife will make them happy. Austen is suggesting that being a wife does not necessarily mean being content. and if Austen is offering a critique of marriage as an institution. Patricia Waugh reveals how “myths of femininity” (1989:40) are reinforced by psychoanalysis which states that. The prevailing assumption that being a wife ensures happiness is challenged by Germaine Greer: Many of the women who will this year shed a husband who thinks that he has behaved as well as could be expected will do so because he is just too much trouble. If this is indeed the case. on the other hand. the ultimate goal for any 105 . (1999:163) Feminists have found that women are lured into marrying. by depicting wives who are unfulfilled. but marriage reform remains a major concern of second-wave feminism. then she could possibly be considered as one of the forerunners of nineteenth-century feminists who sought to reform this institution. it is only ‘natural’ that she should become a wife. Charlotte Lucas. Some gains were made. Helen Tierney writes that: [t]he condition of subordination in America and Europe in the nineteenth century was such that marriage reform was a priority of the feminist movement that began in mid-century. 244). Patricia Beer has suggested that Austen’s novels depict marriage as “ a state where women often struggle and endure” (1974:81). accepts her fate and handles being married to Collins by finding her solace in “her home and housekeeping.
Austen never challenges patriarchy so blatantly. Yet it would appear that she at times suggests marriage does not always leave women feeling fulfilled. be it consciously or subconsciously. In addition. 2000:451). (255) By showing that marriage can be disappointing. Even when women. Because society and language “construct our experiences in ways which we then reify as ‘natural’. women expect to find fulfillment in marriage. It signifies warmth. ‘universal’ and ‘the way things have to be’” (Code. and every year. despite their experience of the families in which they were children. Austen’s fiction examines what we can now refer to as ‘social constructedness’. and the much publicized evidence of the break-up of families in Britain today. In Austen’s novels we find many examples of husbands who regard and treat their wives as their property. she gently mocks the predicament of unfulfilled wives who pretend to be happy. Elinor comments that women are deceived if they think their happiness depends on their husbands: …and all that can be said of one’s happiness depending entirely on any particular person. realise the entrapping possibilities of matrimony. 106 . Chris Weedon explains: [The patriarchal family] is immensely seductive. In Sense and Sensibility we see how women lie to themselves when Mrs Palmer states that she is happily married and that her husband is just the kind of man she likes (114).Chapter Three: Women and Marriage woman to achieve. happiness and emotional and material security. thousands of women willingly set out to create conventional family life. it is not meant – it is not fit – it is not possible that it should be so. which seem to refute the socially-constructed expectation that being married means being content. (1987:16) Obviously. they still enter it in an attempt to find fulfillment.
In Mansfield Park Sir Thomas subscribes to the view that the man is the head of the family. Emma highlights the arrogance of men like Frank Churchill who believe finding a wife is simply a matter of choosing one you like (282). When Collins proposes to Elizabeth. Emma says that “it is not every man’s fate to marry the woman who loves him best” (204). A good wife. just as they always are” (281). In other novels Austen is possibly subverting the idea that husbands ‘own’ their wives by the way she uses language. and could therefore be displaying a dissident attitude towards patriarchal convention. among their own set. Sarah Gamble writes that feminist 107 . 1988:6). is one like his own who will never challenge her husband’s authority. In Pride and Prejudice a single man in possession of a large fortune is considered as “the rightful property” (51) of a single woman. Frank Churchill suggests that they see “women in their own homes. In order for prospective husbands to make an informed choice. for example. to Sir Thomas. When pondering on Mr Elton’s marriage to Augusta Hawkins. while in Emma a man is seen to be “the prize of a girl who would seek him” (313). given that there are other more important things to consider when selecting a wife.Chapter Three: Women and Marriage In the late eighteenth/early nineteenth century the man was seen as the undisputed head of the household and therefore as master over his wife (Nye. For this reason he means “to recommend [Fanny] as a wife by shewing her persuadableness” (285). 147-148). his presumptuousness in thinking such an offer to be irresistible and a great honour is met with amusement and derision by Elizabeth (Pride and Prejudice. Nancy Armstrong mentions in “Captivity and Cultural Capital in the English Novel” (1998) that English law was so one-sided that it “generally considered violence a man’s prerogative” (37). It could be argued that Austen is reversing what has become known as ‘sexist language’. Austen seems to relish portraying men who believe women are subordinate as arrogant and stupid.
Toril Moi believes that although sexism dominates the English language. empower men while they keep women in submission: ‘master’ implies dominance and control. according to Lorraine Code (2000:499). Traditionally. She mentions that with industrialization. Other feminist scholars such as Helen Crowley and Susan Himmelweit have commented on the power of language. Over the course of the century. Society in other words attributes certain connotations to certain words.Chapter Three: Women and Marriage critique is pitched at “the semantic system of English and its usage [for example] the pseudogeneric usage of man [which] enshrines the male-as-norm” (1999:142). Andrea Nye points out that even pairs of words. women have played the role of being subordinate to their husbands. (1988:174) It would seem that gender and language work together to shape opportunities and determine certain roles for men and women. supposedly similar in meaning but denoting a difference in gender. it has no inherent sexist essence (1985:158). Yet they continue to be responsible for 108 . some groups of women began to work for pay outside the home. instead of dominance and control. Janet Chafetz writes that “the division of labor in early industrial societies was such that married women often performed uncompensated work in or around the home” (1999:321). It would seem that there are no neutral words in which one could even attempt to indicate a male/female relation in which the woman was dominant. suggests a kept women or sexual object…‘spinster’ has none of the sophisticated. or even equal. more and more women started to participate in paid work. but indicates unattractiveness and failure. This included doing the housework without any compensation. Today. women make up almost half of the labour force in the industrial world. satisfied air of ‘bachelor’. and have shown that feminists found “within language an underlying bias against women” (1992:183). but ‘mistress’.
whether he says so or not. One might wonder then why all her novels end with the hero and heroine Despite the fact that women increasingly became part of the world’s workforce during the twentieth century. Many a woman is harassed by her husband’s expectations of order. we can infer that Austen may not have been an advocate of matrimony. the woman still does the large majority of housework” (1997:443). Germaine Greer points out that contemporary husbands often treat their wives as their servants: A man who marries expects his house to be kept clean. (1999:171) Given that Austen wrote her novels two centuries ago. coupled with the fact that her fiction at times appears to be openly cynical about the institution of marriage. Margaret McFadden states that “marriage appears… to be more advantageous for men…[since] wives are expected to perform more housework without compensation. Sarah Gamble writes that “[e]ven in an era in which feminism has won many more social and professional opportunities for women. 30 109 . her novels do appear to imply that becoming a wife does not necessarily ensure happiness.Chapter Three: Women and Marriage most of the household chores30. However. women in the United States. according to Margaret McFadden still “had to cope with cultural assumptions about their ‘place’ and with men who failed to do their share at home” (1997:268). often performing these duties as well as maintaining full-time employment” (1997:545). From this. Stevi Jackson suggests the reason that many women get married and “spend much of their adult lives performing housework for men” (1993:190) is that they believe marriage will provide financial security. one cannot expect her to write as openly about the realities of married life as feminist scholars do today.31. Feminist studies reveal that most men expect their wives to do the majority of the housework and take care of the children. 31 Schmittroth and Reilly McCall mention that “[o]ne 1994 study found that women employed full-time outside the home do 70 percent of the housework while full-time homemakers do 83 percent of the housework. marriage remains an enduring institution” (1999:269). This study suggests that while both partners may have full-time jobs.
When Lydia succeeds in ‘catching’ Wickham she and her mother are equally thrilled that she has been able to secure a husband at such a young age (320. The narrator in Pride and Prejudice seems to be critical of Mrs Bennet for hunting down husbands. “we are never allowed to feel that [economic] base as a determining force in [women’s] experience” (1981:130). 32 110 . In Sense and Sensibility Mrs Jennings feels proud that she has managed to marry off both her daughters and now wants “to marry all the rest of the world” (34). Women who chase after men. She also makes it known to the world that a match between Bingley and Jane would be most advantageous (140-141). in desperate pursuit of a husband. This apparent inconsistency will be 2. the narrator appears to be critical of women like Mrs Jennings who chase after eligible husbands for pretty girls: [Mrs Jennings] was remarkably quick in the discovery of attachments…and this kind of discernment enabled her soon Judith Lowder Newton points out that husband hunting had an economic base.on their minds (75-76). She feels that although a novel such as Pride and Prejudice emphasizes this idea. Mrs Bennet insists that they get married (151-152). When Collins proposes to Elizabeth. investigated towards the end of the chapter.and especially officers . could therefore be considered as naive. While Marianne abhors notions such as ‘setting one’s cap at a man’ and ‘making a conquest’ (43). Like their mother. We are told “[t]he business of her life was to get her daughters married” (53) and shown to what lengths she would go to see that they were settled in life. Lydia and Kitty have men only .Chapter Three: Women and Marriage entering nuptials and living happily ever after.3 Husband-hunting Though a married life might ensure one being financially secure32 it certainly has its disadvantages (as I show in the preceding section). 329).
111 . The irony is. It could be argued that Austen illustrates the sad reality that many women. Louisa and Henrietta Musgrove (Persuasion) fall in and out of love effortlessly. for it supplied her with endless jokes against them both. In the space of one year she falls in love with Mr Martin. a woman “not likely to be very. Both Maria and Julia fall in love with Henry Crawford. In Mansfield Park the Bertram sisters display their accomplishments while “looking about for their future husbands” (33). who seems to show some interest in Louisa. But. very determined against any young man who told her he loved her” (358). according to Knightley. In Northanger Abbey Eleanor Tilney does not seem to be a husband-hunter and attends balls “without wanting to fix the attention of every man near her” (43). decisively to pronounce that Colonel Brandon was very much in love with Marianne Dashwood…The immediate advantage to herself was by no means inconsiderable. Harriet Smith (Emma) is shown to be equally fickle and content with any man who would marry her.Chapter Three: Women and Marriage after her arrival at Barton. Mr Elton and Mr Knightley. chances are they will end up feeling unfulfilled. Wentworth. While Henrietta imagines herself to love Charles Hayter. When Robert Martin proposes for the second time she accepts because she is. like Isabella. because he will not have them. while they dream of happiness. Maria settles for Rushworth while Julia runs off with Yates. he is soon forgotten when Wentworth arrives at Uppercross (67). is quickly put out of the sisters’ minds when Louisa gets together with Benwick and Henrietta (once again) with Hayter. so desperately want to be married that they are prepared to forfeit their dignity and self-respect. (34-35) As is the case with the two youngest Bennet sisters. while Isabella Thorpe literally runs after good-looking young men (29-30).
Furthermore. she [had to] be on her best behaviour.Chapter Three: Women and Marriage 3. the woman novelist had to be extremely careful what she wrote: Precisely because [the woman writer’s] foothold upon literary respectability [was] so precarious. especially in novels featuring a woman protagonist. Simone Murray explains in “‘Deeds and Words’: The Woman’s Press and the Politics of Print” (2000) that since the literary world was composed (up until World War One) of male publishers only. It may be argued that Austen submits to patriarchy and endorses marriage as a patriarchal institution in order to continue living and writing in her society. At the same time she is possibly showing that her heroines. Another argument is that Austen uses the façade of happy endings in order to hide some dissident views on matrimony. all Austen’s novels end as the hero and heroine are united in matrimonial bliss. no matter how individualistic they are. Fairytale endings Despite illustrating the reality and dangers of marriage. (198) Judith Lowder Newton has argued in “Power and Ideology of ‘Woman’s Sphere’” (1981) that since Austen lived in a male-dominated society. There are critics 112 . Nancy Armstrong mentions that by the late eighteenth century “it had been established that novels were supposed to rewrite political history as personal histories that elaborated on the courtship procedures ensuring a happy domestic life” (1987:38). She adds that. “a successful conclusion could be none other than a life free of physical labor and secured by the patronage of a benevolent man” (42). walking warily so she [would] ‘not too much displease [the male publishers]’. she must have “felt the pressure of ideologies which required circumscription of power as rigorously as they required marriage (and more loss of power) as a ‘happy’ ending” (1981:884-885). also need to succumb to patriarchy in order to survive in a malefavouring world.
as far as women are concerned. Although the narrator invariably assures the reader at the end that the protagonists live happily ever after. At the very least one has to bear in mind that from very early in the novel marriage is viewed. mentions that in Austen’s work there is “the existence of another system of meanings behind the façade [but that] because of distortions of the surface these hidden meanings are invariably misread” (1998:115). Other newly formed attachments 113 . Sandra Gilbert and Susan Gubar believe that Austen’s ‘happy endings’ are all tongue-in-cheek: Many critics have already noticed duplicity in the “happy endings” of Austen’s novels in which she brings her couples to the brink of bliss in such haste. Mrs Bennet has to endure her husband’s condescension and constant teasing (51-52. (1979:169) The way in which Austen portrays married life in her novels would seem to concur with the view that she did not necessarily believe in matrimonial bliss herself. 262). André Brink shows how this is the case in Emma: It may be argued that. as no more than domestic service… (1998:121) Although we are told that Darcy and Elizabeth are happily married (Pride and Prejudice. we are shown Mr and Mrs Bennet’s stressful married life. referring specifically to Emma.Chapter Three: Women and Marriage who believe that Austen deliberately ends her novels in the conventional way in order to conceal her unconventional views on marriage. André Brink. While Mr Bennet soon has “all his views of domestic happiness…overthrown” (262). or with such unlikely coincidences. a very different picture of marriage is depicted in the marital relations enacted throughout the novels. towards the end. however paradoxically. marriage offers Emma a prospect of liberation…but this appears to be contradicted by all the preceding evidence from other marriages. or with such sarcasm that the entire message seems undercut. 393-396).
(1999:226) Given the unhappy marriages of the Tilneys and the Allens in Northanger Abbey. and not a week earlier. in time. as Barbara Seeber points out: Austen presents [Marianne’s] conversion as unlikely and anything but voluntary. the narrator may be implying the ending should not be taken seriously: I purposely abstain from dates on this occasion. Of the almost five hundred pages written.Chapter Three: Women and Marriage that seem doomed to fail include the marriages of Lydia to Wickam and Charlotte to Collins. Moreover. that every one may be at liberty to fix their own. I only entreat everybody to believe that exactly at the time when it was quite natural that it should be so.that of Sir Thomas and Lady Bertram. Maria and Rushworth .the happy ending reached at the end of the novel seems highly doubtful. Austen uses only the last four to unite Edmund and Fanny in matrimonial bliss. and became as anxious to marry Fanny as Fanny herself could desire. it is possible that the narrator is being ironic when she comments that for Henry and Catherine 114 . It is hard to believe that Lucy Steele would leave Edmund for his brother (which would allow him to court Elinor) and even more unlikely that Marianne would find happiness being married to Brandon. by focusing our attention on the fictionality of the ending and even letting us decide on our own dates. aware that the cure of unconquerable passions. That Marianne’s ‘whole heart became. In light of the array of unhappy marriages we find in Mansfield Park . (475-476) In Sense and Sensibility both Elinor and Marianne find happiness under very unlikely circumstances. Edmund did cease to care about Miss Crawford. as much devoted to her husband as it had once been to Willoughby’…is something we never see. Dr and Mrs Grant. must vary much as to time in different people. What we do witness is the rather violent process which brings about the endings. and the transfer of unchanging attachments.
It seems plausible that the endings are deliberately over-hasty and improbable and that we are expected to question their probability. Critics seem to have different views on Jane Austen’s endings.Chapter Three: Women and Marriage “[t]o begin perfect happiness at the respective ages of twenty-six and eighteen is to do pretty well” (236). Barbara Seeber feels that “Austen’s closures are full of gaps that speak of the inadequacy of the endings which fail to fulfill everyone’s desire” (1998:233). While John Halperin believes Austen’s abrupt endings to be her “one overriding fault as a writer” (1984:78). Her remark that “we are all hastening together to perfect felicity” (234) could signal that we are not supposed to take the ending seriously. Sarah Gamble remarks that the so-called ‘romance novels’ – which typically see the hero and heroine united in heterosexual bliss - 115 . While Nancy Armstrong believes that by marrying off the eligible members within the fictional world of the novel Austen manages “to fix them to a role within a household among households. thereby stabilizing the community” (1988:135). A standard response to Austen is to be found in the work of Patricia Beer who maintains that Austen endorses marriage in a patriarchal society (1974:46). (208) A possible reason that Austen’s endings find appeal among women today is that many women yearn for happy endings in their own lives. More recently. the conclusion reached by Edward Said would seem to concur that Austen’s endings (like most of the novels produced in the late eighteenth century) “confirm and highlight an underlying hierarchy of family” (1993:79). Austen’s parodic conclusions measure the distance between novelistic conventions with their culturally coded sentiments and the social realities of patriarchal power. Karen Newman writes in “Can this Marriage be Saved: Jane Austen makes Sense of an Ending” (1983) that: [f]ar from acquiescing to women’s traditional role in culture.
but because this is what is expected of her. Isobel Armstrong argues that: “[w]here Mrs Inchbald speaks out. not because she wants to conceal her views on matrimony. When one takes into account the numerous unhappy couples Austen creates (by showing rather than by telling). but because she needs to continue living and operating in patriarchal society. Because her novels create an ironic awareness of 116 . Comparing Austen’s Mansfield Park to Mrs Inchbald’s Lovers’ Vows. Since she lived and wrote in the late eighteenth/early nineteenth century. Their intense reliance on these books suggests strongly that they help to fulfill deeply felt psychological needs. But that does not mean that she was less concerned with questions which were profoundly important to her culture. she was not at liberty to be as openly defiant of convention as women writers today. In a paper entitled The Readers and their Romances (1984) Janice Radway explains why so many women want to see the hero and heroine get together at the end of a story: When current reading habits are examined…it becomes clear that the women think that it is the romances that are especially necessary to their daily routine. and not in the early twenty-first. Jane Austen does not. (1988:7) It is also possible that Austen writes according to tradition and succumbs to patriarchy. It could then be that she ends her novels with marriage. a very real possibility is that she neither believes in uncomplicated matrimonial bliss nor in fairytale endings. not necessarily because she endorses it herself.Chapter Three: Women and Marriage “retain an undeniable appeal” and condition women to accept patriarchal authority (1999:307). and when one considers that Austen may be implying that we should not take the endings seriously. (584) Jane Austen ends her novels in the tradition of the romance novel.
117 . Since we may never know the answer.to concentrate on issues that are of importance to women. It could therefore be argued that Austen’s subject matter contains more than what Karl Kroeber refers to in “Pride and Prejudice: Fiction’s Lasting Novelty” (1975) as “middle-class girls getting married” (144). At the least. her novels create an awareness that patriarchy renders women economically and socially dependent on men. regardless of what Austen’s personal views were. and that it thereby enforces marriage. What seems to be important is that. as I shall show in the next chapter. and since we cannot be sure whether her happy endings are intentionally traditional. In addition. it becomes increasingly difficult to decide if she in facts submits to patriarchy in order to survive or whether she opposes patriarchy and hides her dissent behind a decorous façade. they seem to create an awareness of the identity that women inherit in patriarchal society.Chapter Three: Women and Marriage the necessity for women to get married.when reading Austen from a feminist perspective . Austen’s novels make us re-think the reasons that women get married. it would seem useful .
Sniffer. newspapers celebrated my arrival. And I couldn’t even wipe my nose at the time. “men have always told [women] what [they] are” (Crowley and Himmelweit. later variously called Snotnose. there’s no getting away from the date: I was born in Doctor Narlikar’s Nursing Home on August 15th.Chapter Four: Women and Identity Chapter Four – Women and Identity Introduction I was born in the city of Bombay…once upon a time. No. it’s important to be more…On the stroke of midnight as a matter of fact. No. too. 1992:33). Well then: at night. Clock-hands joined palms in respectful greeting as I came. that won’t do. Like his character Saleem. Paula Nicholson comments in “Motherhood and Women’s Lives” (1993) that dominant male discourses have traditionally determined how women see themselves and have defined their social role for them (207-208). I tumbled forth into the world…thanks to the occult tyrannies of those blandly saluting clocks I had been mysteriously handcuffed to history. Buddha and even Piece-of-the-Moon. I was left entirely without a say in the matter. Nancy Armstrong has shown that in the past “language…was dismantled to form the masculine and feminine 118 . had become heavily embroiled in Fate – at the best of times a dangerous sort of involvement. For the next three decades. my destinies indissolubly chained to those of my country. 1947. (Salman Rushdie. spell it out. politicos ratified my authenticity. Stainface. I. Because patriarchy places men in such a powerful position. Soothsayers had prophesied me. Oh. there was to be no escape. Saleem Sinai. And the time? The time matters. Baldy. women have been “mysteriously handcuffed to history” and have had their identity determined by the society they have been born into. Midnight’s Children) The above passage by Salman Rushdie illustrates how our sense of ourselves is often determined by external factors over which we have no control. spell it out: at the precise instant of India’s arrival at independence.
1992:135). a legacy of having their identity prescribed. Contemporary women have inherited a legacy of being told who they are.“the place where our sense of ourselves. 34 Elsewhere I mention that Nancy Armstrong believes the conduct book to be alive and well. men were able to mould women’s identity as domestic overseer of the activities of the house (women’s interiority). used language . 33 119 .. Women were. but the woman character may only provide the domestic world of feeling in which he may…recognize his own inner life” (1989:28).to formulate an identity for women that would suit them and their own needs (Kanneh. our subjectivity. and that it appears as magazines. passive existence. Edward Said believes that today more than ever we “live. while at the same time as not working (women’s dependency). However. Men have. Nineteenth-century male novelists.Chapter Four: Women and Identity spheres that characterize modern culture” (1987:14).. is constructed” (Weedon. in short. 1987:21) . in other words. for example. women in the Western world are no longer explicitly told how to behave. denied women their subjectivity altogether by defining them in terms of interiority and dependency. books and advice columns telling women how to catch and keep a man (1987:62). Today. while constantly being encouraged to a life of submissiveness (2000:335-336). of course. there are feminist writers who believe that women’s identity is strongly influenced by the way in which women are portrayed by the media. The conduct book in turn has ceased to exist34 and women are more liberated to uncover their own identities. By the mere act of writing.in a world Patricia Waugh notes that “it has been argued that the identification of women with ‘interiority’ or ‘sensibility’ in the realist novel tradition precludes ‘their becoming autonomous’…The male hero may act in the world to assert his subjectivity and autonomy. expected to lead an asexual.33 Barbara Darby explains that in the late eighteenth/early nineteenth century the conduct books along with the so-called ‘novel of manners’ constructed a very specific image of femininity – one which suited the male half of the population.
magazines. (1999:167) Though women might have realised for some time that they had been portrayed in a certain way. Feminist scholarship aims at forging a new identity for women. that suffragists first reacted against women’s representation in the media by “seizing control of their own image-making in the press and in the booming popular print culture of the day” (2000:198). as Simone Murray reports. in Chris Weedon’s words. how our femininity and our sexuality are defined for us and 120 . Barbara Darby comments that “[t]elevision advertisements package and sell versions of femininity at the same time as they feature consumer goods” (2000:333). 1987:14). feminists have aimed at making women aware of the “dominant image of the family which confronts us in adverts. The Women’s Liberation Movement explored women’s identity by asking.Chapter Four: Women and Identity not only of commodities but also of representation” (1993:56). from the royals to our own photo albums” (Weedon. In an attempt to eradicate women’s identity as constructed by the media. Dafna Lemish reports that even today women in Israel are represented by the media as “marginal to society…[and] often associated with their traditional roles as caregivers or dependency roles as the ‘wife’ or the ‘daughter of’” (338). the cinema. television and family portraits. Germaine Greer has noted that the media plays a key role in shaping women’s identity: In commercial after commercial the performer of mindless routine tasks is an inanely smiling woman. In an interesting article entitled “The Whore and the Other: Israeli Images of Female Immigrants from the former USSR” (2000). it was not until the early twentieth century. “the very question what it is to be a woman. unless some inanely smiling man pops up to demonstrate a new and better way of using even more of the product by dint of making her look a complete fool.
is not a story. a story that. and how they see themselves (33). but must become a story. Shoshana Felman asks how women should “come…in possession of [the] female mind as distinct from the male mind into which [women] have been coerced” (5). Women and Writing: Virginia Woolf as flâneuse” (1992) that in order to define themselves. in other words. Trained to see ourselves as objects and to be positioned as the Other. subjectivity should be “central to women’s writing” 121 . as Nancy Armstrong points out. as women. women first need to distinguish between the male way of representing them. an autobiography. There is therefore.Chapter Four: Women and Identity how we might begin to redefine them ourselves” (1989:1). 1997:780). More recent writers continue to point out the “wide discrepancy between how women see themselves…and how they think they ought to be” (McFadden. has as yet. estranged to ourselves. (1993:14) Laura Marcus states in “Feminist Aesthetics and the New Realism” (1992) that in order to re-think and re-define women’s identity. precisely. While Judith Fetterley maintains in “Introduction: On the Politics of Literature” (1978) that feminist writing needs to “exorcise the male mind that has been implanted in [women]” (570). Lorraine Code emphasises the importance of “uncovering fundamental processes of patriarchal power in shaping [women’s] sense of [themselves]” (2000:451). She argues that women as yet have not found their own identities. but need still need to write them: …none of us. we have a story that by definition cannot be self-present to us. The view that women’s image is defined for them was thoroughly examined during the 1970s by feminist writers such as Sandra Gilbert and Susan Gubar who stated that for the woman artist the “essential process of self-definition is complicated by all those patriarchal definitions [of what it is to be a woman]” (1979:17). a distinction to be drawn between “essential human nature and the aspects of individual identity that have been imposed upon us by culture” (1987:12). Rachel Bowlby writes in “Walking.
creates an awareness of the way in which women’s identity has been constructed in male literature. 1977:14). She was encouraged to remain fragile and told that her dependence was “a tribute to the man’s strength and competence” (Miles. 1987:149). In this chapter I shall be looking at the ways in which women are represented in Austen’s texts. In addition her work. and a consciousness that women have artificially been endowed with qualities such as emotionality and natural mothering. 1987:39). questions women’s inherited identity and creates women protagonists who display rounded characters. if read from a feminist perspective. In the nineteenth century some women novelists used their writing to redefine what it is to be a woman (Gilbert and Gubar. 1979:44). All of Charlotte Brontë’s novels. 1. and how this portrayal of women differs from women’s representation in male texts. Woman’s image as so-called “Angel in the House” (Showalter. the educational curriculum introduced by the (male-dominated) government in the eighteenth century aimed at producing a specific view of what it meant to be a desirable woman (1987:21). it would seem. for example. she would find fulfillment (Gilbert and Gubar. and as a sweet and subservient being made her believe that her purpose on earth was to please men and that by surrendering the self. as “custodian of the moral values” (Miles. 1987:11). deal to some extent with “a woman in search of her identity” (Miles.1 Male texts In Austen’s day the image of women was created and maintained by men.Chapter Four: Women and Identity (19). Nancy Armstrong has argued that in the nineteenth 122 . Women’s Representation 1. According to Nancy Armstrong. Jane Austen. 1979:25).
(343) Sarah Gamble mentions that canonical texts present women as part of a crude sexual binary. suggest alternative images of women. angel or demon. and also its most satisfying symbol. Mary or Magdalen. The difference is that today feminist writers make women aware of how they are stereotyped and. virgin or whore. passive. woman is the stage on which the age enacts its own enduring morality play. they labelled all those who failed as ‘monsters’. Thus. in addition. Angela Leighton explains the sexual binary according to which women have often been judged in “‘Because Men Made the Laws’: The Fallen Woman and the Woman Poet” (1992): …woman…is the chief upholder of morality.Chapter Four: Women and Identity century “the dynamics of the sexual exchange [were] apparently such that the female [gained] authority only by redeeming the male. asexual existence was a view of women’s moral superiority and their importance as mothers…and guardians of domestic happiness” (2000:336). restricted to canonical texts but can also be seen in modern fiction.35 Toril Moi believes that because patriarchy sees women as representing “the necessary frontier between man and chaos…male culture [has sometimes been able] to vilify women as representing darkness and chaos. however. Patricia Waugh points out that “[t]he ‘splitting’ of women characters into idealized and asexual or highly sexualized objects is the norm in much modern fiction” Barbara Darby writes that the conduct books “constructed a Proper Lady who oversaw the activities of the house…ensured that her husband had a retreat from his work…and reared children…The compensation for this domestic. Stereotyping women by means of the written word is not. 35 123 . to view them as Lilith or the Whore of Babylon” (1985:167). The struggle between good and evil…takes up its old story on the scene of woman’s sexual body. not by pursuing her own desires” (1987:55). While the conduct books advocated that women should behave as ‘angels’. namely as virgin or whore (1999:130).
of the ‘Other’ and that of the ‘Exceptionally Successful’. This type of stereotyping has also been investigated by other feminists. as Gill Frith points out: Feminist critics dissected the sexual stereotyping pervasive in male-authored texts in the literary ‘canon’. 1. Dafna Lemish was able to identify three major images. Investigating the role of newspapers in constructing images of Russian immigrant women in Israel. positive images of women… (1993:153-154) In the following section I shall be looking at the way in which women are portrayed in Austen’s texts. magazines and popular fiction. in children’s literature. self-sacrificing virgin and predatory whore – feminists sought to identify and encourage alternative. It is clear that the narrator is unhappy with Catherine who is prepared to accept all the blame just in order to win back Henry’s favour: 124 .2 Austen’s texts The women in Austen’s fiction challenge the stereotypes associated with ‘femininity’. Austen identifies alternative images of women. In Northanger Abbey Catherine Morland seems to be a mixture of naivety and perceptiveness. In contrast to the dominant. One could therefore argue that. namely that of ‘Whore’. in her own way. negative images – such as passive woman and active man.Chapter Four: Women and Identity (1989:68). Interestingly. the image of whore was by far the most dominant of the three (2000:339). 137) and because she holds herself accountable for failing to keep her appointment with the Tilneys. It would seem that against certain stereotypes of women Austen depicts complex women characters. Although Austen does not explicitly challenge women’s portrayal in male texts. She is naïve because she believes men always to be in the right (36. particularly in exhibiting contradictory traits. her fiction promotes the idea that women are not one-dimensional and predictable.
Chapter Four: Women and Identity
Instead of considering her own dignity injured by this ready condemnation; instead of proudly resolving…to shew her resentment towards him…and to enlighten him on the past only by avoiding his sight, or flirting with somebody else, she took to herself all the shame of misconduct… (81) Yet Catherine is also perceptive. Despite the fact that she enjoys Henry Tilney’s company, for instance, she quickly notices an imperfection in his character. When Henry and Mrs Allen are discussing the qualities of muslin gowns, we are told that “Catherine feared…that
[Henry] indulged himself a little too much with the foibles of others” (16). Catherine also notices John Thorpe’s vanity. The narrator informs us that “the extreme weariness of
[Thorpe’s] company…induced [Catherine] in some small degree…to distrust his powers of giving universal pleasure” (55). In addition, Catherine realises that Isabella is not a true friend. In order to make Catherine call off her engagement with Eleanor Tilney so that she may accompany the Thorpes to Clifton, Isabella resorts to accusing Catherine of having more affection for Eleanor than for herself. That Isabella would reproach her in this manner makes Catherine realise that she is not a true friend but, instead, appears to her “ungenerous and selfish, regardless of everything but her own gratification” (86). In Mansfield Park Fanny Price’s character appears to develop as the novel progresses. Edward Said believes that “[f]rom frightened and often victimized poor relation [Fanny] is gradually transformed into a directly participating member of the Bertram household at Mansfield Park” (1993:87). In the beginning, Fanny herself believes that she can never be important to anyone because of her “situation, [her] foolishness and awkwardness” (Mansfield Park, 25). She is frightened of Sir Thomas (12; 14) and, according to the narrator, “quite overcome by Mrs. Norris’s admonitions” (13).
125
Chapter Four: Women and Identity
Fanny always seems to do as is expected of her. She tries to convince Maria that it is improper to climb over the gate with Henry’s help (101-102) and is firmly set against performing the play (156-158). As time moves on, however, Fanny seems to become more outspoken. Whereas, in the beginning, Fanny hardly manages to speak for herself (11; 72), she later remains firm in her refusal of Henry. Neither Edmund’s aversion to her being “so very determined and positive” (351), nor her fear of her uncle, can make her change her mind. Her concern that she might not always “be able to appear properly submissive and indifferent” (220) is warranted when she is “forced by the anxiety of the moment even to tell her uncle that he [is] wrong” (317). At first Sir Thomas feels Fanny is “[s]elf-willed, obstinate, selfish, and ungrateful” (322) because she will not heed him and marry Henry. When both his daughters elope, however, Sir Thomas begins to realise and to value Fanny’s good nature. What is more, he welcomes the news that she and Edmund are to marry for she is “indeed the daughter that he wanted” (477). Sir Thomas realises how much his opinion of Fanny has changed: [Sir Thomas] had pondered with genuine satisfaction on the more than possibility of the two young friends finding their mutual consolation in each other…and the joyful consent which met Edmund’s application, the high sense of having realized a great acquisition in the promise of Fanny for a daughter, formed just such a contrast with his early opinion on the subject when the poor little girl’s coming had first been agitated… (477) Not only is Fanny valued by Sir Thomas towards the end of the novel, but she herself believes she could be useful and “of service to every creature in the house” (437) when she hears about Maria eloping with Henry Crawford. Fanny proves to be very useful indeed as she helps Edmund to forget Mary Crawford (467) and consoles Lady Bertram (454). Though
126
Chapter Four: Women and Identity
her ‘usefulness’ is questionable in relation to gender (and class) politics, that she asserts herself in this way is commendable. In Sense and Sensibility Elinor Dashwood features a rounded character. While she at times seems to be critical of the society she is living in, she values propriety. For this reason she expresses her unhappiness with Marianne’s indecorous behaviour (51-56) and differs from her mother when she believes there is a proper way of being engaged (77-78). Elinor always behaves as she knows she ought to behave. Even when she is deeply hurt by Edward’s indifference she remains civil and treats him “as she thought he ought to be treated from the family connection” (86-87). Though Elinor values decorum, she notices the silliness of certain social conventions and does not have her judgement clouded. When Marianne asks whether “our judgments were given us merely to be subservient to those of our neighbours” (91), Elinor answers that one should never subject the understanding to the opinion of other people, and that all she has ever attempted to influence has been the behaviour (91). Because Elinor applies good judgement, she notices the absurdity of women like Mrs Ferrars who want their sons to marry someone with connections (289). Her ability to think and judge for herself also makes her realise how empty and monotonous women-talk often is (137). We see another of Austen’s complex women characters in Emma. From the outset we are told that she does what she likes (5) and that she always has her own way (30). Once she has made up her mind, there is no persuading her otherwise (11; 20). She stubbornly persists in her convictions (51) and is not afraid to challenge Knightley (49; 76; 115). She clearly enjoys arguing with men (11) and bravely ascertains that they are only really needed for their money (66-67). Emma’s confidence is reflected in her strong handwriting (224) and straightforward way of speaking (300). To pass the time, Emma enjoys playing games and solving riddles
127
In Elizabeth. headstrong (151. Austen thus succeeds in creating an unforgettable woman character who displays a mixture of strength and compassion. she loves meddling in other people’s affairs and playing matchmaker (10. for instance. Georgina Darcy’s idol. Being the heroine of the novel in most cases means that the reader identifies strongly with the character. 120). 79-81). Furthermore. and Darcy’s beloved. she does not seem to believe in the superiority of men but joins in their discussions (93-95) and argues with them (90). 27. Furthermore. a more serious. She also admits that she has acted inconsiderately and improperly towards Harriet (308). impressive female characters” (1985:47).Chapter Four: Women and Identity (54-59). Moreover. physically strong (78-82). Elizabeth however also displays an unselfish and loving nature . Elizabeth is also loved by characters within the fictional world of the novel: she is the apple of her father’s eye. She realises that Knightley is very dear to her and that she does not want to lose him. Anne Elliot in Persuasion is described as having “elegance of mind and sweetness of character” (7). instead of fragile and weak. While she is “nobody with either [her] father or sister” (7). as when she devotedly nurses Jane back to health (Pride and Prejudice. her sister Jane’s confidante. She. Elizabeth displays love and compassion herself.she is shown to have a great capacity for loving and for being loved in return. 159. and as such a multi-faceted identity. but strives to identify with strong. Toril Moi mentions that the ‘feminist’ reader of the realist period “not only wants to see her own experiences mirrored in fiction. In Pride and Prejudice Elizabeth Bennet is proud (72). There is. Emma gets to know her own heart towards the end of the novel. 208) and snubs decorum by being. displays a selfless nature when she takes care of the poor (65) and when she shows concern for her father’s well-being (7. In addition. unselfish side to Emma. she is “a most dear 128 . however. 314).
when he more seriously described the woman he should wish to meet with [as having a] strong mind. mind. Nancy Armstrong rightly notes that: …one can observe the shift in Austen’s emphasis away from natural virtue as the quality a woman exemplifies to a more complex understanding of subjectivity. I believe that because Austen’s fiction features women with complex. in her temper. (1987:154) If indeed it was Austen’s intention to explore and even suggest a multifaceted identity for women. a model of female excellence” (142). Anne. We are told that. Anne shows courage when she is slighted by her father and her sister. it identifies alternative images of women. She is respected by Mary’s children (39). The narrator mentions that “Anne Elliot was not out of [Frederick Wentworth’s] thoughts. We see that she has a strong mind when she does not hesitate to argue with men about issues such as women’s loyalty (205-207). and valued by Captain Benwick for her gentle nature (90). the narrator tells us that “Anne herself was become hardened to such affronts” (31). When Sir Walter engages Mrs Clay to accompany him and Elizabeth to Bath. favourite and friend” (7) to Lady Russell. Anne attended to her “with all the strength and zeal and thought which instinct supplied” (99). then surely she was not being prescriptive. rounded characters. and that they therefore cannot be stereotyped. Toril Moi’s criticism of feminist theorists such as Luce Irigaray who come to “analyse ‘woman’ in idealist categories” (1985:148) is 129 . when Henrietta fainted. apparently because she would be of more use to them than Anne. manners. with sweetness of manner” (55).Chapter Four: Women and Identity and highly valued god-daughter. It would appear that women like Anne Elliot and Elizabeth Bennet display natures that incorporate a variety of character traits. Anne also shows strength of character when Louisa falls and is seriously hurt. In addition. Mr Elliot thinks she is “a most extraordinary young woman. is not weak. despite her seemingly docile character.
a more complete reformation. for instance. Lorraine Code points out that “Western culture has historically tended to…associate both mind and reason with men and masculinity. While her father bases his decision on emotion and needs to be persuaded to move (13-14). instead of rational creatures” (63). and prone to emotional outbursts” (1997:831). women have been considered illogical. Nancy Armstrong writes that in nineteenth-century fiction “the difference between male and female was understood in terms of their respective qualities of mind…[which] made men political and women domestic” (1987:4). Rationality and Emotion In addition to having classified women as either angels or monsters. Margaret McFadden notes that not only in the eighteenth and nineteenth centuries but also “[i]n many other historical periods. 1992:72).Chapter Four: Women and Identity illuminating in relation to Austen whose work resists essentialist definitions of what women should be. On occasion Austen’s novels appear to subvert the master narrative of her time that all men are rational and all women emotional. 2. Because she has the ability to remain objective Anne makes wise decisions. a quicker release from debt” (13) seems much more rational. Anne realises they have no alternative but to quit Kellynch-hall. while Anne Elliot’s depiction illustrates that women are often more sensible than men. In Persuasion Mrs Croft vehemently objects when Frederick Wentworth talks “as if women were all fine ladies. and to devalue body and emotion while associating both with women and femininity” (2000:160). irrational. 130 . and offers alternative possibilities of what they might also be. When Sir Walter experiences financial difficulties. men have portrayed them as emotional creatures in speech and in writing (Moore. Anne’s favouring of “more vigorous measures. less intelligent than men.
Elizabeth Bennet is able to recognise his true character and knows to reject his marriage proposal (Pride and Prejudice. as any rational creature would have done. Austen seems to be saying something interesting here about the limits of rationality and the limits of an emotional response. 121). 148-149). Elizabeth’s pride is hurt. You talked of expected horrors in London. Henry’s irritation with women who rely solely on their fancy possibly reflects the attitude of the narrator: And you. For the same reason. and instead of instantly conceiving. In contrast to Elizabeth. that such words could relate only to a circulating library. and she loses her objectivity and misjudges Darcy’s character (59. When Darcy rejects her as a dancing partner. In Northanger Abbey Catherine Morland often seems to act on emotion only. Though Edmund thinks it is unlike her “rational self” (351) to reject Henry’s marriage proposal. when Charlotte marries Collins. Jane advises Elizabeth not to judge her friend so 131 . Maria ostensibly bases her decision to go away with Henry purely on emotion and later has to endure shame and scorn (470). Jane is able to regard Darcy rationally and make a more accurate judgment (128). Miss Morland – my stupid sister has mistaken all your clearest expressions. Because she becomes emotionally involved and loses objectivity. she immediately pictured a mob of three thousand men… (101) Possibly because she is not emotionally involved with Collins. however.Chapter Four: Women and Identity In Mansfield Park we see that if emotion only is one’s guide one can easily be led astray. she is convinced that General Tilney murdered his wife (181-182). Because Fanny applies reason she is not persuaded by her cousin to change her mind about Henry Crawford. and under what circumstances these manifest themselves. she turns out to have been the only one ‘rational’ enough to recognise Henry’s intentions (444). On the other hand.
37. When Willoughby betrays her love. Marianne’s actions are based on emotion only. her appearance of 132 . While women like Fanny Dashwood fall into “violent hysterics” (250) and others like Lucy are driven into “a fainting fit” (250).Chapter Four: Women and Identity harshly and sensibly argues that a match between them is not as bad as Elizabeth would make it out to be (174). that her firmness was as unshaken. and ascertains that Marianne “was without any power. Elinor remains calm and in control. whose “person and air were equal to what her fancy had ever drawn for the hero of a favourite story” (41). and coolness of judgment” (4). Elinor admits that she herself enjoys Brandon’s company for he is “a sensible man. In contrast to Marianne. While Elinor applies both. 35. She is shown to esteem passion (16. The narrator comments that Elinor did not need her family’s support for she “was stronger alone. and her own good sense so well supported her. because she was without any desire of command over herself” (80). Elinor never lets her feelings cloud her better judgment. It is partly Marianne’s unrestrained emotionality which induces her to fall hopelessly in love with Willoughby. and sense will always have attractions for [her]” (49). it becomes clear that responding from the heart only can have disastrous effects. rational (19) and discreet (24). 44) and to display an “indulgence of feeling” (81). Sense and Sensibility illustrates the benefits of applying reason as well as emotion by contrasting the Dashwood sisters. Elinor possesses “a strength of understanding. Even though she is emotionally involved she retains the utmost self-command when Edward seems cold and reserved (86-87) and when she learns about his engagement to Lucy Steele (126). and reprimands Marianne for judging Brandon solely “on the strength of [her] own imagination” (50). The narrator comments that “the imaginations of…people will carry them away to form wrong judgments” (241). She is prudent (12).
(1987:35) 133 . the subject (woman) does not notice how she is constantly shaped and subjugated: If knowledge is to become power. and not only by emotion. as…it was possible for them to be” (135). then. Because patriarchal discourse is camouflaged. that it is natural and rewarding for all women to be mothers. Though Elinor suffers as great an emotional loss as Marianne she is able to bear it “with less self-provocation. as Nancy Armstrong points out. Austen’s fiction features women who remain objective under difficult circumstances. Above all. In addition. thus empowers her. Since Austen’s writing contradicts the popular belief that women are born emotional creatures. Her ability to remain rational and objective. it could be argued that she challenges the identity which patriarchy has created for women. it cannot appear to operate in the interests of a political group. These discourses reinforce specific perceptions of women’s identity and “appear natural to the subjected individual” (121). Natural Mothers Much feminist writing has shown that women generally accept the identity society defines for them. Chris Weedon argues that the way “we live our lives as conscious thinking subjects…depends on the range and social power of existing discourses” (1987:26). In the following section I shall show that her novels reveal another myth of women’s identity. even where matters of the heart are concerned. 3. and greater fortitude” (349). In this way I believe it shows that rationality is not solely a man’s faculty. it seems to suggest that if a woman is governed by reason. she will be able to judge better and will remain strong when faced with life’s adversities.Chapter Four: Women and Identity cheerfulness as invariable. it cannot appear to be so.
Rosemary Gillespie reveals how this discourse has established women’s identity in an essay entitled “When No Means No: Disbelief. She states that. many women see it as a way of escaping their dreary employment. We expect to fall irrevocably in love with our babies. but it doesn’t always happen quite like 134 . In the 25 April 2001 edition Deborah Hutton asks in an article what happens when “mothers lose that loving feeling” (64).Chapter Four: Women and Identity A popular belief is that. In part she blames society for constructing the expectation that motherhood is bliss. society treats women who are not mothers as failures and as unfeminine (201-202). She writes that despite the “glossy images of lovey-dovey new-baby bliss” mothers sometimes feel an aversion to their babies. they are only fulfilled once they have borne children. and Deviance as Discourses of Voluntary Childlessness” (2000): Constructions of femininity and women’s social role have historically and traditionally been contextualised around the practices and symbolism surrounding motherhood. because of women’s anatomy. Popular women’s magazine Fair Lady contributes to the debate. It can therefore be said that “women are socialised into wanting children” (209). Motherhood has predominantly been perceived as natural for women. Disregard. and hence for leaving women disillusioned when they realise they do not love their children unconditionally: The bonding principle looms large in every new mother’s consciousness as the emotional superglue that will weld her and her infant together. despite motherhood being “the key means of women’s oppression in patriarchal societies” (1993:201). What is more. the desire for it inevitable… (223) Paula Nicholson investigates in her study on motherhood why many women in contemporary society believe they need to become mothers in order to be fulfilled.
as Nancy Armstrong (1987:59-69) reports. and states that the feminist struggle is one “toward a new feminine awareness fighting sex discrimination and redefining male and female sex roles” (69). we see a number of women who apparently find motherhood fulfilling. and always innocently busy.Chapter Four: Women and Identity that…women feeling less than total love for their children are depicted as. In fact. Armstrong writes that up until the seventeenth century. Although at times the narrator ostensibly praises her for her womanly ‘worth’. In order to understand the origins of the legacy that motherhood is natural. the great majority of conduct books represented the male of the dominant class. she does not appear to be sincere in her commendation. might have been a model of right feminine happiness. it is useful to have a look at what late eighteenth-century writers such as Jane Austen have to say (explicitly or implicitly) about women as mothers. maternal monsters. passing her life with those she doated on. (64) Shoshana Felman similarly exposes the myth that in patriarchal society women want nothing more than to be a mother. a daughter and a wife (1993:73). It was only by the second half of the eighteenth century that the conduct books prescribed the ideal of womanhood (61). it would seem that she is critical of Isabella who is oblivious to the social role she is playing: …poor Isabella. blind to their faults. full of their merits. If we look at the way in which Austen depicts women as mothers. In Emma Isabella Woodhouse plays the role of self-sacrificing mother (72-73). and feel they are. (107) 135 . Armstrong maintains that the conduct books “rewrote the female subject for an eighteenth century audience” (94) and that “it is reasonable to claim that the modern individual is first and foremost a female” (66). The eighteenth century is significant since it signals the rise of the domestic woman.
but she will swallow anything… (117) Austen depicts motherhood as unfulfilling when she. the most rapacious of human beings. because Mrs Morland was pregnant so regularly. Mansfield Park possibly suggests that mothering is not natural to all women and that bearing children does not mean 136 . as anybody might expect. (1) In addition the narrator mentions that. focuses on mothers “who fail in their nurturing of daughters” (1979:125). is likewise the most credulous. Mary Musgrove in Persuasion does not seem to earn the respect of her children (39). her demands are exorbitant. however. and critical of Lady Middleton for being blind to their faults: …a fond mother. While Mrs Bennet in Pride and Prejudice fails to love her daughters equally (145) and is a constant source of embarrassment for Elizabeth (143) and Jane (354-355).Chapter Four: Women and Identity Mrs Morland in Northanger Abbey purportedly finds happiness in motherhood. and to enjoy excellent health herself. as Sandra Gilbert and Susan Gubar have shown. While Mrs Dashwood is a good mother and wants what is best for her children. seems to ridicule the social discourse that childbirth is rewarding when she incredulously comments that Mrs Morland enjoyed health and prosperity after giving birth to ten children: [Mrs Morland] had three sons before Catherine was born. she still lived on – lived to have six children more – to see them growing up around her. Lady Middleton is similarly incapable of seeing her children’s mistakes. in pursuit of praise for her children. she inevitably neglected her children (3). she is blind to their shortcomings (51-52). though. The narrator. and. instead of dying in bringing the latter into the world. The narrator appears to be irritated with the children for being rowdy and mischievous. In Sense and Sensibility we see that motherhood dulls one’s perception.
While we do encounter women who accept their patriarchally-engendered social role. her work at times seems to contradict the discourse that motherhood is fulfilling. In addition. and the charge was made over to her sister… (33) Despite her being childless. Austen is possibly commenting on the enormity of the task of raising children as well as on the consequences of having so many children. some mothers are depicted as failures and as women who have not found fulfillment in motherhood. The narrator comments that: Lady Bertram did not go into public with her daughters. Edmund believes that his aunt is “much better fitted” (25) than his own mother for having the charge of Fanny. Mrs Norris is the one who takes responsibility for displaying their accomplishments and the one who helps them find their future husbands (33). She was too indolent even to accept a mother’s gratification in witnessing their success and enjoyment at the expense of any personal trouble. (Here it needs to be mentioned that since Edmund makes this claim while trying to persuade Fanny that going to stay with Mrs Norris will not be that bad. the narrator’s approval of them at times seems doubtful.Chapter Four: Women and Identity one knows how to take care of them. has so many children that she cannot provide for them all (3). in turn. despondent and worn-out (2-3). Although Austen’s work features wives and mothers. I do not believe it can therefore be said that she endorses women’s social role as defined by patriarchy. Fanny’s own mother. Instead. By portraying her as impoverished. Although Lady Bertram is Maria’s and Julia’s biological mother. it is not clear whether he genuinely believes his aunt is more capable of taking care of his cousin or whether he merely says this in order to reassure Fanny). When the narrator comments that being a 137 .
economic and social system. However.. (1999:151) 138 . and for their having instantly all the liberty and attendance. nineteenthcentury feminists wanted to obtain power for women by seeking equality within the existing social structure. and her intellect not for invention or creation” (Gilbert and Gubar. and to display a weak and fragile nature.. a consciousness of the constructedness of ‘natural’ motherhood. Women empowered Because late eighteenth/early nineteenth-century men believed woman’s power to be “not for rule.which they could possibly wish for” (Emma. many women characters are shown to be without real power. we are not only made aware of the fact that patriarchy renders women powerless but are presented with signs of women’s empowerment. equal rights under the law – they would attain equality with men. 72) it is not clear whether she is commending or exposing motherhood. not for battle.Chapter Four: Women and Identity mother like Isabella Knightley includes having “maternal solicitude for the immediate enjoyment of her little ones. 4. In contrast to the subtle ways in which Austen’s heroines are empowered. employment rights – in other words. Austen’s fiction seems to reflect the powerless state of women in her time. to refuse and to write. To this end I shall argue that women are shown to have the power to judge. the right to vote. Possibly owing to the male-favouring educational. amongst feminist scholars at least. What is clear is that Austen’s work raises questions regarding women’s identity and that it in this way creates. the right to own property. 1974:24) women in Austen’s day mostly remained powerless. as Janet Chafetz reports: Nineteenth century feminists believed that if they obtained the right to an education.
leading to competitiveness with other women. and Patricia Waugh sees: …women’s second-class position in patriarchy [as] reflected in their psychology: lack of confidence.Chapter Four: Women and Identity Chafetz explains that contemporary feminists. as Judith Lowder Newton has suggested. self-condemnation. believe women lack power because they are not allowed to compete with men in male-dominated economic and political spheres. She believes women as a group are not only marginalised culturally but also politically. institutions such as education and marriage rendered women weak. powerlessness. This includes making women good judges 139 . but are relegated to staying at home and raising children (151). does not openly criticise patriarchal society for keeping women powerless. insecurity. if we apply a feminist perspective when reading her novels. 4. Paula Wilcox suggests that the very structure of our society is conducive to the oppression of women (2000:36). (1989:86) In “Exiles From Power: Marginality and the Female Self in Postcommunist and Postcolonial Spaces” (2000) Maria-Sabina Draga-Alexandru metaphorically refers to women as “exiles from power” (356). “by quietly giving emphasis to female capability” (1981:883). on the other hand. However.1 The power to judge Austen empowers her women characters. Helen Tierney argues that “[a]uthority in patriarchal societies…resides ultimately in the male” (1999:892). Austen herself is aware of women’s powerlessness and of the dire need for self-empowerment when she creates strong women protagonists who exercise the power to judge and to refuse. and an inability to feel whole. overdependence. Austen. in contrast to contemporary feminist scholars. we are made aware of the fact that in the late eighteenth century.
who observes with “wonder and censure” (118) the game Henry is playing with her cousins. She is. more or less disguised. When Mrs Musgrove suddenly mourns the death of her “troublesome. Anne can hardly suppress a smile (58).Chapter Four: Women and Identity of character. When she rejects Henry. she is not fooled by her seemingly sweet exterior. The ability to judge thus protects Fanny from being hurt by people like the Crawfords. Despite his being “rational. Anne Elliot is similarly not deceived by people but quickly recognises their intentions. Although Fanny Price is modest and introverted. is consequently not taken in by him. Anne’s power of discernment enables her to recognise Elliot’s true intentions. and finally she is not hurt. Fanny. she has the ability to judge people and assess situations. She is amused by their childish behaviour when they decide to put on a play (134-140). 134). simply in order to impress Wentworth. polished” (143) she does not trust him. Her ability to study characters further proves to be useful when it 140 . for example. Although at times she enjoys Mary’s company she realises that it is “often at the expense of her judgment” (209). Fanny also notices a sort of fault in Mary right from the start (66). discreet. seemed to govern them all” (Mansfield Park. immediately recognises him to be a flirt and is probably not surprised that he never intended to marry Maria. the only one to condemn the young people’s “selfishness which. and even refuses to condone Edmund’s decision to partake (162). On another occasion. 45). She is also sensitive enough to realise that Henrietta and Louisa do not like Mary and really do not want her to join them on a long walk (75). Because she ascertains that Mary “loves nobody but herself and her brother” (429). Mary suggests that Fanny enjoyed “having it in [her] power to pay off the debts of [her] sex” (367). hopeless son” (Persuasion. She knows her uncle better than his own children do (198) and firmly believes that he would not approve (158). She resists his charms because although she “was quiet [she was] not blind” (367).
She boldly contradicts what James and Isabella have told her about him and finds his company tedious. although Emma regards Elton as a suitable match for Harriet. to form a “most unfavourable opinion” (290) of Robert Ferrars. I have mentioned that Catherine Morland. Also. scarcely four weeks after professing he loved Emma. This enables her to detect in Willoughby “a want of caution” (47) and to distrust him when he suddenly takes leave of Marianne (74). she cannot help but recognise and laugh at his superfluous gallantry (Emma. 91). Elinor Dashwood believes it is important to give oneself “time to deliberate and judge” (Sense and Sensibility. 54). Elinor similarly notices a “thorough want of delicacy. Similarly. This. and not a true friend at all. 65). and integrity of mind” (124) in Lucy Steele. she does not fail to see that Isabella is selfish. In addition. She recognises the vanity and superciliousness of Bingley’s sisters and is restored “to the enjoyment of all her original dislike” (81) when they act ungraciously towards Jane. In Pride and Prejudice Elizabeth Bennet’s “quickness of observation…[and] judgment” (63) enables her to see through people. she is not blind to the faults of her own family but wonders at their false sense of pride and at their foolishness (124). although Catherine can at times be extremely naïve. after a single encounter. notices how vain John Thorpe really is. in turn. Elizabeth’s ability to assess situations not only makes it 141 . Her power of discernment also induces her. “[l]ittle as [she] was in the habit of judging for herself” (Northanger Abbey. gives her new hope that he might still love her. She realises that she had been right in assuming he only wanted to marry her for her money when she learns the “amusing and…very welcome piece of news” (133) that he has married Miss Hawkins.Chapter Four: Women and Identity makes her realise that Frederick Wentworth is not in love with either of the Musgrove sisters (74). of rectitude.
Instead of being left disabled by society they find amusement in its follies. narrow-minded. however. feels “all the impertinence of her questions” (198) and recognises her for the bully she is. 142 . Armstrong stresses that “we must see Austen’s novels striving to empower a new class of people . also judges her own family.Chapter Four: Women and Identity possible for her to recognise silliness but also provides a means of self-protection when the sisters refuse to share Darcy’s company with her and she is able to laugh it off (97). to empower themselves. silly man” (174) and feels sorry for Charlotte for being his wife. Elizabeth judges him to be a “conceited. pompous. albeit in a compromised way. Though Austen’s heroines may exhibit ‘authority of a strictly female kind’. Elizabeth is not swayed by Collins’s reverence for Lady Catherine de Bourgh but. my emphasis). instead. She argues that the novel “maintains the continuity of traditional political authority while appearing to broaden its social base by granting Elizabeth authority of a strictly female kind” (1987:53. and in so doing manage. they represent the possibilities of the power of discernment which enables them to defend themselves in an unfair world of ‘normalising practices’. Nancy Armstrong argues that Pride and Prejudice demonstrates the truth of the sexual contract. which aims at providing women with security in exchange for their submission to a traditional role. Elizabeth. she feels she has “never been blind to the impropriety of her father’s behaviour as a husband” (262). Despite being young. While she condemns Lydia’s “unguarded and imprudent manner” (257). Because she is a good student of character she immediately notices Collins’s obsequiousness.not powerful people but normal people” (136).
she remains steadfastly unwilling to marry him. In Northanger Abbey Henry Tilney states that “man has the advantage of choice. In Persuasion Anne Elliott is portrayed as being silently determined when she refuses marriage on two occasions. Here I would agree with Patricia Beer who argues that although these women recognise the need for marriage. When she later realises that she loves Darcy. 173) appears to be subverted in many of Austen’s novels.2 The power to refuse The belief universally accepted “that every man is refused – till he offers” (Persuasion. Even the fear of her uncle is not enough to make her change her mind (317).Chapter Four: Women and Identity 4. In Mansfield Park Fanny stubbornly refuses Henry Crawford. She not only vehemently refuses Collins (Pride and Prejudice. albeit in a manner requiring some compromises and concessions. Austen’s heroines would rather “live unmarried than enter into marriage solely in response to the assumption of society that for women this is the only viable existence” (1987:45). We see how her heroines time and again exercise their right to refuse some proposals and to accept others. woman only the power of refusal” (65). to empower themselves whilst retaining their integrity. she assumes she has the right to change her mind and agrees to marry him (375). Fanny answers that a woman should not be obliged to accept any man who may 143 . Elizabeth Bennet is also shown to reject two suitors. She first breaks off her engagement to Frederick Wentworth and then declines Charles Musgrove (25-26). 148-149) but also Darcy (222). When questioned about her stubbornness. Although she is told that it would be a wonderful match for her. they “do not allow themselves to be utterly trapped by it” (1974:60). We see Catherine exercising her right to refuse when she rejects Thorpe (129-130). Mary Evans has suggested that even though refusing a proposal means risking their financial security.
In the late eighteenth/early nineteenth century “a strengthening discourse of femininity” (Darby. Though Fanny refuses Henry Crawford her new-found independence. according to Armstrong. is not equal to the power of her uncle (1988:52). When Emma (and therefore possibly Austen) suggests staying single as an alternative to marriage. Isobel Armstrong points out that Fanny’s power of refusal is limited. A number of critics. Edward Said feels that although Fanny acquires status during the course of the novel. 373-375). she remains “in her assumption of authority…relatively passive” (1993:85). however. Because Sir Thomas wants Fanny to realise the value of a good income (such as she would be assured of by marrying Mr Crawford) he sends her home to Portsmouth. 2000:336) propagated the idea that women should marry and take care of their husband and home. argue that Fanny displays only marginal power. Patricia Beer believes Fanny is not one of Austen’s spirited heroines but one of the “supine ones…who employ[s] the technique of lying down and going limp” (1974:46). Fanny has no choice but to do as her uncle says (Mansfield Park. Emma also makes a case for women to remain single by maintaining that because married women are only nominal mistresses in their homes and have no real power.Chapter Four: Women and Identity happen to like her (357). it would be better for single women of large fortune never to marry (66-67). 42). Since he is master at Mansfield Park. Nancy Armstrong 144 . she implies that men are dispensable and thus seems to defy the convention of her time. She exercises this right herself when she jilts Elton (101-102) and when she flirts with Frank Churchill while not ever intending to marry him (188). Emma Woodhouse strongly feels a “woman is not to marry a man merely because she is asked” (Emma. She expresses her abhorrence of men who imagine “a woman to be ready for anybody who asks her” (47) and believes that it is the “female right” (51) to reject suitors such as Robert Martin. or even no power at all.
Knightley’s standard of conduct” (1987:153). Women’s power seems limited. realising she needs to live and survive in a patriarchal world. Judith Fetterley notes that because women have been kept from telling their story. and it is in relation to the marriage choice that their autonomy is most emphatically subverted” (1981:126). It could be argued that Austen challenges patriarchy. To be excluded from a literature 145 . as it is in the politics of anything else. Once again. “subjects herself to Mr.3 The power to write I have shown in previous chapters that women were prevented from writing and in this way from producing knowledge. 4. Although some of Austen’s women characters snub male authority by rejecting certain men. which gives man the power to choose. At the same time she shows that women need not say yes to the first marriage proposal that comes along but have the right to reject and to accept whomever they wish. however. Judith Lowder Newton argues that in Austen’s novels “[i]t is in relation to the marriage choice that men’s potential autonomy is brought into most conscious focus. towards the end of the novel. by allowing her women characters to reject certain suitors and to accept others. they remained powerless in a male-dominated society. It could be that Emma. they have been rendered powerless: Power is the issue in the politics of literature. it may be that Austen is illustrating that women often enter the patriarchal institution of marriage in order to survive. all of them end up marrying the male protagonist. As a result. accepts her husband’s authority and thereby relinquishes some of her own.Chapter Four: Women and Identity however suggests that despite Emma’s bravado she.
fortunately. (1993:126) 146 . Shoshana Felman comments on the need for women to write their own story: The need to speak to women without the intermediary of a man. and that each woman’s story can become a story only through women’s collective perception of themselves. Chris Weedon believes reverse discourses to be “the first stage in the production of alternative forms of knowledge” (1987:111). my emphasis) Writing new discourses means challenging existing ones. to listen more attentively to women. is also true. only through a female sharing and exchange of stories.Chapter Four: Women and Identity that claims to define one’s identity is to experience a peculiar form of powerlessness… (1978:565) The reverse. Feminist scholars argue that they can empower women by what they write. and to address more urgently the community of women. only through the bond of reading. has imposed itself as a corollary of my growing sense that the feminine predicament of “the absence of a story”…can be truly grasped. Judith Lowder Newton states that “[t]o write subversively…is a form of struggle – and a form of power” (1981:892). it is also a way for the oppressed to “assert their own identity and the existence of their own history” (1993:xii). the knowledge of women’s contribution could make a significant difference to the judgments and practices of the whole society…male dominance means women’s silence and…society can no longer afford to neither hear nor heed the voice of half of humanity. Edward Said warns that while writing is a way for the oppressor to keep a minority group in subjection. that only women can empower women’s story to become a story. (32. and perhaps remedied. Dale Spender comments in “Women and Literary History” (1989) that by writing women are able to change existing power relations: This is the argument of many women: that in the broadest possible sense.
“a form of power in its own right” (1987:156). Writing for Austen is.4 Domestic Power(lessness) Austen seems to be equating (paradoxically at first glance) domestic power with powerlessness by depicting women characters who appear to be formidable as having no real power. and in this way were “a form of social control” (91). She notes that the conduct books. 147 . By allowing women to tell their story she defies the male authority manifest in literary texts of her era and opens up new possibilities for women. Mrs Ferrars. in Nancy Armstrong’s words. Mrs Churchill. Lady Russell and Mrs Norris might believe that they wield domestic power. she shows that women can claim specific forms of power such as the power to judge and to refuse. which “were attuned to the economic interests that they designated as the domain of the male” (1987:94). The issue of domestic power in Austen’s time has been addressed by current feminist scholars.Chapter Four: Women and Identity When early nineteenth-century women writers such as Jane Austen took up the pen they took up. as Sandra Gilbert and Susan Gubar have suggested. or none at all. 4. Austen’s novels illustrate that manipulating one’s family and friends brings women no real power when women who exercise this type of power have their authority undercut. propagated the idea of ‘domestic power’ in order to ensure that women would effectively manage the home. they are shown to have little power really. a “quest for [their] own story” (1979:76). In addition. Though women such as Lady Catherine de Bourgh. Nancy Armstrong argues that the domestic power of women in this time was ironically symbolic of their powerlessness.
Austen merely hints at its existence. power is money36. in contemporary society. Greer illustrates the destructive effect girlpower can have (399). Sir William (196) and Maria Lucas (196) make her a figure to be reckoned with. young girls at school are invited to partake in excessive drinking and casual sex (399-402). Her “dictatorial and insolent” (Pride and Prejudice. and showed that. who is shown to be overbearing and manipulative. it appears to leave them vulnerable and helpless. Germaine Greer recently investigated a current phenomenon called ‘girlpower’. both being products of the distribution of power” (842). Instead of empowering women. states that “if an individual has high status. wealth [will] follow. 148 . Pointing out the consequences of such behaviour (unwanted pregnancy and venereal disease to mention but two). and shows an awareness that domestic power is a sham. although they usually overlap. Advocated and exploited by the media. 127) nature coupled with the awe she inspires from people like Collins (111). despite what especially younger women may believe. Lady Catherine de Bourgh. women (for the most part) are no longer under the illusion that domestic power is real power. She shows that this 36 The Social Science Encyclopedia (1996). edited by Adam Kuper and Jessica Kuper. While the issue of real power in the twenty-first century is overtly addressed by feminist writers.Chapter Four: Women and Identity The idea of what constitutes real power has changed considerably since the early nineteenth century. A feminist reading of Austen reveals a concern with what constitutes real power in her time. this type of power is not real power (1999:410411). Judith Lowder Newton believes that some of the women characters in Pride and Prejudice aspire to a kind of power which is “manipulative and indirect and [which] is further diminished by the fact that obsession makes them ineffective and unreflecting” (1981:130). and encouraged to match men in any lewd behaviour (409). Austen however illustrates that dictating people’s lives provides a false sense of power. Today. Mostly. provides a good example of a woman seeking such power.
For fear of how she might react Edward. 1984:85). The narrator seems critical of this type of ‘power’. Elinor describes her as “a very headstrong. her meanness. 149 . 273). is shown to ‘wear the breeches’ when she cleverly manipulates her husband into giving his stepmother and sisters. Austen once again seems to be critical of such manipulative ‘power’ when she portrays Mrs Ferrars as a “piece of nastiness” (Halperin. She manipulates Frank’s life by often feigning illness (195) and by expecting him to capitulate to her every whim (231. Fanny Dashwood. and she is shown to control her family with an iron fist. who plays the part of the wicked stepdaughter-in-law. 231). nothing at all (3-11). however. Austen indicates that Mrs Ferrars has no real power when she marries off both her sons to women with neither money nor connections (352-354). Because they realise their fortune depends “on the will of [their] mother” (13) their decisions are influenced by her approval. keeps his engagement to Lucy Steele a secret (129). for example. and when she has Elinor condemn “her pride. In Sense and Sensibility we encounter a seemingly powerful mother-and-daughter pair. Mrs Ferrars is the undisputed head of her family. Like her daughter. Mrs Churchill always gets her own way. She presides not only over her husband but also over her sons. We are told that she “was a capricious woman who governed her husband entirely” (14) and that Frank’s coming to Highbury always depended “entirely upon his aunt’s spirits and pleasure…upon her being willing to spare him” (94).Chapter Four: Women and Identity type of power can easily be destroyed in showing Lady Catherine helplessly standing by and watching as Darcy and Elizabeth are married (395). when Fanny is admonished for her narrow-mindedness and selfishness (3). In Emma. and her determined prejudice” (Sense and Sensibility. instead of three thousand pounds. proud woman” (142).
quieted. It could be argued that by showing how manipulation leads to powerlessness. Of all the inhabitants at Mansfield Park she is the only one who is not afraid of Sir Thomas (Mansfield Park. She is criticized for “her love of money…[and] her love of directing” (6). Manipulation is. Austen is implying that so-called ‘domestic power’ is not real power.Chapter Four: Women and Identity In the same way that Lady Catherine. the wit. 181). and the critical attitudes of Jane Austen. She is so skilled in twisting words and manipulating people that the Bertrams end up taking full responsibility for Fanny even though it was her idea in the first place (27-29). shown to contain no real power when Anne and Wentworth marry and the narrator concludes that Lady Russell. then. 25). indifferent to everything that passed” (452). Manipulating one’s family. her favourite niece. seems to bring less power. This suggests that Austen is interested in women’s true empowerment. and Elizabeth Bennet…is essentially an Austen fantasy. 169). a fantasy of power” (1981:133). Mrs Norris belongs to the same category of women as Lady Russell and Lady Catherine. She is shown to be formidable and is known “as a woman of the greatest influence with every body…able to persuade a person to any thing” (93). stupefied. 80. She is portrayed as cruel and scheming. Lady Russell controls Anne Elliot’s choice in marriage when she is young (Persuasion. To this end she appears to 150 . and especially enjoys making Fanny’s life miserable (74. runs away with Henry Crawford and leaves her “an altered creature. 108. while “suffering some pain…must learn to feel that she had been mistaken…and to take up a new set of opinions and of hopes” (219). and by contrasting this to real power such as Elizabeth’s. Judith Lowder Newton argues that “[r]eal power in Pride and Prejudice…involves having the intelligence. Mrs Norris seems to get her due reward when Maria. instead of more. however. Mrs Ferrars and Mrs Churchill run people’s lives.
The power to write thus enables Austen to contribute to women’s empowerment. 151 . In addition. not only because she suggests ways in which women may empower themselves but also because she identifies alternative identities for women.Chapter Four: Women and Identity encourage women to re-think and re-evaluate their inherited identity. Austen presents the reader with complex women characters who are given the power to judge and the power to refuse. including the notions of women as emotional creatures and as natural mothers.
Which of these views.Conclusion Conclusion Reaching the end of this thesis and looking back at what I have written. from where it is done” (1993:93). He points out that Austen’s novels have no one singular meaning but are open to a myriad of interpretations. does she address the issue of achieving equality with men?37 I am. the understanding of Austen’s fiction “depends on who does the interpreting. as a self-effacing good aunt. or as a nasty old maid. 37 152 . I ask myself to what extent we can categorise Austen as an early nineteenth-century feminist writer. I would like to refer to Edward Said’s understanding of interpreting texts. as Claudia Johnson shows: Austen has appeared to us in a number of contradictory guises – as a cameoist oblivious to her times. not the first to ask this question. in other words. indicates the ‘real’ Austen? In an attempt to answer this question. Shoshana Felman believes “reading has historically been a tool of revolutions and of liberation…a rather risky business whose outcome and full consequences can never be known in advance” (1993:5). Over the years there have been many conflicting interpretations of Austen. (1988:xiii-xiv) Sandra Gilbert and Susan Gubar write that when Austen was “not rejected as artificial and convention-bound. then. it is clear that I followed a Janet Chafetz states that “[t]he first wave of women’s movement in the nineteenth century was…a liberal feminist reform movement [which] sought equality within the existing social structure” (1999:151). of course. and no less important. as a subtly discriminating stylist. when it is done. To him. or a stern propagandist on behalf of a beleaguered ruling class. she was condemned as natural and therefore a writer almost in spite of herself” (1979:110). To what extent. or a homely songbird. unconscious of her art. Evaluating my own reading of Austen.
Alternatively. 153 . The fact that Austen does not overtly challenge patriarchy does not mean that we can discard her input in achieving an overall awareness of women’s subordinate position in patriarchal society. When we. much like Austen herself. while endeavouring to emphasise her feminist awareness. see that all Austen’s heroines get married. there are indications that the endings should not be taken seriously. for instance. to deal with as much of the evidence as possible…to read what is there or not there” (Said. If we merely reduce Austen’s work to tales about marriage without even considering that she had a socially critical agenda. 1988:xx) enables us to understand that Austen had to end her novels in the conventional way. For this reason literary critics have suggested that she might have hidden her social criticism behind the façade of endorsing marriage in patriarchal society. Austen’s novels reveal a consciousness of women’s powerlessness. I believe it to be the duty of literary and cultural critics and theorists to uncover and amplify this awareness. My argument takes into account the premise that we cannot separate a writer and the social system in which she/he lives. we should keep in mind that these women protagonists. ‘lived’ in an emphatically patriarchal society and that they realised the need to adhere at least to some of its conventions if they wanted to survive. and a sensitivity to the problems women writers encounter living and writing in a maledominated culture” (Johnson. 1993:96). I believe we fail to take “seriously our intellectual and interpretative vocation to make connections. No matter how compromised her politics may have been. or if we do not at least acknowledge that her novels create an awareness of women’s subordinate position in the late eighteenth/early nineteenth century.Conclusion gynocritical approach. The “consciousness of how the private is political.
and to men such as Erasmus Darwin who. As a result.Conclusion By looking at some of the issues which Austen’s fiction addresses. Possibly as a consequence of this legacy. and therefore not nearly as dependent 154 . then. These women. 1987:79). In Austen’s time. by considering what Austen’s novels reveal about women’s position in society in the early nineteenth century. Another part of women’s inheritance is the old and mistaken notion that women need men in order to survive. for example. one is made aware of the significant developments in gender politics between Austen’s time and our own. we are given insight into the legacy modern women have inherited. The idea. When Anne Elliot states the pen has always been in male hands she exposes history. Though contemporary women are often permanently employed. in his conduct books. can be traced back to the conduct books. that women should (often in addition to managing a full-time job) take responsibility for their home and for raising the children. realised the need to marry in order to survive financially. Austen’s novels show that women were deprived of an equal education to men and reveal that writing and producing knowledge was a male prerogative. women for many years believed that certain areas of expertise belonged to men exclusively. they often felt compelled to cultivate their ‘talents’ in the hope that they might find a husband. which “elaborate[d] all of the tasks that can be called domestic duty” (Armstrong. language and literature to have traditionally been male domains. “tried to think of a way of instilling in women the idea that their work was its own reward” (92). women were rendered financially and socially dependent on men by a biased economic and social system. Moreover. and by comparing them with the concerns of contemporary feminist scholars.
These discourses. which were made two centuries ago. a need for the type of labour women could provide. Her novels reveal male power to be enshrined in patriarchal institutions such as education and marriage.Conclusion on men’s financial support as they used to be38. Austen’s novels make us aware of the fact that women in her time had their identity prescribed for them. In order to appreciate the extent to which the feminist ideal has progressed. This differs vastly from contemporary feminists who demand that women take action. men were able to keep them submissive and powerless. These findings. and indicate that by enforcing marriage on women. 38 155 . I have mentioned that the conduct books afforded men the opportunity to keep women subjugated by creating an identity for women which would suit their (male) needs. increased control over fertility and heightened social expectations about women’s roles” (2000:499). they do not seem to suggest that any drastic measures should be taken. women’s work opportunities were increased after the Second World War as a result of higher educational achievement. Feminist writers have held social discourses responsible for coaxing women into marriage and motherhood. they often opt to marry. While Austen’s novels create an awareness of women’s pre-determined identity and subordination. In industrialised countries. Austen’s exploration of the effects of masculine power and authority suggests an inequality inherent in the society she was living in. in many ways foreshadow the work of French Marxist Louis Althusser who identifies in Ideology and Ideological State Apparatuses (1971) Lorraine Code reports that by 2000 “about 41 per cent of the world’s women aged fifteen and over [were] economically active. seem to have had their origins in the late eighteenth century. and then to explore some of current feminist theory’s suggestions for transformation. it would seem useful to take Austen’s feminist awareness as a starting point. which declare unmarried women to be failures. To begin with.
by continuing consolidation within education. has given rise to feminist literature: The assertion that women’s history has ignored the exercise of power is the precise opposite of reality. and…[were manifested] by the authority of recognizable cultural formations. “[o]ne of the significant roles of feminist theory has been to try to account for women’s subordination in society” (1993:52). women’s history might not have evolved. the church. Similarly. Sandi Cooper writes in an article entitled “Women and the World Order” (1999) that male power. indeed. largely male. I shall call this reality by its concept: the ideological State apparatuses” (1488-1489). this needs to be inferred from her novels. literature. the ways in which elites. In the past half dozen years. albeit destructive. but must not be confused with it. trade unionism. While she does not openly express any discontent with the fact that authority in patriarchal society resides ultimately in male persons. were it not for the way power has been exercised.Conclusion that ideological State apparatuses such as schools. (98) According to Jackie Stacey. bell hooks believes 39 Althusser states that “it is indispensable to take into account not only the distinction between State power and State apparatus. feminists today call for an explicit examination of the domination of women by men. the political system.39 Edward Said attributes the consolidation of an oppressive system like imperialism in part to the authority of such cultural institutions: …the processes of imperialism occurred beyond the level of economic laws and political decisions. the media and culture support existing (oppressive) social relations. and the visual and musical arts… (1993:12) Although Sandra Gilbert and Susan Gubar believe that Austen is aware “that male superiority is far more than a fiction” (1979:154). 156 . the family. the law. have controlled power and the discourse of rights and wrongs…have shaped a cottage industry of literature. but also another reality which is clearly on the side of the (repressive) State apparatus.
sexism and patriarchy.Conclusion feminists are “compelled to examine systems of domination and [women’s] role in their maintenance and perpetuation” (2000:27). male power. have to be transcended too in any full history of women or feminism. my emphasis) In addition to exposing patriarchal institutions for keeping women submissive in society. Sally Alexander argues emphatically that contemporary women need to do more than merely show that men have kept them subordinated: Since the seventeenth century feminists have railed against the tyranny of men. but those categories. One of the characteristics of feminist literature is. as Laura Marcus has stressed. while retaining a polemical conviction. male domination and in the idiom of the 1970s. Austen’s work seems to suggest some of the ways in which women can be empowered. “a critical awareness of women’s subordinate position …however this is expressed” (1992:11). (2000:26. 1992:37) and if patriarchy is to be understood as “a fundamental organisation of power on the basis of biological sex” (Weedon. Rosalind Miles writes that “the novel has been the only literary form in which 157 . as bell hooks notes: Feminism is a struggle to end sexist oppression. (1994:101) If power relations in society can be defined in terms of gender (Crowley and Himmelweit. I believe. as well as a commitment to reorganizing society so that the self-development of people can take precedence over imperialism. it becomes imperative for feminists to eliminate all forms of power. and material desires. 1987:127). economic expansion. Therefore. it is necessarily a struggle to eradicate the ideology of domination that permeates Western culture on various levels. The novel (the power of the pen) has provided women writers with a means of expressing desire for change.
my emphasis). Others such as Shoshana Felman argue that “feminism [should be] an enabling inspiration [and] not…a theoretical orthodoxy or…an authorizing new institutionalization” (1993:8). contemporary feminists expose the ways in which patriarchal practice encourages women to apply their power within man-made limits. bell hooks commented that the efforts of a group of white bourgeois women. who set out to obtain power. and only then can feminism hope to achieve an overall transformation of existing power relations. “had tremendous appeal for ruling groups of white males who were not threatened by women in feminist movement validating the status quo” (2000:86. my emphasis). Austen. In order to transform power relations in society. though it is necessarily a form of power to be used within patriarchal parameters. Judith Lowder Newton remarks that patriarchal society requires women “to lay aside any desire for the power to achieve. Only once women realise the ways in which they are kept from self-empowerment can they be liberated and empowered. Although Lowder Newton and hooks may have different political agendas. She is of the opinion that writers are able to inspire women by 158 . feminists encourage women to compete with men in male-dominated economic and political arenas. Recently. some feminists regard the abolition of marriage as necessary in achieving equal power relations in society. it would seem. and urge women to transcend patriarchal parameters. Heroines such as Fanny Price and Elinor Dashwood are given power. makes good use of the act of writing and of the novel as a genre when she empowers some of her women characters.Conclusion women have participated in numbers large enough to make their presence felt” (1987:2). Since motherhood and domestic responsibilities often keep women from competing with men and gaining economic equality. especially outside the domestic sphere” (1981:882. In contrast. both contribute to making women aware of how they unwittingly play into men’s hands.
if they want to attain self-empowerment. Austen seems to question women’s man-made identity by featuring. as when she shows that being a wife more often than not is tedious. she manages to suggest an alternative identity for women.Conclusion addressing them and that this in itself is an act of empowerment (127). as story” (Brink. instead of stereotyped women. Given that “we perceive ourselves. Judging by Austen’s novels. which is sometimes the case. bell hooks argues that “women need to know that they can reject the powerful’s definition of reality” (2000:92) so that they might be liberated from the debilitating social role in which men have entrapped them in. or indicates that motherhood does not necessarily provide a sense of fulfillment. heroines with complex identities. 159 . who display a variety of character traits. Another way of empowering women is to eradicate gender roles. and can develop alternative senses of themselves as women. it is imperative that women share their stories with other women. While Austen only hints at women discovering their own identity. our lives. as narrative. or the threat of it. By creating women protagonists such as Elizabeth Bennet and Emma Woodhouse. Austen seems to question certain assumptions about her own sex. many feminists typically provide one of two replies: either women are forced into it by violence. Jackie Stacey points out that feminist theory investigates the reasons for women’s acceptance of their man-made role in society: In answer to the question of why…women ‘accept’ their subordinate opposition in society. 1998:14). In addition. feminist writers today overtly challenge women’s socially-constructed identity in an attempt to empower them. women in the late eighteenth century had their identity prescribed (mostly by the notorious conduct book) as emotional creatures who could only find fulfillment as wives and mothers. At other times they were stereotyped by canonical texts as either angels or monsters.
In particular. for that matter. is Austen lacking? The answer is quite simple. and continue to do so. Irene Gedalof discusses how feminist theory can challenge the positioning of women in male discourses. Does Jane Austen qualify as a feminist? It would seem that she was aware of women’s position in society and that her novels expose masculine domination. Where. or whether they are going to question them and attempt to discover other ways of being and responding to one another. the readers who continue to read Austen and relate to her work.Conclusion but often is not. Two final questions need to be posed. This. she focuses on that feminist theory which offers positive redefinitions of models of women’s identity. then. for it is not Austen who is lacking in commitment. What I am suggesting is that the onus does not rest upon any particular writer to determine women’s future or fate. nor are contemporary feminist writers. however. 160 . is not enough to transform society. or women learn to accept their position through social conditioning and role models. It is now up to every woman to offer her contribution so that gender roles may be challenged and self-development may start. sociologists or theorists. It is ourselves. and asks how effective they have been in dealing with women’s dislocation and with questions of women’s embodiment (2000:339-340). (1993:65) Chris Weedon mentions that feminism rejects stereotyping of women and “questions the assumptions about women which social theories posit as true” (1987:6). They need to decide whether they are going to accept their sociallydictated gender roles. but upon women themselves. Jane Austen and others have done their part.
Feminisms: An Anthology of Literary Theory and Criticism. 161 . 1971. 1985. Louis. Jane. “Constructing the Subject: Deconstructing the Text”. Michielsens and M. C. London: Penguin. Pride and Prejudice. 1818. Deliyanni. Allen. M. London: Routledge. Jane Austen: Mansfield Park. London: Penguin. 1994. London: Penguin. M. 1988. 1972. 1992. Arnot. “Walking. Charlotte Brontë. Armstrong. I. 2000.. “Captivity and Cultural Capital in the English Novel. 1972. London: Virago. 1813. 1988. Desire and Domestic Fiction: A Political History of the Novel. Norton & Company. Rinehart and Winston. Reader. Belsey. M.Bibliography Bibliography Abrams. Ed. 1996. Changing Concepts of Citizenship in Public and Private Spheres”. A Glossary of Literary Terms. G. Sense and Sensibility. Orlando: Holt. 1994. Bowlby. London: Penguin. R. 1818. New York: Oxford University Press. 7. 1987. Araújo. Leitch. 1990. “Ideology and Ideological State Apparatuses”. 1814. Althusser. Northanger Abbey. 1997. The Norton Anthology of Theory and Criticism. Basingstoke: Macmillan.E. 2001.R. 1994.. The European Journal of Women’s Studies Vol. Persuasion. Armstrong. 1816. 1811. Women and Writing: Virginia Woolf as flâneuse. 1998. Evans. “Changing Femininity. The Concise Oxford Dictionary of Current English.H. London: Sage Publication. Ed. Penguin Critical Studies. Price-Herndl. Mansfield Park. and Ivinson. Armstrong.” New Feminist Discourses. K. I Married Him: A Study of the Women Characters of Jane Austen. Eds. Beer. 1974. V. Elizabeth Gaskell and George Eliot. H. New York: W. London: Penguin. 1994. P. S.W. Eds. London: Penguin. Austen. London: Macmillan. London: Penguin. Emma. R. Warhol and D. Becoming a Woman and Other Essays in 19th and 20th Century Feminist History. Alexander. Ed. R. N.B.” Novel: A Forum On Fiction Vol. 31. I. New York: Oxford University Press.
I. 1967. 1978. 1999. Cecil.. Ed. Ed. S. Winship. E.M. London: Harrap. London: Hutchinson. J. London: Cambridge University Press. Mort. New York: Kluwer Chow. A Portrait of Jane Austen. 1988. Ed. Handbook of the Sociology of Gender. Milton Keynes: Open University. S. 2000. J. Wilkinson. M. “Sex Roles and the Socialization Process”. F. “ ‘The Pen of the Contriver’: The Four Fictions of Northanger Abbey”. Hélène. B. and Himmelweit. Ed. Culverwell. W. Dahlström. J. New York: The Feminist Press at the City University of New York. Mort. S. Sellers. The Changing Roles of Men and Women. Smith. Jane Austen: Bicentenary Essays. and Weedon. Ed. Women’s Studies: An Interdisciplinary Journal Vol. M. T.Bibliography Brink. Brundson. and Baca Zinn. Calvino. 1999. 1992. D. R. C. Eds. The Novel: Language and Narrative from Cervantes to Calvino.. D. Burlin. Oxford: Clarendon Press. If on a Winter’s Night a Traveller. 1987. A. “Women and the World Order”. “Extreme Fidelity”. 1975. Encyclopedia of Feminist Theories. Class & Gender. Butler. M. Knowing Women. Eds. Bland. Academic/Plenum Publishers. “Psychoanalysis and the Cultural Acquisition of Sexuality and Subjectivity”. 1978. 1998. Writing Differences: Readings from the Seminar of Hélène Cixous. Crowley. Ed. Cixous. O. Burniston. “The More Things Change: The Rules and Late Eighteenth-Century Conduct Books for Women”. L. S. O’Rourke. Women’s Studies Quarterly Vol. 1930. R. Harrison. Brun-Gulbrandsen. 1993. London: Mandarin. Martin. California: SAGE Publications. Chafetz.R. London: Gerald Duckworth. J. McCabe. L. D. Halperin. 1984. Weedon and.E. A. Cooper. Newark: Harwood Academic Publishers. 29. C. Race. C. Women Take Issue: Aspects of Women’s Subordination. The Englishman and His Books in the Early Nineteenth Century. Ed. E. London: Penguin. S. xxvii. Cambridge: Polity Press. 2000. Zandy. 1996. Cape Town: University of Cape Town Press. 162 . Hobson. Cruse. Code. K. Darby. Jane Austen and the War of Ideas.S. London: Routledge. F. H.
S.com/films/sensible. Eds.” Introducing Women’s Studies: Feminist Theory and Practice. Cambridge: Blackwell. B. 1978.7. Language. Warhol and D. G. Richardson and V. Bouchard. M. The Routledge Critical Dictionary of Feminism and Postfeminism. Working with Feminist Criticism. 11. 1996. “Identity in Transit: Nomads. 163 .html De Lapp. R. Writing and Language: Making the Silences Speak. Ed. Michielsens and M. Marcus and A. Fair Lady 26 April 2000: 141.cnn. “Hollywood Popularizes Jane Austen”. New York: Cornell University. H. 1969. 1993.sten/index. 2000. Michel. Felman. Eagleton. London: Macmillan. Jane Austen’s Novels: The Art of Clarity. [online]. [online]. 1996. Feminisms: An Anthology of Literary Theory and Criticism.html Draga-Alexandru. M. R.R. I. M. Practice: Selected Essays and Interviews. 2000. What Does a Woman Want? London: The Johns Hopkins University Press. Gedalof. “Women. London: Macmillan. 1993. Robinson. Eds. 1999. D. Women: A Cultural Review Vol. The French Lieutenant’s Woman. Jane Austen and the State. Available from Internet URL htpp://newtimes. “Introduction: On the Politics of Literature”. Du Plessis. 7. New Haven: Yale University Press. London: Routledge. K. L. Eds. Mark. The European Journal of Women’s Studies Vol. Cyborgs and Women”. London: Sage Publications. Gard. Michielsens and M. S. Counter-Memory. 1996. M. J.rway.. S. Eds. D. London: Tavistock Publications. Fetterley. J. R. or Sex and Class as Culture”.Bibliography Dean. “Sweet Jane”.com/SHOWBIZ/Movies96. 1997. I Armstrong. 1987. The European Journal of Women’s Studies Vol. Evans.. Available from Internet URL http//www-cgi. “Quality Time”. Evans. Carr. 2000. 1992. 1977. Gagnier. London: Sage Publications. Evans. New York: Routledge. Eds. “The Functions of Class at the Present Time: Including Taste. Ed. M. Price Herndl. Gamble. Fowles. “Exiles From Power: Marginality and the Female Self in Postcommunist and Postcolonial Spaces”. Frith. Basingstoke: Macmillan.F. Foucault.
1988. 1980. and Deviance as Discourses of Voluntary Childlessness”. 23.” New Feminist Discourses. Irigaray.M. Class. Horwitz. The Life of Jane Austen. Ed. M. Richardson and V. L. 1994. Chicago: University of Chicago Press. [Online]. G. 2000. Eds. Cambridge: South End Press. “Pride and Prejudice”. “When No Means No: Disbelief. F. “From The Woman Question in Technology to the Technology Question in Feminism: Rethinking Gender Equality in IT Education”. Speculum of the Other Woman. Fair Lady 25 April 2001: 64-66. 1992. 1979. Luce.best. Jane Austen: Women Politics and the Novel. B. and Gubar. Harlow. Sussex: The Harvester Press. D. The Madwoman in the Attic: The Woman Writer and the 19th Century Literary Imagination. Kaplan. “When mothers lose that loving feeling”. Evans. Halperin.R. Basingstoke: Macmillan.nzoj/pride. London: Anchor. S. Available from Internet URL.. S. C. London: Routledge. 1999. D. Eds.” Introducing Women’s Studies: Feminist Theory and Practice. The Whole Woman.. Multiculturalism and Media Culture”. Greer. New York: Cornell University. I. “Women and the Family. J. Women’s Studies International Forum Vol.html Henwood. Gillespie. Warhol and D. London: Sage Publications. “Love. California: SAGE Publications. Feminist Theory: From Margin to Center. 2000. C. Kanneh. Zmroczek. R. 1993. Michielsens and M. hooks.16. New York: Pergamon. D.” Persuasions No. Robinson.Bibliography Gilbert. “Pandora’s Box: Subjectivity. Narcissistic Narrative: The Metafictional Paradox. D. 1984. b. Jackson. Johnson. London: Macmillan. C. Eds. S. Hutton. The European Journal of Women’s Studies Vol. Disregard. Ed. 1997. 164 . “Cultural Studies. New Haven: Yale UP. K. Armstrong. 1985. 2000. Eds. Humez. 7. Dines and J.L. London: Methuen.M. Gender. and Sexuality in Socialist Feminist Criticism. 1995. “Women’s Education During the Regency: Jane Austen’s Quiet Rebellion. Hutcheon. Price Herndl. Kellner. Mourning and Metaphor: Terms of Identity. G. R. 1974.com/~donh/Esperanto/Lite.” Feminisms: An Anthology of Literary Theory and Criticism. Race and Class in Media.
“Women. Eds. Feminisms: An Anthology of Literary Theory and Criticism. D. 165 . McFadden.” Critical Reconstructions: The Relationship of Fiction and Life. “Balancing Gender in Higher Education: A Study of the Experience of Senior Women in a ‘New’ UK University”. C. Stanford: Stanford University Press. Eds. 1939.B. 1992. 1997. and Spender. 1981. Halperin. London: Routledge. 2000. “‘Because Men Made the Laws’: The Fallen Woman and the Woman Poet”. 7. Victorian Feminism: 1850-1900. Tallahassee: The Florida State Lowder Newton. I. Second Edition. J. Kuper. Kroeber. P. Eds. and Kuper.M. Polhemus and R. 1966. Thousand Oaks: Sage Periodical Press. 1981. Henkle. Gender & Society Vol. Price Herndl. and Manfredi. Jane Austen: Bicentenary Essays. Paris: Editions du Seuil. R. New York: Routledge. “Power and Ideology of ‘Woman’s Sphere’”. Lacan. Eds. A. Ledwith. 1997. Jane Austen and her Art. S. L.14. Jacques. London: Oxford UP. Bose. A. Clark. Ed.” New Feminist Discourses. The Social Science Encyclopedia. Marcus. Ed. University. Lascelles. S. 1996. D. C. K.Bibliography Kramarae. M. J. M. New Case Books: Sense and Sensibility and Pride and Prejudice. J. Routledge International Encyclopedia of Women: Global Women’s Issues and Knowledge. “The Whore and the Other: Israeli Images of Female Immigrants from the former USSR”. Michielsens and M.R. Evans. R. R. I. Ed. 1975. McMaster. 1994. New Feminist Discourses. Levine.E. Power and Subversion”. 2000. Ed. 1992. Armstrong. London: Routledge. Ed. Warhol and D. 2000. New York: St Martin’s. London: Routledge. Basingstoke: Macmillan. Leighton. J. 1987. London: Cambridge University Press. London: Sage Publications. 1994. Ready Reference: Women’s Issues. M. “Pride and Prejudice: Fiction’s Lasting Novelty”. Ecrits. Pasadena: Salem Press. “Emma Watson: Jane Austen’s Uncompleted Heroine. Lemish. Ed. The European Journal of Women’s Studies Vol. Armstrong. Eds. “Feminist Aesthetics and the New Realism.
Nicholson. “Why Have There Been No Great Women Artists?” Theorizing Feminism: Parallel Trends in the Humanities and Social Sciences.J. Schmittroth. London: Croom Helm. Sexual/Textual Politics: Feminist Literary Theory. 1988. Clark. R. Moi. Nochlin. 1993. Robinson. New York: Vintage Books. 1992. Eds. Feminist Theories and the Philosophies of Man. L. Culture and Imperialism. Moore. I. “‘Drim Dros’: Marginalised Women both Inside and Outside of the Academia”. Eds. Rutherford. D. 1981.S. Eds. Encyclopedia of the Novel. D.Bibliography Meyer. Zmroczek. 1997. J. London: Routledge. Stewart. 1983. 1998. Nye. Sense and Sensibility and Pride and Prejudice. Ed. Murray. Mark. 1994. Herrmann and A. L. London: Routledge. E. 23. Swets & Zweitlinger. Beggar on a Beach of Gold. Carr. C. The Female Form: Women Writers and the Conquest of the Novel. S. Miles. Said. Marcus and A. R. Produced by Christopher Neil. 2000. 1987. “Motherhood and Women’s Lives”. 1995. 2000. 1985. and Reilly McCall. 1993. A. “Another Cup of Coffee”. Newman. “An Other Space: A Future for Feminism?” New Feminist Discourses. Rushdie. London: Routledge. Chicago: Fitzroy Dearborn Publishers. L. P. 1998. I. Schellinger. Ed. R. English Studies: A Journal of English Language and Literature 79:3. Introducing Women’s Studies: Feminist Theory and Practice. New York: Pergamon. Armstrong. 166 . Martin’s Press. London: Routledge. Eds. London: Vintage. Women’s Studies International Forum Vol. P. M. Ed. Mike. Blom. S. 11. Ed. London: Macmillan. Boulder: Westview Press. H. 2000. “‘Deeds and Words’: The Woman’s Press and the Politics of Print”. “Mr Knightley’s Education: Parallels in Emma”. Midnight’s Children. Richardson and V. A. Ed. Armstrong. Reay. J. “Can this Marriage be Saved: Jane Austen makes Sense of an Ending”. T. 1994. Women’s Almanac. Gale: UXL. Women: A Cultural Review Vol. K. New York: St.
Westport: Greenwood Press. Women’s Studies Encyclopedia. Richardson and V. T. R. The Victorian Novel: Modern Essays in Criticism. Eds. 1989. “The Unsettling Subject of Violence in Women’s Lives: Encouraging Notes from the Classroom Front”. Belsey and J. G. London: Macmillan. New York: The Feminist Press at The City University of New York. Mark. 1989. Oxford: Blackwell Publishers. H. Basingstoke: Macmillan. Feminist Practice and Poststructuralist Theory. Stacey. 1985. Weedon. R. PriceHerndl. Moore.” Eighteenth Century Fiction Vol. The Feminist Reader: Essays in Gender and the Politics of Literary Criticism. C. G. “Sweeping Changes”. Watt. Tanner. Carr. 1997. A Literature of Their Own: British Women Novelists from Brontë to Lessing. Marcus and A. 167 . 1999. Thorp. Eds. Feminine Fictions: Revisiting the Postmodern. Eds. 1993. J. I. University Press. “‘I See Every Thing As You Desire Me to Do’: The Scolding and Schooling of Marianne Dashwood. Seeber. New York: John Wiley & Sons. London: Macmillan. London: Methuen. “Laughing Medusa: Feminist Intellectuals at the Millennium”.Bibliography Schulman. B. Ed. Robinson. Tierney. Armstrong. Eds.R. London: Macmillan. 1971. Ed. Unger. Zandy. London: Routledge. 2001. Metafiction: The Theory and Practice of Self-Conscious Fiction. Women’s Studies Quarterly Vol. Princeton: Princeton University. Warhol and D. Ed. 11.K. J. Handbook of the Psychology of Women and Gender. 1986. Feminisms: An Anthology of Literary Theory and Criticism. 2000. Jane Austen. 1984. 1999. C. “Three Women’s Texts and a Critique of Imperialism”. 1987. Spender. “Women and Literary History”. Women: A Cultural Review Vol.” Introducing Women’s Studies: Feminist Theory and Practice. 11. Showalter. 1999. C. London: Oxford Waugh. I. 2001. Spivak. London: Routledge. P. xxvii. D. B.K. “Untangling Feminist Theory. H. E. L. Fair Lady 25 April 2001:58-59. 1977. D.
Tomaselli.K. 2000. Ed.E. M. S. “The Lived Body Experience of Domestic Violence Survivors: An Interrogation of Female Identity”.1797. “‘Me Mother’s Bank and Me Nanan’s. P.. You Know. Women’s Studies International Forum Vol.T. Ed. Cambridge: Cambridge University Press. Alison. 23. Support!’: Women who Left Domestic Violence in England and Issues of Informal Support”. Ed. 2001. Encyclopedia of Women and Gender: Sex Similarities and Differences and the Impact of Society on Gender. New York: Pergamon. Zmroczek. Zmroczek. 168 . Wollstonecraft. J. 1995.Bibliography Wesely. 23. J. A Vindication of the Rights of Men and a Vindication of the Rights of Woman. New York: Pergamon. 1759 . I. and Schneider. 2000. Women’s Studies International Forum Vol. Wilcox. San Diego: Academic Press. C. C. Mary. Ed. Worell. | https://www.scribd.com/document/190295904/Kollmann-e | CC-MAIN-2017-47 | en | refinedweb |
- Portable Asphalt Plant For Sale | Mobile Asphalt Plant
small asphalt plant of capacity 20 30 tph for sale. mobile asphalt plant gives consistent production. fast installation and setup for quick hot mix production
- Portable Asphalt Mixing Plant Atlas Industries
portable asphalt drum mix plant many customers have seen tempting advertisements of portable asphalt plants for sale and mobile asphalt drum mix plant
- Technical Parameters Of Qlb Mobile Asphalt Mixing Plant
asphalt drum mixing plant; mobile asphalt mixing plant .. main structure of qlb mobile asphalt mixing plant .. mobile asphalt plant, asphalt hot mix plant,
- Used Asphalt Plants For Sale. Vögele Equipment & More
search 637 listings for used asphalt plants. find vögele, dynapack, a, xuetao, bitelli, abg, a, bomag, a, a for sale on machinio.
- Mobile Asphalt Plant | Asphalt Mixing Plant Manufacturer
atlas has one concrete solution for customers who are looking for quality mobile asphalt plant for sale .. hot mix plant to its fullest. by mobile drum mix
- Mobile Asphalt Drum Mix Plant Atlas Industries
atlas industries is a provider of mobile asphalt drum mix plant which is available in mobile asphalt plants in the mini hot mix plant is
- Machinerytrader | Asphalt / Pavers / Concrete
peru uruguay adm asphalt / pavers / concrete equipment for sale. number of matches 11 adm spl 30 portable asphalt drum mix plant,
- Speedcrafts Road Maintenance Machines, Road
speedcrafts limited, patna pothole repairing machine, mechanical broom, mobile hot mix plant, asphalt drum mixing plants
- Stansteel
full service manufacturers of hot mix asphalt plants. supplies and provides parts, components, and service for a wide range of permanent and mobile requirements. site
- Asphalt Drum Mix Plant Supplier, Hot Asphalt Drum Mix
asphalt drum mix plant manufacturer in china. supplier of mobile asphalt drum mix plant, drum mix asphalt plant. high quality and good price.
- Asphalt Plants. Batch & Drum Mix | A Plant
hot mix storage; bitumen a plant's range of batch and drum mix asphalt plants can meet the super roadmix fulfils all the requirements of a truly mobile
- Asphalt Plant For Kazakhstan Market Asphalt Mixing Plant
feb 26, 2014· plant /mobile hot asphalt drum mixing plant mix asphalt plant; panama, ecuador, peru, asphalt batching plant for sale in china hot
- Asphalt Drum Mix Plants Supply Supplier, Find Best Asphalt
find best asphalt drum mix plants supply dhb40 hot asphalt plant, mobile asphalt drum mix a rd175x 175tph stationary asphalt drum mix plant for sale
- Cap40 Continuous Asphalt Mixing Plant 40t/h Asphalt
cap40 continuous asphalt plant for slb8 small mobile asphalt cap40 asphalt plant in peru a group our 2015 hot sale mobile asphalt drum mix plant,cap40
- High Quality Asphalt Plant As Per American Standers
mobile hot mix plant; self loading concrete mixer; asphalt plant (american specs) new generation drum mix asphalt plants
- Asphalt Plant Drum Mixer For Sale & Rental New &
asphalt plant drum mixer for sale & rental | rock & dirt. search from 1000's of listings for new & used drum mixers for sale or rental updated daily from 100's of
- Heavy Construction Equipment Of Mobile Asphalt
hot mix plant mini asphalt plant mobile asphalt peru | gulin solutions. asphalt plant for sale, asphalt mixing plant,mobile asphalt plant,asphalt drum mix.
- Professional Manufacture Lb800 Small Asphalt Mixing Plant
peru asphalt mixing plant asphalt drum mix plant asphalt mixing plant exporter in peru, cusco, projects hzs25 mobile concrete batching plant for sale.
- Portable Asphalt Drum Mix Plant Supplier, Find Best
find best portable asphalt drum mix plant supplier on asphalt drum mix plant also searched mobile asphalt plant,hot mix asphalt plant for sale.
- Rsl Mobile Asphalt Recycling Plant
rsl mobile asphalt recycling plant mobile asphalt drum mix developed the hot mix asphalt recycler range and have plants, asphalt plant for sale,
- Speedcrafts Limited Asphalt Mixing Plants And Other
speedcrafts limited indias leading manufacturer & exporter of asphalt mixing plants, drum mix plant, asphalt batch mix plants, hot mix plants, bitumen sprayers, etc.
- Supply Mobile Asphalt Plant Rock Crusher Equipment
thus the name hot mix asphalt with the remaining 1,300 are drum mix plants. the asphalt pavement xsm mobile asphalt crushing plant for sale can be
- Manufacturers Of Continuous And Batch Process Hot A
a manufacturer of hot mix asphalt plants.
- Concrete Mixing Plants Irsil.org
asphalt plants, hot mix plants, supplier of mobile asphalt plant, asphalt drum mix plant. best concrete & asphalt plant for sale.
- Portable Asphalt Recycling Plant For Sale
portable asphalt recycling plant for sale .. a model pvm 10 portable drum mix plant .. asphalt plant for sale | mobile portable mix
- Used Portable Asphalt Plants For Sale
used portable asphalt plants for sale supplier of mobile asphalt plant, asphalt drum mix plant .. asphalt drum mix plant | hot mix asphalt plant
- Efficient Asphalt Mixing Plant Road Machine In Kazakhstan
asphalt drum mix plant india, hot mix plant vinayak equipments is peru , chile, india an efficient high quality mixing plant hot sale ready mobile plant
- Mobile Asphalt Plant For Sale In Pakistan
asphalt drum mix plant | hot mix asphalt algeria, peru, indonesia,pakistan xsm mobile asphalt hot sale appunti al volo mobile asphalt plant for sale in
- Bitumen Hot Mix Plant For Sale In Eritrea
bitumen hot mix plant for sale in addis ababa qlb20 mobile asphalt mixing plant hot sale us .. drum mix plant, hot mix plant hot mix asphalt mixing plant
- Statistical Process Control In Asphalt Plant | Mining
4.19 statistical techniques 4.20 verification of asphalt drum mix plant statistical process control in asphalt plant peru 100 tph river stone mobile
- Asphalt Plant Cost In Guinea Bissau
hot mix asphalt for county roads used asphalt plants for sale. your session mobile asphalt mix plant and mobile asphalt drum mix plant from india. we
- Mobile Asphalt Plant For Sale In Pakistan Rrcser.in
mobile asphalt plant for sale in pakistan hot sale panama, papua new guinea, paraguay, peru, philippines, pitcairn, drum mix asphalt plant for sale
- Asphalt Plant Parts Wilsonswharf.co.za
asphalt plants. batch & drum mix kazakhstan, egypt, asphalt plants peru etc a 240t/h asphalt mobile batch plant. hot sale 20m3/h small concrete mixing
- Lb2500 Asphalt Mixing Plant 200t/h In India
batch mix asphalt plants, asphalt drum mix plant for sale hot selling, we supply asphalt drum mix plant drum mix plant. slb mobile asphalt
- Asphalt Mixing Plant Manufacturer
asphalt drum mixing plant, mobile asphalt asphalt hot mix plant for sale; small mobile concrete batch plant for sale; a xap160 asphalt mixing plant asphalt
- Batching Mixing Asphalt Station Structure With High
mixed concrete batching plant in the peru; plant from 80tph mobile hot mix asphalt batching mixing plant h drum asphalt mixing plant dhb60 for sale
- Go Aggregates Asphalt Plant Co Philippines Evam.co.in
buy hot asphalt drum mix plant hot brazil , philippines , indonesia mobile asphalt drum mix plant brand continuous asphalt mixing plant for sale chinese
- Factory Directly Sell Asphalt Blending Plant In Mongolia
view 80tph hot mix mobile asphalt plant for road construction asphalt drum mix plant. we manufacture asphalt plant a asphalt plant lb800 64tph hot sale
- Hsr Concrete Mixing Plant For Sale In Republic Of Poland
concrete batching plant, hot sale ready concrete mixing plant hzs60 provider of asphalt drum mix plant mobile asphalt mixing norway; panama; peru .
- Lb1000/2000 Asphalt Batch Mix Plant Asphalt Mixing Plant
lb2000 hot mix asphalt batching plant for. lb2000 hot mix asphalt batching plant for sale, peru ce eveirmential asphalt mixing plant lb1000 asphalt drum mix.
- Machinerytrader | Asphalt / Pavers / Concrete
peru uruguay erie strayer asphalt / pavers / concrete equipment for sale. number of matches 5 mobile gravity central mix plant
- Asphalt Recycling Equipment For Sale 13 Listings
we have 13 asphalt recycling equipment for sale .. 2005 bomag mp1300 milling machine. 52 drum, folding 2003 marathon tra rem asphalt/hot oil trailer
- Asphalt Plant Component For Sale & Rental New &
asphalt plant component for sale & rental | rock & dirt. search from 1000's of listings for new & used asphalt plant components for sale or rental updated daily from
- Asphalt / Pavers / Concrete Equipment For Sale
post a free for sale listing .. this a as4252c 8ft expandable asphalt screed is unused mobile concrete batching plant twin shaft mixer cap. 2.25m3
- Cost Of 80 To 100 Tph Hot Mix Plant In India
cost of 80 to 100 tph hot mix plant in india. hot mix posted at 8 39 in news by sme machinery asphalt drum mix plants mobile crusher for sale.
- Hot Sale Good Quality Simple Concrete Mixing Plant
mixing plant,asphalt mixing plant,bitumen hot mix plant batching plant hot sale used mobile plant plant machinery with js1000 hot sale drum mix
- Concrete Plants | A Roadbuilding
asphalt plants. counter flow drum range of dry and wet mix concrete plants from 4 yd highly in high production mobile concrete batch plants for the
- Saudi Aramco Buy Asphalt Plant 3 Ton Construction
saudi aramco buy asphalt plant 3 ton pollution control unit, wet mix plant, drum mix mobile plant, line of continuous and batch process hot mix asphalt
- Used Concrete Batching Plant On Sale | Mobile Concrete
used concrete batching plant on sale mobile and portable ready mix plants; used concrete batching plant asphalt plant.
- Iran Asphalt Plant, Iranian Asphalt Plant Manufacturers
manufacturing no. of employees 51 100 tags hot mix asphalt plant mobile asphalt plant portable asphalt plant spl110. refurbished asphalt drum mi
- China Batch Asphalt Plant Suppliers, Batch Asphalt Plant
import china batch asphalt plant from various high quality chinese batch asphalt plant suppliers asphalt hot mix plant drum mobile asphalt mixing plant.
- Self Erecting Storage Silos | A Roadbuilding
asphalt plants. counter flow drum mixers. e3 rap star series all a self erecting hot mix storage systems come complete with all necessary lifting and
- Asphalt Mixing Plant,china Asphalt Mixing Plant
hot sale qlb40 mobile asphalt mixing plant specifications asphalt hot mix plant 1.productivity 160t/h 2 integrated design of drying drum and
- Asphalt Pavers For Sale 359 Listings Page 4 Of 15
we have 359 asphalt pavers for sale .. complete 250 tph cedarapids semi portable asphalt plant price used parallel flow 8828 cedarapids drum and baghouse.
- Mixing Plant Importers & Mixing Plant Buyers Tradekey
instantly connect with verified mixing plant buyers & mixing plant importers from mobile hot mix plant hot mix plant mobile| asphalt drum mix plant
- Used Concrete Batching Plant For Sale In India Codep
used concrete batching plant for sale in high quality hzs25 concrete batching plant for sale · mobile batching plants for sale, . click used ready mix | http://www.aboutastrology.co.in/china_made/32242/mobile-hot-asphalt-drum-mix-plant-for-sale-in-peru-cusco.html | CC-MAIN-2017-47 | en | refinedweb |
Hosting Remote Objects in Internet Information Services (IIS)
This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the Windows Communication Foundation (WCF).
To host a remote object in Internet Information Services (IIS) you must configure the remote object. Normally this is done either within a configuration file or programmatically within the hosting application code. When a remote object is hosted within IIS you can either place the configuration information a Web.config file or you can programmatically configure the remote object in the Application_Start method in the Global.asax file.
To use a configuration file to configure a remote object, do the following:
Place your configuration information in the Web.config file in the IIS virtual directory that you have chosen to use.
Place your remotable type implementation in the \bin directory (or use the Global Assembly Cache tool (Gacutil.exe) to place it in the global assembly cache).
When specifying a Web.config file, the following are not supported:
Specifying an application name, the name of the virtual directory becomes your application name.
Using the <debug> element in a Web.config file that is used for .NET remoting configuration.
Using any channel other than the HttpChannel.
Use the Web.config file and the <client> element to configure your client Web application automatically. If you want to use IIS as a remoting client, you must call RemotingConfiguration.Configure in the Application_Start method in the Global.asax file.
The Web.config file still contains the basic information about your type that the system must know, but some declarations must change slightly to accommodate the hosting environment. For example, you can custom configure a particular HttpChannel, but you should not specify a port for the channel; should ASP.NET create another application domain to handle the load, the remoting configuration causes that new application domain to try to listen on the same port again, raising an exception. For example, a Web.config file for an IIS-hosted .NET remote object might look like the following code example. It is not necessary to include the channel configuration lines in this case, except to set the channel properties (in this case, the
priority property).
<configuration> <system.runtime.remoting> <application> <service> <wellknown mode="Singleton" type="ServiceClass, ServiceClassAssemblyName" objectUri="ServiceClass.rem" /> </service> <channels> <channel name="MyChannel" priority="100" ref="http" /> </channels> </application> </system.runtime.remoting> </configuration>
To successfully host server-activated (that is, <wellknown>) objects inside IIS, you must have an object Uniform Resource Identifier (URI) that ends in .rem or .soap. There is no such requirement for other host application domains. To use the Soapsuds tool (Soapsuds.exe) to generate metadata for a server-activated object hosted in IIS, the URL to pass as an argument to Soapsuds.exe is as follows:
http://< Computer >:< Port >/< VirtDir >/< ObjectURI >?wsdl
For client-activated objects hosted in IIS or any other application domain, you do not need an object URI of any form. The URL to pass as an argument to Soapsuds.exe is as follows:
http://< Computer >:< Port >/< VirtDir >/RemoteApplicationMetadata.rem?wsdl
Programmatic configuration in IIS is done using the Global.asax page. The following example shows the same configuration as the previously shown configuration file, but uses the Global.asax file.
<%@ Application Language="VB" %> <%@ Assembly Name="Server" %> <%@ Import Namespace="System.Runtime.Remoting" %> <%@ Import Namespace="System.Runtime.Remoting.Channels" %> <%@ Import Namespace="System.Runtime.Remoting.Channels.Http" %> <%@ Import Namespace="Server" %> Sub Application_Start() Dim props = New Hashtable() As IDictionary props("name") = "MyChannel" props("priority") = "100" ' Nothing entries specify the default formatters. Dim channel As New HttpChannel( _ props, _ Nothing, _ Nothing _ ) ChannelServices.RegisterChannel(channel) Dim WKSTE As New WellKnownServiceTypeEntry( _ GetType(ServiceClass), _ "HttpService", _ WellKnownObjectMode.SingleCall ) RemotingConfiguration.RegisterWellKnownServiceType(WKSTE) End Sub <%@ Application Language="C#" %> <%@ Assembly Name="Server" %> <%@ Import Namespace="System.Runtime.Remoting" %> <%@ Import Namespace="System.Runtime.Remoting.Channels" %> <%@ Import Namespace="System.Runtime.Remoting.Channels.Http" %> <%@ Import Namespace="Server" %> void Application_Start(){ IDictionary props = new Hashtable(); props["name"] = "MyChannel"; props["priority"] = "100"; // Null entries specify the default formatters. HttpChannel channel = new HttpChannel( props, null, null ); ChannelServices.RegisterChannel(channel); WellKnownServiceTypeEntry WKSTE = new WellKnownServiceTypeEntry( typeof(ServiceClass), "HttpService", WellKnownObjectMode.SingleCall ); RemotingConfiguration.RegisterWellKnownServiceType(WKSTE); }
The following entries must be placed in the Web.config file to make sure the required assemblies are referenced:
For a complete example, see Remoting Example: Hosting in Internet Information Services (IIS).
Using SSL Certificates with .NET Remoting
Certificates identify a particular computer, the name of which resides in the common name of the certificate. However, it is easy to change the name of a computer or use "localhost" in client configuration files, which creates a mismatch between the client and the common name in the server certificate. In the .NET Framework version 1.0, this mismatch is ignored and the call is invoked on the server.
Starting with .NET Framework version 1.1, this mismatch throws the following exception: "System.Net.WebException: The underlying connection was closed: Could not establish trust relationship with remote server." If you are unable to configure the remoting client to use the certificate common name, you can override the mismatch using the following settings in your client application configuration file:
To make your client overlook the certificate name mismatch programmatically, the client must create an instance of a class that implements the ICertificatePolicy interface and implements the CheckValidationResult to return true if the certificateProblem value is 0x800c010f. You must then register the object with the System.Net.ServicePointManager object by passing the object to the ServicePointManager.CertificatePolicy property. The following code is a basic implementation:
Public Class MyPolicy Implements ICertificatePolicy Public Function CheckValidationResult(srvPoint As ServicePoint, certificate As X509Certificate, request As WebRequest, certificateProblem As Integer) As Boolean ' Check for policy common name mismatch. If certificateProblem = 0 Or certificateProblem = &H800b010f Then Return True Else Return False EndIf End Function End Class public class MyPolicy : ICertificatePolicy { public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { // Check for policy common name mismatch. if (certificateProblem == 0 || certificateProblem == 0x800b010f) return true; else return false; } }
The following code registers an instance of the preceding class with the System.Net ServicePointManager:
Authentication in IIS-hosted Remoting Applications
The following table describes the configuration settings that enable certain types of authentication behavior in .NET remoting when hosting your service in Internet Information Services (IIS). | https://msdn.microsoft.com/en-us/library/y0hedwet(v=vs.85).aspx | CC-MAIN-2017-47 | en | refinedweb |
Python vs Parrot.
Example
A simple example, incrementing
a in Python:
LOAD_FAST a LOAD_CONST 1 BINARY_ADD STORE_FAST a
And in Parrot:
find_lex P1, a add P1, P1, 1
The first difference you may notice is that Python is stack
based, and Parrot is register based; but the difference I want to
focus on is the add operation itself. In Python, the
BINARY_ADD operation is generic and can handle everything from
integers to floating point to strings. For this to work, the
numeric
1 must first be converted to an object (a
process often referred to as boxing) pushed on the stack.
BINARY_ADD will then pull two objects off of the stack, unboxing as
appropriate, do the appropriate operation, box up the results, and
then push it back on the stack.
In Parrot, the boxing and unboxing is deferred... there is a separate and unique opcode for adding an integer to an object (a.k.a. PMC). This is in addition to opcodes that add floating point numbers to an object, adding an integer to an integer, an object to an object, etc. This requires more special cases to be handled, but the payoff is that with this additional development work, runtime work can be eliminated. In this case, all of the boxing and unboxing can be avoided.
In absolute terms, boxing and unboxing is not very expensive. But in relative terms (and in this case, what it is to be compared against is simple integer addition), it can be very significant.
With the way Parrot is structured, much of the development
overhead can be eliminated. Not every object class that
wishes to provide an add operator needs to implement an
add_int method. By using a common base class, a
generic
add_int method can be provided that boxes up
the int and calls a single
add method designed to work
on objects. Such a technique allows subclasses for which
add_int is a common enough operation worthy of
optimization to do so directly, without burdening all other
subclasses with the need to do so.
Goals
The first goal of a Python on Parrot implementation needs to be fidelity to CPython implementation. Otherwise, you are simply implementing a Python-like language on top of another runtime. Such a language would not be able to make use of the full range of existing Python libraries and scripts.
However, that goal, by itself, is insufficient. There already is a CPython implementation. Potential secondary goals include better performance and better integration with other languages. Both of those goals ultimately require some trade-offs to be made with respect to the first goal.
Most of the performance trade-offs can be made without compromise to functionality. Best cases are when common scenarios are made significantly faster at an marginal expense to less common scenarios.
The integration scenarios are trickier. Perl's integer divide has different semantics than Python's, particularly for negative numbers. What does dividing a Perl integer by a Python integer mean? If two Perl integers are passed to a Python function which attempts to divide them, what should be done?
The same operation that does a binary arithmetic also does string concatenation in Python.
These are admittedly edge cases. But such edge cases
abound. Python has a
dict as a fundamental data
type. Perl has a
hash. Keys of Python
dictionaries can be any immutable value. Keys of Perl5 hashes
can only be strings. More significantly is the impact of
Duck
Typing. If somebody passes a Perl hash to a Python
function, the Python function expects there to be a
fair number
of methods at its disposal. How much of this can be
papered over, and how much of this will show through is still a
research topic at the moment.
Fundamentals
To date, I've found a number of areas that are more fundamentally different between Python and Parrot than any of the examples above. The two implementations of Python on Parrot that I have looked at, namely pie-thon and pirate, approach these differently.
The first deals with the extent of the Python canonicalization mentioned above. In Parrot, instances may have properties, methods, and attributes. In Python, there are only attributes. This is possible as functions, methods, and even classes are also objects in Python, so each are possible values for a given attribute.
In the pie-thon implementation of Python on Parrot, all methods are attributes. In Pirate, all methods are properties. The implication being that from the perspective of a language like Perl, such Python objects will have no methods defined.
This can be dealt with by implementing a
find_method method in PyClass that searches first the
set of methods, and then the attributes/properties.
More troublesome is the issue of naming. In Parrot, the presumption is that all subroutines and classes are globally named. In Python, such names are lexically scoped. It is quite legal to have multiple methods in the same scope with the same name, in fact, the syntax to define a class in Python really only creates an anonymous class object and assigns it to a (lexically scoped) variable. The only names that are global in Python are module names. Modules in Python are used to address much the same types of problems that namespaces do in Parrot, but again, are fundamentally different.
Here's an example that can't be handled by pie-thon currently:
def f(x): class c: def m(SELF): return 0 if x<0: class c: def m(SELF): return -1 if x>0: class c: def m(SELF): return +1 return c() print f(7).m(), f(0).m(), f(-7).m()
But even that can be largely masked by clever compilers. Pirate addresses this with a bit of name mangling.
A difference that can't be masked at all is a difference that
isn't there. In Python there is no vocabulary for "new-ing"
up an instance of a class. Instead, the
__call__
method on the class is expected to act like a factory. Non
python libraries will either be required to mimic this behavior, or
an alternate syntax (perhaps a
Parrot module which
exports a
new function) will need to be provided.
Status and Plans
Michal Wallace has given me commit access to Pirate, and I've made a number of small fixes. But mostly, I've been holding back until I can get a new set of python specific classes implemented and committed.
Leopold Tötsch has been committing (most of) my patches to Parrot, and now I am ready to have a largish one committed. It is mostly new Python specific dynclass sources, with some small mods to the system to make it work. Once that is committed, I'll update Pirate, and both will once again pass all defined tests.
At that point, I plan to do two activities. One is to refactor as much of the existing logic in Pirate into Parrot dynclasses as possible. The other is to expand the test suite and use that to drive the addition of new functionality. Two sources of tests will be the parrotbench and the CPython unit test suite. | http://www.intertwingly.net/blog/2004/11/09/Python-vs-Parrot | CC-MAIN-2017-47 | en | refinedweb |
a thought about the TIP process that came to me while
pondering things said during the TCT town meeting at the conference.
What mainly triggered it was Bryan's TIPs that practically died
because there was no implementor. I think the TIP process should
allow for a TIP to go to voting without an implementor. If the vote
says no, there was no need for an implementor anyway and the TIP
is no longer stuck in the draft stage. If the vote says yes, it
can be put in an accepted state with a big WANTED sign on it looking
for an implementor.
I think both ends of the TIP process gains from this.
Pre-vote, people with ideas but limited time or implementation skills
will probably be more likely to contribute, thus using their
time more efficiently.
And post-vote it is easier for an implementor to take on the TIP
since it is just to start implementing when you find yourself
with spare time.
Of course, a reference implementation is always nice and a proof of
concept implementation might be deemed required in some cases before
a vote but that I think is another matter.
The worst thing that can happen is that a TIP gets stuck in the accepted
state, but why is that worse than a TIP that lingers in the draft state
forever?
/Peter
The reference implementation seems to re-build the fonts on *all*
WM_SETTINGCHANGE calls. That message can be sent for many reasons--and
since re-building the fonts will have the side-effect of updating all
windows that use those fonts, it could be expensive to change the fonts
when it isn't required. It is possible to update only when required; see:
for details.
Donal,
This looks pretty good, but I think it needs one addition: a handler for
unknown subcommands. Snit would need this to support its "delegate
method * to..."
statement.
Will
On Monday, August 4, 2003, at 07:28 AM, Donal K. Fellows wrote:
> Hi everyone!
>
> I've just uploaded a major revision to the TIP where I propose adding
> an ensemble mechanism to Tcl. In short, this adds a [namespace
> ensemble]
> command so that we can implement this in Tcl 8.5 instead of having to
> wait for Tcl 9 because of the amount of breakage. It also adds
> control over the precise mapping between ensemble subcommands and
> their implementing commands, primarily because I thought it would be
> cool to do anyway, but also because it makes it easier for packages
> like Snit to be implemented.
>
> The full specification, including a bunch of examples, is at:
>
>
> Please let me know ASAP if there are any silly mistakes in there!
>
> Once I find some time, I intend to fix up an implementation (I've got
> a lot of the work done, but there's still more to do). If that goes
> according to plan, I'll call for a vote. Hopefully this will end up
> as a new, cheap, jaw-droppingly must-have feature for 8.5 :^)
>
> Donal.
> --
> Donal K. Fellows, Department of Computer Science, University of
> Manchester, UK.
> (work) donal.fellows@... Tel: +44-161-275-6137 (preferred
> (home) donal@... Tel: +44-1274-401017 Mobile:
> +44-7957-298955
> (Don't quote my .sig; I've seen it
> before!)
>
>
-------------------------------------------------------------
will -at- wjduquette.com | Catch our weblog, | The View from the Foothills | https://sourceforge.net/p/tcl/mailman/tcl-core/?viewmonth=200308&viewday=5 | CC-MAIN-2017-47 | en | refinedweb |
RNA de novo modeling was originally written in Rosetta by R. Das in late 2006, back when the code was in
rosetta++. It gradually accreted additional functionalities, such as post-fragment-modeling minimization (fragment assembly of RNA with full-atom minimization, FARFAR). A bit of the code was put into object-oriented form in 2010-2011 with the migration to Rosetta 3 ('minirosetta') and tests of a
coarse_rna modeling scheme (never published). But the code was due for a reorganization as additional functions started to be introduced or envisioned – e.g., chemical shift scoring, general 'chunk' fragments (not contiguous in sequence), modeling or refinement of sub-poses of larger poses – and as better practices for Rosetta coding were established.
In 2015-2016, the Das lab seeks to test an integration of stepwise modeling with FARNA/FARFAR. This has required encapsulation of FARNA functionality into a single class and has presented an opportunity to organize sub-functionalities into different sub-namespaces/sub-directories.
This document outlines the current organization for developers, including notes on anticipated additions including handling of RNA/protein interfaces & job specification using the much cleaner flags & setup functions developed for
stepwise (see To Do at bottom of this document).
One semantic note: The terms FARNA and FARFAR are now preferred throughout the code to refer to the actual fragment assembly Monte Carlo protocol, which can now be accessed through
rna_denovo but also through
stepwise or, in principle, anywhere else in the code, e.g. for refinement of RNA pieces of poses. The term RNA_DeNovo or rna_denovo are retained in a few places to signify old wrapper code specific to the
rna_denovo.cc application with
.params input for the more specific use case of modeling RNA from extended chain.
protocols::farna
RNA_DeNovoProtocoland
FARNA_Optimizer
RNA_DeNovoProtocol is the 'classic' wrapper, itself setup by the
rna_denovo.cc application. It loops over the
nstruct poses that need to be built and kicks off instances of RNA_FragmentMonteCarlo, and then outputs those poses to silent files. It is also in charge of the input from
.params files (hopefully to be deprecated soon). Note: this could/should be handled by a JobDistributor, and should migrate to
JD3 when that's ready.
FARNA_Optimizer is a more bare-bones wrapper that doesn't do any fancy silent file input/output. It was coded up for use within
stepwise runs, testing the
-lores flag where 100 cycles of FARNA are carried out. Briefly described on the stepwise page. Its the reasonable object to use to call FARNA within more complex workflows, including motif-by-motif refinement of big RNA poses (which doesn't exist yet).
RNA_FragmentMonteCarlo
RNA_FragmentMonteCarlo is the main protocol setting up all libraries:
There is one important/tricky concept in RNA_FragmentMonteCarlo, an object called
atom_level_domain_map, which is a
protocols::toolbox::AtomLevelDomainMap. This holds for each atom in the pose an assignment of where that residue came from, and demarcates where fragments/jumps/chunks can be inserted at atom level.
The convention is as follows:
+ 0 marks totally free atoms.
+ 1,2,...998 marks atoms that came from fixed input domains (e.g, PDBs), with a different index for each PDB.
+ 999 is special, marking absolutely fixed atoms that did not come from an input domain (e.g., virtual phosphates that don't need to get moved during FARNA)
+ 1000 is special (ROSETTA_LIBRARY_DOMAIN) and marks atoms that are covered by a BasePairStepLibrary
protocols::farna::moversnamespace
RNA_FragmentMover holds a
RNA_Fragments library and actually makes fragment moves on a
pose.
Note: This is where we could put in functionality to, e.g., choose fragments of longer length if they have sequence-matches to the desired pose. This is also where we could put chemical-shift-based weighting of fragment choices. Would need to define weights for each possible fragment, and update random choice to reflect those weights, but that should be easy (there's some code in
stepwise::monte_carlo::mover::StepWiseMoveSelector that we could share.)
RNA_JumpMover holds an
RNA_JumpLibrary and actually makes jump moves on a
pose
RNA_Minimizer carries out 2'-OH packing and full-atom minimizing in two rounds. The first round prevents 'blow up' of FARNA conformations from clashes by coordinate constraints.
RNA_LoopCloser looks over a
pose and applies CCD (cyclic coordinate descent) loop closure to any segments with chainbreaks and CUTPOINT_UPPER/CUTPOINT_LOWER variants (as specified by 'cutpoints_closed', or created during setup)
RNA_Relaxer is not really in use. Use at your own risk.
protocols::farna::fragmentsnamespace
RNA_Fragments is a base class for reading fragments from a database on disk and storing torsions.
FullAtomRNA_Fragments is specific to Rosetta poses with
fa_standard-type RNA residues.
It generates culled lists of, e.g., 1-residue, 2-residue fragments, for particular sequences 'just-in-time'. (Note that while the object is kept const during the run, the just-in-time info is stored in a mutable map -- kind-of a standard hack.)
Default library is
database/sampling/rna/RICHARDSON_RNA09.torsions, but should be updated to
NR2015 from Motif Atlas.
Note: This class could be extended to hold LarmorD-predicted atom-level chemical shifts and nucleotide-level chemical reactivities (to DMS, SHAPE, etc.) for each database RNA structure.
These classes were developed separately from protein fragment classes whose definitions were in flux at the time of coding the RNA protocols; it might be worth unifying the two, although its hard to imagine use cases that demand it.
There is also a (largely deprecated) class called
protocols::coarse_rna::CoarseRNA_Fragments that inherits from
RNA_fragments for poses that use coarse-grained RNA residue types with 3 dummy chains on the backbone and 3 in the base.
Hey, maybe this should be a sub-namespace of libraries...
protocols::farna::librariesnamespace
RNA_LibraryManager manages singletons of each library read from disk. Use it to read relevant libraries once.
In addition to holding the
RNA_Fragments, its got
RNA_JumpLibrary and
BasePairStepLibrary, for now.
RNA_JumpLibrary holds jumps read from the Rosetta database of jumps. By default, only drawn from the 1jj2 ribosome for now?
database/sampling/rna/1jj2_RNA_jump_library.dat, but this should minimally be updated to an RNA11 database (which exists in the database as
RNA11_full.jump), or even to NR2015.
Note: should be general to RNA/protein too, but those jumps haven't been implemented.
BasePairStepLibrary holds coordinates of base pair steps (see BasePairStep) read from databases on disk. It actually just registers which files are on disk and then reads in the silent files 'just in time' during the run. Example file:
database/sampling/rna/base_pair_steps/general/bulge_1nt/ag_unu.out.gz hold coordinates of 4 residues of two base pairs from a base pair step in which one strand has sequence
ag and the other has sequence
unu (
n means any nucleotide).
RNA_ChunkLibrary is an important object in
RNA_FragmentMonteCarlo that holds base pair steps and any coordinates from user-input PDBs or silent files. It also is responsible for creating the
AtomLevelDomainMap (shared by numerous movers above).
ChunkSet
Object that holds coordinates of input PDBs or base pair steps, in compact
MiniPose format.
Note: should be general to combined RNA/Protein chunks, but hasn't been tested.
protocols::farna::optionsnamespace
Options are like a Russian doll of nested classes:
RNA_BasicOptions has the most basic options, e.g.,
dump_pdb
RNA_MinimizerOptions inherits from
RNA_BasicOptions and adds minimizer-specific options.
RNA_FragmentMonteCarloOptions inherits from
RNA_MinimizerOptions and adds a bunch of fragment modeling options, including number of cycles
monte_carlo_cycles, whether to minimize or not
minimize_structure, filters like
filter_lores_base_pairs, and names of input PDB files.
RNA_DeNovoProtocolOptions inherits from
RNA_FragmentMonteCarloOptions and adds a few i/o options, including number of models
nstruct.
protocols::farna::base_pairsnamespace
This directory is meant to handle information on where base pairs and base pair steps are located in the pose for FARNA runs.
RNA_BasePairHandler handles locations in pose of base pairs, base_pair_steps, any chain_connections (two segments that are supposed to have a pair between them somewhere). Also handles
setup_base_pair_constraints().
Note: Would be great to have a proper RNA secondary structure information object specifiable by user and stored in the pose (see To Do below) -- at that point, this class would handle the conversion from that class into parameters used by FARNA.
BasePairStep.cc holds information on an object like this:
OneOne
5'-- ( i ) -- ( i+1) -- 3' | | | | 3'-- (j+q+1) ( j ) -- 5' \ / n - n - n allowing bulges (n's) on the second strand
core::rna::BasePair, i.e. no storage of Watson-Crick edges or orientations. Keeping track of that information leads to very sparse databases.
protocols::farna::secstructnamespace
RNA_SecStruct is meant to be a general class that stores actual pairings and can handle input/output of dot-paren notation like
(((....))) for a hairpin. Its still a bit crude, in that its primary datum is a string and not a list of pairs, which would be more fundamental. It also cannot input/output arbitrary #'s of pseudoknots, just three layers as dictated by
(,
);
[,
]; and
{,
}. See also rna-secondary-structure-file.
RNA_SecStructLegacyInfo currently holds 1D information on secondary structure
This class was derived to match Rosetta protein modeling (which holds 1D information on alpha-helix,beta-sheet, or loop).
protocols::farna::setupnamespace
RNA_DeNovoSetupallows FARNA to now bypass the legacy
.params-file based input and instead directly take from command-line
-sequence,
-secstruct,
-obligate_pair. (see RNA DeNovo docs)
RNA_DeNovoPoseInitializerholds code for taking
.paramsinformation and creating a fold-tree and cutpoints for a new pose. (may become deprecated if we use build_full_model from stepwise to initialize the pose after
RNA_DeNovoSetup).
RNA_DeNovoParametersis responsible for reading in
.paramsfiles (now legacy code).
rna_denovo_setup.pyinto the RNA_DeNovoSetup class, which handles residue mapping to subproblems. Now just need to run
build_full_modelto generate initial poses. A good time to test this might be when Kalli generalizes FARNA to include RNA-protein lo-res potential. Rebuilding an RNA pair within the MS2 test case is a good example. | https://www.rosettacommons.org/docs/latest/farna-refactor | CC-MAIN-2017-47 | en | refinedweb |
#include <stdio.h>
int main (void)
{
printf ("Hello, world!\n");
return 0;
}
We will save the above 'C' code in a file named 'hello.c'. Inorder to compile a C file with gcc, use the following command:
[bash]$ gcc -Wall hello.c -o hello
This compiles the source code in ‘hello.c’ to machine code and stores it in an executable file ‘hello’.
NOTE: The output file for the machine code is specified using the -o option. This option is usually given as the last argument on the command line. If it is omitted, the output is written to a default file called ‘a.out’. If a file with the same name as the executable file already exists in the current directory it will be overwritten.
The option -Wall turns on all the most commonly-used compiler warnings---it is recommended that you always use this option! There are many other warning options, but -Wall is the most important. GCC will not produce any warnings unless they are enabled. Compiler warnings are an essential aid in detecting problems when programming in C and C++.
In this case, the compiler does not produce any warnings with the -Wall option, since the program is completely valid. Source code which does not produce any warnings is said to compile cleanly.
To run the program, type the path name of the executable like this:
[bash]$ ./hello
Hello, world!
This loads the executable file into memory and causes the CPU to begin executing the instructions contained within it. The path ./ refers to the current directory, so ./hello loads and runs the executable file ‘hello’ located in the current directory.
For a detailed view about how the who compilation process goes checkout Compilation process in GCC.
Your comments are moderated | http://codingfreak.blogspot.com/2008/02/compiling-simple-c-program-using-gcc.html | CC-MAIN-2017-47 | en | refinedweb |
In the first part of this blog post we covered some common scenarios for setup and configuration of your tests to ensure the overall test suite
maintainable over the long run. Now, we’ll talk about backing APIs, extended tests, and test oracles.
As powerful as Test Studio is, every project will end up needing some form of coded infrastructure at some point. Backing APIs make it much easier to
handle the setup and configuration tasks mentioned above. You could work with Test Studio Standalone and use an empty coded step in an empty test as a
holding place for custom utility classes and namespaces; however, that approach is only suitable for prototypes and tiny projects.
Working with Test Studio inside Visual Studio makes it much easier to split out backing APIs/infrastructure to separate projects where they’re much more
easily managed. This ensures teams are able to keep areas of responsibility properly separated out from the tests themselves.
You’ll also find yourself wanting to drop to code to extend your tests for various reasons. Testing particular conditions on controls such as Trees or
Grids is a fine example of this situation.
Let’s use this grid as an example for two situations: verifying the count in the grid, and verifying the count of rows meeting specific criteria.
First, we’ll count up the total rows in the grid’s body. There are several ways to do this here’s one example.
IList
rows = Find.AllByXPath
("//tbody/tr");
Assert.AreEqual(9, rows.Count);
Another test might be to validate a table generated by a report or other query. Using the table above, we could say we’re validating two rows with users
from the New Earth region will be displayed when we run the query against the baseline dataset.
The following example shows a different way of interacting with the Grid on the page. In this case, we’ve stored the grid in the Element Repository and are
able to extract it as a strongly typed object. We’re then looking for elements containing the text we’re looking for. This will effectively pull us off two
table cell elements—this entire test scenario is predicated on us making these decisions based on our knowledge of the baseline dataset, and the absolute
trust that we don’t have to worry about pulling off some other element(s) in the table.
RadGrid grid = Pages.HomePage.Content_Grid;
IList<Element> newEarthContacts =
grid.Find.AllByContent(
"New Earth"
);
Assert.AreEqual(2, newEarthContacts.Count);
In this example we’re using Xpath to grab all table row elements under the table body element. (“//tbody/tr”) That’s stored in the rows collection, and
we then simply use the Assert class to validate we’ve got the correct count.
Test oracles are another critical area where you’ll find yourself needing to write code. Oracles (sometimes also referred to as “heuristics”) are the final
check in your tests. These are the true validations of whether your system’s actually functioning as you expect it to—and it’s generally not just
a simple validation on the UI.
An oft-used example is that of creating a new item in your system’s UI. Your test may log you on, navigate through a few steps and submit something, then
finally give you a visual confirmation your item has been created. If your test finishes off with a validation of the UI, then the test is only partially
complete because you can’t be sure the item was truly created in your database or underlying persistence system. An oracle should be used to connect to
that persistence layer and validate the data item to ensure there’s not been some issue with unhandled exceptions, caching, or other problem which might
have the UI updating while not saving things to the database.
Below is a practical example of this concept.
Here we’re doing a two-step validation: first in steps 11-16 we’re confirming the UI accurately reflects the edits we’ve made. In step 17 we have a coded
step which confirms the user was created in the database—the code for that is shown in the window below and also reflects our use of a backing API to
handle easy communication to the database via the ContactFactory helper class.
With Test Studio you're able to do a great many things without writing code. That said, these last two posts have shown you where it's easy to drop to code for specific tasks that can really help your automation suites shine! Don't get carried away writing too much code when you don't have to, but don't be afraid to dive into VB.NET or C# and add some great value to your tests. | https://www.telerik.com/blogs/working-with-visual-studio-write-code-where-needed---part-2 | CC-MAIN-2017-47 | en | refinedweb |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616 1) I try setParameter() and pass null as a first argument. I get exception ("Component returned failure code: 0x80600008 [nsIXSLTProcessor.transformToFragment]") when trasformTo...() method is called. 2) If I call setParameter() and pass namespace "" as a first argument then parameter will not be setted. It is independent of importStylesheet() method call point. Reproducible: Always Steps to Reproduce:
Created attachment 162832 [details] xml file
Created attachment 162833 [details] xsl file
Created attachment 162834 [details] main
(In reply to comment #0) > 2) If I call setParameter() and pass namespace > "" as a first argument then parameter will > not be setted. Are you sure it is not set? Can you try with xsl:copy-of? It seems like you set it as a stringvalue but you use it as a nodeset.
In the stylesheet, you reference <xsl:for-each which expects the non-namespaced parameter "path" to hold a nodeset. That is not supported for external parameters just yet, that's bug 248025. xslProcessor.setParameter("", "path", "messages/message[@type='error']"); actually sets xsl:path (DONT, please) to a string value. Not a nodeset. Everything works as expected, besides the fact that we can't pass nodes :-/
I can't understand. Why does <xsl:for-each expect nodeset not string? I guess it is not evident. I expect when I set string parameter then all parameters entries in xslt is replaced by value of passed string. In this case we get xslt document in witch value of passed string is located on place of parameter.
In other words I expect from setParameter() method for behaviour like: var path="messages/message[@type='warning']"; xslDoc.getElementsByTagName("param")[0].setAttribute("select", path); says <xsl:for-each select = node-set-expression> The variable references are not replaced, but they are expressions in their own sense. | https://bugzilla.mozilla.org/show_bug.cgi?id=265410 | CC-MAIN-2017-47 | en | refinedweb |
Build inbound-src:d509e44cae3e with B2G_DEBUG=1 causes assertion failure and crash loop on startup. Logcat context: E( 4443:0x115b) Could not read chrome manifest ''. I( 4443:0x1167) WARNING: NS_ENSURE_TRUE(lowMemFd != -1) failed: file /home/mikeh/dev/mozilla/m-c/inbound-src/widget/gonk/GonkMemoryPressureMonitoring.cpp, line 136 I( 4443:0x115b) WARNING: Failed to create Addons Manager.: file /home/mikeh/dev/mozilla/m-c/inbound-src/toolkit/xre/nsXREDirProvider.cpp, line 799 F( 4443:0x115b) Assertion failure: false (The number of items in sClassInfoData doesn't match the number of nsIDOMClassInfo ID's, this is bad! Fix it!), at /home/mikeh/dev/mozilla/m-c/inbound-src/dom/base/nsDOMClassInfo.cpp:3648 F( 4443:0x115b) Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1) I( 4442:0x115a) debuggerd committing suicide to free the zombie! I( 4457:0x1169) debuggerd: Feb 11 2013 10:47:10
This crash does not happen for B2G_DEBUG=0 builds.
if (i != eDOMClassInfoIDCount) { printf_stderr("i = %d, eDOMClassInfoIDCount = %d\n", i, eDOMClassInfoIDCount); MOZ_NOT_REACHED("The number of items in sClassInfoData doesn't match the " "number of nsIDOMClassInfo ID's, this is bad! Fix it!"); return NS_ERROR_NOT_INITIALIZED; } I( 7591:0x1da7) i = 320, eDOMClassInfoIDCount = 321
Andrea, it looks your change m-c:92f93ab32aec is causing the run-time check in Comment 2 (above) to fail on DEBUG builds. This change is described as "Bug 838172 - Convert AudioChannelManager to WebIDL", and it removes the following lines from nsDOMClassInfo.cpp: 2.35 -#ifdef MOZ_AUDIO_CHANNEL_MANAGER 2.36 - NS_DEFINE_CLASSINFO_DATA(AudioChannelManager, nsEventTargetSH, 2.37 - EVENTTARGET_SCRIPTABLE_FLAGS) 2.38 -#endif But the declaration still exists in nsDOMClassInfoClasses.h: 432 #ifdef MOZ_AUDIO_CHANNEL_MANAGER 433 DOMCI_CLASS(AudioChannelManager) 434 #endif If this is an unintentional leftover, I can remove it.
This doesn't affect any of the mozilla-b2g18 branches because they haven't picked up the change yet.
Created attachment 712591 [details] [diff] [review] remove leftover AudioChannelManager reference from nsDOMClassInfoClasses.h
This patch is perfect but this bug is a duplicate of 840260. | https://bugzilla.mozilla.org/show_bug.cgi?id=840105 | CC-MAIN-2017-47 | en | refinedweb |
In this section we will have a list of questions , my personal collection, which I encountered or derived from my understanding of java and this is highly recommended for experienced Java developers.
General Collections
- What is a load factor ?
- Which of the collection class would you user if you have to implement a queque behavior ?
- What is size and capacity of a Vector ?
- Which situation would lead a Vector to throw an ArrayIndexOutOfBoundsException ?
- Can you iterate a map ?
No, Map does not implement Iterable interface, only Collection ( thus , list and set ) do , so the Collection implements iterable <E> , make the set and the list iteratble. The Map can't be iterable only the key part can be iterable for example the following code is how you traverse the map
Map <String,String> map= new HashMap<String,String>();
Ierator i =map.keySet().iterator();
while(i.hasNext()){
String value=map.get(i.next());
}
- How can you make your custom class iterate through advanced for loop ?
You need to make your class implement the Iterable interface, override the iterator() method , and create Iterator class , which can iterate your items in the class.
-
HashCode,Equality , toString,identity
- Suppose that I am designing a class it is really mandatory to override the hashCode() method , even if I am sure none of these object will ever be used in Hash based collections like HashMap, Hashtable or HashSet ?
It is not necessary to override the hashCode method even if you don't use it in a hashbased collections. But If you have your equals method overriden , which means that you would want your object to be tested for equality. And the contract with the equals method is that , if two objects are equal you must override the hashcode method. Lets take the following example
class Animal { private int i=12; } public class Test { public static void main(String [] args) throws Exception { Animal a1=new Animal(); Animal a2=new Animal(); System.out.println(a1==a2); System.out.println(a1.equals(a2)); } }Looking at the code you certainly know that the a1 and a2 objects are equal meaningfully, But the output would say otherwise, ( false false), This is not expected. What the above equals does is , it invokes the equals method on Object , and the object checks if they are pointing to the same object, which is not the right way to check. So essentially you would have to override the equals method, and as per contract with hashCode, the whenever the equals is overriden it is necessary to override the hashCode(), who knows you might need this objects added to the hash based collections, so better do it now.
- When I invoke system.out.println() on an object which class doesn't override the toString() method , what is the output and what it means ?
The output comes in a format of <fully qualified class name>@hashcode, the hashcode (in hexadecimal) is invoked from the Object if hashCode method is not overriden
- What is the problem if you return a random number in your hashCode(), I think it is most efficient , since it would create unique bukkets ?
- How good idea is that to return 1 ( a contstant value ) in your hashCode()?
In such case all your object will fall into one single bucket , and the searching algorithm will end up invoking the equals method to find the object you are looking for , which is a highly inefficient way , but legal.
Seriallization , Deseriallization, Externalization
- Lets say you need to introduce a marker interface in your library, how would be add capability to the class which implements it?
- Static fields don't get seriallized, but lets say I would want to save this the state of the field , how would I do it ?
Generics
- If methods overloaded on basic of type parameters, what is the best alternative to overload ?
Java Memory Management
How do you set the stack size of java runtime ?
-Xss can be used to set the stack size
What is the difference between stackoverflowerror vs outofmemoryerror ?
stackoverflow happens in overflow of stack ,and outofmemory ocuures if you dreained your heap.
- How to generate StackOverlFlow error and OutOfMemoryError problematically ? | http://www.bullraider.com/java/core-java/advanced-interview-questions | CC-MAIN-2017-47 | en | refinedweb |
Since its release, the Eclipse Rich Client Platform (RCP) has suffered from a lack of support for automated builds with tests. The IDE provides tools for building and packaging RCP applications, but they are very different from the PDE/Build tools that perform these tasks in an automated fashion. Also, until recently, testing support for JUnit 4 was not present in the Eclipse TestFramework. While the situation has markedly improved in Eclipse 3.6, setting up an automated build with tests remains a time-consuming and difficult task.
To make the job easier, I've created a minimal project called "Lightning," which demonstrates how to combine the new automated build tool Buckminster, the Eclipse Test Framework, and the integration testing tool SWTBot. Lightning has been tested on Linux and Windows. (Buckminster on the Mac platform has a few kinks to work out.)
Buckminster is a build system for Eclipse products and plug-ins. It can be run from within the IDE (with the proper tooling installed) or from the command line. I use the command-line version in Lightning, so no additional IDE tooling is required. Buckminster can inspect artifacts such as plug-ins and features in order to determine their dependencies.
I launch Buckminster with Apache Ant, which manages all the other tools required by Lightning. Ant provides the top-level targets and everything you need to run the build from Eclipse, the command line, or a continuous-integration server like Jenkins.
Since the command-line distribution of Buckminster is hard to install manually, the Lightning build process installs it automatically using the P2 director application from the Buckminster download site. P2 is the provisioning system in Eclipse, replacing the old update manager.
The first step in building the Lightning project is to download it from github and unzip it, or just clone the project using git.
Because this build uses Buckminster, you can actually download and assemble the target platform for the project from the Helios P2 repository automatically which is called "materializing" in Buckminster parlance. To do so, simply navigate to the "Buckminster.build.feature" directory and run the command
ant materialize.target.platform, which will materialize the target platform to "<unzip location>/workspace-target-platform." This directory will serve as the target platform for the IDE workspace. Next, import the Lightning plug-ins into a new Eclipse 3.6 workspace and instruct it to use the target platform you just materialized.
Building the Application
You can kick off the full build process by running the command
ant from the "buckminster.build.feature" directory.
The build process starts by installing P2. This, in turn, installs the command-line version of Buckminster. The next step uses Buckminster to build the Eclipse RCP products. Two products are created during the build process. The first is the test product, which includes Lightning along with all tests and test dependencies. The second is the production product, which includes only the Lightning application. This is the version that will be shipped to customers when the time comes. If it seems a little strange that two products are needed, just remember that the tests must be run inside an OSGi environment, and this means that they need to be packaged into a fully functional Eclipse RCP application.
When Buckminster is used to build the Lightning products it runs in an Eclipse workspace, just as it would if it were being run from within the IDE. The first step in building the product, therefore, is to set up the workspace and associated target platform. This gives Buckminster a sandbox in which to play. The target platform is imported using a target definition file, which tells Buckminster where to place any plug-ins it later downloads for the target platform. Next, the
import command executes an import of those plug-ins as defined in a .cquery file (Listing One).
Listing One: The structure of the .cquery file.
<cq:componentQuery xmlns: <cq:rootRequest ... </cq:componentQuery>
The .cquery file points to an Eclipse feature that I have created especially for Buckminster, and also includes a list of places to find the plug-ins included in that feature. This list is stored in an .rmap file, part of which I include in Listing Two.
Listing Two: The .rmap file.
<rm:rmap xmlns: <rm:searchPath <rm:provider <rm:uri </rm:provider> </rm:searchPath> <rm:searchPath <rm:provider <rm:uri <bc:propertyRef </rm:uri> </rm:provider> </rm:searchPath> <rm:searchPath <rm:provider <rm:uri <bc:propertyRef <bc:propertyRef </rm:uri> </rm:provider> </rm:searchPath> <rm:locator <rm:locator <rm:locator </rm:rmap>
The .rmap file lists the locations of the plug-ins that ultimately make up the application. These include public P2 repositories from the Internet, local P2 repositories, and local source folders. The local P2 repositories were created earlier in the build process using the P2 director application and a list of previously built plug-ins. To reduce traffic to the remote P2 repositories, it is a good idea to create mirrors of the P2 repositories on the local network (though this is not required).
Once the .cquery is imported, Buckminster has a fully materialized target platform, a workspace, and the required projects for Lightning. It is now ready to build the projects. Note that you could set up the build to use the workspace-target-platform created earlier, and the process would probably be a bit faster. But I wanted to demonstrate how Buckminster can assemble a target platform on the fly. | http://www.drdobbs.com/tools/automating-an-eclipse-rcp-build/231500378 | CC-MAIN-2017-47 | en | refinedweb |
Quick links
Before reading this post, I hope you are equipped with required software’s to run a C program. If not please first set up your C lab before writing, compiling and running a C program.
After you have installed and configured all essential software’s you can continue to first C program.
Basic structure of a C program
Since the early days of programming, it has been a tradition to write first program as "Hello Word" program. I will continue the legacy.
Open your favorite text editor and write below program.
/* My first C program to print Hello, World! */ #include <stdio.h> int main() { printf("Hello, World!"); return 0; }
Note: Do not make typing mistakes while writing the above program. Otherwise it may result in various errors.
Save the above program with name helloworld.c
Before I get down in details about the code. Let us run the program and test.
gcc helloworld.c -o helloworld helloworld.exe Hello, World!
The code on execution produces Hello, World! on screen.
Let us see the various elements used in the code and meaning they convey.
Understanding basic structure of C program
/* My first C program to print Hello, World! */
The first line of the program is a comment. Comments are non-executable code used to add inline documentation about the code or program.
/*and ends with
*/. Anything between are not executed by the compiler.
#include <stdio.h>
Almost all C program that I will write in this C tutorial series will begin with the statement
#include <stdio.h>.
#includeis a pre-processor directive used to do some processing before compilation process. The
includepre-processor directive inserts all contents of
stdio.hfile at the beginning of our code.
Why it is used here?
stdio.hfile contains various input output functions. I have used
printf()function to print a text which exists in
stdio.hheader file. Hence, I must tell the C compiler explicitly to link
printf()function with our program.
If it seems confusing, leave it for now just remember to add this line at the top of every C program. Pre-processor directives are explained in depth in later sections.
int main()
A program is a collection of functions and a function is a collection of tasks. To run any program, we must know the starting function of a program. You may think it as an entry gate to the program.
int main()is a special function that defines starting point of the program. A function is followed by a pair of opening and closing curly brace
{
}. It defines body of the function. We write logic of our program inside body of
maini.e. inside
int main() { //Here goes your logic }
Read more - Various ways to write main function and standard main function declaration
printf("Hello world!");
printf()is a C function used to write text on screen.
printf()function takes an argument that specifies what will be printed on screen.
Don’t get confused with function, arguments, parameters and
printf(). All are covered in details in later sections.
return 0;
Return statement specifies that a function has finished all its tasks and it will terminate now. Here
returnstatement is followed by 0. You are free to use any integer instead of 0. Apart from that,
return 0has special meaning to
mainfunction. It specifies that the program has executed successfully without any error.
Therefore, I have used 0 instead of any other integer value.
So far, we learned how a C program looks and basic structure of a C program. We created, compiled and executed our first C program. Next, we will learn the compilation process and fundamental of C.
<pre><code> ----Your Source Code---- </code></pre> | http://codeforwin.org/2017/08/hello-world-program-c.html | CC-MAIN-2017-47 | en | refinedweb |
Company
products
Leave Message
Current Location:
specification refers back breaking
Stone crusher machine
Ore dressing machine
Building materials equipment
Powder making machine
Production Line
specification refers back breaking
Breaking: Oppo Find 7 specification questions answered - Giz.
Home Tech Leaks and Spy photos Breaking: Oppo Find 7 specification questions answeredTech Leaks and Spy photos news Phones Oppo.
Synopsis 2: Bits and Pieces
3-Within a regex, unspace is disallowed as too ambiguous with customary backslashing conventions in surrounding cultures. Hence you must write.
Lumo Lift Posture Coach & Lumo Run Smart Running Shorts
Shop Back Lumo Lift Lumo Run Where to BuyPlatformORDER NOW Technology That Helps You Move Better.Solutions to every day movements.Technology.
CPE - Common Platform Enumeration: CPE Specifications
CPE Version 2.3 departs significantly from past CPE practice by breaking .BACK TO TOP MatchingThe CPE 2.3 Name Matching Specification defines a .
Back Office
BREAKING DOWN 'Back Office' The back office can be thought of as the part of a company responsible for providing all business functions related to its .
2(1)_
intensification justification simplification certification glorification specification .refers to the back-breaking labor human beings pretend to do in a ga.
jvmti specification - JVM(TM) Tool Interface 1.0.38
Strings section of the JNI specification for .terminology refers to the Java platform and not .back into the VM or Java programming language .
BREAKING: ATF White Paper Leaked - The Firearm BlogThe .
This could change their determination that came out back in 2015 that using.At the bare minimum, breaking a law undermines the authority of it which.
html5 - What's the key difference between HTML 4 and HTML 5? .
history and allows pages to add to it to prevent breaking the back button.HTML 5 refers to the name of the W3C specification, whereas "HTML5" is.
specification analysis of affine term structure models_.
ThefocusonATSMsextendsbackatleasttothepathbreakingstudiesbyVasicek~1977!andCox,.Ideally,aspecificationanalysisofATSMscouldbeginwiththespecifica-tionofanall-.
Flex SDK / Wiki / FXG 2.0 Specification
FXG 2.0 Specification Authors: .Auto means line breaking opportunities are based on standard .The baseline that this property refers to is .
Break key - Wikipedia
The Break key of a computer keyboard refers to breaking a telegraph circuit.^ "Dell Inspiron 17 specification" (PDF). ^ Computer Hope, Pause key .
ASTM D578 / D578M - 05(2011)e1 Standard Specification for .
D578 - 05(2011)e1 Standard Specification for Glass Fiber Strands , breaking strength, chopped glass strand, construction designation, diameter, glass roving.
acdccdb -
201531-The procedure refers to the section of 6.4.3. .breaking till the specified length insertion is .specification.The main process of backfi.
Extensible 3D (X3D), ISO/IEC 19775-1:2013, 4 Concepts
EXAMPLE "2.[ABCD]" refers to a reference .dynamically by rerouting, adding or breaking .A complete specification of the X3D SAI services.
Method for manufacturing a textured yarn - Toyo Boseki KK
it is wound back and forth across the surface .specification refers to that portion of the .BreakingSampleBalloonof Balloonof YarnStress.
break load,break load:.
Test method for grab breaking load and elongation of geotextiles Stranded steel wire ropes - specification for higher br.
Car Insurance Online Save Money When You Compare Rates - .
Remember in the state the rate is to back up coverage Are driving, what.Tends to be similar in condition, specification, and age on inauguration day.
2.doc -max-.
specification modernization mechanization realization civilization globalization .refers to the back-breaking labor human beings pretend to do in a game.
Color specification - MATLAB ColorSpec (Color Specification)
ColorSpec is not a function it refers to the three ways in which you specify color for MATLAB graphics:
Cluster Specification Akka Documentation
in response N2 creates A and sends back a ready message after receiving the.to the new host N2, breaking message ordering from a client to actor A.
2015611.doc-.
2015429-backbreaking struggle to wring a little food out.personnel specification such as Rodgers Seven-Point.it in line 9, paragraph 1 refer.
Data Model Last Call Comments
The Data Model specification refers to several namespaces by prefixes (xs:,.. The second occurrence of "language" is meant to refer back to the .
Google
Music is not limited to the world of sound. There exists a music of the visual world. Oskar Fischinger,1951 Share your creation New compositionLoading.
2(2)_
identification justification certification specification mechanization civilization .refers to the back-breaking labor human beings pretend to do in a game.
Previous Post:
weight of line rock per cubic foot
Next Post:
ultrafine mill users in india
Recommended Products
Jaw crusher
sand making machine
Raymond mill
Ball mill
Cement mill
Impact crusher
Circular vibrating screen
Sand washer
High strength pulverizer
Energy saving cone ball mill
Cement dryer
Combination crusher
Other Content
sayaji crusher machine number specification
cone crushers specification
vertical shaft impact sand specification
cone crusher crushing specification pdf stone quarry simulator 2012 full ind
specification refers back breaking | http://geneaphoto.eu/4608/specification-refers-back-breaking/ | CC-MAIN-2017-47 | en | refinedweb |
Hello,
My Electron goes into a Listening Mode some seconds after “Breathing White”.
The device is not claimed, without SIM (never inserted the SIM).
No battery or antenna connected.
system firmware version: 0.6.2
CLI: particle --version gives 1.25.0
There is no difference if the user code running is mine (see below) or the Tinker.
Odd thing is - it worked well for some days. I have been developing and testing my software successfully using the device.
The code I am flashing is:
#include "application.h" SYSTEM_MODE(SEMI_AUTOMATIC); //SYSTEM_MODE(MANUAL); void setup() { Cellular.off(); Serial.begin( 9600); Serial.print( "Setting up the device ..."); Serial.println( "OK"); } void loop() { Serial.println("Test"); delay( 100); }
Not only there is nothing on the terminal, but as I mentioned - the device drops into a Listening Mode.
I am aware about the tons of topics with the similar subject - tried all of them that seemed relevant.
My question is - what else can I try before deciding that “mode” button is broken and replacing it.
Thanks in advance! | https://community.particle.io/t/electron-jumps-to-listening-mode-frequent-blue-led-blinking/37422 | CC-MAIN-2018-51 | en | refinedweb |
Repository: hbase
Updated Branches:
refs/heads/branch-1.2 88c991e4a -> 4541d7059
HBASE-16256 Purpose of EnvironmentEdge, EnvironmentEdgeManager (Sai Teja Ranuva)
Project:
Commit:
Tree:
Diff:
Branch: refs/heads/branch-1.2
Commit: 4541d70598b0662da4f5a90822cf6b71f6ac48b6
Parents: 88c991e
Author: stack <stack@apache.org>
Authored: Fri Jul 29 16:34:22 2016 -0700
Committer: stack <stack@apache.org>
Committed: Fri Jul 29 16:36:15 2016 -0700
----------------------------------------------------------------------
.../hbase/util/EnvironmentEdgeManager.java | 34 ++++++++++++++++++++
1 file changed, 34 insertions(+)
----------------------------------------------------------------------
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/EnvironmentEdgeManager.java
b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/EnvironmentEdgeManager.java
index b9c1bf2..3674156 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/EnvironmentEdgeManager.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/EnvironmentEdgeManager.java
@@ -24,6 +24,40 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
* Manages a singleton instance of the environment edge. This class shall
* implement static versions of the interface {@link EnvironmentEdge}, then
* defer to the delegate on invocation.
+ * <br>
+ * <b>Original Motivation:</b>
+ * The main purpose of the Environment Edge Manager was to have better control
+ * over the tests so that they behave the same when run in any system.
+ * (Refer: <a href="">HBASE-2578</a>
- The issue
+ * which added the {@link org.apache.hadoop.hbase.util.EnvironmentEdgeManager}).
+ * The idea is to have a central place where time can be assigned in HBase. That makes
+ * it easier to inject different implementations of time. The default environment edge is
the Java
+ * Current Time in millis. The environment edge manager class is designed to be able
+ * to plug in a new implementation of time by simply injecting an implementation
+ * of {@link org.apache.hadoop.hbase.util.EnvironmentEdge} interface to
+ * {@link org.apache.hadoop.hbase.util.EnvironmentEdgeManager}
+<p>
+ <b>Problems with Environment Edge:</b><br>
+ 1. One of the major problems is the side effects of injecting an Environment Edge into
+ Environment Edge Manager.<br>
+ For example, A test could inject an edge to fast forward time in order to avoid thread
+ sleep to save time, but it could trigger a premature waking up of another thread waiting
+ on a condition dependent on time lapse, which could potentially affect the normal
+ working of the system leading to failure of tests.<br>
+ 2. Every test should ensure it is setting the Environment Edge it needs for the test to
+ perform in an expected way. Because another test which might have run before the current
test
+ could have injected its own custom Environment Edge which may not be applicable to this
+ test. This is still solvable but the problem is that the tests can run in parallel
+ leading to different combinations of environment edges being injected causing unexpected
+ results.<br>
+ 3. Another important issue with respect to injecting time through Environment Edge is that
+ the milliseconds unit of time is ingrained throughout the codebase in the form of hardcoded
+ sleep time or timeouts that any change of time unit or making it fast or slow can potentially
+ trigger unexpected failures due to timeout or unintended flow of execution.<br>
+</p>
+ Because of the above issues, only {@link org.apache.hadoop.hbase.util.DefaultEnvironmentEdge}
+ is being used, whose implementation of time returns the {@link System#currentTimeMillis()}.
It
+ is advised not to inject any other {@link org.apache.hadoop.hbase.util.EnvironmentEdge}.
*/
@InterfaceAudience.Private
public class EnvironmentEdgeManager { | http://mail-archives.apache.org/mod_mbox/hbase-commits/201607.mbox/%3C84f57ef411264c70b6100e863f92af06@git.apache.org%3E | CC-MAIN-2018-51 | en | refinedweb |
Kinds of LV computation. More...
#include "/opt/doxygen-docs/src/llvm/tools/clang/lib/AST/Linkage.h"
Kinds of LV computation.
The linkage side of the computation is always the same, but different things can change how visibility is computed.
Definition at line 29 of file Linkage.h.
Do an LV computation when we only care about the linkage.
Definition at line 58 of file Linkage.h.
References IgnoreAllVisibility, IgnoreExplicitVisibility, clang::Result, and clang::NamedDecl::VisibilityForValue.
Referenced by clang::NamedDecl::getLinkageInternal(), and clang::NamedDecl::isLinkageValid().
Definition at line 46 of file Linkage.h.
References ExplicitKind.
Referenced by getExplicitVisibility(), isTypeVisibility(), and isValueVisibility().
Definition at line 50 of file Linkage.h.
References getExplicitVisibilityKind(), and clang::NamedDecl::VisibilityForType.
Referenced by hasDirectVisibilityAttribute().
Definition at line 53 of file Linkage.h.
References getExplicitVisibilityKind(), and clang::NamedDecl::VisibilityForValue.
Referenced by clang::NamedDecl::getExplicitVisibility(), and getExternalLinkageFor().
Definition at line 65 of file Linkage.h.
References ExplicitKind, IgnoreAllVisibility, and IgnoreExplicitVisibility.
The kind of entity whose visibility is ultimately being computed; visibility computations for types and non-types follow different rules.
Definition at line 32 of file Linkage.h.
Referenced by getExplicitVisibilityKind(), and toBits().
Whether all visibility should be ignored.
When set, we're only interested in computing linkage.
Definition at line 38 of file Linkage.h.
Referenced by forLinkageOnly(), clang::LinkageComputer::getLVForDecl(), getVisibilityOf(), hasDirectVisibilityAttribute(), and toBits().
Whether explicit visibility attributes should be ignored.
When set, visibility may only be restricted by the visibility of template arguments.
Definition at line 35 of file Linkage.h.
Referenced by forLinkageOnly(), getExplicitVisibility(), hasExplicitVisibilityAlready(), toBits(), and withExplicitVisibilityAlready(). | https://clang.llvm.org/doxygen/structclang_1_1LVComputationKind.html | CC-MAIN-2018-51 | en | refinedweb |
I have an component that needs to access its root element from the Dart code. By reading Differences between Angular.js and Angular.dart? here on SO and grepping around in the AngularDart source code I figured out that what I need is to provide a constructor with explicitly typed arguments. If one of the arguments has type
dom.Element
NoSuchMethodError : method not found: 'simpleName'
@ng.NgComponent (
selector: 'math',
templateUrl: 'packages/embarassing_name_of_my_package/math/math_component.html',
publishAs: 'ctrl'
)
class MathComponent {
ng.Scope _scope;
dom.Element _element;
ng.NgModel _ngModel;
ng.NodeAttrs _attrs;
MathComponent(this._scope, this._element, this._ngModel, this._attrs);
…
}
ng
dom
import 'package:angular/angular.dart' as ng;
import 'dart:html' as dom;
Classes are registered using the
Module.type() method (or factory, value).
You can take a look at Angular.dart source - search for 'type(' like lib/core/module.dart
(Please ignore the results where
type is not the function name)
When a constructor or a method called by Angular needs a parameter DI looks up its registered types/values/factories and uses a provided instance (value) or creates a new instance (type) or uses the result that a factory returns and injects it. | https://codedump.io/share/1g7moskj8ZLH/1/how-does-angulardart-dependency-injection-work | CC-MAIN-2018-51 | en | refinedweb |
Create a password protected zip file using zlib and ZipEngine
First you need to download zlib package from here and ZipEngine from here.
Once got the sources put all the files in your project folder. There are no duplicate files name than you can keep all the files in the same path. As said before ZipEngine is a wrapper over zlib. This mean using this wrapper you don't need to use the zlib directly but sources (or precompiled library) are needed.
The first step is to create a new zip file or open an existing one with the following code:
#include "zip.h" zipFile hZipFile; m_ZipFile = zipOpen("myfile.zip", APPEND_STATUS_CREATE); if(m_hZipFile == NULL) { // Error here }
The flags available for open a zip file are:
- APPEND_STATUS_CREATE
Create a new zip file from scratch
- APPEND_STATUS_CREATEAFTER
If file exist the zip will be created at the end of the file (useful if the file contain a self extractor code)
- APPEND_STATUS_ADDINZIP
Open an existing zip file and add the new files inside it
Now we have our zip handle we can proceed to add file inside the zip just created.Basically the procudure used by ZipEgine is to create a new item inside the zip file with the name of the file you want to insert. Once successfully create this new item you can write the content of the file connected to the item name. However, since in your example we want to protect our zip file with a password, we need also to have the CRC value of the file content we are going to insert. This mean we have to precalculate the CRC by reading all the file content with the following algorithm:
unsigned long CRC = crc32(0L, Z_NULL, 0); const unsigned int BufferSize = 10000; unsigned char Buffer[BufferSize]; size_t nRead; FILE* pFile; pFile = fopen("myfile.bin", "rb"); while((nRead = fread(Buffer, BufferSize, 1, pFile)) > 0) { CRC = crc32(CRC, Buffer, nRead); } fclose(pFile);
Now we have our CRC number we can proceed to create a new item inside the zip with the name the the file we want to store inside:
zip_fileinfo zipInfo; int Result; zipInfo.dosDate = 0; zipInfo.tmz_date.tm_sec = 0; zipInfo.tmz_date.tm_min = 10; zipInfo.tmz_date.tm_hour = 12; zipInfo.tmz_date.tm_mday = 01; zipInfo.tmz_date.tm_mon = 05; zipInfo.tmz_date.tm_year = 2012; zipInfo.internal_fa = 0; zipInfo.external_fa = 0; Result = zipOpenNewFileInZip3(hZipFile, "myfile.bin", &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, 15, 8, Z_DEFAULT_STRATEGY, "mypassword", CRC ); if(Result != ZIP_OK) { // Error }
The function for create a new item get a lot of params. If you wan to have more info regarding the meaning of these params you can check the documentation provided with the ZipEngine package. Anyway, if you are not interested to read boring info regarding how many ways you have for "customize" a zip file and want to simply create a normal zip file, you can get the params above and live happy. The zipInfo structure must be filled with the date and time of the item you want to be saved as file info (in the example we used random date and time). Once successfully create the item you can proceed to fill them with the content of the file:
const unsigned int BufferSize = 10000; unsigned char Buffer[BufferSize]; size_t nRead; FILE* pFile; pFile = fopen("myfile.bin", "rb"); while(Result == ZIP_OK && (nRead = fread(Buffer, BufferSize, 1, pFile)) > 0) { Result = zipWriteInFileInZip(hZipFile, Buffer, nRead); } fclose(pFile);
Operation done. Now close the item:
zipCloseFileInZip(hZipFile);
and, if you have no other file to add, close the zip file itself:
zipClose(hZipFile, NULL);
This is a really simply tutorial. As already said, if you are interested in more info regarding the possible params to change in zip file management, you can check the documentation provided with both products. If you are not interested at all simply get these pieces of code and used them in your software. Enjoy!
Should I compile this code on C or C++?
MinGW also gave me a bunch of errors. I guess that something is missing.
The code is in C style than you can compile in both C or C++. The snippets are very simple, which kind of error do you have?
Great thanks for the code! You saved my time.
But I tried to zip non-empty file - without success.
The decision was to replace
fread(Buffer, BufferSize, 1, pFile) to:
fread(Buffer, 1, BufferSize, pFile) or better fread(Buffer, sizeof(unsigned char), BufferSize, pFile)
2 Vinícius:
#include needed for fopen(), fread(), fwrite()
Thanks, this helped me enormously.
A couple of points:
1. I got a convenient combined package from including zlib and zipengine and a Visual Studio 2010 solution.
2. It looks as though some renaming has gone on and in fact hZipFile, m_hZipFile and m_ZipFile are all supposed to be the same identifier.
Thanks, this code really saved my time! :-)
Hello guys, I am trying to use the password protection feature but this doesn't seem to function. The zip file is successfully created with a bin file inside it. I thought that the zip file itself should be Password protected and not the bin file inside it. When I am trying to open the bin file it ask me for a Password, but whatever I give as Input, the file is opened freely.
1) Is there a way to create a Password protected zip file (and not the files inside it)?
2) If not, why the Password protected bin file inside the zip files opens with any Password I give as Input? Any clues? Thanks
It seem really strange you can open your zip file using any password, it's the first time I hear something like this. About "global" password the "engine" of zip file protection allow you to set password for only some files inside a single zip and live free to open the others. This is the reasons the password doesn't cover the entire zip. If you want something like this you should move to .rar compression that allow what you need.
At first, thank you for your fast response. Actually, the password protection of the file-files inside the zip is ok for me. The problem is that it opens with any Password given. Can you please guide me to fix this issue? Thanks in advance.
I'm sorry but I really don't know how to fix your problem since is the first time I hear about a zip password protected file that can be opened using any password. The only suggestion I can give is to verify again if you followed all the steps explained in this post...
Hello, I followed the tutorial. I could create a zip file protected by a password. However I can not open this file with popular zip open program such as WinRar, 7Zip, AlZip. Although I input right password, these programs always notice error message "Wrong password". Could you tell me how to fix this issue. Many thanks !
Hi, is your password string you set in ascii format instead of some unicode format? You have to be sure to inser a "pure" ascii format, this could be a reason of your problem (but is only an hypothesis since I can not verify directly).
Thanks for your answer. But I use password as your sample "mypassword". So I think that insert "pure" ascii password is not problem. Do you have any ideas for my issue ?
Also if you use a password composed by ascii value only if the compiler you use is set to magane unicode string the ascii value will be converted in unicode (two bytes per character). I don't know which compiler you are using or under which OS you are developing but using latest compilers unicode is the standard. Try to unsert the password in binary hexadecimal format (for example, the password "xxx" will be char passwd[] = { 'x', 'x', 'x' }; ). However it could be true the opposite, that mean the winrar tool will suppose password is in unicode format and you insert an pure ascii string. A test would be to try reopen the .zip password file using the same sofware you developed for create your zip (that same compiler). This test will give you a first clue if the zip is created correctly. In positive case try to open with your software a zip password protected created by winrar and see if it work.
I will try your suggestions. Thanks a lot :D
Hi FalsinSoft, could you give me a sample code for unzipping zip files with password. Thank you.
Sorry, I don't have a ready made unzipping code. This post is very old and I don't use this library anymore for my projects.
Ok Thank you :)
Use crc = 0 and the magic appears!!! ; ) | https://falsinsoft.blogspot.com/2012/03/create-password-protected-zip-file.html | CC-MAIN-2018-51 | en | refinedweb |
Daytime protocol. More...
#include <stdlib.h>
#include "core/net.h"
#include "std_services/daytime.h"
#include "debug.h"
Go to the source code of this file.
Daytime daytime service is a useful debugging and measurement tool. The service simply sends the current date and time as a character string without regard to the input. Refer to RFC 867 for complete details
Definition in file daytime.c. | https://oryx-embedded.com/doc/daytime_8c.html | CC-MAIN-2018-51 | en | refinedweb |
an interactive course on Educative.io!
Declaratively Rendering Earth in 3D, Part 1: Building a Cesium + React App with Webpack
This is a post in the Declaratively Rendering Earth in 3D series.
Create-React-App ejection, Webpack tweaks, and use of Webpack's DllPlugin
Intro
Cesium.js is a powerful Javascript library for rendering a 3D globe. It can display a wide variety of geospatial visualizations, including icons and text labels, vector geometries, 3D models, and much more, all on top of a fully-viewable 3D Earth with digital 3D terrain and imagery layers.
Cesium is very similar to Google Earth in concept and capabilities. However, Cesium has many advantages over the now-deprecated Google Earth browser plugin. The Google Earth Plugin was a binary plugin that had to be installed on client systems, and while it had a Javascript API, the internal implementation was a black box of behavior. Also, while GEP could be customized to work with a "Google Earth Enterprise" self-hosted globe data server, GEE licensing was expensive.
On the other hand, while Cesium is primarily developed by employees of AGI, it's a fully open-source Javascript library. Cesium does not require a browser plugin, just the WebGL 3D rendering capability that is built into modern browsers. Cesium also supports a wide variety of imagery and terrain data sources, and can work with both publicly hosted and self-hosted globe data servers.
I've used Cesium in several geospatial applications at work, and have become very familiar with its capabilities. In the process, I've used it with multiple client frameworks, including GWT, Backbone, and now React.
Cesium is a complex toolkit, and dates back to early 2012. Because of that, its architecture has several intricacies that make it somewhat difficult to use in a modern React+Webpack application. While there is existing documentation on how to use Cesium in a Webpack-based application, I haven't yet seen any discussion of how to use it with React. In addition, I've been able to leverage some of Webpack's advanced capabilities to improve the development and deployment process.
In this two-part series, I'll show you how to :
- Set up a basic React app that loads Cesium
- Configure Webpack for faster build times and deployment of an application that uses Cesium using DllPlugin for code splitting
- Use React components to declaratively control rendering of Cesium primitives through Cesium's imperative APIs
This series assumes some familiarity with Cesium, React, and Webpack, and isn't intended to teach the basics for them.
The code for the sample project accompanying this series is on Github at github.com/markerikson/cesium-react-webpack-demo. The commits I made for this post can be seen in PR #1: Configure Webpack I'll be linking to many of the commits as I go through the post, as well as specific files in those commits. I won't paste every changed file in here or show every single changed line, to save space, but rather try to show the most relevant changes for each commit as appropriate.
Table of Contents
- Creating a Basic React+Cesium App
- Optimizing Cesium App Deployment
- Final Thoughts
- Further Information
Creating a Basic React+Cesium App
Initial Setup
We're going to start by using the excellent Create-React-App tool to create our new project. To keep things simple, we'll skip the details of the initial setup steps, but here's a summary:
- Use
create-react-appto create the project and commit it to Git
- Use Yarn to set up a lockfile for the project's dependencies
- Clean out the existing
<App>component so it only renders the text "Empty"
- Use Yarn to add Cesium as a dependency to the project
At the time of writing, the current versions are CRA 0.9.2 and Cesium 1.31.
Configuring Webpack to Use Cesium
As mentioned, Cesium has many complexities in its architecture that make it difficult to use with Webpack out of the box. This includes:
- Cesium is currently written using the AMD module format for its source files
- It includes some pre-bundled AMD-based third-party libraries
- Cesium makes heavy use of web workers
- Some of the code uses multi-line strings
The primary documentation on using Cesium with Webpack comes from the article Cesium and Webpack on Cesium's blog, and the sample repo mmacaula/cesium-webpack, both written by Mike Macaulay. In his tutorial, he discusses two ways to use Cesium: using the pre-built Cesium bundle, and using Cesium's source directly. We're going to use the "source" approach to start with.
As the blog post points out, we need to set two specific Webpack config options for this to work right. We need to set
sourcePrefix: '' to fix Webpack indenting multi-line strings improperly, and also set
unknownContextCritical: false to stop Webpack from printing warnings about certain libraries being loaded.
Unfortunately, since we're using Creact-React-App, we don't have direct access to the Webpack config files, since CRA hides them from us by default. So, we're going to have to use CRA's "escape hatch": the
npm run eject command. This will copy all of CRA's config files into our own project, and update
project.json to include all the individual tool dependencies instead of the single
react-scripts dependency. After we eject, everything will still run exactly the same, but we can no longer simply upgrade the
react-scripts dependency to get the latest build system updates - we now "own" all the build config ourselves.
After ejecting and committing the newly visible config files, we can make the necessary config tweaks.
First, per the instructions in the "Cesium and Webpack" tutorial, we need to copy Cesium's pre-built worker files and assets to our public folder. This is a manual step, and doesn't involve any commits. Browse into
$PROJECT/node_modules/cesium/Build/. You should see two folders,
Cesium and
CesiumUnminified. Copy the entire
Cesium folder over to
PROJECT/public/, and rename it to
cesium. Then, delete the
Cesium.js file that's just inside. You should now have the following folder structure:
- $PROJECT - public - cesium - Assets - ThirdParty - Widgets - Workers
Since we don't want to actually commit these files, it's a good idea to add a line to the project's
.gitignore file to ignore these:
Commit c47204c: Ignore the public/cesium folder containing the copied Cesium output
.gitignore
# production /build +/public/cesium/
Then, we'll add the needed config tweaks to the Webpack config files:
Commit 2015273: Add Webpack config options needed to run Cesium
config/webpack.config.dev.js
publicPath: publicPath, + sourcePrefix : '', // Skip ahead module: { + unknownContextCritical : false,
This should be done for both the development and production configs.
Before we can actually load the Cesium Viewer widget into our application, we have to configure Cesium so it knows how to construct the URLs for all of its assets. That requires a call to the
buildModuleUrl() function that Cesium provides. Once that's done, we can load the Viewer instance and have things work correctly.
Commit 17479d3: Add initial Cesium viewer to the app
src/index.js
import App from './App'; import './index.css'; +import "cesium/Source/Widgets/widgets.css"; + +import buildModuleUrl from "cesium/Source/Core/buildModuleUrl"; +buildModuleUrl.setBaseUrl('./cesium/');
Note that we set the base URL to
"./cesium/", which corresponds to the pre-built Cesium folder we copied earlier into
$PROJECT/public.
From there, all we have to do is use the standard React approach for interacting with code that needs to access a DOM element directly. We render a div that will serve as the container for our Cesium widget, and use a "callback ref" to save a reference to the real DOM element. Then, in
componentDidMount, we create the Cesium.Viewer instance, and give it the div reference to serve as its parent:
src/App.js
import React, { Component } from 'react'; import Viewer from "cesium/Source/Widgets/Viewer/Viewer"; class App extends Component { componentDidMount() { this.viewer = new Viewer(this.cesiumContainer); } render() { return ( <div> <div id="cesiumContainer" ref={ element => this.cesiumContainer = element }/> </div> ); } }
Notice that we're importing pieces from inside Cesium's folder structure, rather than just
import Cesium from "cesium".
If we run the project, here's what we should see:
Success! We've loaded Cesium, and are viewing a 3D globe with the Cesium Viewer in its default configuration. (If you squint carefully at the image, you'll see that the viewer doesn't actually fill the whole screen - there's a bunch of blank space below. We'll fix that in the next part.)
That wraps up the basic application setup. Let's move on to setting up a proper production build.
Optimizing Cesium App Deployment
Thus far, we've been simply importing Cesium directly into our main application. That's okay as a starting point, but it also means that our main application bundle is going to include pretty much all of Cesium. Unfortunately, Cesium is a big toolkit. Let's run a production build of the application:
$ node scripts/build.js Creating an optimized production build... Compiled successfully. File sizes after gzip: 532.54 KB build\static\js\main.304c45dc.js 4.78 KB build\static\css\main.c5310e60.css Done in 48.13s.
Hmm. "532KB after gzip?" That seems big. Let's check out what goes into the bundle, using the
source-map-explorer to view the contents of the minified bundle:
EEEP! Our production app bundle is over 2MB, and Cesium itself is taking up 1.8MB of minified Javascript!!! That's... not good, to say the least. Meanwhile, Cesium's various web workers and assets, while loaded separately, are also a significant chunk of space as well. Yes, gzipping the bundle will take that down to about 532KB, but that's still way more than we'd like to load at once.
The bad news is that there's only so much we can do to solve this. Cesium is simply a very large, very complex toolkit, and there's nothing we can do to fully shrink down the size of Cesium itself. Any app using Cesium will never win awards for "Smallest Total Loading Size".
However, the good news is that we can separate Cesium out from our application bundle. We do still need to load it, and in fact we'll need to load it before the app bundle, but by separating it out we can at least make it cached for the next time the user loads the app. Also, by pre-building the Cesium bundle, we can cut down on production build time for our application's bundle.
Serving Cesium Assets in Development
Before we get to building Cesium as a separate bundle, we can make an improvement to our development process. All this time, we've had a copy of Cesium's pre-built output folder sitting in our
$PROJECT/public/cesium/ folder, because those files need to be loaded by Cesium at runtime from the server. We can remove the need for that by modifying the CRA dev server setup so that it serves those files directly out of
node_modules/cesium/.
First, we'll add a few more entries to CRA's list of pre-defined paths:
Commit 73bdbe2: Add additional paths for use in build config
config/paths.js
ownNodeModules: resolveApp('node_modules'), + app : resolveApp('.'), + appConfig : resolveApp('config'), + cesiumDebugBuild : resolveApp('node_modules/cesium/Build/CesiumUnminified/'), + cesiumProdBuild : resolveApp('node_modules/cesium/Build/Cesium/'), + cesiumSourceFolder : resolveApp('node_modules/cesium/Source/'), nodePaths: nodePaths,
Then, we'll make a small edit to CRA's dev server setup to tell it to serve static files directly out of the right folder:
Commit eabdcf5: Modify CRA dev server to serve Cesium files from node_modules
scripts/start.js
var openBrowser = require('react-dev-utils/openBrowser'); var prompt = require('react-dev-utils/prompt'); +var express = require("express"); // Skip ahead function addMiddleware(devServer) { + // Handle requests for Cesium static assets that we want to + // serve up direct from /node_modules/cesium/. + devServer.use("/cesium", express.static(paths.cesiumDebugBuild)); +
We should now be able to delete the
cesium/ folder from
$PROJECT/public/, at least in terms of development. CRA automatically copies everything inside of
/public/ to the build output folder when it does a production build, so we'll need to add some custom logic to handle copying Cesium's assets for production builds. We'll come back to that in a bit.
Building a Cesium Bundle using DllPlugin
Webpack has several ways to create bundles and chunks. The most widely used methods are declaring bundle entry points in the
entry section of a Webpack config, and using the
CommonsChunkPlugin to extract files that are shared between multiple chunks into a separate bundle.
There's another Webpack plugin that's less well known:
DllPlugin. Named after the idea of a native code "Dynamic Link Library" from Windows (or
.so for you *nix users), the idea is that you pre-build a bundle containing the reusable or shared portions of your code, and also create a metadata file that describes what's inside the bundle. Then, when you build your application itself, you add a reference to the metadata so that Webpack knows what code should already be available. Webpack will then skip including those pieces in your app bundle.
Building a DLL bundle requires creating a new Webpack config that's separate from the application configs. Here's what the config looks like:
Commit 4ddc26a: Add a Webpack config to pre-build a Cesium bundle
config/webpack.cesium.dll.config.js
"use strict"; const path = require("path"); const webpack = require("webpack"); const paths = require("./paths"); const env = require("./env"); const outputPath = path.join(paths.app, "distdll"); const webpackConfig = { entry : { cesiumDll : ["cesium/Source/Cesium.js"], }, devtool : "#source-map", output : { path : outputPath, filename : "[name].js", library : "[name]_[hash]", sourcePrefix: "", }, plugins : [ new webpack.DllPlugin({ path : path.join(outputPath, "[name]-manifest.json"), name : "[name]_[hash]", context : paths.cesiumSourceFolder, }), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify("production") }), new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }) ], module : { unknownContextCritical : false, loaders : [ { test : /\.css$/, loader: "style!css" }, { test : /\.(png|gif|jpg|jpeg)$/, loader : "file-loader", }, ], }, };
Some key things to note here. First, we're building this in production mode by setting
process.env.NODE_ENV="production" and minifying it. We've also included the couple specific config settings we had to tweak earlier.
The really important part is that we're including the
DllPlugin in the config. The
path option tells Webpack where to write the metadata file,
name is the name of the bundle file itself, and I think
context has to do with how the imported source files are looked up. Roughly. :)
Now that we have the config file, we need to actually run Webpack with this config to generate our Cesium DLL bundle. I've written a couple new script files to control this process. One encapsulates the work of running Webpack with a certain config and printing out some readable stats, and the other just calls the Webpack compiler script with the Cesium DLL config.
Commit b55dbd5: Add scripts to build a Cesium bundle with DllPlugin
We'll skip looking at the script contents, but here's the output of running the DLL build script:
$ node ./scripts/buildCesiumDLL.js Compiling: cesium build [====================] 100% (35.5 seconds) () Build completed in 35.47s Hash: 0829da3ac0fb7ef638b5 Version: webpack 1.14.0 Time: 35472ms Asset Size Chunks Chunk Names cesiumDll.js 2.13 MB 0 [emitted] cesiumDll cesiumDll.js.map 19 MB 0 [emitted] cesiumDll Done in 37.33s.
If we look in
$PROJECT/distdll, we should see three files:
cesiumDll.js,
cesiumDll.js.map, and
cesiumDll-manifest.json. Cesium is still a really hefty chunk of code, but at least now it's a separate file.
Using a DLL Bundle in the Application
Happily, the hard part is done. Now that we have the DLL bundle generated, we can point our production Webpack config at the manifest file:
Commit 6db616f: Update Webpack prod config to use the Cesium DLL bundle
config/webpack/config.prod.js
+var path = require('path'); var autoprefixer = require('autoprefixer'); // Skip ahead plugins: [ + new webpack.DllReferencePlugin({ + context : paths.cesiumSourceFolder, + manifest: require(path.join(paths.app, "distdll/cesiumDLL-manifest.json")), + }),
We just add
DllReferencePlugin to the production config, set the
manifest option to point to the manifest file that was generated earlier, and use the same
context option we used when we generated the DLL (to make sure that source file references match before and after).
Let's re-run a production build of the app and see how things look:
$ node scripts/build.js Creating an optimized production build... Compiled successfully. File sizes after gzip: 46.09 KB build\static\js\main.f984614f.js 4.78 KB build\static\css\main.c5310e60.css Done in 10.43s.
That looks much better! The compile time dropped from 48 seconds to about 10 seconds, and the main bundle is down to 46KB gzipped. Let's take another look at the contents of the bundle using
source-map-explorer:
The overall application bundle is now down to 150KB. We're now looking at just the application code plus the non-Cesium libraries. There's more we could do to optimize, but this is sufficient for the concepts I wanted to show off.
Including Cesium in Production
We now need to actually include Cesium into the production build output. Since we deleted the hand-copied
public/cesium folder, Cesium's assets aren't being copied to
/build/ any more. We can add some logic to CRA's existing build script to do that. It'll just do some glob searching to collect a list of files under
node_modules/cesium/Build/Cesium/, and copy each one to the output folder, along with the Cesium DLL bundle we've created.
Commit 902ba04: Update build script to copy Cesium files to the output folder
The last step is to actually include the Cesium DLL bundle into our page. CRA uses the HtmlWebpackPlugin to insert the right script tags into the
index.html template during the build process. We can customize the template so that it only includes the DLL bundle during a production build.
Commit c65e7bd: Conditionally include Cesium bundle in the HTML host page
config/webpack.config.prod.js
new HtmlWebpackPlugin({ inject: true, template: paths.appHtml, + production : true,
HtmlWebpackPlugin takes a number of specific options, but you can also add any other options you want, and it will pass them through. So, since we know we're doing a prod build when this config is being used, we just add a
production : true option that we can use in the template.
public/index.html
<body> <div id="root"></div> + <% if(htmlWebpackPlugin.options.production) { %> + <script src="cesium/cesiumDll.js"></script> + <% } %> <!--
HtmlWebpackPlugin uses Lodash templating, so we can insert a simple check for the
production option we added, and only include the Cesium DLL script tag if it's a prod build.
Note that the Cesium DLL bundle must be loaded before the main application bundle! This is because the DLL bundle exposes its contents as a global variable (such as
var cesiumDll_0829da3ac0fb7ef638b5 ), and the
DllReferencePlugin adds logic to look for that specific variable.
With that, we should be able to run an HTTP static file server from our
build folder, and see the application successfully load!
Wrapping Up Webpack Optimization
While I was working on this post, I had intended to demonstrate lazy-loading the DLL bundle using Webpack's code-splitting abilities. Unfortunately, I realized that what I'm doing in my own app right now doesn't actually qualify as lazy-loading. I've got some code-splitting in place, but as we just saw, bundles produced by DllPlugin still have to be loaded manually. Since a DLL bundle is usually vendor libs, it's reasonable to have a specific script tag that loads the DLL bundle first.
There's a couple threads in the Webpack issues tracker that discuss ways to actually load DLL bundles at runtime, so that they truly are lazy-loaded. The consensus seems to be that it's possible, but it requires use of some non-Webpack loading code to make it work. See Webpack issues #2592 and #3115 for discussion on the topic.
It's also important to note that DllPlugin doesn't actually reduce the amount of code that has to be loaded, but it does split things into more cacheable pieces.
Final Thoughts
Cesium is a complex and powerful library, and Webpack is a complex and powerful build tool. Getting them to play nicely together takes a bit of work, but is well worth the effort.
Next up in Part 2, we'll look at how to use React components to control Cesium's API. Be sure to check it out!
Further Information
- Cesium and Webpack
- Cesium Blog: Cesium and Webpack
- Repo: Cesium and Webpack tutorial and examples
- Repo: Cesium-Webpack project template
- Cesium group: "Incompatible with Webpack"
- Cesium group: "Cesium usage with Webpack?"
- Cesium #2981: Making Cesium Webpack and Browserify friendly
- Cesium #4876: Fix remaining issues that require special Webpack config settings?
- Webpack Optimization with DllPlugin
- Webpack Plugins we been keeping on the DLL
- RRUHE #616: DllPlugin usage summary
- React-Boilerplate #495: Implement DllPlugin
- Optimizing Webpack for Faster React Builds
- Optimizing Webpack build times and improving caching with DLL bundles
- Building Vendor and Feature Bundles with Webpack
- Webpack #2592: Proposal - Dll-like plugin for an external context
- Webpack #3115: How to lazy load a DLL bundle?
- Formidable Playbook: Webpack Shared Libs
This is a post in the Declaratively Rendering Earth in 3D series. Other posts in this series:
- Mar 07, 2017 - Declaratively Rendering Earth in 3D, Part 1: Building a Cesium + React App with Webpack
- Mar 07, 2017 - Declaratively Rendering Earth in 3D, Part 2: Controlling Cesium with React | https://blog.isquaredsoftware.com/2017/03/declarative-earth-part-1-cesium-webpack/ | CC-MAIN-2018-51 | en | refinedweb |
In this article, we’ll talk about Xamarin, a C# .NET tool enabling development of cross-platform mobile applications. We’ll focus on the missing part: the reuse of native libraries.What is Xamarin?
Xamarin is not only a product but also a company. The product addresses a common issue, the unified cross-platform development.
Xamarin allows to create native applications on iOS, Android and Windows Phone platforms. Its upside lies in the reuse of code, reducing the time to market.
Xamarin also provides its own development environment, Xamarin Studio.
With Xamarin, it’s important to grasp that applications are run natively. Every iOS or Android APIs are available from C# code. It’s true for push notifications, contacts integration, Bluetooth…Sure, but what’s going on in real life? Regarding code sharing, in particular?
Today, there are two different ways to build a Xamarin project.
The first one consists of building a solution with an Android project, an iOS project, and a common project (created as a Portable Class Library).
This Portable Class Library (based on a curtailed subset of .Net features) will bear most of the reusable code. It will embed our “Models”, our service access layer, … Since 2014, Xamarin supports the MVVM pattern, famous among rich or Modern XAML-based applications developers. Actually, ViewModels and Models will be shared through this common library. For more inputs on the subject, Xamarin’s documentation is fairly thorough.
The second way is to use the Shared Project solution
In a Shared Project, we can develop reusable code while injecting target platform specificities. In a Shared Project, each file is copied into sub-projects (iOS, Android, Windows Phone) during compilation. Compilation directives will let us execute platform specific code.It’s also possible to share views. Xamarin.Form relies on this kind of project to build very simple applications with little visual specificities. This feature applies to business applications, prototypes or applications with a strong visual identity requiring a single rendering on whichever platform.
Therefore, a Shared Project is less binding than a Portable Class Library (PCL), since the latter curtails access to the .NET Framework depending upon the PCL’s targeted platform.
I wrote libraries on each platform, I don’t want to rewrite everything for Xamarin, is that an option?
The answer is yes. Xamarin provided a feature to address this issue a year ago: Binding projects. Binding projects build a DLL (therefore usable with C#) that exposes iOS and Android native library APIs.
This kind of project is interesting for framework publishers, since they can release their native framework on the Xamarin platform within short delays and low cost.The Android Binding Project
Xamarin.Android provides two ways to expose a java library:Use Java Native Interface (JNI) to directly call methods. Create a Java Binding Library project which exposes the library’s APIs in C#. The latter will be developed in this article.
The binding is implemented using 2 mechanisms:the Manage Callable Wrappers (MCW): the MCW is a JNI bridge which is used at each call to the java library embedded into Xamarin C# code The Android Callable Wrappers (ACW): conversely, ACW is a JNI bridge which is used each time Android runtime code (ART) calls “managed code”
To bind a java library, follow the following steps:Create a Java Binding Library project Add the jar as an “EmbeddedJar” and all its dependencies as “EmbeddedReferenceJar” (here we used jar files as example, but aar files can be binded as well with little more effort) Resolve binding related issues that may occur due to automated generation (you may need to delete nodes that shouldn’t be exposed)
This can be done by looking into 3 generated xml configuration files:EnumFields.xml: binds java int constants to C# enums EnumMethods.xml: binds java int return types and parameters to C# enums MetaData.xml: change the generated API (rename a namespace, hide irrelevant methods…)
For instance, we may want to hide a few classes within the jar. This is done with one line in the MetaData.xml file as follows<remove-node
Once the binding project configured and compiled, you only need to add it as a reference from your Android Xamarin project. There are still several things to do in the MetaData.xml file, including renaming the methods parameters. Indeed, on a java method defined as such:public static void log (string logLevel, string message)
The output will be:public static void Log (string p0, string p1)
Not very user friendly for the developer who’ll use the SDK. To rename the method parameters, add these lines:<attr path="/api/package[@name='com.octo.android']/class[@name='MyClass']/method[@name='log']/parameter[@name='p0' and @type='java.lang.String']" name="name">logLevel</attr><attr path="/api/package[@name='com.octo.android']/class[@name='MyClass']/method[@name='log']/parameter[@name='p1' and @type='java.lang.String']" name="name">message</attr>
For further information about java library (.jar) binding, you can refer to the Xamarin documentation:
Now that you have a DLL embedding the jar, you need to add it to the Xamarin Android project. You can now access it as if it was a regular C# DLL!
To properly use your new library, you should obviously take a thorough look at its documentation. You need to make sure that the required methods are accessible, the configuration files are added and the resource keys are properly set in these files.The iOS Binding Project
This kind of project requires to be developed on a Mac OS system (or at least to have one usable as a build host, as explained further). First, you’ll need the latest version of XCode, then Xamarin for Mac OS. Reversing this order may cause issues during the project compilation.
To bind a static iOS library, follow these steps:Create an iOS Binding Project Add the library (.a) to your project Declare the interfaces to be mapped in the ApiDefinition.cs file
Once the iOS library is added, you may need to edit the *.linkWith.cs file to import the library dependencies.For instance, this line imports the lsqlite3.dylib required by my iOS library:[assembly: LinkWith ("[myLib].a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator, ForceLoad = true, Frameworks = "CoreFoundation CoreGraphics CoreLocation Foundation QuartzCore UIKit", LinkerFlags = "-lsqlite3", IsCxx = true)]
Once the dependencies are properly imported, you need to define the interfaces that should be made available from the resulting DLL.To do that, browse the .h file and add a C# interface in ApiDefinition.cs for each Objective-C interface found.
For example, from the following Objective-C interface:@interface MyClass : NSObject+ (void)init;- (NSString *)reverse:(NSString *)value;- (NSString *)concat:(NSString *)a and:(NSString *)b;+ (NSUUID *)currentId;@property bool allOk;@end
The ApiDefinition.cs file mapping this interface will be:namespace myLib.iOS{[BaseType (typeof (NSObject))]public interface MyClass { [Static, Export ("init")]bool Init(); [Export ("reverse:")]void Reverse(string value); [Export("concat:and")]string Contact([NullAllowed]string a, [NullAllowed]string b); [Static, Export("currentId")]string CurrentId { get; set; } [Export("allOk")]bool AllOk { get; set; } }}
Here are a few tips to bear in mind when writing the binding:The interface to be mapped must be decorated by a BaseType attribute having the interface type as a parameter (NSObject in our example, but it depends on the interface). The interface methods, variables and properties must be decorated with the Export(method/property/variable name) property. Some types need to be converted to C# (refer to Xamarin documentation Type mappings section ) The nullable parameters must be preceded with [NullAllowed], otherwise the code generated by Xamarin will raise an exception on null parameters without calling the iOS library method! The methods without any parameter only need to be declared with their name (iOS wise) as an Export parameter: Export(“init”). Methods with only one parameter, must be followed by “:” after their name: Export (“reverse : “)]. The Objective-C syntax allows for a method name to be split by its parameters. For instance, the second method’s name above is “concat” and “and”. This method is mapped by including “:” after each part of the method name: Export(“concat:and:”) Static methods, properties and class variables must be decorated with the Static attribute.
For further information about iOS library (.a) binding, you can refer to Xamarin documentation:
To use your now binded library, all that’s left to do is adding your binding project into your Xamarin iOS project to access all of the features mapped in the ApiDefinition.cs file.I am not too comfortable with Mac OS, can I keep using Windows?
You can configure a Mac to delegate compilation from a Visual Studio on Windows.
Indeed, Xamarin provides a Mac OS tool allowing for a Windows / Visual Studio developer to compile both binding project and Xamarin iOS project from his workstation. It’s called Xamarin.iOS Build Host. Once the service started on the Mac, the developer only needs to reference the Mac IP address from the Windows computer and to fill in the PIN code generated by Xamarin.iOS Build Host:
Thanks to Xamarin, the .NET developers used to Visual Studio C# can create iOS (iPhone, iPad, Watch) or Android (smartphone, tablet, wear) applications, and of course share code with the Microsoft ecosystem (Phone, Tablet). Therefore, you can choose Xamarin for a cross-platform development if your teams are already familiar with .NET. However, they won’t improvise themselves Android or iOS developers, and a considerable learning effort is still necessary to grasp each platform’s specificities. | http://www.dlxedu.com/detail/28/438481.html | CC-MAIN-2018-51 | en | refinedweb |
- Micha Kops
- Jul 26, 2017
- Updated on Jul 26, 2017
- Tagged as Java Testing
Testing a Java Spring Boot REST API with Karate
Learn how to write web service tests with Karate, a new framework for scripting HTTP sequences specifying expectations.
Introduction
This tutorial will show you how to write web service tests with the Karate framework. We will start with a short introduction about the basic features, then we will explore the domain-specific language (DSL), and learn how to apply it to verify a web service's response and the returned JSON structures.
As integration with existing frameworks is important, we will demonstrate how to integrate well-known tools like JUnit, TestNG, and Maven to execute our tests and generate reports that may be used for integration-servers/services.
This tutorial will also cover other interesting aspects of this framework like configuration files, data tables, switching HTTP client implementations or more complex use cases like testing multipart file uploads.
Finally, we will show you how easy it is to set up a build plan on Semaphore for Karate tests in a few seconds.
Prerequisites
We assume that you posses general knowledge of the HTTP protocol, the JSON notation, basic Java ™ knowledge and experience in using build tools like Maven.
To integrate Karate in our project using Maven as build tool, we only need to add the following two dependencies if JUnit is our test framework of choice:
<dependency> <groupId>com.intuit.karate</groupId> <artifactId>karate-apache</artifactId> <version>0.4.1</version> <scope>test</scope> </dependency> <dependency> <groupId>com.intuit.karate</groupId> <artifactId>karate-junit4</artifactId> <version>0.4.1</version> <scope>test</scope> </dependency>
Integrating with TestNG as alternative is convered later on in this tutorial.
About Karate
Karate is a new web services testing framework build on top of the popular Cucumber library. It eases the testing process allowing developers without Java ™ knowledge to script sequences of HTTP calls and specify expectations for the web services response easy and fast, offering a custom domain-specific language.
The project itself is quite new as the first commit was in February 2017 but its author and main contributor, Peter Thomas is very busy adding new features and pushing new releases.
Features of Karate
In addition to the features mention above, the Karate library offers a variety of additional features:
- Cucumber based, Gherkin syntax supported — IDE support and syntax-highlighting are supported,
- 'Native' JSON and XML support including JsonPath and XPath expressions,
- Re-usable scripts and feature files that may be called from other scripts and feature files,
- Embedded JavaScript engine that allows to write reusable functions in Javascript,
- Re-use of payload-data and user-defined functions across tests,
- Configuration switching/staging support,
- Multi-threaded parallel execution support,
- Ability to invoke Java classes from a test,
- Select between Apache and Jersey HTTP client to avoid conflicts with existing dependencies, and
- Simple latency assertions may be used to validate non-functional requirements in respect of performance requirements.
Many other features are listed on the GitHub project.
Implementing Karate Tests
We're now ready to write our first tests. Tests consist of a Java ™ class that might be recognized by the designated test framework used and a feature file that describes our interaction with the service under test.
Directory Structure
The test classes are save in src/test/java/feature and our feature files in src/test/resources/feature — this follows the naming conventions and allows the Java ™ class to find its corresponding feature file.
└── src └── test ├── java │ └── feature └── resources └── feature
Feature Files
Karate features are written in a DSL that we'll be covering in the following examples.
Our features are generally stored in resources/feature so that feature files and Java ™ tests are matched by their name and package structure.
JUnit Integration
All we need to do to integrate JUnit is to create a test class addressing our corresponding JUnit runner, so that a minimal approach could look like the following class.
package feature; import org.junit.runner.RunWith; import com.intuit.karate.junit4.Karate; @RunWith(Karate.class) public class SomeFeatureTest {}
If we need to set up instrumentation for our tests, we can use JUnit's lifecycle mechanisms like @Before, @BeforeClass, @After, @AfterClass, test rules and so on.
Simple Hello World Example
We're now ready to start with a simple example.
Assuming that we've got a simple RESTful web service running on localhost (e.g.) that returns a random quote when called in a GET request.
The response is returned using the JSON format and looks like this one:
{ "quote":"Hello world, use Karate! :)" }
We're starting by writing our expectation in a new feature file named quote.feature saved in src/test/resources/feature/quote:
In this feature file, we're defining a new feature named "Quote generator", and setting a global setting for our base url (named url).
Afterwards we're adding one scenario for fetching random quotes and assure that the response status code is 200 and that the quote in the response's JSON structure is not null using a special marker.
The following markers are currently supported:
- #ignore Ignores the field.
- #null Value must be null.
- #notnull Value must not be null.
- #array Value must be JSON array.
- #object Value must be JSON object.
- #boolean Value must be true or false.
- #number Value must be a number.
- #string Value must be a string.
- #uuid Value must match the UUID format.
- #regex Value matches a regular-expression.
- #? EX Javascript expression EX must evaluate to true.
More detailed information about the rich syntax of Karate's DSL can be found in the project's wiki.
Feature: Quote generator Background: * url Scenario: Fetch random quote Given path '/quote' When method GET Then status 200 And match $ == {quote:'#notnull'}
In the next step, we're adding a Java ™ class so that JUnit's test-runner executes our test.
Following the naming conventions, we're creating a the following class named QuoteTest in src/test/java/feature/quote:
package feature.quote; import org.junit.runner.RunWith; import com.intuit.karate.junit4.Karate; @RunWith(Karate.class) public class QuoteTest {}
We may now run our test using Maven in the command line as follows:
$ mvn test ------------------------------------------------------- T E S T S ------------------------------------------------------- Running feature.quote.QuoteTest 11:56:31.648 [main] DEBUG com.intuit.karate.cucumber.CucumberRunner - init test class: class feature.quote.QuoteTest 11:56:31.756 [main] DEBUG com.intuit.karate.cucumber.CucumberRunner - loading feature: /data/project/karate-bdd-testing/target/test-classes/feature/quote/quote.feature [..] 1 > GET [..] 1 < 200 1 < Content-Type: application/json 1 < Server: Jetty(9.2.13.v20150730) 1 < Transfer-Encoding: chunked 1 < Vary: Accept-Encoding, User-Agent { "quote": "Hello world, use Karate! :)"} [..] 1 Scenarios (1 passed) 5 Steps (5 passed) 0m0.866s Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.874 sec Results : Tests run: 6, Failures: 0, Errors: 0, Skipped: 0
Or alternatively using our IDE of choice:
Data Tables Example
Data tables allow us to add datasets in a tabular form as examples for our tests, and also use this information to fill our tests and assertions.
Feature: Name transformation Background: * url '' Scenario Outline: Transform multiple names Given path '/name' And request {name:'<name>'} When method POST Then status 200 And match $ == {length:'<length>'} Examples: | name | length | | Tim | 3 | | Liz | 3 | | Selma | 5 | | Ted | 3 | | Luise | 5 |
Again, we can run these tests using Maven in the command line like this:
$ mvn test ------------------------------------------------------- T E S T S ------------------------------------------------------- Running feature.name.NameTest 13:43:23.567 [main] DEBUG com.intuit.karate.cucumber.CucumberRunner - init test class: class feature.name.NameTest 13:43:23.688 [main] DEBUG com.intuit.karate.cucumber.CucumberRunner - loading feature: /data/project/karate-bdd-testing/target/test-classes/feature/name/name.feature [..] 1 > POST 1 > Content-Type: application/json {"name":"Tim"} [..] 1 < 200 1 < Content-Type: application/json 1 < Server: Jetty(9.2.13.v20150730) 1 < Transfer-Encoding: chunked {"length":"3"} [..] 5 Scenarios (5 passed) 30 Steps (30 passed) 0m1.288s Tests run: 35, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.334 sec Results : Tests run: 35, Failures: 0, Errors: 0, Skipped: 0
Or alternatively using our IDE of choice:
Complex Example
To demonstrate Karate's capabilities when dealing with file uploads and Multipart requests, we're going to write tests for a RESTful web service for file management.
This service allows us to upload files that are stored in a temporary directory, and also to list all stored files.
Throughout its APIs, the JSON format is used for the server's response messages.
For demonstration purpose, we have hacked together a quick and ugly implementation using Spring Boot.
File Store Service
This is our simple file store application written with Spring Boot:
package com.hascode.tutorial; // imports .. @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
This is our RESTful web service implementation:
package com.hascode.tutorial; // imports .. @Controller public class FileUploadController { // setup, temp-dir etc .. @GetMapping("/") @ResponseBody public ResponseEntity<List<FileDto>> listFiles() { return ResponseEntity .ok() .contentType(MediaType.APPLICATION_JSON) .body(Arrays.stream(store.listFiles()).map(FileDto::of).collect(Collectors.toList())); } @PostMapping("/") @ResponseBody public ResponseEntity<Map<String, Object>> uploadFile(@RequestParam("file") MultipartFile file) throws IOException { // store file Map<String, Object> response = new HashMap<>(); response.put("error", false); response.put("bytesUploaded", file.getBytes().length); return ResponseEntity .ok().contentType(MediaType.APPLICATION_JSON).body(response); } @ExceptionHandler(FileNotFoundException.class) public ResponseEntity handleStorageFileNotFound(FileNotFoundException e) { return ResponseEntity.notFound().build(); } // simple DTO private static class FileDto { private final String name; private final long sizeInBytes; private FileDto(String name, long sizeInBytes) { this.name = name; this.sizeInBytes = sizeInBytes; } public static FileDto of(File file) { return new FileDto(file.getName(), file.length()); } public String getName() { return name; } public long getSizeInBytes() { return sizeInBytes; } } }
Starting the RESTful Web Service
We may run our service now using our IDE of choice or by using Maven in the command line as follows:
$ mvn spring-boot:run [..] . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.3.RELEASE) [..] 06-09 13:53:39.316 INFO 14498 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) [..] 2017-06-09 13:53:39.792 INFO 14498 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[POST]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> com.hascode.tutorial.FileUploadController.uploadFile(org.springframework.web.multipart.MultipartFile) throws java.io.IOException 2017-06-09 13:53:39.793 INFO 14498 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.util.List<com.hascode.tutorial.FileUploadController$FileDto>> com.hascode.tutorial.FileUploadController.listFiles() [..] 2017-06-09 13:53:40.270 INFO 14498 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2017-06-09 13:53:40.274 INFO 14498 --- [ main] com.hascode.tutorial.Application : Started Application in 2.463 seconds (JVM running for 4.887)
Accessing the Service
We are now ready to access our RESTful web service and practice some Karate with it.
First, let's have a short introduction of the APIs exposed and how to access them using regular tools like curl or Postman.
Storing a New File
We may upload files to the service that are stored in a temporary directory.
In the following examples, we're uploading sample PDF files to our webservice.
Uploading a file with curl:
curl -vi -XPOST -F file=@test.pdf
Uploading a file with Postman:
Listing Stored Files
The second API allows us to list stored files and receive a JSON response containing the file's names and size (in bytes).
List stored files with curl:
$ curl -vi -XGET
Response:
Assuming that we have uploaded two files named test.txt and test1.txt the following JSON structure is returned.
[ { "name": "test1.txt", "sizeInBytes": 53 }, { "name": "test.txt", "sizeInBytes": 41 } ]
List stored files with Postman:
Karate Test for the File Service
To demonstrate how easy it is to test file-uploads and/or file-multipart requests, we're going to write a quick test for the file server above.
Test Configuration
In the first step, we're using a separate configuration file to load the base url from a file and support staging.
For this purpose, we're adding a file named karate-config.js to the directory src/test/resources:
function() { return { baseUrl: '' } }
From now on, we're referencing our base-url in our feature-files like this:
Background: * url baseUrl
Feature File
This is our feature file that describes how we're interacting with our webservice's upload and file-listing functions.
Feature: Uploading a file Background: * url baseUrl Scenario: Upload file Given path '/' And multipart field file = read('test.pdf') And multipart field name = 'test.pdf' When method POST Then status 200 And match $ == {error: false, bytesUploaded:'#notnull'} Given path '/' And multipart field file = read('test1.pdf') And multipart field name = 'test1.pdf' When method POST Then status 200 And match $ == {error: false, bytesUploaded:'#notnull'} Scenario: List uploaded files Given path '/' When method GET Then status 200 And match $.length() == 2
Directory Structure
Our test directory structure should now look similar to this one:
src/test ├── java │ └── feature │ └── file │ └── FileTest.java └── resources ├── feature │ └── file │ ├── file.feature │ ├── test1.pdf │ └── test.pdf └── karate-config.js
Running the Test
We may run our tests again using Maven in the command line or using our IDE of choice.
$ mvn test [..] ------------------------------------------------------- T E S T S ------------------------------------------------------- Running feature.file.FileTest 17:05:46.548 [main] DEBUG com.intuit.karate.cucumber.CucumberRunner - init test class: class feature.file.FileTest 17:05:46.671 [main] DEBUG com.intuit.karate.cucumber.CucumberRunner - loading feature: /data/project/karate-bdd-testing/target/test-classes/feature/file/file.feature [..] 1 > POST 1 > Accept-Encoding: gzip,deflate 1 > Connection: Keep-Alive 1 > Content-Type: multipart/form-data; boundary=fgmmzFn4TdUJNb-aFXVLkGTwHY9GCma2fZ 1 > Host: 127.0.0.1:45074 1 > Transfer-Encoding: chunked 1 > User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_45) 17:05:47.105 [main] DEBUG com.intuit.karate - 1 < 200 1 < Content-Type: application/json 1 < Date: Thu, 06 Jul 2017 15:05:47 GMT 1 < Transfer-Encoding: chunked {"bytesUploaded":6514,"error":false} [..] 2 > POST 2 > Accept-Encoding: gzip,deflate 2 > Connection: Keep-Alive 2 > Content-Type: multipart/form-data; boundary=YqMIBXLu-C1HQkMo0AuggtF2vcd3-XuWRJ 2 > Host: 127.0.0.1:45074 2 > Transfer-Encoding: chunked 2 > User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_45) 17:05:47.170 [main] DEBUG com.intuit.karate - 2 < 200 2 < Content-Type: application/json 2 < Date: Thu, 06 Jul 2017 15:05:47 GMT 2 < Transfer-Encoding: chunked {"bytesUploaded":6514,"error":false} 17:05:47.170 [main] DEBUG com.intuit.karate - response time in milliseconds: 6 17:05:47.225 [main] DEBUG com.intuit.karate - 1 > GET 1 > Accept-Encoding: gzip,deflate 1 > Connection: Keep-Alive 1 > Host: 127.0.0.1:45074 1 > User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_45) 17:05:47.239 [main] DEBUG com.intuit.karate - 1 < 200 1 < Content-Type: application/json 1 < Date: Thu, 06 Jul 2017 15:05:47 GMT 1 < Transfer-Encoding: chunked [{"name":"test.pdf","sizeInBytes":6514},{"name":"test1.pdf","sizeInBytes":6514}] 17:05:47.240 [main] DEBUG com.intuit.karate - response time in milliseconds: 14 2 Scenarios (2 passed) 18 Steps (18 passed) 0m1.106s Tests run: 20, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.585 sec Results : Tests run: 20, Failures: 0, Errors: 0, Skipped: 0
The Karate demo section offers a test-setup using an embedded Spring Boot instance, too as well as other interesting examples.
Using TestNG Instead of JUnit
To use TestNG instead of JUnit, we simply need to change our Maven setup to use the following two dependencies:
<dependency> <groupId>com.intuit.karate</groupId> <artifactId>karate-apache</artifactId> <version>0.4.1</version> <scope>test</scope> </dependency> <dependency> <groupId>com.intuit.karate</groupId> <artifactId>karate-testng</artifactId> <version>0.4.1</version> <scope>test</scope> </dependency>
Choosing the HTTP Client
Since Karate 0.3.0 we may select which HTTP client to use for running our tests, by adding the designated Maven coordinates — at the time of writing this article, Apache and Jersey implementations are supported.
For Apache we're adding the following dependency to our project's pom.xml:
<dependency> <groupId>com.intuit.karate</groupId> <artifactId>karate-apache</artifactId> <version>0.4.2</version> <scope>test</scope> </dependency>
For Jersey we're using this dependency:
<dependency> <groupId>com.intuit.karate</groupId> <artifactId>karate-jersey</artifactId> <version>0.4.2</version> <scope>test</scope> </dependency>
Reports
Karate uses the surefire-plugin to generate standard reports in xml format that may be processed by standard mechanisms of common integration servers and providers like Semaphore.
target/surefire-reports ├── feature.user.UserManagementTest.txt └── TEST-feature.user.UserManagementTest.xml
Running Karate Tests on Semaphore
As Karate integrates well with known tools like Maven, JUnit or TestNG, setting up jobs or build plans for integration servers is an easy task. We'll use Semaphore for continuous integration and demonstrate how to set up a build plan within a few seconds.
First, sign up for a free Semaphore account if you don’t have one already.
First create a new project and authorize with GitHub or Bitbucket depending on the fact where your Git() repository is located.
Afterwards you may search and add the designated repository:
In the next step, you select the repository's target branch:
Having done that, Semaphore pulls the repository and analyses its structure.
Depending on this analysis, Semaphore recommends a build setup so that we just need to modify a few steps.
In this example we switched the Java ™ version to 1.8 and reduced the Maven tasks to a simple execution of mvn test.
Having created the plan we may now lean back and enjoy watching our build plan being run by Semaphore within a few seconds.
Finally we're able to see that our build plan ran successfully within 40 seconds
Conclusion
We hope that this tutorial helped you to get a basic understanding of Karate's features and possibilities and that you now have another utility in your tool box for testing web services of all kinds.
As the project is in an early stage, please feel free to contribute or file new feature requests — the speed in which new features are implemented is quite impressive and Karate's author, Peter Thomas responds very fast.
If you found this testing framework interesting, please feel free to share this tutorial. You're also welcome to leave any comments or questions here!
Happy testing :)
Edited on {{comment.updatedAt}} | https://semaphoreci.com/community/tutorials/testing-a-java-spring-boot-rest-api-with-karate | CC-MAIN-2018-51 | en | refinedweb |
Created on 2010-02-08.16:43:21 by slucas, last changed 2010-08-11.14:16:13 by zyasoft.
I'm trying to port our Java application that uses Jython 2.1 to use Jython 2.5.1. However, I'm getting the following error using Jython 2.5.1 which prevents us from using it:
SystemError: Automatic proxy initialization should only occur on proxy classes
I see this error after calling copy.copy or copy.deepcopy() to copy a Java type variable (such as one of type java.util.ArrayList for example). The copy completes without any errors but as soon as the copied variable is accessed in any fashion, this SystemError occurs.
Josh Juneau responded to my posting to the jython-user mailing list about this problem and said:
"Looks like your copied object is being treated as a proxy class and I don't think that should be happening. The PyObject code has been completely overhauled for the 2.5.x release, and therefore it is difficult for me to look through the old code from 2.2.1 and compare...so I cannot tell you the exact cause. This looks like a bug"
Here's a simple example of this problem after copy.copy() is used to copy a java.util.ArrayList instance, and then the copied variable is accessed. This example works fine using Jython 2.1.
C:\jython2.5.1>jython
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_13
Type "help", "copyright", "credits" or "license" for more information.
>>> from java.util import ArrayList
>>> gList = ArrayList()
>>> gList
[]
>>> import copy
>>> copyList = copy.copy(gList)
>>> copyList
>>>
Note this problem occurs with some other Java classes as well, including some custom classes we use, not just a Java list.
It seems to me to be a very "bad" thing as globals() also then fails with this error. This problem prevents us from migrating our Java application to use Jython 2.5.1.
Note: Our application is STAX which is used by thousands of poeple and is part of the STAF open source project (). Many of our customers have requested upgrading STAX to use Jython 2.5.1 (instead of Jython 2.1) so that they can take advantage of the new Python features. However, this bug prevents use from using Jython 2.5.1.
Please let me know if there is a workaround or fix for this bug. Or, if I can provide any more information to help resolve this problem. Thank you.
If you n
I am looking into this issue starting with PyObject. It seems that java libraries shouldn't be treated as proxy classes and for some reason a copy of such an object is being treated as such.
A workaround to make shallow copies of native Java objects is to use the Java clone() technique. In order to repair this issue and ensure that the Jython interpreter does not treat copies of native Java objects using copy.copy as proxy classes, we'll have to somehow alter the proxy objects (or perhaps the copy lib) to perform a check to see if indeed the object being copied is a native Java object. If it is a native Java object, then treat differently then a Python object that inherits from a Java class.
Perhaps the easiest fix would be to place a check in the copy lib that would simply use clone() as opposed to copy.copy if an object is found to be a native Java object. The most difficult part of the problem is determining if an object is indeed native Java or a Python class that inherits from a Java object.
As I mentioned in my email to jython-dev, you can determine whether something is a java object via isinstance(obj, java.lang.Object) and whether a type is a java class via issubclass(cls, java.lang.Object)
I've re-implemented copy.py so that it makes use of the clone() technique to create shallow copies of Java objects. It now also has a java deep copy implementation. Lastly, a function is_java(obj) has been included to help differentiate java objects from python. This implementation of copy.py is fully functional. However, it appears that copy.py in general needs to be optimized. There is currently some development work towards implementing copy.py in java...this should help optimization.
I have implemented a possible fix for this in r7045, with support for __copy__ and __deepcopy__ in proxy objects. This sidesteps the question of proxy initialization.
Consequently I'm marking this issue as pending. However, we need significantly more test coverage for such a feature, especially with any number of corner cases.
I downloaded Jython 2.5.2 Beta 1 to verify that this bug I opened has been fixed. Some of the issues have been fixed (e.g. problems copying Python objects). But the problem copying a Java object still exists and this prevents my Java application, STAX, from working with Jython 2.5.2. We need this fixed in Jython 2.5.2. Should I reopen issue 1551 or open a new bug? I would greatly appreciate any help you can provide in resolving this issue.
Here's an example of the problem that remains when copying a Java object (and that was fixed in a private fix to the copy module that Josh Juneau had provided earlier this year).
1) Create an instance (e.g. me) of the Java Person class object. Note that this class does not implement a clone method and isn't Serializable. It's source code is at the bottom on this note.
2) Use copy.copy() to make a copy of me and call it copyMe.
3) Accessing copyMe causes an Automatic proxy initialization error. Even worse is that globals() fails with this error as well (and this prevents our Java application from working with Jython 2.5.2 as it essentially clones globals() and this is now failing). In Jython 2.1 and 2.2.1, globals() would not fail.
C:\jython2.5.2b1>jython
Jython 2.5.2b1 (Release_2_5_2beta1:7075, Jun 28 2010, 07:44:20)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_20
Type "help", "copyright", "credits" or "license" for more information.
>>> import copy, sys
>>> sys.path.append("C:/dev/src/stax/PersonDir")
>>> import Person
>>> me = Person("Sharon", "Lucas")
>>> copyMe = copy.copy(me)
>>> copyMe
>>>
In Jython 2.1, doing a shallow copy of this Java class object resulted in error "un(shallow)copyable object of type org.python.core.PyJavaInstance". Doing a shallow copy of globals(), would work and essentially appear to do a deep copy of the Java class object.
C:\Jython-2.1>jython
Jython 2.1 on java1.5.0_07 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import copy, sys
>>> sys.path.append("C:/dev/src/stax/PersonDir")
>>> import Person
>>> me = Person("John", "Java")
>>> copyMe = copy.copy(me)
Traceback (innermost last):
File "<console>", line 1, in ?
File "C:\Jython-2.1\Lib\copy.py", line 78, in copy
Error: un(shallow)copyable object of type org.python.core.PyJavaInstance
>>> globals()
{'sys': sys module, 'PyPerson': <module PyPerson at 3298006>, 'Person': <jclass
Person at 31228301>, '__name__': '__main__', 'copy': <module copy at 29199470>,
'me': Person@14ebadd, '__doc__': None}
>>> copyGlobals = copy.copy(globals())
>>> copyGlobals <== No error accessing the copy of globals() - looks like it actually did a deep copy of me
{'sys': sys module, 'Person': <jclass Person at 31228301>, __name__': '__main__
', 'copy': <module copy at 29199470>, 'me': Person@14ebadd, '__doc__': None} |
>>> me.setFirst("Jane")
>>> me.printPerson()
Jane Java
>>> copyGlobals['me'].printPerson()
Jane Java
Here's the content of Person.java (its compiled Person.class resides in C:\dev\src\stax in the above examples).
public class Person {
private String first;
private String last;
public Person(String first, String last){
this.first = first;
this.last = last;
}
public void printPerson(){
System.out.println(first + " " + last);
}
public void setFirst(String first){
this.first = first;
}
public void setLast(String last){
this.last = last;
}
}
Added null versions of __copy__ and __deepcopy__ that raise a TypeError for Java classes not implementing Cloneable and Serializable respectively. Also I added a version of the Person test submitted by Sharon to test_java_integration.py
The globals problem observed is actually the result of the proxies not being configured properly, it doesn't have anything to do with globals itself, just accessing objects referenced by it.
Ideally immutable Java objects like java.lang.String should be copied too (Python semantics). Note this works for deepcopy.
Lastly, copy_reg which is somewhat related is no longer used by copy in CPython 2.5, so need to update our copy module support.
For these last two reasons, keeping this pending.
Added immutable object support in r7089. Sharon reported in an email that copy is now working for her application. Lastly, we use the standard CPython copy module, so any copy_reg in there is as it should be apparently ;)
Closing this issue out at last. If there are further subtle issues in copy, possibly not 2.5.2 blockers, let's address in a separate issue. | http://bugs.jython.org/issue1551...but | CC-MAIN-2018-05 | en | refinedweb |
Ive got the code below and i want to change the speed of the action in the program, (in this case it draws a shape so i want the program to draw the shape faster)
import SpikeLib.*;
public class SpikeOctagon
{
public static void main (String args [] )
{
SpikeWindow window;
Spike mySpike;
mySpike = new Spike ();
window = new SpikeWindow ();
window.addSpike (mySpike);
mySpike.setColour (Spike.RED, Spike.PINK);
mySpike.moveNorth();
mySpike.moveNorthWest();
mySpike.moveWest();
mySpike.moveSouthWest();
mySpike.moveSouth();
mySpike.moveSouthEast();
mySpike.moveEast();
mySpike.moveNorthEast();
}
}
as im new to java i was thinking of inserting the following code into the program above
int speed = 0
for (int 1=0; i<5 ; i++)
{
speed = 50 x i ;
}
my query is would this little piece of code speed up the actions in the programs ? if so where in the program do i insert it ? or if im wrong what coding should i insert and where.
cheers
Code:
int speed = 0
for (int 1=0; i<5 ; i++)
{
speed = 50 x i ;
}
?? i dont get your for loop...did you mean 50*i? right now if you tried to compile that for loop in some code, you would get an error saying undefined variable x. Anyways, you should know that the * (star, astericks (sp?)) is the operator you use to multiply to stuff together. also, could you like give us somehow the SpikeLib package?
int speed = 0
for (int 1=0; i<5 ; i++)
{
speed = 50 x i ;
}
Support your right to arm bears.
^^This was the first video game which i played on an old win3.1 box
Exactly my point White_Eskimo, how are we supposed to help when we don't even have the package he is importing. I have no clue what it is. Also, I don't see any way to speed up a program other than taking out a lot of code so that it is processed faster. So what you suggested about the speed variable would actually slow it down. It will run as fast as it possibly can without any for loops. If you put in extra for loops it will just slow it down.
In Java theres a method called setdelay
thats what you use.
int Speed=0 ;
for (int i =0; i < 5; i++){
window.setDelay(50 * i);
so by inserting the above code it changes program speed.
esi1's example is one of how to slow your program down. Basically the fewer for loops you have the faster the program runs. So you will want to only have the most necessary for loops in all your programs. The only way to speed up your program other than that is to run it on a computer with a faster cpu. I have run some of my programs at school and at home and the speed was very different with the two different cpu speeds. So I guess the answer to how to speed up a program is to get rid of unnecessary for loops and get a faster computer. for loops are good for delays but they can't speed up your program.
Forum Rules | http://www.antionline.com/showthread.php?248633-Change-Speed-in-Java&p=682577 | CC-MAIN-2018-05 | en | refinedweb |
Scott Dial wrote: > >> >> But doesn't do that for files, and couldn't we do something >> like zip? Of course, we'd want to >> do zip, too. That >> way leads to madness.... >> > > It would make more sense to register protocol handlers to this magical > unification of resource manipulation. But allow me to perform my first > channeling of Guido.. YAGNI. > I'm thinking that it was a tactical error on my part to throw in the whole "unified URL / filename namespace" idea, which really has nothing to do with the topic. Lets drop it, or start another topic, and let this thread focus on critiques of the path module, which is probably more relevant at the moment. -- Talin | https://mail.python.org/pipermail/python-dev/2006-October/069579.html | CC-MAIN-2018-05 | en | refinedweb |
.beaninfo.swing;21 22 import java.beans.*;23 import javax.swing.border.CompoundBorder ;24 25 public class CompoundBorderBeanInfo extends BISupport {26 27 public CompoundBorderBeanInfo() {28 super("compoundBorder", javax.swing.border.CompoundBorder .class); // NOI18N29 }30 31 protected PropertyDescriptor[] createPropertyDescriptors() throws IntrospectionException {32 return new PropertyDescriptor[] {33 createRO(CompoundBorder .class, "outsideBorder"), // NOI18N34 createRO(CompoundBorder .class, "insideBorder"), // NOI18N35 };36 }37 }38
Java API By Example, From Geeks To Geeks. | Our Blog | Conditions of Use | About Us_ | | http://kickjava.com/src/org/netbeans/modules/form/beaninfo/swing/CompoundBorderBeanInfo.java.htm | CC-MAIN-2018-05 | en | refinedweb |
I have been given this assignment to be completed and I am stuck at the first step. Here are the requirements. I have 4 files:
Parent.cs
Child1.cs
Child2.cs
Form1.cs
Parent is abstract class
Modify child1.cs and child2.cs so that they are nested classes within Parent class
Make sure child1 and child2 classes can only be created by Parent class
Create a static method in Parent class which takes string parameter and if string is 'Child1' return child1 else return child2
Method in the form1.cs that creates and instance of parent class.
I am not sure how to make them as nested classes ...if I need to create partial classes then how do I do that.
How do I make sure that child classes can only be created by parent class?
Thanks
View Complete Post
Hi,
I am creating a simple CMS for learning purposes. It has a DAL, BLL and UI. The DAL contains non static methods which are accessed in the BLL layer.
I have a factory pattern which creates instances of the DAL methods like this:
public class Factory
{
public static T GetInstance<T>() where T : new()
{
return new T();
}
}
And they are accessed in the BLL like this:
public void Save(Article article)
{
ArticleData artDate = GeepyFactory.GetInstance<ArticleData>();
}
My question is, what additional logic should/usually go into the Factory class to make it favourable/a better solution over standard instantiation of a class like this ArticleDAL artDal = new ArticleDal(); ??
Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend | http://www.dotnetspark.com/links/35551-factory-pattern.aspx | CC-MAIN-2018-05 | en | refinedweb |
Outputting CSV with Django¶
This document explains how to output CSV (Comma Separated Values) dynamically using Django views. To do this, you can either use the Python CSV library or the Django template system.
Using the Python CSV library¶ MIME type,header,
When dealing with views that generate very large responses, you might want to
consider using Django’s
StreamingHttpResponse instead.
For example, by streaming a file that takes a long time to generate you can
avoid a load balancer dropping a connection that might have otherwise timed out
while the server was generating the response.
In this example, we make full use of Python generators to efficiently handle the assembly and transmission of a large CSV file:
import csv from django.utils.six.moves import range from django.http import StreamingHttpResponse class Echo(object): """An object that implements just the write method of the file-like interface. """ def write(self, value): """Write the value by returning it, instead of storing in a buffer.""" return value def some_streaming_csv_view(request): """A view that streams a large CSV file.""" # Generate a sequence of rows. The range is based on the maximum number of # rows that can be handled by a single sheet in most spreadsheet # applications. rows = (["Row {}".format(idx), str(idx)] for idx in range(65536)) pseudo_buffer = Echo() writer = csv.writer(pseudo_buffer) response = StreamingHttpResponse((writer.writerow(row) for row in rows), content_type="text/csv") response['Content-Disposition'] = 'attachment; filename="somefilename.csv"' return response
Using the template system¶. example. | https://docs.djangoproject.com/en/1.8/howto/outputting-csv/ | CC-MAIN-2018-05 | en | refinedweb |
Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Odoo Web service api host name
Hi,
I have to connect with odoo in my localhost or my nearest system(192.168.0.24).
So what should be my host url?
$url = <insert server URL>;
i tried "localhost:8069" and "192.168.0.24:8069"
$info = ripcord::client('')->start();
here i tried "localhost:8069/xmlrpc" and "192.168.0.24:8069/xmlrpc"
both not working. I don't know is it my host name is causing it.
What might be the problem?
what do "/start" stand for?
Hi Akhil
Please try this
import xmlrpclib
dbname = 'demo'
username = 'admin'
pwd = 'admin'
server = ''
sock_common = xmlrpclib.ServerProxy(server + '/xmlrpc/common')
sock = xmlrpclib.ServerProxy(server + '/xmlrpc/object')
uid = sock_common.login(dbname, username, pwd)
recored_id = sock.execute(dbname, uid, pwd, 'model', 'search', [('name', '=', name])
print ">>>>>>>>>>>>", recored_id
About This Community
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now | https://www.odoo.com/forum/help-1/question/odoo-web-service-api-host-name-95992 | CC-MAIN-2018-05 | en | refinedweb |
Hi Philipp, Dominik Dominik, can you give a short overview what zope.generic can do? [...] > > If you take a closer look at this package and you will see > that each > > subpackage is well documented. > > Right. But that information isn't easily accessible. You have > to go to zope.generic/trunk/src/zope/generic/foobar. That's > FIVE directory layers down from zope.generic!
Yes, that's true, but if you install only one package from the 'zope.generic' collection you need to have that README.txt in this package and not more then that. > Another question I raise: Why are there subpackages in the > first place? > And what's the rationale for calling it 'generic'. It's be > like calling it 'zope.fast' or 'zope.easy': you get no idea > about the contents of the package. Of course, I know why it's > called 'zope.generic'. Because it's a package *collection*. I > think package collections (e.g. like zope.app or > zope.products which we used to have some years ago) are a mistake... I'm not sure if that is also right for the generic package. The generic package is ONE concept which is implemented in different reusable sub-packages which also can be used as single packages for just one aspect of the generic concept. > > The generic package collection is/was developed/mentained > by Dominik. > > The zope.generic sub-package are very well layered and have clear > > dependency that's the reason why they are containd in a collection > > package. I'm not fimilar with the state of the 'generic' > project right > > now. But it's a really cool concept. > > I'm not convinced that easily :). Perhaps sketching out what > it really is and what its purpose is would help. I think Dominik can explain the generic pattern. All I can say this quickly, you can define new instances only based on schemas without a class implementation. It's a kind of ZClasses, Archetypes in a clean Zope3 like implementation. Generic means you can define generic components which are initializable and configurable during the runtime. There is also a pattern for enhance such a generic instances via plugins. All I can say, it's generic ;-) > >> * For example, what does the 'z3c' namespace package stand > for? Who's > >> behind this stuff? And why does it sometimes use 'sandbox' or > >> 'Sandbox' > >> instead of or in parallel of 'trunk' for its main > development branch? > > > > The z3c top level package is a namespace for additional > packages where > > I and Bernd started to use at the SwissEasterSprint. > > Great. This should be written down somewhere. (I'm not > blaming you for not having done this; we have no rule for > this right now. I think we should have a rule, though). no problem, I agree to have a place for such infos. The README.txt files are not good enough for give a overview because you have to checkout first or browse the really slow repos with a browser. Tell me where is somewhere and I can write something ;-) > >> - Do other people also think it'd be a good idea to come > up with some > >> repository guidelines? Stephan had a proposal about specifying > >> package metadata and code maturity/quality, I think it's worth > >> working towards easily accessible info like that. If others agree, > >> then let's get started. > > > > Not started, just make progress in what allready started > with Stephans > > proposal and the ZSCP implementation ;-) > > > > Yes, I agree > > Perhaps you can check the proposal and see what we did in > >. I guess there is more to > implement but > > right now it's working and very professional looking. > > Thanks to Kamal Gill for the great desing work! > > I'm not as much looking for a website that gathers all the > ZSCP information as much as for guidelines that help us > maintain a certain quality of documentation within the repository. I think the proposal from Stephan should catch all your questions. If not feel free to define and propose them. I agree with have a more clear process for all you are asking. > >> - Should this be part of the Zope Foundation development process > >> (which again seems to be worked out by the Zope Management > >> Organization)? If so, I'll hereby volunteer to join such a > committee > >> and contribute my ideas (especially on package organization in the > >> repository and the associated development process). > > > > I really hope that we adapt the prosess described in Stephans ZSCP > > proposal. > > > > > > > ?rev=6 > > 6671&view=markup > > > > Whould be cool if we could make progress on what Stephan > started with > > the proposal and your ideas. > > Yup. I'll reiterate over Stephan's proposal once again and > provide my comments. > > Philipp > _______________________________________________ Zope3-dev mailing list Zope3-dev@zope.org Unsub: | https://www.mail-archive.com/zope3-dev@zope.org/msg05652.html | CC-MAIN-2018-05 | en | refinedweb |
: filter plugins require parent classes defined in
logstash/filters/base and logstash/namespace:
require "logstash/filters" ... }:),
uri,
..
See Bundler’s Gemfile page for more details.
source '' gemspec gem "logstash", :github => "elastic/logstash", :branch => "6.1". You should use semver versioning strategy for version numbers..
-filter-example.gemspec
That’s it! Your gem should be built and be in the same path with the name
logstash-filter-6.1.1.tar.gz cd logstash-6.1.1. | http://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_filter_plugin.html | CC-MAIN-2018-05 | en | refinedweb |
Is it possible to set conditions (filters) for the DataFrame columns before reading a csv or tsv files, If I am already aware of the column names and types? If yes, how?
For Example: Consider there are two numerical columns (col1 and col2) in a very big file. I do not want to load whole file in the memory and select only those rows where col1 greater than col2. Therefore, first, I want to set the condition on the dataframe that it should read only those rows from the csv file where col1 is greater than col2. I hope my explanation make sense.
Thanks
You can use blaze for this which is a handy tool to have alongside
pandas.
Let's assume an input file of:
a,b 1,2 3,4 5,3 3,6 6,1
We then open the file and query the data - note that the query isn't executed until you attempt to materialise/access it:
import blaze import pandas as pd csv_data = blaze.Data('input.csv') query = csv_data[csv_data['a'] > csv_data['b']] df = pd.DataFrame.from_records(query, columns=query.fields)
That then gives
df as:
a b 0 5 3 1 6 1 | https://codedump.io/share/U0JDg68DCAvq/1/applying-conditions-on-pandas-dataframe-columns-before-reading-csv-or-tsv-files | CC-MAIN-2017-34 | en | refinedweb |
Education and the Internet. Austan Goolsbee University of Chicago, G.S.B., American Bar Foundation, and N.B.E.R. September 2000.
- Elfreda Stokes
- 2 years ago
- Views:
Transcription
1 Prepared for 2001 Brookings Internet Volume, Robert Litan, ed. Education and the Internet Austan Goolsbee University of Chicago, G.S.B., American Bar Foundation, and N.B.E.R. September 2000 Abstract The growth of educational content in the Internet industry and the increasing use of the Internet in the educational system has been quite rapid in the last few years. This paper examines both the rise of for-profit Internet education start-ups and the use of the Internet to improve education in the existing offline educational system in some sense, the supply and the demand for Internet education. While both have grown rapidly, key questions remain as to how effective either will be at enhancing educational productivity. The paper describes the state of the sector today and speculates where it will likely go over the next few years. Both sides of the market are likely to have significant effects on the productivity of the educational system only in limited areas, at least for the near term. These are likely to be things like corporate information technology training and M.B.A.- type executive education. Major productivity gains will need to wait for more comprehensive innovations in the sector. The total impact of the Internet on educational productivity in the near term is likely to remain rather modest. I wish to thank Robert Litan and members of the Brookings conference on the Internet Economy for helpful comments and the Alfred P. Sloan foundation, the National Science Foundation, the American Bar Foundation, and the Robert P. Reuss/Centel fellowship at the University of Chicago, G.S.B. for financial support.
2 Section I: Introduction Although the educational sector is not a business in the conventional sense, there has been tremendous interest in the role of the Internet and of electronic commerce as they relate to educational spending. This interest has taken two forms, the supply of education online through for-profit Internet start-ups and the demand for Internet technology and access on the part of non-profit public schools. In 2000 educational spending in the U.S. will total about $772 billion, making it the second largest industry in the country at about 9% of GDP (Close and Hum, 2000). Although most of this spending is for non-profit and government run educational institutions, there has been a marked trend toward for-profit education in the last two decades and an increasing amount of distance education. The sometimes awkward relationship between the Internet and education has grown rapidly in both the supply and demand directions. The goal of this paper is to examine the two distinct sides of the Internet-education market, emphasizing what has happened thus far and where it may be going. The overall theme of the paper is that the growth of the educational Internet has been rapid throughout the educational system but that, due to the nature of the product, the impact on educational productivity is likely to be fairly modest over the next several years except in certain niche areas such as IT training and executive education. The paper proceeds in 5 sections, section II gives a brief overview of the benefits and the costs to learning online compared to conventional instruction. Section III then examines the for-profit supply side sector of the education on the Internet including the context and the likely productivity effects in three segments general distance education, 2
3 corporate training, and executive and business education. Section IV examines the demand side of educational Internet technology in the existing school system documenting the rapid spread of Internet access in schools but also their lack of integration into the curriculum. Section V concludes. Section II: Costs and Benefits of Online Education A brief evaluation of the pros and cons of the Internet medium for education, akin to the analysis of elearners (2000), makes it easier to understand the types of segments that are amenable to online education as well as the types of things that create problems. The most obvious benefit from Internet education and training is the convenience. Students do not need to travel and can take the classes according to their own schedules (so called asynchronous learning) substantially reducing the opportunity cost of education and offering an appealing approach to introverted students or students not confident in their spoken language skills. A second major benefit is that if done properly, Internet education is completely scalable with very low marginal cost. Education providers can potentially reach large audiences cheaply. Third, the Internet, and computer training in general, is very good for automated types of tasks where it might be expensive to pay teachers to simply cover the same repetitive lessons over and over again. Albeit with considerable investment in course development, it is possible to create problem or simulation based content that can be a very effective means of teaching. 3
4 There most obvious downside of internet education is that at present it has very low bandwidth when compared even to other forms of distance learning such as video or CD-ROM, much less live instructors. This should give pause to anyone planning to start an online educational venture by putting lectures on the web. Second, although the marginal replication cost of the content is low, the creation of Internet education content can be very costly and time consuming, limiting the profitability of creating customized instruction. The other side of the benefits of problem/simulation based learning is that if the school does not invest in the enhanced form of learning and instead just puts up regular reading materials online or streaming video of lectures, the retention is substantially worse than in conventional education. Third, with existing technology, identity can be a problem since it is difficult to prevent cheating, dropping out, or other negative outcomes when the student is on the opposite side of a terminal. Fourth, a large segment of the U.S. does not have a computer and has no Internet access, limiting the inherent market for the product. Further, appealing directly to customers online has proven an expensive proposition and many customers have shown little willingness to pay for things online. Finally, although proponents claim that the Internet can enhance interactivity between students (Urdan and Weggan, 2000), in practice, interaction is minimal (Dalton et al., 2000). Subjects based primarily on discussion and interaction are not well suited to online instruction at this time. Even the need for graders, instructors and teaching assistants can get very expensive and make a course unwieldy. 4
5 Given these costs and benefits we can ask what segments of the education sector are most amenable to Internet education somewhat in the spirit of the De Figueiredo (2000) analysis of what will be successful online products. The most successful impact of the Internet in education is likely to be in areas where the students are working so they value time flexibility, where content does not need to be highly customized, where there would be travel involved in getting in-person instruction, where the students are computer literate, and so on. Section II: Internet Education Ventures & the Effectiveness of Various Segments A. Context Throughout the twentieth century, when the returns to schooling have risen, typically the demand for education has risen significantly (see Goldin, 1999 for a discussion of the history of U.S. schooling). The 1980s and 1990s are no exception. The skilled worker wage premium has grown dramatically and this has fueled a rise in education overall and especially among distance and for-profit educational providers who cater to older students and to those whose instruction is more job oriented. Employers, recognizing the value of higher skilled employees have driven spending on corporate training to all-time highs. Using data from the Bureau of Labor Statistics, Wit Capital (1999) claims that the share of unskilled workers in the U.S. economy fell from 45 percent in 1991 to only 15 percent today. Regardless of the exact numbers, the shift toward higher educational demands on the job is clear. Table 1 presents data on the size of various parts of the education sector (Urdan and Weggan, 2000). Most of the spending is on K-12 education but this is unlikely to 5
6 shift toward Internet spending in any serious way in the next five years. The same is true for childcare. This leaves the post-secondary education, continuing education and corporate training markets as the leading targets for Internet education start-ups. Over the next ten years, the number of people seeking post-secondary education is expected to rise by almost 2 million people and many of these will be looking at for-profit and distance education. Within post-secondary education, table 2 illustrates that for profit companies already account for a large share of post-secondary institutions, almost half overall and more in the two-year and continuing education components (Close and Hum, 2000). Further, a growing number even of non-profits run distance education efforts. The information in U.S.D.O.E. (1999) suggests that in 1998, more than one third of 2 and 4 year post-secondary institutions offered some kind of distance education. B. Segments General Distance Education. The area with the most activity relating to online education has been distance education versions of the basic two or four year college experience. Many institutions have moved to using Internet technology to provide distance education. Although distance education has always been relatively small, the Internet appears to give these programs the ability to reach even wider audiences. A surprisingly large number of colleges and universities in the U.S. have official distance education programs. The Department of Education report on distance learning (U.S.D.O.E., 1999b) indicates that in 1998 there were 1,680 colleges and universities with distance education programs and an additional 990 that planned to start one in the 6
7 next three years. In 1998 there were 1.36 million students enrolled in distance education programs, 1.08 million of which were in undergraduate courses. This was a 78 percent increase in enrollments since the previous report of 3 years ago (U.S.D.O.E., 1997). Carr (2000) cites the forecast of IDC that the number of distance education students will rise by more than 1 million over the next few years. Although growing quickly, it is worth noting that this is still only a very small fraction of the total student body in the U.S. Simultaneous with, and probably contributing to this increase in distance education has been a major shift toward using the Internet in distance instruction. The share of distance education courses uses the Internet for some aspect of the course has risen from 22 percent in 1995 to more than 60 percent in 1998 so clearly the Internet is useful (U.S.D.O.E., 1999b). One issue that all the Internet education start-ups must confront, however, is the limited pedagogical success of several types of distance education in recent years: video tape, television broadcast, and CD-ROM. Each of these was touted as a new way to deliver content to the educational consumer a star teacher lecturing on a video tape would be superior to a mediocre teacher lecturing in person. Their success has only been moderate distance education is still a small segment of the overall market. The Internet has even lower bandwidth than these technologies so its ability to supplant other methods may be limited. Indeed, the Department of Education survey indicates that while 60 percent of distance education courses use the Internet, half also rely on video tapes and more than half on video conferencing. Eighty two percent of say they intend to increase the amount of Internet instruction in their courses, 61 percent say they intend to increase 7
8 the amount of video-conferencing, as well. In this sense the Internet may be viewed as just another input into a typical distance learning course. Further, there are some major difficulties with shifting to general distance education online. First, the evidence in Dalton et al. (2000) points out that reading retention from online material is about 30 percent lower than from books. While institutions could put in place problem and simulation based classes, to do so would be quite expensive so most have just been using the Internet as a way to post reading materials, problem sets and the like and, therefore, probably are not providing much improvement on existing courses. Second, the lack of identity online inherently limits the ability of the product to move up the quality ladder. For the most part, the successful distance education firms are lower market educational or hybrid institutions University of Northern Colorado, University of Phoenix, Capella University, Kaplan University, and so on. It will be difficult to get the kind of prestige held by institutions such as Yale and Harvard until one can be sure of who is turning in the work. The dark side of the identity, question, as well, is that the types of students getting education at for-profit companies are noticeably higher risks than traditional students are and this threatens the accreditation process for the schools and various types of federal funding (both of which are affected by high student loan default rates and high dropout rates). The data in Close and Hum (2000) show that the student loan default rate among for profit schools postsecondary schools is almost double the national average at that education level. Their discussion also indicates that students at these for-profit schools sue the school over placement and education issues with disturbingly high frequency. 8
9 Third, creating the community aspect of a standard college environment is quite difficult online. To be sure, there are companies trying to do just that, such as Fathom.com, an alliance of the Smithsonian, the New York Public Library, the British Library, L.S.E. (see Kiernan, 2000) but the low bandwidth of the Internet and the inability of students to get together make this somewhat of a long-shot. Finally, even as the Internet becomes highly useful in distance education, it is worth considering whether it will have much effect on educational productivity. According to most analyses, albeit most of it done before the Internet existed, distance education is, at best, equally effective as instructor-based and many clearly feel it is worse (see Phipps et al., 1998). There is little cost advantage, however, other than travel, to taking most of the distance education courses. The data in U.S.D.O.E. (1999b) indicates that 77 percent of the institutions with distance education programs charged the same tuition for those courses as for their conventional classes, 6 percent charged more and only 3 percent charged less (14 percent did not specify). Judged this way, the use of the Internet for general distance education probably costs about the same for tuition and slightly less counting travel but provides content that is at least somewhat inferior to conventional instruction. The total effect on productivity probably isn t very large. At best it is may dominate the distance education segment of the market but will likely have significant problems cutting into the market of conventional offline instruction. Business Education. Business post-graduate education is one of the segments most in demand in the current educational environment and allows for some distinct differences from the problems of general distance learning discussed above. 9
10 First the buyer is typically the student s employer, limiting the customer acquisition costs and financial defaults and also making it easier to establish a reputation for quality (e.g., our courses have been used by IBM, Microsoft, and so on). Most of the students are busy, want to avoid taking time off from work, and currently have to travel to get this education from a traditional program. The data in U.S.D.O.E. (1999b) shows that of institutions offering any distance education, 55 percent of them offer business courses. This amounted to about 20 percent of all 2- and 4-year post-secondary institutions in the country so the current market seems ripe for an Internet approach. Frequently the demand for this type of education is to learn some basic knowledge area such as accounting rather than to get a degree. Several Internet start-ups have targeted this segment, some run by offline business schools, some pure-play Internet firms that form alliances for content, and some where an online firm creates its own content. Pensare and UNEXT.com, for example, have each contracted with leading business schools to help provide content and then they create learning environments based on that content (Pensare has allied with Harvard Business School publishing, Fuqua, Wharton, and U.S.C., UNEXT with Stanford, Columbia, the University of Chicago, The London School of Economics, and Carnegie-Mellon). Both companies employ instructors to facilitate discussion and try to encourage "community" between the students on the site. UNEXT also intends to offer degree programs through its Cardean University brand. The two companies have signed up customers among major companies such as IBM, Fujitsu and Unysis, though most of the courses are in testing stages at this point. Multinational firms provide a particularly good place to 10
11 market the product since they often have English speaking potential students stationed far from offline business schools. Estimates of the cost of taking an online course from Pensare are around $300 - $600 per student with discounts available based on volume (Urdan and Weggan, 2000). At this price, the courses are likely to cost less than half what a comparable unit would at an executive education center. Forbes estimates the UNEXT cost at 80 percent of a comparable instructor led M.B.A. class (Forbes, 2000). There do seem to be cost savings here, even separate from the travel expenses. The goal in these programs is to create content that is explicitly problem and simulation based rather than just video lectures and online readings. This is likely to greatly improve the quality of these courses compared with standard distance education and, in some areas, may be better than conventional methods. According to Dalton et al. (2000), simulation based Internet education on accounting at Harvard Business School showed that training times were reduced by 50 percent and scores significantly improved relative to conventional instruction. If accurate, the Internet would stand to be a major productivity enhancement to the executive education market. As a result, though, each these courses can cost more than one million dollars to create (Forbes, 2000). The simulation/problem based approach is easier in fields that lend themselves to problems such as finance and accounting as opposed to softer subjects like organizational behavior or ethics. One interesting competitor to these online executive programs is the new Fuqua (Duke) School of Business Global Executive Program. This hybrid program is taught with the same faculty as the regular M.B.A. program and much of the class is conducted 11
12 online. In addition to the online requirements, however, this program requires the students to spend some time in residence and the tuition is more than a traditional M.B.A. This residence requirement gives the Duke program the potential to create community and raise the perceived quality of the program but it also ensures that the model is not scalable. It will be interesting to see if they will have sufficient incentive to develop the expensive simulation/problem based learning environments needed for good online instruction when they cannot resell the content to tens of thousands of students at a low marginal cost. My impression is that hybrid classroom/internet models will have difficulty becoming widespread for this reason. Corporate IT Training. One of the other clear markets for Internet education is for teaching computer related training to corporations. The spending on corporate training in 1999 exceeded $62 billion and IT training accounted for about 50 percent of that total (Training Magazine, 1999). This area has many of the same advantages as executive education as relates to the Internet and there is the further plus that the workers and the subject matter are, by definition, closely related to computer technology. Some have gone so far as to argue that IT workers are more comfortable with computer based training than they are with human beings! There is a fair amount of anecdotal evidence about the use of Internet based IT training at high technology firms such as Cisco and Sun but the data in Urdan and Weggen (2000) suggests that in 1999 Internet delivered training was only about 8 percent of corporate of IT training while instructor led training still accounted for more than 70 percent, even of computer training (Training Magazine, 1999). 12
13 Data on effectiveness is difficult to come by but fragmentary evidence suggests that IT training online may represent a productivity improvement. In interviews with training managers at major companies, Dalton et al. (2000) report that two-thirds of respondents report that the main benefit they derive from online training is cost savings, albeit largely through reduced travel budgets. Urdan and Weggen (2000) claim savings of 50 to 70 percent compared to instructor-led training. Outside of the IT area, though, Internet training is unlikely to be as successful. For whatever reason, the training managers report drop out rates from online programs is as high as 80 percent (Dalton, et al., 2000). These courses are apparently much less effective, perhaps because the nature of the content easily adapted online. One firm that has succeeded in this corporate IT training marketplace has been DigitalThink. Their model is to provide computer training 100 percent web delivered for between $195 and $450 for a 20 hour course. These prices are significantly lower than a typical instructor led course. They have more than 200 courses on subjects like C++ programming, MS Office applications, and the like. Since 1997 they have delivered 150,000 training courses. Their customers have included Cisco, Motorola, Intel, and many other companies. While this has been a successful venture, the total impact of the Internet on training quality outside of IT may be quite small. Urdan and Weggan (2000) estimate that spending on corporate training online will rise from about $550 million in 1998 to be about $11 billion in This would be an extremely successful spread but would likely not have a dramatic effect on the overall productivity of training courses since this would still be only about percent of the corporate training bill. Likely it would 13
14 involve quite productive improvements to IT training, perhaps even coming to dominate that segment, but probably much less in other types of training. Section III: The Internet in Public Schools A. Context Although rather far removed from the high-flying world of Internet education start-ups, thousands of public and private schools around the country are clamoring to increase the amount of Internet and computer technology in the classroom. This is the demand side of the Internet education market and it has become a major political issue in the last five years with President Clinton and both presidential candidates pledging their support for various initiatives to increase the use of technology in the schools. Much of this push has been in the context of the digital divide between so called information haves and have-nots, often similar to splits along income and racial lines (see Goolsbee, 2000; Walsh et al., 2000). In 1994, Clinton called for all public schools to be wired by 2000 and proposed a series of programs to help make that happen. The most important federal program has been the Universal E-Rate program, passed in 1996 and operated through the FCC. This program established larger subsidies of percent for school and library access to the Internet with the largest subsidies being reserved for low-income schools. Spending on this subsidy has totaled more than $2 billion per year, funded by a regulatory charge on long distance (and not without controversy see the critique of the program in Hausman, 1998 of the deadweight costs of the tax involved). Compared to the total computer spending in public schools for 1999 of $3.3 billion (including hardware, software, training, networking, service, etc.), this has 14
15 been a very large program, indeed (Lake, 2000). It is worth considering its impact on schools. B. Effectiveness What is generally not understood by the public is how far these programs have already gone toward wiring schools. The share of schools with access to the Internet has grown dramatically since Tables 3 and 4 present data compiled by the National Center for Education Statistics. Table 3 gives the share of schools with Internet access. Table 4 gives the share of instructional rooms with Internet access. In 1994, about one third of schools had Internet access and only 3 percent of instructional rooms had such access. By 1999, 95 percent of schools had Internet access and the share of instructional rooms with access had increased more than 20 times to 63 percent. In this sense, the wiring of schools is almost complete. The data even show that among schools with more than half the students eligible for free or subsidized school lunches (i.e., low income locations), more than 90 percent of the schools have Internet access, though there is a noticeably smaller share of instructional rooms with access to the Internet among the very poorest schools. Given that success, however, it is worth wondering how this spending on technology will affect educational outcomes. Measured as an enhancement to the productivity of the educational system, the Internet may have much more subtle impacts. It is probably unrealistic to expect that putting Internet access in an otherwise bad school will make the instruction significantly better, especially if the Internet is not integrated into the curriculum. Although almost two-thirds of teachers have used computers or the 15
16 Internet for classroom instruction but the share using it for things beyond the simplest simple computer applications (i.e., who actually use computers or the Internet for drills, projects, or multimedia presentations, etc.) is likely to be less than half that rate (see the data in U.S.D.O.E., 2000b). The estimates of Hawkes (1998) using data in 1995 indicate that installing a school technology plan (i.e. computers and the Internet) cost $180 - $501 per student and required ongoing spending of $40 to $105 per student to maintain. Once the E-Rate program ends, it will be interesting to see whether schools will maintain their connections to the Internet. Questions also remain about the qualifications of teachers to instruct kids about the use of computers. In a survey of teachers done by the Department of Education (U.S.D.O.E., 2000b) only one third of teachers reported that they were well prepared or very well prepared to use computers and the Internet. This share is notably lower for teachers with 10 or more years of experience. According to another recent study, most teachers are novice or completely inexperienced (Clarkson, 2000). In many locations, and especially in high schools, it is hard to imagine that the teachers know more about the Internet than the students already know themselves. The next wave of Internet education investment will need to be in the area of training teachers and incorporating technology into the curriculum. These investments may have larger educational payoffs but may be slow in spreading. Without such training, the investments in Internet access are unlikely to pay major dividends for school productivity. It would be easy to design experiments to test for the impact of Internet and computer access on test scores or academic performance. In fact, the technology 16
17 planning handbook put out by the Department of Education (U.S.D.O.E., 1999a) emphasizes that evaluation should be an important part of a technology plan, but in most places, it is an afterthought. Even without experiments, simply making such data available to researchers would allow for econometric tests. Given that there has been little direct work on the impact of the computer investments of the 1980s and 1990s on school performance, it may be a pipe dream to think that such analyses will happen for the impact of the Internet. As a first pass, given that school spending generally has little apparent impact on school outcomes, it may be hard to imagine spending on the Internet doing much better (see Hanushek, 1996). But it might, especially if it increases something as fundamental as a student s motivation to come to school. This is also not to say that the productivity effect is zero. Certainly the Internet has enabled access to some resources that students might not otherwise have had. There are now numerous online libraries millions of books that small school libraries could not carry. For a student wanting to do research or read such materials, access to the Internet at school could be a boon, although how many students actually use such resources is unknown. Other small productivity enhancements include things like state and federal clearing houses of information such as the Educational Resources Information Center (ERIC). This is a network that catalogs, summarizes, and provides access to education information. The data base and ERIC document collections are housed in about 3,000 locations worldwide, including most major public and university library systems. ERIC produces a variety of publications and provides user assistance, including things like AskERIC, an electronic question answering service for teachers on the Internet, 16 17
18 subject-specific Clearinghouses, and the National Parent Information Network giving information to parents of school children. Again, the capabilities may be several years ahead of consumer usage at this point but there are at least some conceivable benefits. There are also, potentially, the back office functions for educational institutions including the handling of student records, transfers of transcripts, and the like. As in the case of medical records, privacy issues may prevent being too comprehensive in the conversion at the moment but there are technologies that may develop on this front in the coming years that enable schools to exploit this productivity enhancer more thoroughly (see Zittrain, 2000). IV. Conclusion The educational sector is massive, regulated and bureaucratic. Recent years have seen an explosion of interest in for-profit online educational ventures as well as the use of the Internet in public schools around the country. While there has been a great deal of activity, the impact of the Internet on educational productivity is likely to remain quite modest for the next several years except in areas particularly amenable to the Internet. These are likely to be areas like executive education in areas like finance and corporate IT training. As a replacement for a typical college or junior college experience, the Internet is still a very far away. On the demand side, the spread of Internet access to public schools in the last five years has been quite dramatic and is now close to 100 percent. This is true in rural and urban areas. This is quite an accomplishment. Its impact on school performance is likely to be modest, however because the teachers are generally not prepared to teach students 18
19 Internet or computer skills and the Internet has not been integrated well into the curriculum. It will be interesting to see if investment in information technology in poor quality schools will have a higher rate of return (in educational terms) than other types of spending. On both the for-profit supply side and the public school demand side, one gets the sense that fifteen years from now, the answers could be very different than they will be five years from now. In the near future, the Internet appears destined to be used more and more but not yet to have the potentially major impact that it could have in other sectors of the economy. Looking to the longer-term, the impact might be substantially greater, though obviously much harder to quantify. The most promising might be the diffusion of bestpractice simulation type training from private industry back down into the classroom, in either vocational or standard classrooms. In the long-run, given sufficient training or software development, teachers might be able to access learning programs specially designed for certain subsets of students who have a difficult time in the typical classroom or whose interests are more specialized than a small rural school can afford. At that point, the productivity gains to the Internet are likely to spread throughout the education sector and raise educational productivity more generally rather than just in certain niches. In some ways, that is the challenge that education poses for the Internet in the next twenty years. 19
20 Bibliography Carr, Laurie (2000), College Off-Campus, The Industry Standard, October 2000, p Clarkson, Blair (2000), Ready of Not? Not Industry Standard, September 12, 2000 Close, Rich and Rob Hum (2000), "Proprietary Higher Education: Intellectual Capital for the Knowledge Economy," SunTrust Equitable Securities, January 3, De Figueiredo, John (2000), Finding Sustainable Profitability in the E-commerce Continuum, forthcoming, Sloan Management Review elearners (2000), What are the Pros and Cons of e-learning? <>, accessed September 5, 2000 Forbes (2000), "Forbes.com Best of the Web," September 11, pp Goldin, Claudia (1999), "A Brief History of Education in the United States" NBER Historical Working Paper # H0119. Goolsbee, Austan (2000), "Explaining the Digital Divide," Mimeo, University of Chicago. Hanushek, Eric (1996), "School Resources and Student Performance," in Department of Educations Money Matter?, Gary Burtless, ed.brookings Institution Press (Washington, D.C.). Hausman, Jerry (1998), "Taxation by Telecommunications Regulation" in Tax Policy and the Economy, vol 12, James Poterba, Ed. MIT Press (Cambridge, Mass.). Hawkes, M. (1998), "Funding a Technology Network in Your School," Schools in the Middle, 7(5) Kiernan, Vincent (2000), A For-Profit Web Venture Seeks to Replicate the University Experience Online, Chronicle of Higher Education, April 3, Lake, David (2000), Surfing at School, The Industry Standard, October 2000, p Phipps, R., J. Wellman, and J. Merisotis (1998), "Assuring Quality in Distance Learning: A Preliminary Review," report for the Council of Higher Education Accreditation, Washingotn, D.C. Institutue for Higher Education Policy. Training Magazine (1999), Industry Report 1999, <> accessed September 8,
Is an Executive MBA right for you?
Is an Executive MBA right for you? A GUIDE TO THE EXECUTIVE MBA achieve goals busy schedule support classroom contribution cost peer network the new MBA What is an Executive MBA? The Executive MBA is a
Acceptability of Online Degrees As Criteria for Admission to Graduate Programs
ACCEPTABILITY OF ONLINE BACHELOR'S DEGREES Journal of Computing in Higher Education Fall 2004 Vol. 16(1), 150-163. Acceptability of Online Degrees As Criteria for Admission to Graduate Programs Margaret
In society today, technology, education, and economic growth go hand in hand.
181 APPENDIX A Federal Programs to Increase Children s Access to Educational Technology Linda G. Roberts In society today, technology, education, and economic growth go hand in hand. Technological literacy
Massive Open Online Courses
MOOCs Massive Open Online Courses MOOC (noun) Massive Open Online Course, a term used to describe web technologies that have enabled educators to create virtual classrooms of thousands of students. Typical
Online Learning Home News Special Reports Online Learning
Online Learning Home News Special Reports Online Learning October 31, 2010 For-Profit Learning Is Always Cheaper, and Other Myths By Jorge Klor de Alva For-profit higher education, particularly when delivered
Politics, Public Relations & Performance. Michael J. Cooney Chair, Wisconsin Educational Approval Board
Politics, Public Relations & Performance Michael J. Cooney Chair, Wisconsin Educational Approval Board The Answer: Disclosure: The answers presented in this presentation maybe be appropriate for some institutions,
Online Learning Solutions for the Challenges of Catholic Education
Online Learning Solutions for the Challenges of Catholic Education How would that business continue to function and prosper without the owner? As teaching technology has advanced, online education has
Developments Changing Education
Developments Changing Education Cloud based computing Digital textbooks i Tunes University High Quality Video Streaming Mobile devices and connectivity For-profit universities Specialized training centers
DOES TEACHING ONLINE TAKE MORE TIME?
DOES TEACHING ONLINE TAKE MORE TIME? Gregory W. Hislop 1 Abstract Many instructors feel that teaching online takes more time, but there is relatively little data available on this issue. This paper discusses
TUITION/PRICING FOR ONLINE LEARNING
TUITION/PRICING FOR ONLINE LEARNING Karen Paulson National Center for Higher Education Management Systems ABSTRACT To make online learning an integral part of higher education, institutions must determine
Interview with Gerald Heeger
Interview with Gerald Heeger Badrul Khan: This is the era of open, flexible, and distributed learning, and the University of Maryland University College (UMUC) is one of the fastest growing universities
The Future of ABC University and Blended Learning
MAY 20, 2008 STEPHEN J. LASTER The Future of ABC University and Blended Learning Eighteen months after joining ABC University (ABC) as chief information officer (CIO), Rob Smith was pleased with the progress
INNOVATING BY DOING BOTH : CISCO MANAGES CONTRADICTIONS THAT DRIVE GROWTH AND PROFIT
STRATEGY AND LEADERSHIP MAGAZINE INTERVIEW INNOVATING BY DOING BOTH : CISCO MANAGES CONTRADICTIONS THAT DRIVE GROWTH AND PROFIT (Published on and in Strategy and Leadership
Proprietary Education: Threat, or Not? Defining the Issue
VOLUME 10 NUMBER 4 SEPTEMBER 2004 Proprietary Education: Threat, or Not? Defining the Issue As an industry, proprietary education is evolving from mostly small local schools that deliver short, vocationallyoriented
Current Advantages and Disadvantages of Using E-Textbooks in Texas Higher Education
VOLUME 7, NUMBER 1, 2013 Current Advantages and Disadvantages of Using E-Textbooks in Texas Higher Education Darlene Waller Doctoral Candidate Texas A&M University-Commerce Commerce, TX Abstract This study
Technology: Creating New Models in Higher Education
Technology: Creating New Models in Higher Education By Robert W. Mendenhall Western Governors University Summary Technology will greatly expand access to higher education and fundamentally change the models
Online Training Made Easier with Video
Online Training Made Easier with Video A Ziff Davis White Paper Sponsored by: Contents Executive Summary... 03 Online Training... 03 Online Training with Video... 04 Primary approaches to online training
Chapter 3 FACTORS OF DISTANCE LEARNING
Chapter 3 FACTORS OF DISTANCE LEARNING 1. FACTORS OF DISTANCE LEARNING Distance learning, where the learner can be anywhere, anytime, is an important component of the future learning system discussed
IBM Training White Paper. The value of e-learning
IBM Training White Paper The value of e-learning Contents 1 Overview of the market 2 Types of e-learning 3 Benefits and disadvantages 6 Implementing a program 7 Developing a business case 9 Recommendations
The Adult Learner: An Eduventures Perspective
white PapeR The Adult Learner: An Eduventures Perspective Who They Are, What They Want, and How to Reach Them Eduventures, a higher education research and consulting firm, has been closely tracking the
Online Learning Solutions for the Challenges of Christian Education
Online Learning Solutions for the Challenges of Christian Education How would that business continue to function and prosper without the owner? As teaching technology has advanced, online education
Proposal to Change an Academic Program. Bachelor of Science in Business for Online Delivery
Proposal to Change an Academic Program Adding an Online Version of an Existing Program at The University of Minnesota, Crookston Bachelor of Science in Business for Online Delivery Prepared and Submitted.
Realizing the Full Potential of Blended Learning
A STRATEGY PAPER FROM Realizing the Full Potential of Blended Learning FLICKR/CONCORDIA What higher education institutions say about effective instructional strategies, practices and technologies for student
Online Universities: The Benefits and Disadvantages for Students and Professors
1 Online Universities: The Benefits and Disadvantages for Students and Professors The internet first came to universities during its creation. In 1970, when the first five nodes for the internet were established,
Trends in Higher Education Series. Trends in College Pricing
Trends in Higher Education Series Trends in College Pricing 2006 Introduction This report, based on the College Board s Annual Survey of Colleges, provides up-to-date information on tuition and other expenses
Corporate Universities: Competitors or Collaborators?
Corporate Universities: Competitors or Collaborators? Dr. Philip McGee, Program Coordinator for the Masters in Human Resource Development, Clemson University, South Carolina ABSTRACT universities bogged
THE EDUCATIONAL PROGRESS OF BLACK STUDENTS
NATIONAL CENTER FOR EDUCATION STATISTICS Findings from THE CONDITION OF EDUCATION 1994 NO. 2 THE EDUCATIONAL PROGRESS OF BLACK STUDENTS U.S. Department of Education Office of Educational Research and Improvement
Analysis Brief March 2013
Trends in Higher Education Series College Board Advocacy & Policy Center Analysis Brief March 2013 How Students and Parents Pay for College Kathleen Payea Policy Analyst, The College Board Sandy Baum Senior
informed. Planning Considerations for K-12 Communications Technology Planning Issues for K-12 Communications Technology frontier.
informed. Planning Considerations for K-12 Communications Technology frontier.com/enterprise 1 Executive Summary K-12 schools are increasingly wanting to leverage new digital learning technologies to make
Future of E-learning in Higher Education and Training Environments
1 20th Annual Conference on Distance Teaching and Learning Future of E-learning in Higher Education and Training Environments Curtis J. Bonk, Professor Departments of Educational Psychology and Instructional
Distance Education in Higher Education Institutions
NATIONAL CENTER FOR EDUCATION STATISTICS Statistical Analysis Report October 1997 Distance Education in Higher Education Institutions U.S. Department of Education Office of Educational Research and Improvement
HIGHER EDUCATION PRACTICE RESEARCH ABSTRACTS
1750 H Street NW, Suite 200, Washington, DC 20006 P 202.756.2971 F 866.808.6585 HIGHER EDUCATION PRACTICE RESEARCH ABSTRACTS January 2012 The following abstracts describe a sampling
Going Global A Methodology for Shaping Students for the Global Workplace
Session 3460 Going Global A Methodology for Shaping Students for the Global Workplace Raymond E. Thompson, Ronald Sterkenburg Purdue University Abstract Many programs are seeking ways to become global.
Masters of Business Administration (MBA)
So You Think You Want A : Masters of Business Administration (MBA) October 22, 2014 Presentation Agenda MBA Overview Why Choose a MBA? MBA Benefits By The Numbers MBA Admissions Criteria MBA Curriculum
Developing Communication-Related Master s Degree Programs
ACADEMIC AFFAIRS FORUM Developing Communication-Related Master s Degree Programs Custom Research Brief Research Associate Amanda Michael Research Manager Nalika Vasudevan December 2012 2 of 13 3 of
Proposal to Change an Academic Program. Bachelor of Manufacturing Management for Online Delivery
Proposal to Change an Academic Program Adding an Online Version of an Existing Program at The University of Minnesota, Crookston Bachelor of Manufacturing Management for Online Delivery Prepared and Submitted
CALIFORNIA AMERICAN UNIVERSITY'S DISTANCE LEARNING MBA PROGRAM
CALIFORNIA AMERICAN UNIVERSITY'S DISTANCE LEARNING MBA PROGRAM CALIFORNIA AMERICAN UNIVERSITY IS PLEASED TO PROVIDE A DISTANCE LEARNING MBA PROGRAM FOR EXPERIENCED BUSINESS PROFESSIONALS. EARN YOUR MBA
ALL ABOUT COMPETENCY BASED EDUCATION
ALL ABOUT COMPETENCY BASED EDUCATION New learning model offers credit for existing knowledge and skills AN INTRODUCTION TO COMPETENCY BASED EDUCATION BY 2020 35% of job openings will require at least,
EMBARGOED FOR RELEASE UNTIL: Contact: 9:00 a.m. ET, June 17, 1998 Heather Balas or Matt James. New National Survey of Small Businesses
EMBARGOED FOR RELEASE UNTIL: Contact: 9:00 a.m. ET, June 17, 1998 Heather Balas or Matt James New National Survey of Small Businesses MEASURES, SMALL BUSINESS EXECUTIVES SUPPORT CONSUMER PROTECTION EVEN
2006, Steven F. Tello
ONLINE EDUCATION AS A TECHNOLOGY INNOVATION IN HIGHER EDUCATION Steven F. Tello, Ed. D. College of Management, University of Massachusetts Lowell, Steven_Tello@uml.edu ABSTRACT Growing competition
By Hart Research Associates
One Year Out Findings From A National Survey Among Members Of The High School Graduating Class Of 2010 Submitted To: The College Board By Hart Research Associates August 18, 2011 Hart Research Associates
Foundational Insight: Online Higher Education Market Update 2012/13 Confronting Market Maturity and New Competition Executive Summary
Foundational Insight: Online Higher Education Market Update 2012/13 Confronting Market Maturity and New Competition Executive Summary Online Higher Education Market Update 2012/13: Confronting Market Maturity
Appendix D: Summary of studies on online lab courses
1 Appendix D: Summary of studies on online lab courses 1) Sloan Consortium Class Differences: Online Education in the United States (2011) Searched for lab, laboratory, science found no significant hits Case for EMBA Sponsorship
The Case for EMBA Sponsorship Part 1 - Preparation and Research Written by Daniel Szpiro, Dean of Executive Education at The Jack Welch Management Institute
Running Head: EFFECTIVE USE OF TECHNOLOGY IN EDUCATION 1
Running Head: EFFECTIVE USE OF TECHNOLOGY IN EDUCATION 1 Effective Use of Technology in Education Inez Escandón The University of Texas at San Antonio EFFECTIVE USE OF TECHNOLOGY IN EDUCATION 2 Effective
A Comparison of E-Learning and Traditional Learning: Experimental Approach
A Comparison of E-Learning and Traditional Learning: Experimental Approach Asst.Prof., Dr. Wanwipa Titthasiri, : Department of Computer Science : Faculty of Information Technology, Rangsit University :
The Public on Requiring Individuals to Have Health Insurance
Summary & Chartpack NPR/Kaiser Family Foundation/Harvard School of Public Health The Public on Requiring Individuals to Have Health Insurance February 2008 Summary This latest NPR/Kaiser Family Foundation/Harvard
Identifying Stakeholder Needs within Online Education. Abstract
Bozkurt Identifying Stakeholder Needs 1 Identifying Stakeholder Needs within Online Education Dr. Ipek Bozkurt Assistant Professor Engineering Management Programs School of Science and Computer.
BOOST STUDENT RETENTION AND EMPLOYABILITY while improving the bottom line
BOOST STUDENT RETENTION AND EMPLOYABILITY while improving the bottom line DISTINGUISH YOUR INSTITUTION by offering globally recognized computing certifications It s no secret that improving student retention and
The Impact of Digital Media on Lead Quality:
The Impact of Digital Media on Lead Quality: Guide to Using Toll-free Vanity Numbers as Response Tools in Advertising to Get Higher Quality Leads Published March 2013 Table of Contents The Channels of
avoiding the top 10 recruiting mistakes BeaconFey
avoiding the top 10 recruiting mistakes BeaconFey Better thinking. Better results. market situation The future is now! >Experts say that the country s nursing corps is aging faster than nearly any other
IMPROVING URBAN PUBLIC SCHOOLS: SUGGESTIONS FOR TEACHER UNION LEADERS
Panel Discussion IMPROVING URBAN PUBLIC SCHOOLS: SUGGESTIONS FOR TEACHER UNION LEADERS RichardJ. Murnane* For three related reasons, I focus my comments on the challenge of improving the quality of education
New! For Association Executives Certificate in Programming Online
New! For Association Executives Certificate in Programming Online Online programming is growing and will become 50% of association professional development. But Gen Y and future generations of association
Application to Modify a Recurrent Authorization to Operate
Application to Modify a Recurrent Authorization to Operate Institution: Program: Degree: Program: Degree: Institution s Existing Degree(s) in Same or Similar Discipline: Bryan College of Health Sciences
68 questions of concern to every computer industry executive with customer education responsibility:
978-443-5943 (phone) 978-443-3316 (fax) esfusion@sellmoretraining.com (email) (web) Readiness Audit 68 questions of concern to every computer industry executive with customer education
Investment Company Institute and the Securities Industry Association. Equity Ownership
Investment Company Institute and the Securities Industry Association Equity Ownership in America, 2005 Investment Company Institute and the Securities Industry Association Equity Ownership in America,
Controlling Expenses:
Controlling Expenses: Inside a Common Challenge for Business Owners Controlling business expenses is a top stressor for leaders of small and midsize companies. By understanding how other owners rein in
Evolving Campus Support Models for E-Learning Courses
ECAR Respondent Summary March 2003 Respondent Summary Evolving Campus Support Models for E-Learning Courses Paul Arabasz and Mary Beth Baker Wireless networks, course management systems, multimedia, and
OVERCOMING THE FINANCIAL AID BARRIER FOR E-LEARNERS
OVERCOMING THE FINANCIAL AID BARRIER FOR E-LEARNERS Bruce Chaloux Electronic Campus Southern Regional Education Board ABSTRACT Financial aid systems help make higher education available to all who can
Simplify and Focus the Education Tax Incentives. June, 2006
Simplify and Focus the Education Tax Incentives June, 2006 Susan Dynarski, Harvard University & National Bureau of Economic Research Judith Scott Clayton, Harvard University A college education is a good
Distance Education at Degree-Granting Postsecondary Institutions: 2000-2001
Distance Education at Degree-Granting Postsecondary Institutions: 2000-2001 U.S. Department of Education Institute of Education Sciences NCES 2003-017 E.D. Tabs Distance Education at Degree-Granting Postsecondary
Federal Student Loan Debt: 1993 to 2004
Issue Brief June 2005 Federal Student Loan Debt: 1993 to 2004 University officials, lenders, and policy makers typically monitor annual federal student loan volume (the number of loans made and the total | http://docplayer.net/895770-Education-and-the-internet-austan-goolsbee-university-of-chicago-g-s-b-american-bar-foundation-and-n-b-e-r-september-2000.html | CC-MAIN-2017-34 | en | refinedweb |
import "golang.org/x/tools/refactor.
THIS PACKAGE IS EXPERIMENTAL AND MAY CHANGE AT ANY TIME.
It is provided only for the gorename tool. Ideally this functionality will become part of the type-checker in due course, since it is computing it anyway, and it is robust for ill-typed inputs, which this package is not.
A Constraint records the fact that the RHS type does and must satisify the LHS type, which is an interface. The names are suggestive of an assignment statement LHS = RHS.
type Finder struct { Result map[Constraint]bool // contains filtered or unexported fields }
A Finder inspects the type-checked ASTs of Go packages and accumulates the set of type constraints (x, y) such that x is assignable to y, y is an interface, and both x and y have methods.
In other words, it returns the subset of the "implements" relation that is checked during compilation of a package. Refactoring tools will need to preserve at least this part of the relation to ensure continued compilation.
Find inspects a single package, populating Result with its pairs of constrained types.
The result is non-canonical and thus may contain duplicates (but this tends to preserves names of interface types better).
The package must be free of type errors, and info.{Defs,Uses,Selections,Types} must have been populated by the type-checker.
Package satisfy imports 6 packages (graph) and is imported by 1 packages. Updated 2017-08-15. Refresh now. Tools for package owners. | http://godoc.org/golang.org/x/tools/refactor/satisfy | CC-MAIN-2017-34 | en | refinedweb |
Got any useful PowerShell scripts? It doesn't matter if you created them yourself or not. I'm sure there are a bunch of good scripts out there so please share.
19 Replies
Jul 8, 2009 at 12:06 UTC
PS nub here. Waiting for others to share...
Jul 9, 2009 at 7:53 UTC
Just starting into Powershell and so far Kinda have this one working.
#Set the location of the Powershell Script
New-PSDrive -name X –psprovider FileSystem -root Z:\Powershell
Set-Location Z:
#Set Domain Users as Power Users to Local PC
{
$ComputerName = get-content env:computername; $objUsrname = get-content env:username
$objUser = [ADSI]("WinNT://cityoftupelo.cityhall/$objUsrname")
$objGroup = [ADSI]("WinNT://$ComputerName/Administrators")
$objGroup.PSBase.Invoke("Add",$objUser.PSBase.Path)
}
#Set the Execution Policy to RemoteSigned from Restricted
set-ExecutionPolicy RemoteSigned
# Call the Assembly needed
[System.Reflection.Assembly]::LoadWithPartialName('system.serviceprocess')
if (-not ([appdomain]::CurrentDomain.getassemblies() |? {$_.ManifestModule -like "system.serviceprocess"})) {[void][System.Reflection.Assembly]::LoadWithPartialName('system.serviceprocess')}
#Collect Operating System and Disable and Stop the Firewall
$colItems = get-wmiobject -class "Win32_OperatingSystem" -namespace "root\CIMV2"
foreach ($objItem in $colItems) {
$Name = $objItem.Name
if ($Name = "6") {set-Service MpsSvc -startupType Disabled}
stop-Service MpsSvc -force
if ($Name = "5") {set-Service SharedAccess -startupType Disabled}
stop-Service SharedAccess -force
}
Jul 9, 2009 at 9:56 UTC
I made a couple at my previous employer. I know I backed them up somewhere before I left so I will try and dig them up.
They are just basic scripts though, nothing too fancy.
Jul 16, 2009 at 2:15 UTC
I can't remember if I wrote this one or not, nevertheless:
Usage: .\scriptname.ps1 computername
get-wmiobject Win32_ComputerSystem -computername $args[0] | format-table -property name, username
Use this to return the currently logged on user of a computer.
Jul 16, 2009 at 10:49 UTC
I did not write this script but it is handy for quick AD domain information if you are on a new network and need to familiarize yourself with it.
I tried to copy and paste but the formatting looked horrible so I have attached it as a .ps1 file.
Enjoy!
Jul 17, 2009 at 11:20 UTC
Get-childitem C:\Data\DFS\Share -recurse | ForEach-Object -process {if (($_.attributes -band 0x100) -eq 0x100) {$_.attributes = ($_.attributes -band 0xFEFF)}}
MS guy helping us yesterday in a DFS issue used that PS command to change files marked as "temp" to "not temp".
PS is so freaking hard.
Jul 20, 2009 at 11:08 UTC
1st Post
The best way to get hands dirty with PS to get started with PowerGUI, it is amazing free tool in my opinion, I am sure you will love it. By the way SpiceWorks look promissing (-:
best,
ocd
oz Casey Dedeal,
MVP (Exchange)
MCITP (EMA), MCITP (SA)
MCSE 2003, M+, S+, MCDST
Security+, Project +, Server + (Blog) (Blog) (Blog)
Jul 29, 2009 at 3:53 UTC
Another vote for PowerGUI - it's awesome! :)
Jul 30, 2009 at 12:08 UTC
Exchange 2007 sucks. If I had known I would have become a Linux admin instead.
PS that I just used to create a certificate request for Exchange 2007.
New-ExchangeCertificate -GenerateRequest -DomainName xxx -FriendlyName xxx -Path d:\xxx.csr -KeySize 1024 -SubjectName "c=US, s=xxx, l=xxx, o=xxx, ou=xxx, cn=xxx" -PrivateKeyExportable $True
Then I'll need another command to import the SSL cert, another to find the blueprint, then another to configure it on Exchange, IIS, etc.
Honestly...
Aug 4, 2009 at 11:02 UTC
Well, apart from some clicking here and there - techdemos, fairs etc - I haven't touched Exchange since v5 (also tested 2000) but based on what I've seen I never considered it seriously: it was such a mess compared to any high-performance linux setup it just scared me away despite being a Windows shop...
...good to know it's still a mess, though. :D
Aug 4, 2009 at 12:12 UTC
Exchange 2003 was OK. But 2007 is completely different, it's like XP to Vista or Office 03 to 07, much much worse. The GUI is used for 40% of the tasks, the rest....google is your only hope.
Aug 13, 2009 at 8:06 UTC
he he, Exchange keeps many people employed. But so does Cisco, CheckPoint, blah, blah, blah, pick your own poison. We get paid to bear the burden of supporting these solutions. While I prefer a Linux environment and shell scripting or perl, the Windows powershell is the CLI tool for a Windows environment and one that Windows admins need to learn. The PowerGUI was a great recommendation.
Jun 24, 2010 at 1:54 UTC
1st Post
This script allows you to view 3 certain events from a remote computer.
Jul 1, 2010 at 11:39 UTC
Looks like there's a display issue in the community wysiwyg. I initially tried to post by pasting the following stuff. It pasted, but removed formatting and didn't show int he wysiwig. Figured out that hitting the delete key on the last line the cursor shows on will make the next block of pasted text visible.
Ah well, two deleted posts and several edits later... my post! yay!
Edit: fixed a bug in the attached script file, now works as it should.
Attached is a script I wrote this morning for utilizing the GAM tool with Google Apps to remove a user from several groups listed in a text file. I became curious, as usual, and figured out how to do the help documentation and required parameter stuff so it has a fleshed out entry if you use get-help .\Remove-User-From-Groups.ps1.
Also, below I've pasted some one-liners I came up with to help with doing stuff for distribution groups in Exchange 2007, though I could use what I learned writing the attached script to make them more flexible and sophisticated if I felt like it... in fact I could probably glom them all together into one script and utilize decision structure and arguments to determine what action it does.
get distribution groups user is a member of:
$user = get-user <username>; Get-DistributionGroup | foreach {$dg = $_ ; Get-DistributionGroupMember $dg | foreach {if ($_.identity -like $user.identity) {"Member of : " + $dg} }}
Remove user from all distribution groups:
$user = get-user <username>; Get-DistributionGroup | foreach {$dg = $_ ; Get-DistributionGroupMember $dg | foreach {if ($_.identity -like $user.identity) {Remove-DistributionGroupMember $dg -member $user.identity -Confirm:$false;"Member removed from : " + $dg} }}
Get members from specific multiple distribution groups:
get-distributiongroup | foreach{$dg = $_; if(($_.name -like "distrogroup1") -or ($_.name -like "distrogroup2")){"`n $dg `n";get-distributiongroupmember $dg.name}}
Add user to multiple specified distribution groups
$user = get-user <username>; get-distributiongroup | foreach{$dg = $_; if(($_.name -like "distrogroup1") -or ($_.name -like "distrogroup2")){add-distributiongroupmember $dg.name -member $user.samaccountname}}
Jul 14, 2010 at 1:05 UTC
I've been looking for some code to help me pull data off a webpage. I found a few things on the web here and there, and then I found a script to pull Citrix license data on Poshcode.org
(to give credit where it is due: # Virtu-Al http:/
Anyway, I was only interested in getting a single line from a webpage that required login credentials. Nothing I found helped until now. I had to make some changes to the code snippet I copied but here is what I have that works for me.
#Retrieve web page into a text file, find a string
$webClient = New-Object System.Net.WebClient
#The next two lines should be all one line
$webClient.credentials = New-Object System.Net.NetworkCredential("user","pass")
$webadd = "http:/
$webClient.DownloadString($webadd) > "c:\pathto\file.txt"
$myLine = Get-Content "c:\pathto\file.txt" | Select-String -pattern "stringpattern"
$myLine | Out-Host
There are few more things that could be done but this is nice, small and works. I found that if I piped the download into a variable, PS didn't like it. I fooled around and finally just used a silly txt file.
The biggest problem I was having before was providing login credentials. This works as is.
Jul 14, 2010 at 1:45 UTC
MarcusJ, I haven't tried doing anything with web pages, but have you tried using the get-credential command to acquire the credentials you need? I've had it work with other things, figure it's worth a shot.
Jul 15, 2010 at 2:14 UTC
I did find a Powershell tip that showed how to use read-host -AsSecureString etc.. but it didn't work for me. As I understand, Get-Credential prompts you or uses your current credentials. The page I was accessing is actually from a Cisco Catalyst Express (HIGHLY UNrecommended!) that was too overloaded to display the webGui.
On the side, I had tried to copy and paste into the text box here and nothing seemed to show... then when I clicked "submit" all the attempts showed at the bottom! Just in case you were wondering what all that seemingly random text was at the end of my post.
Nov 26, 2010 at 12:30 UTC
I use this to find Computers in AD that are not on the floor anymore. It checks the modification date of the computer object (the pc password changes every 30 days by default), writes this to a text file, takes that text file and tries to ping those pc's (a secondary check to make sure its not out there), exports those results to csv. You just need to change the date to how far back you want to look.
Only problem is it puts quotes around the names when it writes to the text file. They need to be removed.
get-qadcomputer -SizeLimit 0 | Where-Object {$_.modificationdate -lt "05.01.2010"} | Select-Object name | Export-Csv c:\powershell\PingPC.txt
Write-host `
"Pinging List of Dead Computers and Writing to c:\psexport\PingPc.csv `WAIT" -foregroundcolor "Red"
Get-Content c:\powershell\pingpc.txt | ForEach-Object {GWMI win32_pingstatus -filter ("address='"+ $_ +"'") -computername .} | Select-Object address,responsetime,statuscode | export-csv c:\psexport\PingPC.csv
Dec 29, 2010 at 8:53 UTC
I am only just getting into Powershell but i am loving it!!!
Here are a couple of useful scripts i've written up / hacked together for myself or my users. Not sure if anyone else would be interested in them but please feel free to use / edit them as you wish.
Firstly This will unzip any .zip files you have in the current folder the script is run from - I found this on the internet but where from exactly eludes me
$shell=new-object -com shell.application
$CurrentLocation=get-location
$CurrentPath=$CurrentLocation.path
$Location=$shell.namespace($CurrentPath)
$ZipFiles = get-childitem *.zip
$ZipFiles.count | out-default
$Index = 1
foreach ($ZipFile in $ZipFiles)
{
$Index = $Index + 1
$CreateFolder = $Location + "\$Index"
New-Item $Location
$ZipFile.fullname | out-default
$ZipFolder = $shell.namespace($ZipFile.fullname)
$Location.Copyhere($ZipFolder.items())
}
This is my modified script to copy from the current folder to a specified folder and put each zip file into it's own directory
######################################
# Mashed together By Hookimus #
# 13/12/10 #
######################################
$shell=new-object -com shell.application
$CurrentLocation=get-location
$CurrentPath=$CurrentLocation.path
$Location=$shell.namespace($CurrentPath)
# Find all the Zip files and Count them
$ZipFiles = get-childitem *.zip
$ZipFiles.count | out-default
# Set the Index for unique folders
$Index = 1
# For every zip file in the folder
foreach ($ZipFile in $ZipFiles)
{
# Get the full path to the zip file
$ZipFile.fullname | out-default
# Create a new folder - EDIT THE BELOW LINE TO CHANGE THE LOCATION TO SAVE THE FILES TO
$NewLocation = "E:\TestFolder\Unzipped\$Index"
New-Item $NewLocation -type Directory
# Move the zip file to the new folder
Move-Item $ZipFile.fullname $NewLocation
# List up all of the zip files in the new folder (should only be the 1 we moved)
$NewZipFile = get-childitem $NewLocation *.zip
# Get the COMObjects required for the unzip process
$NewLocation = $shell.namespace($NewLocation)
$ZipFolder = $shell.namespace($NewZipFile.fullname)
# Copy the files to the new Folder
$NewLocation.copyhere($ZipFolder.items())
# Increase the Index to ensure that unique folders are made
$Index = $Index + 1
}
This last one is the one we use for deployments of .vce files that are used by our companies IVR system. It prompts the user for the location of all the files.
######################################
# Created By Hookimus #
# 30/12/10 #
######################################
#Load Visual Basic Assembly
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
#Prompt User for the file locations
$Originalfolder = [Microsoft.VisualBasic.Interaction]::InputBox("Enter the Live location", "Live Location", "C:\")
$Newfolder = [Microsoft.VisualBasic.Interaction]::InputBox("Enter the location of the New files", "New Files", "C:\")
$Oldfolder = [Microsoft.VisualBasic.Interaction]::InputBox("Enter Enter where you want the live files to be backed up to", "Backed up", "C:\")
#Get the appropriate files
$Newfiles = Get-Childitem $Newfolder *.vce
$Originalfiles = Get-Childitem $Originalfolder *.vce
#For each file in the folder, move only that file to the new destination
foreach ($File in $Originalfiles)
{
Move-Item $File.fullname -Destination $Oldfolder
}
#For each file in the folder, copy only that file to the new destination
foreach ($File in $Newfiles)
{
Copy-Item $File.fullname -Destination $Originalfolder
}
This discussion has been inactive for over a year.
You may get a better answer to your question by starting a new discussion. | https://community.spiceworks.com/topic/71319-share-your-scripts | CC-MAIN-2017-34 | en | refinedweb |
ASP.NET (OWIN) Authorization
Sample Project
Download a sample project specific to this tutorial configured with your Auth0 API Keys..
Create a Rule to assign roles
First, we will create a rule that assigns our users either an
admin role, or a single
user role. To do so, go to the new rule page and create an empty rule. Then, use the following code for your rule:
function (user, context, callback) { var addRolesToUser = function(user, cb) { if (user.email.indexOf('@example.com') > -1) { cb(null, ['admin']); } else { cb(null, ['user']); } }; addRolesToUser(user, function(err, roles) { if (err) { callback(err); } else { context.idToken[""] = roles; callback(null, user, context); } }); }
Update the code to check for your own email domain, or match the condition according to your needs. Notice that you can also set more roles other than
admin and
user, or customize the whole rule as you please.
This quickstart uses for the claim namespace, but it is suggested that you use a namespace related to your own Auth0 tenant for your claims, e.g
Restrict an action based on a user's roles
As with the country property which was added in the previous step, you will also need to manually extract the roles from the user in the
OnAuthenticated event and add the appropriate claims. For each role, you can add a role of the type
ClaimTypes.Role.
This will ensure proper integration with the existing role-based authorization in ASP.NET MVC and allow you to restrict access to a controller by simply decorating your controller actions with the
[Authorize(Roles = ?)] attribute
So change the existing middleware registration in the
Startup class to extract the roles and add the claims:
// Startup.cs var options = new Auth0AuthenticationOptions() { Domain = auth0Domain, ClientId = auth0ClientId, ClientSecret = auth0ClientSecret, Provider = new Auth0AuthenticationProvider { OnAuthenticated = context => { // Get the user's country JToken countryObject = context.User[""]; if (countryObject != null) { string country = countryObject.ToObject<string>(); context.Identity.AddClaim(new Claim("country", country, ClaimValueTypes.String, context.Connection)); } // Get the user's roles var rolesObject = context.User[""]; if (rolesObject != null) { string[] roles = rolesObject.ToObject<string[]>(); foreach (var role in roles) { context.Identity.AddClaim(new Claim(ClaimTypes.Role, role, ClaimValueTypes.String, context.Connection)); } } return Task.FromResult(0); } } }; app.UseAuth0Authentication(options);
Now you can add a new action to your controller and restrict it by decorating your controller actions with the
[Authorize(Roles = ?)] attribute.
The sample code below will restrict the particular action only to the user who have the "admin" role:
// Controllers/AccountController.cs [Authorize(Roles = "admin")] public ActionResult Admin() { return View(); } | https://auth0.com/docs/quickstart/webapp/aspnet-owin/05-authorization | CC-MAIN-2017-34 | en | refinedweb |
four years. Brian is a steering committee member of the Buckeye SharePoint User Group, and he enjoys giving back to the community through giving presentations, planning and volunteering at conferences, maintaining a SharePoint/.NET-centric blog, and contributing to the SharePoint Twitterverse. He also holds several Microsoft Certified Technology Specialist (MCTS) certifications for SharePoint-related technologies.
Brian’s blog: The Frog Pond of Technology
Now, here’s Brian…
Office 365 is picking up in deployments and user adoption. Windows PowerShell is one tool for the administration of Office 365 that is similar to its on-premises counterparts, but it can have a few differences. In this post, I will discuss one way to get the size of an Exchange Online mailbox in bytes and consequently GBs.
Problem
Getting the size of an on-premises Exchange 2010 mailbox is fairly easy. In his blog The Get-MailboxStatistics Cmdlet, the TotalitemSize Property, and that pesky little “b”, fellow PFE Gary Siepser, explains how to accomplish this task by using the mailbox TotalItemSize property with methods such as ToMB() and ToGB(). Note that Gary’s script will not work when remoting from a local machine that doesn’t have the Exchange object model installed or loaded.
A similar type of scenario exists if you are executing Windows PowerShell against Exchange Online. The data type for TotalItemSize being returned (ByteQuantifiedSize) exists in the Exchange namespace. If the WindowsPowerShell session doesn’t have access to that namespace (or hasn’t loaded it), Windows PowerShell works with an approximation of that data type.
The following script is a sample on the TechNet article View Mailbox Sizes and Mailbox Quotas Using Windows PowerShell, which a customer of mine tried, but it was failing. (I made minor edits to fit it
The script is targeted to Exchange 2010, but it fails for Exchange Online. In Exchange Online, when referencing the TotalItemSize property, there is not a Split method, which ultimately causes the script to return no data for “Total Item Size (MB)” column.
Solution
A simple solution would be to add a call to the ToString method off of the TotalItemSize property (shown in bold on line 5 in the following script). eyesore to me. I attempted to simplify the string manipulation with a regular expression. (For more information about regular expressions in Windows PowerShell, see the Regular-Expressions.info website.)
The result is a working script that adds two pieces of functionality. First, the script allows you to input a specific user to search for (or all users if no input is supplied). A technique called splatting is used to allow “@Params” to send additional optional parameters to the Get-Mailbox cmdlet. Second, the script adds a new member to the mailbox statistics called TotalItemSizeInBytes. With this member you can then convert to any byte level that suits your needs (for example, KB, MB, or GB).
Note You can download the full version of this script from the Script Center Repository (it includes commands to connect to Exchange Online session):
Get Exchange Online Mailbox Size in GBs
$userToFind = Read-Host -Prompt "Enter user to find (leave blank for all)"
$params = @{}
if([string]::IsNullOrEmpty($userToFind) -eq $false)
{$params = @{Identity = $userToFind}
}
$UserMailboxStats = Get-Mailbox -RecipientTypeDetails UserMailbox `
-ResultSize Unlimited @Params |
Get-MailboxStatistics
$UserMailboxStats |
Add-Member -MemberType ScriptProperty -Name TotalItemSizeInBytes `
-Value {$this.TotalItemSize -replace "(.*\()|,| [a-z]*\)", ""}
$UserMailboxStats |
Select-Object DisplayName, TotalItemSizeInBytes,@{Name="TotalItemSize (GB)"; `
Expression={[math]::Round($_.TotalItemSizeInBytes/1GB,2)}}
The regular expression ‘$this.TotalItemSize –replace "(.*\()|,| [a-z]*\)", ""’ is searching for the following three patterns and replacing them with empty strings. The result is the total item size in bytes with no other extra characters.
- .*\( = Any number of characters followed by an opening parentheses
- , = Commas
- [a-z]*\) = Any number of alphabetic characters followed by a closing parentheses (i.e. “bytes)”)
Moving from on-premises to the cloud with Windows PowerShell (and Windows PowerShell remoting in general) can sometimes present new challenges due to what you have access to. This means that you must always test your code and scripts.
I still believe that not having to physically RDP to a server is a huge gain over some of the small hurdles that you may encounter during the transition. Scripting is the future of administration, and it makes you more valuable. Hopefully this script and the concepts presented help you be a better admin and developer.
For more information, watch my video series: The One Thing: Brian Jackett and SharePoint 2010.
—Frog Out
Links
- The Get-MailboxStatistics cmdlet, the TotalItemSize property, and that pesky little “b”
- View Mailbox Sizes and Mailbox Quotas Using Windows PowerShell
- Regular Expressions with Windows PowerShell
- Get Exchange Online Mailboxes Size in GBs on TechNet Script Center
- “I don’t always test my code…” image
- The One Thing: Brian Jackett and SharePoint 2010
Awesome job, Brian. Thanks for an informative and helpful guest blog post. Join me tomorrow when I will talk about using Windows PowerShell to explore process threads. been trying to modify this script to display mailboxes based on their size as a percentage of the Warning Quota. But my Where-Object expression does not return the values I expected. It seems that since the values of DatabaseIssueWarningQuota and
TatalItemSize are in Bytes, and since you can’t have a fraction of a byte, the division will one return an integer. Either “0 Byte”, if the results of the division is less than 1, or “1 Byte” if the results of the division is more than 1.
I’ve tried many ways to force the division to return a decimal result, but all have failed. Amy ideas to make it work.
Get-Mailbox -ResultSize Unlimited |
Get-MailboxStatistics |
Where {$_.TotalItemSize / $_.DatabaseIssueWarningQuota) -lt .90} |
Sort-Object TotalItemSize -Descending | ft –auto
Interesting! I used below trick in mine and it produces same result as yours. The crazy part is I search everywhere for something like this before I decided to resolve it myself.
——————————-
$stats = $mb | Get-MailboxStatistics | Select-Object TotalItemSize,ItemCount,LastLogonTime,StorageLimitStatus,TotalDeletedItemSize
$lastlogon = $stats.LastLogonTime
$TotalItemSize = [double]$Stats.TotalItemSize.SubString($Stats.TotalItemSize.indexof("(")+1, $Stats.TotalItemSize.indexof(" b")-$Stats.TotalItemSize.indexof("("))
$TotalItemSizeGB = $TotalItemSize / 1073741824
$TotalItemSizeGB = "{0:N2}" -f $TotalItemSizeGB
$TotalItemSizeMB = $TotalItemSize /1048576
$TotalItemSizeMB = "{0:N0}" -f $TotalItemSizeMB
————————————–
Meg.
how can we export the result to a .csv file?" | https://blogs.technet.microsoft.com/heyscriptingguy/2013/02/27/get-exchange-online-mailbox-size-in-gb/ | CC-MAIN-2017-34 | en | refinedweb |
My program is trying to find the longest contiguous sequence of an array, but the output is wrong.
public class longsec {
public int[] longestForward(int[] arr){
int subSeqLength = 1;
int longest = 1;
int indexStart = 0;
int indexEnd = 0;
for (int i = 0; i < arr.length - 1; i++)
{
if (arr[i] == arr[i + 1] - 1)
{
subSeqLength++;
if (subSeqLength > longest)
{
longest = subSeqLength;
indexStart = i + 2 - subSeqLength;
indexEnd = i + 2;
}
}
else
subSeqLength = 1;
}
int T[] = new int[arr.length];
for (int i = indexStart; i < indexEnd; i++)
T[i]= arr[i];
return T;
}}
The reason why that is happening is because you are creating an array with the same size as the array you inputted. As you can see here.
int T[] = new int[arr.length];
However if just change that piece of code you will get an arrayIndexOutOfBoundsException. And it will be thrown here:
for (int i = indexStart; i < indexEnd; i++) T[i]= arr[i];
Because indexStart will ussually be greater than the length of the array. So instead of looping from indexStart to indexEnd what you should be doing is looping through the length of the contiguous numbers like this.
int T[] = new int[longest]; for(int i = 0; i < longest; i++) T[i] = arr[i + indexStart];
That should give you your desired output. What I am doing is just offsetting the iteration by the indexStart value of your array. | https://codedump.io/share/D3jtAUa9CUM2/1/removing-useless-elements-of-an-array | CC-MAIN-2017-34 | en | refinedweb |
import a form.Asked by waldson on November 16, 2014 at 06:23 PM
Dear Sirs,
I'm not able to regenerate this html script like a form
<script type="text/javascript" src=""></script>
when I use import form option from a web page,
It does the operation, but jotform transforms it in a wronged way not able to modify it.
Note content formisc.html contains
<script type="text/javascript" src=""></script>
Thks.
- JotForm Support
Hello waldson,
I am not sure if I have understood your question correctly.
Do you want to import the above form. Please be noted that to be able to import a form, you should use its direct URL. The code above you have mentioned is the form's embed code and not direct URL.
Please use the following URL to clone this form in your account :
Hope this helps.
Do get back to us if you have any questions.
Thank you!
It took a time but at the end It has solved.
Thank you!
- JotForm Support
Hello waldson,
You are welcome.
I am glad to know that you were able to clone your form/
Do get back to us if you have any questions.
Thank you!
- | https://www.jotform.com/answers/460101-Not-able-to-import-a-form- | CC-MAIN-2017-34 | en | refinedweb |
sc_get_card_types_for_reader()
Retrieve a list of card types that match the ATR of the card in the reader associated with the provided context.
Synopsis:
#include <smartcard/sc_smart_card.h>
sc_response_code_t sc_get_card_types_for_reader(sc_context_t *context, sc_card_name_t *cards, size_t *num_cards)
Since:
BlackBerry 10.2.0
Arguments:
- context
The active smart card context. This value cannot be NULL.
- cards
An array of card types that can drive the card in the reader. If NULL, only the number of available card types is retrieved.
- num_cards
On input, this value indicates the number of elements in the cards array. On output, the value indicates the number of card names that have been written to the cards array. This value must not be NULL.
Library:libscs (For the qcc command, use the -l scs option to link against this library)
Description:
This function is useful in determining which card types can be used to manipulate the card in the reader.
A handle of type SC_HANDLE_READER_SLOT_LOGICAL must be allocated before calling this function; otherwise an error is returned.
Returns:
SC_SCARD_S_SUCCESS upon success, an error code otherwise. See sc_response_code_t for defined error codes.
Last modified: 2014-09-30
Got questions about leaving a comment? Get answers from our Disqus FAQ.comments powered by Disqus | http://developer.blackberry.com/native/reference/core/com.qnx.doc.smartcard.lib_ref/topic/sc_get_card_types_for_reader.html | CC-MAIN-2017-34 | en | refinedweb |
import "golang.org/x/text/internal/utf8internal"
Package utf8internal contains low-level utf8-related constants, tables, etc. that are used internally by the text package.
The default lowest and highest continuation byte.
const ( // ASCII identifies a UTF-8 byte as ASCII. ASCII = as // FirstInvalid indicates a byte is invalid as a first byte of a UTF-8 // sequence. FirstInvalid = xx // SizeMask is a mask for the size bits. Use use x&SizeMask to get the size. SizeMask = 7 // AcceptShift is the right-shift count for the first byte info byte to get // the index into the AcceptRanges table. See AcceptRanges. AcceptShift = 4 )
Constants related to getting information of first bytes of UTF-8 sequences.
var AcceptRanges = [...]AcceptRange{ 0: {LoCB, HiCB}, 1: {0xA0, HiCB}, 2: {LoCB, 0x9F}, 3: {0x90, HiCB}, 4: {LoCB, 0x8F}, }
AcceptRanges is a slice of AcceptRange values. For a given byte sequence b
AcceptRanges[First[b[0]]>>AcceptShift]
will give the value of AcceptRange for the multi-byte UTF-8 sequence starting at b[0].
First is information about the first byte in a UTF-8 sequence.
type AcceptRange struct { Lo uint8 // lowest value for second byte. Hi uint8 // highest value for second byte. }
AcceptRange gives the range of valid values for the second byte in a UTF-8 sequence for any value for First that is not ASCII or FirstInvalid.
Package utf8internal is imported by 1 packages. Updated 2017-08-15. Refresh now. Tools for package owners. | http://godoc.org/golang.org/x/text/internal/utf8internal | CC-MAIN-2017-34 | en | refinedweb |
David's XMLC Tips
XMLC Tips
XMLC supports two XML parsers for building a DOM template: the Xerces DOM and the LazyDOM, an XMLC enhancement subclass of the Xerces DOM. Although the LazyDOM usually delivers superior performance, thanks to its capability to instantiate only selected portions of the DOM, the Xerces DOM might perform better if your page is extensively dynamic.
Sometimes you just cannot figure out why your resultant markup is coming out the way it is. Use the DOMInfo class as a runtime approach to dumping the current state of your page template at any point once it has been factory loaded. Here's an example of using DOMInfo to take a look at a portion of a page template dealing with a single row in an HTML table.
A shortcoming of the DOM API is that it doesn't address JavaScript other than supporting the <script> element. So, how do you dynamically update a JavaScript without resorting to the ugly nature of shoving script into a CDATA section? One approach, among many, is to use hidden fields to set JavaScript variables later accessed by the JavaScript. This approach works great for JavaScript that performs client-side validation, such as checking a password for minimum length.
There's more than one way to reference XMLC's dynamic content labeling id attributes. If your table labeling id attribute is named "PartsTable," you can either use the hardwired named getElementPartsTable() or the more flexible getElementById method, as in "getElementById("PartsTable"). There is no performance penalty, and you can do robust coding with friendlier error checking. By checking the returned value of the getElementById() method, you can double check that the id attribute was not left out by the markup designer during a page maintenance revamp. Instead of dealing with a crash-and-burn situation when your code tries to invoke a nonexistent getElementPartsTable(), you instead alert the QA department that the expected PartsTable attribute is no longer there.
Barracuda is the exciting new presentation framework for XMLC featuring client-type detection, forms handling and validation, and other common presentation-handling needs. But, with its comprehensiveness, it can be a little daunting. So, why not test the water by only using the portions of it that address immediate needs. For example, rather than mastering its hierarchical event handling or assortment of user interface components, why not just use the localization ant taskdef to better take advantage of its excellent automation of separating and organizing localized strings for markup pages?
import org.enhydra.xml.dom.DOMInfo;
PrintWriter out = newPrinterWrite(new OutputStreamWriter(System.out, "UTF-8")); myPageHTML page = (myPageHTML) xmlc.getFactory().create(myPageHTML.class); Node subTemplate = myPage.getElementCustomerRow(); DOMInof.printTree("Customer Row template", subTemplate, DOMInfo.PRINT_ATTR_DETAILS,out);
For example, in your markup, you might have the following default value and associated message:
<input type="hidden" name="passLen" value="8" id="passwordLength"> <script language="javascript"> document.write("Password length must be " + document.loginForm.passwordLength.value); </script>
In your Java code, the following will really let your users know you mean business.
HTMLInputElement input = page.getElementPasswordLength(); input.getAttribute("value").setValue("16"); | http://www.informit.com/articles/article.aspx?p=25858 | CC-MAIN-2017-34 | en | refinedweb |
If.
public class CalculatorTester { public void TestAdd() { var calculator = new Calculator(); if (calculator.Add(2, 2) == 4) Console.WriteLine("Success"); else Console.WriteLine("Failure"); } }.
What Are Unit Test Frameworks?
Well, as you can imagine, having this sort of unit testing across your entire codebase could prove cumbersome. You’d write lots of classes just like this one and then… what? You’d look at all of the console output for failures, only to discover that failure proved pretty inscrutable.
Most likely you would then have the clever idea to include the name of the test in the output so that you could see what had failed. From there, you might start to add some sort of GUI-like feedback to the results, to present them in a more readable fashion. From there, who knows? Maybe you write a Visual Studio plugin or maybe you find a way to incorporate this test suite into your build?
Well, it turns out that if you did all that stuff, you would have built yourself a unit testing framework. Let’s take a look now at what some code written for an actual unit test framework (MS Test) looks like.
[TestClass] public class CalculatorTests { [TestMethod] public void TestMethod1() { var calculator = new Calculator(); Assert.AreEqual(4, calculator.Add(2, 2)); } }
Unlike the last snippet, we have a bit of magic here. Notice the attributes, TestClass and TestMethod. Those exist simply to tell the unit test framework to pay attention to them when executing the unit test suite. When you want to get results, you invoke the unit test runner, and it executes all methods decorated like this, compiling the results into a visually pleasing report that you can view.
So, with that background established, let’s take a look at your top 3 unit test framework options for C#.
1. MSTest/Visual Studio
First, since I’ve already mentioned it, I’ll lead with MSTest. MSTest was actually the name of a command line tool for executing tests, so we’re really talking about something called the “Visual Studio Unit Testing Framework.” But veterans will colloquially call it MSTest, so let’s use that here.
MSTest ships with Visual Studio, so you have it right out of the box, in your IDE, without doing anything. This lack of friction to getting started is arguably its killer feature. The preferred .NET pattern for unit tests is to have a test project for each production (regular) project in your codebase. With MSTest, getting that setup is as easy as File->New Project. Then, when you write a test, you can right click on it and execute, having your result displayed in the IDE. Pretty neat, huh? And you can also see code coverage without installing any other tools.
On the con side, one of the most frequent knocks on MSTest is that of performance. People find the experience can be sluggish. On top of that, many people struggle with interoperability. After all, Microsoft makes it so you can integrate with other Microsoft/Visual Studio stuff, so making it work with third party things would probably not rate as a priority.
2. NUnit
Next up, I’ll talk about NUnit. Unit test frameworks have a history dating back almost 30 years, so they long predated .NET. NUnit started out as a port from Java’s JUnit, but the authors eventually redid it to be more C# idiomatic. So the tool has the rich history of unit testing behind it, but with an appropriately C# flavor.
Because of its independent history, NUnit also has the distinction of interoperating nicely with other tools, such as non-Microsoft build platforms and custom test runners. On top of that, NUnit also has a reputation for fast testing running, and it has some nice additional features as well, including test annotations allowing easy specification of multiple inputs to a given test.
The main downside here is that it doesn’t integrate into Visual Studio the way that MSTest does. Using it means doing extra work, and installing extra tools, regardless of how easy those tools’ authors may make the process.
3. xUnit.NET
The last option that I’ll cover is xUnit.NET (I’ll just call it xUnit for brevity, not to be confused with the xUnit category of test tools). One of the creators of the idiomatic version of NUnit went on to create xUnit. xUnit has a relatively innovative for users to reason about their tests, dividing tests into “facts” and “theories” to distinguish between “always true” and “true for the right data,” respectively.
xUnit earns points for creating extremely intuitive terminology and ways to reason about the language of tests. On top of that, the tool has a reputation for excellent extensibility. Another awesome feature of xUnit is actually not a feature of the software, but a feature of the authors. They have a reputation for commitment, responsiveness, and evangelism.
On the con side, some users seem to wish the tool had more documentation. Beyond that, the community seems pretty enthusiastic and it’s hard to find a lot of detractors. This may speak to an implicit con, however. It has a small but loyal core of users because it requires a different way of thinking about some things and perhaps a bit more learning.
Just Get Started
I’ll close here by stating something emphatically. If you’re looking to start your unit testing journey, do NOT get bogged down in trying to pick one of these frameworks. Just pick one — roll some dice, flip a few coins — whatever.
They have their pros and cons, their detractors and supporters. But every one of them is better, by far, than continuing not to write unit tests. You can always re-evaluate and switch later if you need to. I’ve used a lot of different unit test frameworks in my career and never felt locked in or concerned about it.
So get started as quickly as you can. And before you know it, you’ll suffer the curse of knowledge with unit testing and not be able to conceive of someone not versed in the pros and cons of their favorite unit testing framework.
- | https://stackify.com/unit-test-frameworks-csharp/ | CC-MAIN-2018-09 | en | refinedweb |
Custom Card Number Verification System Challenge
Kevin Mungai
Dec 26 '18
Updated on Jan 02, 2019
・5 min read
caveat
This programming challenge is found at
or
and it will be presented as is:
the challenge
Cellulant has implemented a custom, card number verification system to ensure detection and blocking of fake cards. A scratch card consists of 4 sets of 5 digits (20 digits in total) e.g. [10006-12342-00081-99993] which are printed separated by a space or a dash.
Each set of 5 digits consists of two parts, the first 4 digits (the number) and a 5th digit (the checksum) The formula dictates that each of the sets must be validated as follows: The first 4 digits, e.g 1234, as decimal numbers be converted into an octal number (base 8) i.e. 23228. This octal number is then processed to generate the checksum, as follows:
- Add all digits to each other to get a new number “X”
- If “X” is more than 1 digit, repeat step (1) until you have a single digit. “Y”
- Append “Y” to the end of the original decimal number e.g. 1234 2
For Example:
Given the set “10006”
Convert 1000 to octal =>1750>
1+7+5+0=15
1+5=68
Valid number is 10006 so;
return (TRUE)
Given the set “99998”
Convert 9999 to octal => 23417
2+3+4+1+7=21
2+1=3
Valid number is 99993 so;
return (FALSE)
Create a Java, Java-Script or PHP script with the function that will receive a string value (scratch card number) and return boolean TRUE or FALSE, on whether the card number is valid, as shown below
You should use as many other functions as you deem necessary within your code.
really neat solution
This solution was contributed by Filipe Ramalho
- We get the modulo operation of first-four with 7
- Then we subtract the result from the checksum
- Next we get the modulo operation of the result above with 7
- Then we check if it is equal to 0
Better explained by Filipe Ramalho:
For 9999|8
- 9999 % 7 = 3 //First you modulo through 7
- 8 - 3 = 5 //Then you subtract the result from the checksum.
- 5 % 7 = 5 //Then you modulo that through 7.
The end result isn't 0, so the digit isn't valid
(defn is-valid? [number] (let [first-four (quot number 10) check-sum (rem number 10)] (-> first-four (mod 7) (- check-sum) (mod 7) (= 0)))) user> (is-valid-modified? 10006) true user> (is-valid-modified? 99993) true user> (is-valid-modified? 99998) false user> (is-valid-modified? 12342) true user> (is-valid-modified? 11697) true
(defn validate-scratch-card [card-number] (let [f (comp is-valid? #(Integer/parseInt %))] (->> (string/split card-number #"(-|\s)") (map f) (every? true?)))) user> (validate-scratch-card "10006 12342 00081 99998") false user> (validate-scratch-card "10006 12342 00081 99993") true
It is an elegant solution.
the old solution
Instead of using any of the proposed languages above, I shall use Clojure.
validate-scratch-card is a function which takes a string which may look like:
- "
10006-12342-00081-99993"
- "
10006 12342 00081 99993"
It would be nice to split the argument based on the presence of a space or a hyphen so that I could work on each substring:
;; has hyphen user> (clojure.string/split "10006-12342-00081-99993" #("-|\s)") ;; ["10006" "12342" "00081" "99993"] ;; has spaces user> (clojure.string/split "10006 12342 00081 99993" #"(-|\s)") ;; ["10006" "12342" "00081" "99993"]
Next item on the agenda is to parse each individual substring to
Integer via the Java method
Integer/parseInt.
user> (Integer/parseInt "10006") ;; 10006
map can be used to parse each individual substring
user> (map #(Integer/parseInt %) "10006 12342 00081 99993") ;; 10006
Each Integer can be checked for validity based on the rules above.
Each Integer has 2 parts:
- first four digits (the number)
- the fifth digit (the checksum)
user> (quot 10006 10) ;; 1000 first four digits (the number) user> (rem 10006 10) ;; 6 fifth digit (checksum)
Next is to convert the first four digits to octal.
This will be achieved by creating a base converter
(defn- to-digits [number base] (loop [n number digits '()] (if (pos? n) (recur (quot n base) (conj digits (mod n base))) digits))) (defn to-octal [number] "returns a list of octal numbers" (to-digits number 8))
user> (to-octal 1000) ;; (1 7 5 0)
Subsequent step is to sum up each of the generated numbers.
But before that, a function that takes two octal numbers and sums them up is needed.
(defn add-two-octal [x y] "add two octal numbers" (let [a (Integer/parseInt (str x) 8) b (Integer/parseInt (str y) 8)] (-> (+ a b) Integer/toOctalString Integer/parseInt)))
user> (add-two-octal 3 6) ;; 11
This
add-two-octal function can then be used to sum up a list of octal numbers together as follows:
user> (reduce #(add-two-octal %1 %2) (to-octal 1000)) ;; 15 user> (reduce #(add-two-octal %1 %2) '(1 7 5 0)) ;; 15
Although the addition works fine it doesn't satisfy the requirement that the result of the sum should be a single digit.
If a single digit is the result of the sum then the single digit should be returned else the summation should be done again.
Also there is need for a function to separate the new summation if it happens to be two digits.
(defn separate [number] "a utility function to separate digits" (loop [n number digits '()] (if (zero? n) digits (recur (quot n 10) (conj digits (rem n 10)))))) (defn sum-octal [number] (let [sum (reduce #(add-two-octal %1 %2) (to-octal number))] (if (zero? (quot sum 10)) sum (apply add-two-octal (separate sum)))))
user> (sum-octal 1000) ;; 6
Next a function that takes a number and checks for validity can be written as follows:
(defn is-valid? [number] (let [first-four (quot number 10) check-sum (rem number 10) verify (sum-octal first-four)] (= verify check-sum)))
user> (is-valid? 10006) ;; true user> (is-valid? 99998) ;; false
The
is-valid? function and the
#(Integer/parseInt %) can be composed together
(comp is-valid? #(Integer/parseInt %)) user> ((comp is-valid? #(Integer/parseInt %)) "10006") ;; true
Finally, the
validate-scratch-card function will shape up as follows
(defn validate-scratch-card [card-number] (let [f (comp is-valid? #(Integer/parseInt %))] (->> (string/split card-number #"(-|\s)") (map f) (every? true?))))
user> (validate-scratch-card "10006 12342 00081 99993") ;; true user> (validate-scratch-card "10006 12342 00081 99998") ;; false
(open source and free forever ❤️)
How do you keep up with Kubernetes?
A collection of resources I use to stay up-to-date on Kubernetes
You can also use modulo. You calculate the iterative digit sum with number % 9. If 0 comes out the sum is 9.
sjsu.edu/faculty/watkins/Digitsum0...
I'm not familiar with Clojure so I can't give you a code example of Clojure. But here in pseudocode
You can also consider 0 and 9 equal and spare the conversion from 0 to 9:
Or you could modulo the difference through 9. If it's 0 the result is 0, if it's 9 the result is also 0.
So in one line it would look like this
Thank you for contribution.
I have really tried my best to understand, but have failed.
Could you use examples?
Actually I had an error. You shouldn't convert the digit. And instead modulo through 7.
For 9999|8
The end result isn't 0, so the digit isn't valid
For 1234|2
The end result is 0, so the digit is valid
For 1169|7
1.1169 % 7 = 0 //If you modulo through 7, when the digit sum is 7 instead 0 comes out, so you can consider 0=7.
The end result is 0, so the digit is valid
Updated code
You can also consider 0 and 7 equal and spare the conversion from 0 to 7:
Or you could modulo the difference through 7. The difference must be either 7 or 0 and both have the same result for modulo 7.
So in one line it would look like this
Thank you for clarifying. I have now understood.
It is actually a really neat solution it basically reduces the code to just two functions.
I have learnt something, thank you. | https://dev.to/kevinmungai/custom-card-number-verification-system-challenge-13o0 | CC-MAIN-2019-04 | en | refinedweb |
Grouping paths/elements
- Maarten Renckens last edited by
Is it useful to allow the grouping of elements like text/paths/…? That way, several elements on the canvas can be moved/scaled/rotated at the same time and around the came coördinates, without having to code all of them one by one.
I would like to encourage you to write your own 'grouped' items!
make function, a
def myTextRect(...), that draws anything you like to draw!!!
like:
def myTextRect(txt, box, border): x, y, w, h = box with savedState(): with savedState(): stroke(0, 1, 1) fill(None) strokeWidth(border) rect(x - border, y - border, w + border * 2, h + border * 2) corners = [ (x - border, y - border), (x + w + border, y - border), (x + w + border, y + h + border), (x - border, y + h + border), ] stroke(None) fill(1, 0, 0) dotSize = border * 2 for cornerX, cornerY in corners: oval(cornerX - dotSize, cornerY - dotSize, dotSize * 2, dotSize * 2) font("Times-Italic") fontSize(20) fill(0, 1, 0) textBox(txt, box) translate(100, 100) myTextRect("hello world" * 100, (20, 20, 300, 200), 20) translate(0, 400) myTextRect("foo bar" * 100, (20, 20, 300, 200), 20)
- Maarten Renckens last edited by | https://forum.drawbot.com/topic/79/grouping-paths-elements/3 | CC-MAIN-2019-04 | en | refinedweb |
Public API for tf.experimental namespace.
Classes
class Optional: Represents a value that may or may not be present.
Functions
async_clear_error(...): Clear pending operations and error statuses in async execution.
async_scope(...): Context manager for grouping async operations.
function_executor_type(...): Context manager for setting the executor of eager defined functions.
output_all_intermediates(...): Whether to output all intermediates from functional control flow ops. | https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/compat/v1/experimental | CC-MAIN-2020-50 | en | refinedweb |
Spring Boot test doesn't find bean from sibling package
spring boot test junit 5
spring boot test autowired null
spring-boot-test-autoconfigure
spring-boot-starter-test
spring boot integration test example
spring boot test exclude configuration
spring boot test configuration properties
I have a
@SpringBootTest annotated test class which wants to make use of a test utility:
package org.myproject.server; // ... @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class ServerITest { private @Autowired TestHelperBean helper; // ... }
This works fine if the
TestHelperBean is defined in the same package as the test class (or in a sub-package).
package org.myproject.server; import org.springframework.stereotype.Component; @Component public class TestHelperBean { // ... }
If I move it to a sibling package though, the component is not found:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.myproject.testutils.TestHelperBean' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
I guess that component scanning by default only looks in the test class' package and sub-packages – but is there a way to override this default? I tried to add the
@ComponentScan annotation to my test, but this didn't seem to have any effect:
@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @ComponentScan("org.myproject") public class ServerITest { // ... }
Is there a way to use beans from sibling packages in Spring Boot tests?
Getting Started, Spring Test & Spring Boot Test — Utilities and integration test support for Spring NONE — Loads an ApplicationContext using SpringApplication but does not The spring-boot-starter-test dependency contains everything we need to override the property value in the tests. 3. Setup. First, we'll have to create a class in the
With componentscan annotation you can specify '*' to cover all subpackages under base package as well.
@ComponentScan({"org.myproject.*", "org.newproj.*"})
It covers all subpackages under "org.myproject" and "org.newproj".
Example package structure
org.myproject org.myproject.abc org.myproject.abcd org.myproject.xyz.abc org.newproj org.newproj.abc org.newproj.xyz
OR
Register bean with Configuration/SpringBootApplication class
@Bean private TestHelperBean helper() { return new TestHelperBean(); }
41. Testing, Please note: The following article will be dedicated to testing Spring Boot is to get a User by their id so we're going to test if it does what it's supposed to. The spring-boot-starter-test is the primary dependency that contains the majority of elements required for our tests. The H2 DB is our in-memory database. It eliminates the need for configuring and starting an actual database for test purposes. 4.
In the component scan you can add multiple packages the need to be scanned
@ComponentScan({"org.myproject","org.myproject. server","org.myproject. sibilings"})
Integration Tests with @SpringBootTest, Learn about @SpringBootTest annotation provided by Spring boot to enable boot specific features in the tests during unit testing or integration testing. This way, Spring doesn’t fire up a whole application context each time the test is started. For tests that cover integration with the web layer or persistence layer, we can use @WebMvcTest or @DataJpaTest instead. For integration with other layers, have a look at Spring Boot’s other test slice annotations. Note that these test slices will
The other answers regarding the use of
ComponentScan are correct. However, the Spring Boot documentation strongly advises that "your main application class be in a root package above other classes". From personal experience I can say that deviating from this practice will result in more trouble than it's worth.
Testing in Spring Boot, This testing tutorial will teach you how to write unit and integration tests for a Spring Boot app and introduce tools like Hamcrest to facilitate testing. MockMvc is the Spring class that does that. It can be set up in different ways:. You have 0 compile dependencies, only test-compile dependencies defined, because you've commented out spring-boot-starter-data-jpa. Spring starter's pull other dependencies in (including other starters) to create everything needed at compile time. Un-comment the spring-boot-starter-data-jpa dependency, and/or re-evaulate what dependencies you
How to Test a Spring Boot Application, Spring Boot provides a @SpringBootTest annotation, which can be [com/logicbig/example/ShoppingCartTest-context.xml] does not exist By default, spring-boot-starter-test dependency imports the junit 4 dependencies into Spring boot application. To use Junit 5, we must exclude Junit 4 and include Junit 5 into project dependencies. We are using latest spring boot version (to date) i.e. 2.1.7.RELEASE .
Spring boot integration testing with @SpringBootTest , You can just mock the method that will connect to database in your repository class in the @Test method. @SpringBootTest Test Coverage analysis (with JaCoCo and Sonar) for your Spring Boot app by Moisés Macero on February 6, 2016 One of the main metrics for a software project is Test Coverage: if done properly, it gives you a quick picture of how much code is protected by tests .
Unit and Integration Tests in Spring Boot, Spring-boot framework allows us to provide YAML files as a replacement for the .properties file and it is convenient.The keys in property files can be provided in YAML format in application.yml file in the resource folder and spring-boot will automatically take it up.Keep in mind that the yaml format has to keep the spaces correct for the value to be read correctly.
- Check to make sure that TestHelperBean is annotated properly. It should not be a problem if that class is part of the same project.
- The TestHelperBean is annotated with
@Component- see updated question. This is correct AFAIK.
- I tried this out, but it doesn't have any effect :(
- I've also tried your second proposal, i.e. I've added the
@Beanannotated method to the test class, but it doesn't work either :(
- I tried this out with the appropriate package names, but it doesn't have any effect :-(
- it included the package of the TestHelperBean | http://thetopsites.net/article/54444726.shtml | CC-MAIN-2020-50 | en | refinedweb |
"The Raspberry Pi Compute Module was designed with industrial and automation applications in mind, but it can be tasked for much more, "
"There are some excellent community efforts too, of which our current favourite is this nifty dual camera board."
"The StereoPi can capture, save, livestream, and process real-time stereoscopic video and images for robotics, AR/VR, computer vision, drone instrumentation, and panoramic video."
"When it comes to what you can do with StereoPi, the possibilities are almost endless: mount two wide-angle lenses for 360º recording, build a VR rig to test out virtual reality games, or, as I plan to do, build a stereoscopic camera!"
"You can hook this up to YouTube, to Oculus Go, you can use it with OpenCV... I cannot wait to start messing around with these because it's basically a dream come true.".
We’ve already made many demos of StereoPi integrating with other tools, including:
StereoPi Standard Edition
Front view
Top view
StereoPi is a carrier board for a Raspberry Pi Compute Module and is compatible with all compute module variants: CM1, CM3 (normal and Lite), and CM3+ (normal and Lite):
With Raspberry Pi at its core, StereoPi naturally makes use of standard Raspbian.
Of course, Raspbian comes with Python, which means getting started developing with StereoPi is as easy as installing Picamera, a pure Python interface to the Raspberry Pi camera module that supports stereo capture. For example:
from picamera import PiCamera camera = PiCamera(stereo_mode='side-by-side', resolution=(1280,720)) camera.capture('foo.jpg')
StereoPi is a perfect way to get to know how stereoscopic vision works "under the hood." You’ll immediately see the effects on human perception of changing various camera calibrations and settings, such as stereobase (the distance between cameras).
With a StereoPi Starter Kit, a simple 3D-printed case, a 4G modem, and some simple code, we livestreamed this 3D video of an aquarium straight to YouTube:
To view this video in 3D, you can use any phone equipped with a 3D viewer like Google Cardboard. You also can view it with Oculus Go. Below is a photo of the actual set up used to capture the video:
StereoPi is small enough and flexible enough to quickly prototype new augmented and virtual reality (AR/VR) applications. It’s powerful enough for some real-time video processing right on the Raspberry Pi, and fast enough to stream video to a host computer for additional processing. Here’s what we did with Oculus Go:
We assembled this prototype over the course of a few days. The idea is to give the person wearing the Oculus Go a third-person view of themselves, as is often done in video games. Of course, real life is very different than a video game!
Autonomous cars, drones, and robots are coming! With StereoPi, you can
seamlessly dive into this oncoming wave. Start with basics like camera
undistortion and calibration, and then level-up to building depth
maps. Combine this with neural networks and you’ll be
ready to fight
the imminent SkyNet an expert in unmanned vehicles. Here’s a depth
map we made using OpenCV 3.0
running on StereoPi:
If you have experience running OpenCV on Raspberry Pi, you may know that most paths will lead you to PyImageSearch, where Adrian gives a lot of ready-to-use examples of everything from OpnenCV installation, all the way up to face detection on the Raspberry Pi. We hope Adrian will use StereoPi to make some new tutorials for stereoscopic video!
You can find our brief OpenCV Python depth map tutorial on our blog, and source code in our stereopi-opencv GitHub repository.
A critical task for many robots is understanding their physical environment. But, as a budding roboticist, you might not have thousands of dollars to shell out. StereoPi to the rescue! In this example, we used the Robot Operating System (ROS) image for Raspberry Pi from Ubiquiti Robotics and added some simple code to arrive at this depth map:
If you’ve experimented with ROS and Raspberry Pi, then you may already
know the popular
raspicam_node
package for working with the Raspberry Pi camera. We asked this
package author, Rohan Agrawal
(@rohbotics), if it is possible to use
it in stereoscopic mode. After a brief GitHub
discussion
and a few tests, it appears you can capture stereoscopic images
out-of-the-box. Thanks to Rohan for adding camera selection
support!
So, right now, you can use StereoPi for depth maps and SLAM in ROS. Our plan is to help create an ROS driver optimized for StereoPi with full stereoscopic support, like other ROS-supported stereoscopic cameras.
Creating a 360° panoramic camera is as easy as stitching together the images from two wide-angle cameras to create a single spherical image. All you need is a mounting plate for the cameras and either on-board or off-board stitching software. Below is an example of what you can do with StereoPi and a panoramic stitcher like Hugin:
This is the actual setup with two 220° cameras:
StereoPi works seamlessly with the popular
raspivid native
Raspberry Pi camera
application
— just add the
-3d sbs option to receive stereoscopic video. This
means StereoPi also works with
raspivid-based projects, such as
Wifibroadcast
and
EZ-WifiBroadcast,
for livestreaming video from drones using a Raspberry Pi.
Here’s a setup using Wifibroadcast to livestream video from a StereoPi with wide-angle cameras mounted on top of a rover to a Raspberry Pi-based ground station and then to an iPhone equipped with a Google Cardboard viewer:
StereoPi can also be used with off-the-shelf video streaming solutions that simply take in HDMI and wirelessly stream it to a base station. In the setup below, we’ve connected the StereoPi’s HDMI output to an Insight SE 5G:
Of course, you can also point the StereoPi’s cameras in opposite directions to get both the front and rear views of your drone:
If you use long-range Wi-Fi solutions like Mikrotik or Ubiquiti, or a COFDM Ethernet bridge (e.g., HN-550TX), you can combine telemetry data with the two StereoPi video streams and transfer it to your ground station.
We know from experience how a seemingly minor inconvenience in a piece of hardware can lead to a massive amount of time lost and frustration. That’s why, when designing StereoPi, we took into account a lot of small, but very important features.
StereoPi comes in two flavors: standard and slim. Most people will want the standard edition. The slim edition is intended for advanced users who plan to integrate StereoPi into another device and don’t need (or don’t have space for) the large connectors. Specifically, the slim edition doesn’t have the USB Type-A connectors, RJ45 Ethernet jack, or GPIO header. Of course, the PCB pads for those connectors are still available in case you want to solder directly to them or install your own connectors.
In all other ways, the slim edition is identical to the standard edition. Both support all variants of Raspberry Pi Compute Module (CM1, CM3/CM3+, and CM3/CM3+ Lite).
In addition to the StereoPi boards themselves, we’re offering a variety of accessories and kits so you can tailor StereoPi to your needs.
We have two kinds of power cables:
This entry-level camera is great for experimenting with StereoPi. It’s included in the starter kit.
We love this camera and use it in most of our projects! However, it is relatively expensive, so we’re only offering it as part of the deluxe kit.
All cameras on the market include a camera ribbon cable approximately 10-20 cm long, which is great for benchtop setups, but unwieldy for compact setups. When space matters, we prefer this short (5 cm) camera ribbon cable.
This custom laser-cut acrylic plate makes it easy to mount two V1 or V2 cameras in a stereoscopic setup. The plate has holes for 2 mm screws (not included) to affix camera. It also has cutouts for the camera optics so they will be positioned 65 mm apart.
This custom laser-cut acrylic plate makes it easy to mount two wide-angle Waveshare cameras in a stereoscopic setup. The plate has holes for 2 mm screws (not included) to affix camera. It also has cutouts for the camera optics so they will be positioned 65 mm apart.
We’ve been making remote-controlled things with real-time video livestreams since 2010. We’ve made robots, boats, planes, copters, and so on. The smallest of these were four-centimeter-long RC cars used for real-time online racing (hello Q-Steer by Takara Tomy!), and the largest was a four-ton iPad-controlled bulldozer. Somewhere in the middle was an iPad-controlled automobile, which took first place on the Discovery Channel in 2014.
In doing these projects, we were always faced with the problem of finding inexpensive tools. For example, in ancient 2011 (before Raspberry Pi!) we created our own single-board computer with the TI DaVinci DM365 SoC. This ended up being our main tool for projects for a several years. However, by 2015, we understood we needed not only to control our drones and robots, but also add more autonomous features. The age of AI and computer vision had arrived. This informed the key requirements for our new tool:
We searched for existing ready-to-use solutions, but they were all either poor-quality toys or expensive industrial-grade systems. This remains true even today. For example, you can use something like a ZED Stereo series stereo camera ($450), add some "angry" hardware like a Jetson TX2 (~\$300 + \$200 for carrier board) with support for USB 3.0, but that’s about $1,000 right there.
Or you could get USB stereo cameras on Aliexpress, but not have any way to control the video options and spend most of your time fighting horrible (or nonexistent) drivers to manage an uncompressed USB stream to your single-board computer. Worse still, neither of these solutions is really hackable or flexible enough for some really interesting applications.
That’s why we decided to create StereoPi: two fully configurable cameras, a friendly Raspberry Pi ecosystem with a lot of ready-to-use examples, and a total cost well under $150. In the beginning of 2016, we made a first-generation board on Compute Module 1. In 2017, we made a second-generation board with Compute Module 3 that was ten times more powerful. Now, with this campaign, we’ll finally have a tool that lets us focus on our projects instead of fighting the wrong hardware.
For StereoPi production, we’ve chosen a full-service contract manufacturer that does everything from component purchasing to final quality assurance testing. Our plan calls for three stages of production:
In the prototyping stage, we work with the manufacturer to check that everything is okay with our schematics, PCB, and components. For example, we discovered that our original microSD connector choice was end-of-lifed and there was a market shortage, so we had to find a replacement.
This stage comes right before all batch manufacturing and is intended to find hidden bugs and any remaining PCB or component problems. In the worst case, we would have to make all the PCBs over again with fixes, or buy alternative components if we encounter quality issues. In the best case scenario, the manufacturing is successful and we progress to the next stage.
If we gather many more orders than expected, the production time can be lengthened to accommodate additional batches. Delivery will be carried out as units are produced.
We plan to send devices to backers using Crowd Supply fulfillment services, so parcels will be shipped to backers from Portland, Oregon. Delivery within the US is included with the price of StereoPi. Delivery outside the US will incur a surcharge during checkout. For more information, please see Crowd Supply’s guide on ordering, paying, and shipping.
Production: Factory batch production is a difficult challenge and errors can be very costly. Thus, before manufacturing the main batch, we must be sure all aspects of production are double and triple checked. Final PCB drawings, components, assembly procedures, and accessories quality (like cameras) are all tested in close collaboration with our factory before production begins. Our three-stage manufacturing plan is intended to minimize potential errors If we have any problems in stages one or two, we will take action to mitigate them before moving to the next stage. This might take some additional time and money, but it will be worth avoiding a mistake in the main production batch.
Delivery: We have two steps in delivery. First, there is delivery from the factory to Crowd Supply’s warehouse. Second, there is delivery from Crowd Supply’s warehouse to backers. Both steps have potential risks of parcel damage or unexpected delivery delays. For example, Chinese New Year may impact the production schedule and therefore the delivery schedule. We will inform all backers of any delays and what we’re doing to avoid them.
Software support of stereoscopic mode: While developing StereoPi, we were focused on full software compatibility with the original Raspberry Pi, which we managed to achieve. You won’t need to patch a kernel or do some other tricky things to get it to work. Raspbian has had stereoscopic support since 2014, but in all these years, the only mass-produced hardware available for DIY enthusiasts has been the Raspberry Pi Development Board. As such, the stereoscopic feature was used and tested not by tens of thousands of people, but only by hundreds of people. It may be that in some special use cases, you might be faced with some software problems. In our own experience, nearly all stereoscopic features "just work" and in those few cases that don’t work, the Raspberry Pi community helps us quickly solve the problem.
The first open source iCE40 FPGA development board designed for teachers and students
An open video development board in a PCI express form factor that supports overlaying content on encrypted video signals. Let's bring open video to the digital age!
A Raspberry Pi-powered pocket projector | https://www.crowdsupply.com/stereopi/stereopi | CC-MAIN-2020-50 | en | refinedweb |
.
String variable interpolation may use %-formatting, f-strings, or
str.format()as appropriate, with the goal of maximizing code readability.
Final judgments of readability are left to the Merger’s discretion. As a guide, f-strings should use only plain variable and property access, with prior local variable assignment for more complex cases:
# Allowed f'hello {user}' f'hello {user.name}' f'hello {self.user.name}' # Disallowed f'hello {get_user()}' f'you are {user.age * 365.25} days old' # Allowed with local variable assignment user = get_user() f'hello {user}' user_days_old = user.age * 365.25 f'you are {user_days_old} days old'
f-strings should not be used for any string that may require translation, including error and logging messages. In general
format()is more verbose, so the other formatting methods are preferred.
Don’t waste time doing unrelated refactoring of existing code to adjust the formatting method.
Avoid use of “we” in comments, e.g. “Loop over” rather than “We loop over”.
Use underscores, not camelCase, for variable, function and method names (i.e.
poll.get_unique_voters(), not
poll.getUniqueVoters()).
Use
InitialCapsfor.
Use
assertIs(…, True/False)for testing boolean values, rather than
assertTrue()and
assertFalse(), so you can check the actual boolean value, not the truthiness of the expression.:
$ python -m pip install isort >= 5.1.0 $ isort -rc .
...\> py -m pip install isort >= 5.1.0 ...\> isort -rc .
This runs
isortrec modulestatements before
from module import objectsin each section. Use absolute imports for other Django components and relative imports for local components.
On each line, alphabetize the items with the upper case items grouped before the lowercase Metashouldis defined for a given model field, define each choice as a list whichstatements that are no longer used when you change code. flake8 will identify these imports for you. If an unused import needs to remain for backwards-compatibility, mark the end of with
# NOQAtofile. | http://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/ | CC-MAIN-2020-50 | en | refinedweb |
import "github.com/gohugoio/hugo/resources/resource_factories/create"
Package create contains functions for to create Resource objects. This will typically non-files.
Client contains methods to create Resource objects. tasks to Resource objects.
New creates a new Client with the given specification.
FromString creates a new Resource from a string with the given relative target path.
Get creates a new Resource by opening the given filename in the assets filesystem.
GetMatch gets first resource matching the given pattern from the assets filesystem.
Match gets the resources matching the given pattern from the assets filesystem.
Package create imports 8 packages (graph) and is imported by 9 packages. Updated 2019-08-18. Refresh now. Tools for package owners. | https://godoc.org/github.com/gohugoio/hugo/resources/resource_factories/create | CC-MAIN-2020-50 | en | refinedweb |
I am a beginner experimenting with user input and data types. My program, chatbot, has an error in it that I cannot find. When run, it collects my name and age, but then skips right over prompting for my favorite pasttime, as if I had pressed the "enter" key prematurely. It then goes to the next question. I believe that this error has something to do with my use of the 'byte' data type, but I don't know how to fix it.
Here is my code:
import java.util.Scanner; public class ChatBot { public static void main(String[] args) { Scanner in = new Scanner(System.in); String name; System.out.print("What is your name? "); name = in.nextLine(); System.out.println("Hello, " + name + ". "); byte age; System.out.print("How old are you? "); age = in.nextByte(); \\ Here is where it skips ahead in the code. System.out.println("So, you're " + age + " years old? "); String hobby; System.out.print("What is your favorite hobby? "); hobby = in.nextLine(); System.out.println("So, you like " + hobby + "? "); \\ Here is where it picks up. It does prompt for my mother's name, but not my hobby. String mother; System.out.print("What is your mother's name? "); mother = in.nextLine(); System.out.println("So, your mother's name is " + mother + ". "); } } | https://www.javaprogrammingforums.com/file-i-o-other-i-o-streams/41316-input-error-program-skips-several-lines-code-during-execution.html | CC-MAIN-2020-50 | en | refinedweb |
.
In PUN 2, the SupportLogger can be enabled with a checkbox in the PhotonServerSettings. The console or log file will contain the new log entries. PUN, you can set
PhotonNetwork.UseAlternativeUdpPorts = true before you connect..
Set
PhotonNetwork.CrcCheckEnabled = true before you connect
Photon clients track how many packages get dropped due to enabled CRC checks.
You could monitor
PhotonNetwork.PacketLossByCrcCheck.
PUN has two properties which allow you to tweak the resend timing:
QuickResends
PhotonNetwork.QuickResends speed up repeats of reliable commands that did not get acknowledged by the receiving end.
The result is a bit more traffic for a shorter delays if some message got dropped.
MaxResendsBeforeDisconnect
PhotonNetwork.MaxResendsBeforeDisconnect defines how often the client will repeat an individual, reliable message.
If the client repeats faster, it should also repeat more often.
In some cases, you see a good effect when setting
PhotonNetwork.QuickResends to 3 and
PhotonNetwork.MaxResendsBeforeDisconnect).
PhotonNetwork.ResentReliableCommands
If this value goes through the roof, the connection is unstable and UDP packets don't get through properly (in either direction).
Send Less. No need to instantiate and destroy each bullet..
Typically avoid exchanging a
Vector3for rotation of your character as most likely it only rotates around the vertical axis. So make extra code to extract the vertical rotation and only send this you save 2/3 of the size just for that parameter.
- Don't try to combine data into arrays. Split everything into individual using
stream.SendNext()for every single variable.
- Be careful of over-using Custom Properties. If you set a lot of them in a long running game, joining players will have a lot to catch up with. When your clients drop a lot while joining a room, check this..
Set
PhotonNetwork.Networking PUN, this is done using
PhotonNetwork PUN, this is done using
PhotonNetwork.Reconnect(). Photon.Pun; using UnityEngine; using Photon.Realtime; public class RecoverFromUnexpectedDisconnectSample : MonoBehaviourPunCallbacks { public override void (!PhotonNetwork.ReconnectAndRejoin()) { Debug.LogError("ReconnectAndRejoin failed, trying Reconnect"); if (!PhotonNetwork.Reconnect()) { Debug.LogError("Reconnect failed, trying ConnectUsingSettings"); if (!PhotonNetwork.ConnectUsingSettings()) { Debug.LogError("ConnectUsingSettings failed"); } } } } } | https://doc.photonengine.com/en-US/pun/current/troubleshooting/analyzing-disconnects | CC-MAIN-2020-50 | en | refinedweb |
Set-Vpn
Auth Protocol
Configures the authentication method for incoming site-to-site (S2S) VPN interfaces on a Routing and Remote Access (RRAS) server.
Syntax
Set-Vpn
Auth Protocol [-UserAuthProtocolAccepted <String[]>] [-TunnelAuthProtocolsAdvertised <String>] [-RootCertificateNameToAccept <X509Certificate2>] [-CertificateAdvertised <X509Certificate2>] [-SharedSecret <String>] [-PassThru] [-CertificateEKUsToAccept <String[]>] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [-WhatIf] [-Confirm] [<CommonParameters>]).
Examples
EXAMPLE 1
PS C:\> Set-VpnAuthProtocol -UserAuthProtocolAccepted Certificate -PassThru WARNING: Configuration parameters will be modified after the Remote Access service is restarted. UserAuthProtocolAccepted : {Certificate} TunnelAuthProtocolsAdvertised : Certificates RootCertificateNameToAccept : CertificateAdvertised :
This example changes the authentication method used by the server for incoming connections to Certificate and advertises certificates as authentication mechanism to the peer computers.
EXAMPLE 2
PS C:\>$cert1 = ( Get-ChildItem -Path cert:LocalMachine\root | Where-Object -FilterScript { $_.Subject -Like "*CN=Contoso Root Certification Authority,*" } ) PS C:\>Set-VpnAuthProtocol -RootCertificateNameToAccept $cert1 -PassThru
This example sets the root certificate against which all of the incoming connections computer certificates are matched.
Parameters
Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
Specifies the certificate to be sent to a peer computer. Applicable only if the TunnelAuthProtocolsAdvertised parameter is set to Certificate.
Specifies an array of Certificate Extended Key Usage (EKU) extensions to allow. This parameter is only valid if the UserAuthProtocolAccepted parameter contains certificates..
Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
Specifies the root certificates that are allowed. Applicable only if the UserAuthProtocolAccepted parameter contains certificates.
Specifies the text of the shared secret for the connection. Applicable only if the TunnelAuthProtocolsAdvertised parameter is set to PSK..
Specifies the local authentication protocols that are allowed.
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Inputs
None
Outputs
The
Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects.
The path after the pound sign (
#) provides the namespace and class name for the underlying WMI object. | https://docs.microsoft.com/en-us/powershell/module/remoteaccess/set-vpnauthprotocol?view=win10-ps | CC-MAIN-2020-50 | en | refinedweb |
This page provides a general overview of how Ingress for HTTP(S) Load Balancing works. Google Kubernetes Engine (GKE) provides a built-in and managed Ingress controller called GKE Ingress. This controller implements Ingress resources as Google Cloud load balancers for HTTP(S) workloads in GKE.
Overview
In GKE, an Ingress object defines rules for routing use Ingress, you must have the HTTP load balancing add-on enabled. GKE clusters have HTTP load balancing enabled by default; you must not disable it.
Ingress for external and internal traffic
GKE Ingress resources come in two types:
Ingress for external HTTP(S) load balancer deploys the Google Cloud external HTTP(S) load balancer. This internet-facing load balancer is deployed globally across Google's edge network as a managed and scalable pool of load balancing resources. Learn how to set up and use Ingress for external HTTP(S) load balancer.
Ingress for Internal HTTP(S) Load Balancing deploys the Google Cloud internal HTTP(S) load balancer. These internal HTTP(S) load balancers are powered by Envoy proxy systems outside of your GKE cluster, but within your VPC network. Learn how to set up and use Ingress for Internal HTTP(S) Load Balancing. Google Cloud network services
- Support for multiple TLS certificates. An Ingress can specify the use of multiple TLS certificates for request termination.
For a comprehensive list, see Ingress features.
Container-native load balancing
Container-native load balancing is the practice of load balancing directly to Pod endpoints in GKE using Network Endpoint Groups (NEGs).
When using Instance Groups, Compute Engine load balancers send traffic to VM IPs as backends. When running containers on VMs, in which containers share the same host interface, this introduces some limitations:
- It incurs two hops of load balancing - one hop from the load balancer to the VM
NodePortand another hop through kube-proxy routing to the Pod IP (which may reside on a different VM).
- Additional hops add latency and make the traffic path more complex.
- The Compute Engine load balancer has no direct visibility to Pods resulting in suboptimal traffic balancing.
- Environmental events like VM or Pod loss are more likely to cause intermittent traffic loss due to the double traffic hop.
With NEGs, traffic is load balanced from the load balancer directly to the Pod IP as opposed to traversing the VM IP and kube-proxy networking. In addition, Pod readiness gates are implemented to determine the health of Pods from the perspective of the load balancer and not just the Kubernetes in-cluster health probes. This improves overall traffic stability by making the load balancer infrastructure aware of lifecycle events such as Pod startup, Pod loss, or VM loss. These capabilities resolve the above limitations and result in more performant and stable networking.
Container-native load balancing is enabled by default for Services when all of the following conditions are true:
- For Services created in GKE clusters 1.17.6-gke.7 and up
- Using VPC-native clusters
- Not using a Shared VPC
- Not using GKE Network Policy
In these conditions, Services will be annotated automatically with
cloud.google.com/neg: '{"ingress": true}' indicating that a NEG should be created to mirror the Pod IPs within the Service. The NEG is what allows Compute Engine load balancers to communicate directly with Pods. Note that existing Services created prior to GKE 1.17.6-gke.7+ will not be automatically annotated by the Service controller.
For GKE 1.17.6-gke.7+ clusters where NEG annotation is automatic, it is possible to disable NEGs and force the Compute Engine load balancer to use an instance group as its backends if necessary. This can be done by explicitly annotating Services with
cloud.google.com/neg: '{"ingress": false}'.
For clusters where NEGs are not the default, it is still strongly recommended to use container-native load balancing, but it must be enabled explicitly on a per-Service basis. The annotation should be applied to Services in the following manner:
kind: Service ... annotations: cloud.google.com/neg: '{"ingress": true}' ...
Shared VPC
Ingress and MultiClusterIngress resources are supported in Shared VPC topologies, but require some upfront preparation to work. The GKE Ingress controllers use a Google Cloud service account to deploy and manage Google Cloud resources. When a GKE cluster resides in a service project of a Shared VPC, this service account does not have the rights to manage network resources owned by the host project. The Ingress controller actively manages firewall rules to provide access between load balancers and Pods and also between centralized health checkers and Pods.
However, in a Shared VPC, the GKE Ingress controller has no rights to manage firewall rules. You can add rights by manually provisioning firewall rules from the host project or by providing the GKE Ingress controller permission to manage host project firewall rules.
Manually provision firewall rules from the host project
If your security policies only allow firewall management from the host project, then you can provision these firewall rules manually. When deploying Ingress in a Shared VPC, the Ingress resource event provides the specific firewall rule you need to add necessary to provide access.
To manually provision a rule:
View the Ingress resource event:
kubectl describe ingress INGRESS_NAME
Replace INGRESS_NAME with the name of your Ingress.
You should see output similar to the following example:
Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Sync 9m34s (x237 over 38h) loadbalancer-controller Firewall change required by network admin: `gcloud compute firewall-rules update k8s-fw-l7--6048d433d4280f11 --description "GCE L7 firewall rule" --allow tcp:30000-32767,tcp:8080 --source-ranges 130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16 --target-tags gke-l7-ilb-test-b3a7e0e5-node --project <project>`
The suggested required firewall rule appears in the
Messagecolumn.
Copy and apply the suggested firewall rules from the host project. Applying the rule provides access to your Pods from the load balancer and Google Cloud health checkers.
Providing the Ingress controller permission to manage host project firewall rules
An automated approach is to provide the GKE Ingress controller service account the permissions to update firewall rules. Create a custom IAM role which provides the ability to manage firewall rules directly and grant this role to the GKE Ingress service account.
In your host project, grant a custom role with the
compute.firewalls.*and
compute.networks.updatePolicypermissions to the GKE service account of the service project:
gcloud iam roles create ROLE_NAME \ --project PROJECT_ID \ --title ROLE_TITLE \ --description ROLE_DESCRIPTION \ --permissions=compute.networks.updatePolicy, compute.firewalls.*\ --stage GA
Replace the following:
- ROLE_NAME: add a name for the role.
- PROJECT_ID: add the project ID of the host project.
- ROLE_TITLE: add the title of the role you want to create.
- ROLE_DESCRIPTION: add the description of the role you want to create.
Apply this custom role to the GKE Ingress service account:
gcloud projects add-iam-policy-binding my-project \ --member=user:SERVICE_ACCOUNT \ --role=roles/gke-ingress-fw-management
The value of SERVICE_ACCOUNT differs between GKE Ingress and multi-cluster Ingress:
If you are using GKE Ingress, then SERVICE_ACCOUNT is:
PROJECT_NUMBER@container-engine-robot.iam.gserviceaccount.com.
If you are using multi-cluster Ingress, then SERVICE_ACCOUNT is:
PROJECT_NUMBER@gcp-sa-multiclusteringress.iam.gserviceaccount.com.
Replace PROJECT_NUMBER with your host project's project number.
Multiple backend services
Each external HTTP(S) load balancer or internal HTTP(S) load balancer uses a single URL map, which references one or more backend services. One backend service corresponds to each Service referenced by the Ingress. called
my-ingress:
apiVersion: networking.k8s.io external HTTP(S) load balancer or internal, you must use
type: NodePort unless you're using
container native load balancing.
If using container native load balancing, use the
type: ClusterIP.: networking.k8s.io.
Ingress to Compute Engine resource mappings
The GKE Ingress controller deploys and manages Compute Engine load balancer resources based on the Ingress resources that are deployed in the cluster. The mapping of Compute Engine resources depends on the structure of the Ingress resource. Awareness of these resources mappings helps you with planning, designing, and troubleshooting.
The
my-ingress manifest shown in the
Multiple backend services section specifies an
external Ingress resource with two URL path matches that reference two different
Kubernetes Services. Here are some of the Compute Engine resources created on
behalf of
my-ingress:
- A forwarding rule and IP address.
- Compute Engine firewall rules that permit traffic for load balancer health checks and application traffic from Google Front Ends or Envoy proxies.
- A target HTTP proxy and a target HTTPS proxy, if you configured TLS.
- A URL map which with a single host rule referencing a single path matcher. The path matcher has two path rules, one for
/*and another for
/discounted. Each path rule maps to a unique backend service.
- NEGs which hold a list of Pod IPs from each Service as endpoints. These are created as a result of the
my-discounted-productsand
my-productsServices. The following diagram provides an overview of the Ingress to Compute Engine resource mappings.
Options for providing SSL certificates
There are three ways to provide SSL certificates to an HTTP(S) load balancer:
- Google-managed certificates
- Google-managed SSL certificates are provisioned, deployed, renewed, and managed for your domains. Managed certificates do not support wildcard domains.
- Self-managed certificates shared with Google Cloud
- You can provision your own SSL certificate and create a certificate resource in your Google Cloud.
Health checks.
GKE uses the following procedure to create a health check for each backend service corresponding to a Kubernetes Service:
If the Service references a
BackendConfigCRD with
healthCheckinformation, GKE uses that to create the health check. Both the Anthos Ingress controller and the GKE Ingress controller support creating health checks this way.
If the Service does not reference a
BackendConfigCRD:
GKE can infer some or all of the parameters for a health check if the Serving Pods use a Pod template with a container whose readiness probe has attributes that can be interpreted as health check parameters. See Parameters from a readiness probe for implementation details and Default and inferred parameters for a list of attributes that can be used to create health check parameters. Only the GKE Ingress controller supports inferring parameters from a readiness probe.
If the Pod template for the Service's serving Pods does not have a container with a readiness probe whose attributes can be interpreted as health check parameters, the default values are used to create the health check. Both the Anthos Ingress controller and the GKE Ingress controller can create a health check using only the default values.
Default and inferred parameters
The following parameters are used when you do not specify health check
parameters for the corresponding Service using a
BackendConfig
CRD.
Parameters from a readiness probe
When GKE creates the health check for the Service's backend service, GKE can copy certain parameters from one container's readiness probe used by that Service's serving Pods. This option is only supported by the GKE Ingress controller.
Supported readiness probe attributes that can be interpreted as health check parameters are listed along with the default values in Default and inferred parameters. Default values are used for any attributes not specified in the readiness probe or if you don't specify a readiness probe at all.
If serving Pods for your Service contain multiple containers, or if you're
using the Anthos Ingress controller, you should use a
BackendConfig
CRD to define health check parameters. For more information, see When to use a
BackendConfig CRD instead.
When to use
BackendConfig CRDs instead
Instead of relying on parameters from Pod readiness probes, you should
explicitly define health check parameters for a backend service by creating a
BackendConfig CRD for the Service in these situations:
If you're using Anthos: The Anthos Ingress controller does not support obtaining health check parameters from the readiness probes of serving Pods. It can only create health checks using implicit parameters or as defined in a
BackendConfigCRD.
If serving Pods have multiple containers with unique readiness probes: If the serving Pods for a Service have more than one container, and each container has different readiness probe settings, you should define the health check for the corresponding backend service by referencing a
BackendConfigCRD on the corresponding Service. GKE does not allow you to choose a specific readiness probe from which it infers health check parameters if multiple readiness probes are present in a serving Pod.
If you need control over the port used for the load balancer's health checks: GKE only uses the readiness probe's
containers[].readinessProbe.httpGet.portfor the backend service's health check when that port matches the service port for the Service referenced in the Ingress
spec.rules[].http.paths[].backend.servicePort.
Parameters from a
BackendConfig CRD
You can specify the backend service's health check parameters using the
healthCheck parameter of a
BackendConfig
CRD referenced
by the corresponding Service. This gives you more flexibility and control over
health checks for a Google Cloud external HTTP(S) load balancer or internal HTTP(S) load balancer
created by an Ingress. See Ingress
features for
GKE version compatibility.
This example
BackendConfig CRD defines the health check protocol (type), a
request path, a port, and a check interval in its
spec.healthCheck attribute:
apiVersion: cloud.google.com/v1 kind: BackendConfig metadata: name: http-hc-config spec: healthCheck: checkIntervalSec: 15 port: 15020 type: HTTPS requestPath: /healthz do this by specifying multiple certificates in an Ingress manifest. The load balancer chooses a certificate if the Common Name (CN) in the certificate matches the hostname used in the request. For detailed information on how to configure multiple certificates, see Using multiple SSL certificates in HTTPS Load Balancing with Ingress..
Limitations
In clusters using versions earlier than 1.16, the total length of the namespace and name of an Ingress must not exceed 40 characters. Failure to follow this guideline may cause the GKE Ingress controller to act abnormally. For more information, see this issue on GitHub.
Quotas for URL maps apply.
If you're not using NEGs with the GKE ingress controller then GKE clusters have a limit of 1000 nodes. When services are deployed with NEGs, there is no GKE node limit. Any non-NEG Services exposed through Ingress do not function correctly on clusters above.
An external HTTP(S) load balancer terminates TLS in locations that are distributed globally, to minimize latency between clients and the load balancer. If you require geographic control over where TLS is terminated, you should use a custom ingress controller exposed through a GKE Service of type
LoadBalancerinstead, and terminate TLS on backends that are located in regions appropriate to your needs.
Combining multiple Ingress resources into a single Google Cloud load balancer is not supported.
What's next
- Learn more about load balancing in Google Cloud.
- Read an overview of networking in GKE.
- Learn how to configure Ingress for internal HTTP(S) load balancer.
- Learn how to configure Ingress for external HTTP(S) load balancer. | https://cloud.google.com/kubernetes-engine/docs/concepts/ingress?hl=hi | CC-MAIN-2020-50 | en | refinedweb |
During the recent Microsoft Ignite conference I heard questions related to hybrid and partner free/busy relationships quite often, so I wanted to write about it.
This scenario applies to companies with one or more external free busy relationships configured. For instance, you could have two or more companies on-premises sharing free/busy between each other.
Then one fine day, one of the companies deploys a hybrid configuration and moves mailboxes to Office 365; in our example, it is Tailspin. Suddenly, Contoso and Fabrikam users find availability information is not showing for the Tailspin mailboxes moved to Exchange Online.
This blog post discusses why free/busy is broken and what you can do about it.
Note: OAUTH is not a supported way to see free/busy between two on-premises organizations.
Note: In most environments, the shared namespace “TailspinToys.com” can be used as the Target address for on-premises users and you would not need the additional namespace of onprem.TailspinToys.com. However, to account for all complex partnerships that could be in place, a unique namespace used as the target address will ensure free busy works properly.2. Create an Organization Relationship between Contoso on-premises and Tailspin in Exchange Online. For this Organization Relationship the domain name should be TailspinToys.Mail.onmicrosoft.com. 3. Make sure that you have a solution in place to sync mailbox enabled objects between Tailspin and Contoso. As a mailbox is moved from Tailspin on-premises to Tailspin online, Contoso needs to be made aware and the related objects’ Target Address needs to be updated in Contoso. This is needed to ensure we direct the free/busy requests to the correct premises the first time. This step can be achieved via Forefront Identity Manager (FIM) or with a script.
Note: The domain name “TailspinToys.com” is not present in any of the Organization Relationships in the Contoso environment. Keeping this name out of the Organization Relationship will ensure that you can continue to use the shared namespace and see free/busy information.
Thanks for sharing. This clarifies a lot and helps to understand a hybrid M&A much better.
Awesome article...this helps how to share free/busy details with another organization in a Hybrid configuration
I opened a call on this problem last week for two hybrid tenants. At Tier 2, they still have no idea what is going on. With this post and a few lines of PowerShell - all is now well with the world.
I am curious about the reverse scenario. But I'll test that in my labs.
But why doesn't the Tailspin OnPrem Exchange server return the target address to Contoso? In that case, I won't need to sync mailboxes with target address from Tailspin to Contoso.
Scenario:
Contoso user asks for F/B of cloud user "userA@tailspintoys.com" -> Contoso Exchange asks Tailspin Exchange -> Tailspin Exchange recognizes, that "userA@tailspintoys.com" has a target address with "userA@tailspintoys.mail.onmicrosoft.com" and provide this information to Contoso Exchange. Contoso Exchange will start / redirect F/B request against O365 (of course you need to configure the OrganizationRelationship from Contoso to tailspintoys.mail.onmicrosoft.com first).
This would be my desired scenario. | https://techcommunity.microsoft.com/t5/Exchange-Team-Blog/The-Hybrid-Mesh/ba-p/605910 | CC-MAIN-2019-43 | en | refinedweb |
I currently have thirteen buttons hooked up to two digital pins (0,1) on a Teensy 3.2 through two 74HC4051 muxes. The Muxes are controled by pins 10,11,12. MUX 1 has eight pushbuttons and MUX 2 five, with the spare pins tied to ground.
I am using the midicontroller.h library from here:
the circuit is essentially the same as the one shown here, but with only two Multiplexers:
Some of the buttons are DigitalLatch, some are simple Digital (see code below)
Everything is working as it should up to a point. However the DigitalLatch buttons on Pin 7 and Pin 3 of MUX 1 seem to alternate between firing the two MIDI notes assigned to these pins at a very fast rate when either button is pushed.
After much playing around, I am wondering if this might be an issue with the S2 control pin getting current even when it is nominally "low", causing the read to flicker between these pins?
as per the datasheet, this is the difference between reading pin 7 and pin 3
If this is the case what can I do to solve this? I read someone suggesting tying the control pins to ground via a high value resisitor might help. Is this a possible solution?
I have already re-soldered the control pin connections, and tried replacement buttons, and also tried moving the buttons on MUX 2 to different pins. One interesting result here was that removing the button from pin 7 and moving it to pin 4 of the mux seemed to cause the button on pin 6 to exhibit the same behavior.
Something even stranger seems to happen on the other Multiplexer - On Pin7 of Mux 2 the Digital button appears to trigger MIDI note 16, as well as 12 (which it is allocated)..... and it triggers both again at a very fast repeat, rather than held note.
I am sort of hoping solving the first problem will also help with this though!
thanks in advance for any advice.
Code:
#include <Encoder.h>
#include <MIDI_Controller.h>
//Midi controller library
#include <ResponsiveAnalogRead.h>
// analog smoothing
#include <Bounce.h>
// include the Bounce library for 'de-bouncing' switches -- removing electrical chatter as contacts settle
// usbMIDI.h library is added automatically when code is compiled as a MIDI device
using namespace ExtIO;
// use standard arduino digital write pin mode etc.
AnalogMultiplex buttonsmux1(1, { 10, 11, 12 } );
AnalogMultiplex buttonsmux2(0, { 10, 11, 12 } );
// creating muxers
//AnalogMultiplex(pin_t analogPin, { pin_t addressPin1, addressPin2, ... addressPinN } )
//analogPin: the analog input pin connected to the output of the multiplexer
//addressPin#: the digital output pins connected to the address lines of the multiplexer
DigitalLatch Arcadebuttons[] = {
{buttonsmux1.pin(0), 0, 14, 127, 10},
{buttonsmux1.pin(1), 1, 14, 127, 10},
{buttonsmux1.pin(2), 2, 14, 127, 10},
{buttonsmux1.pin(3), 3, 14, 127, 10},
{buttonsmux1.pin(4), 4, 14, 127, 10},
{buttonsmux1.pin(5), 5, 14, 127, 10},
{buttonsmux1.pin(6), 6, 14, 127, 10},
{buttonsmux1.pin(7), 7, 14, 127, 10},
// Create 8 new instances of the class 'DigitalLatch', on the 8 pins of the buttonsmux
};
DigitalLatch Arcadebuttonextras[] = {
{buttonsmux2.pin(3), 8, 14, 127, 10},
{buttonsmux2.pin(4), 9, 14, 127, 10},
//extra two arcade buttons
};
Digital Navigation[] = {
{buttonsmux2.pin(5), 10, 14, 127},
{buttonsmux2.pin(6), 11, 14, 127},
{buttonsmux2.pin(7), 12 , 14, 127},
// Create 3 new instances of the class 'Digital' for navigation buttons, on the 3 pins of the buttonsmux
};
//CONSTANT VALUES
const static byte Channel_Volume = 0x7;
// controller number 7 is defined as Channel Volume in the MIDI implementation.
const static size_t analogAverage = 8;
// Use the average of 8 samples to get smooth transitions and prevent noise
const static byte velocity = 127;
// the maximum velocity, since MIDI uses a 7-bit number for velocity.
const static int latchTime = 3000;
// the amount of time (in ms) the note is held on. Read documentation or see source code for more information.
const static byte C4 = 60;
// note number 60 is defined as middle C in the MIDI implementation.
const static byte E0 = 16;
// note number 60 is defined as middle C in the MIDI implementation, so 16 is E0
const byte Channel = 14;
// MIDI channel 14
const byte Controller = 0x14;
// MIDI controller number
const int speedMultiply = 1;
// no change in speed of the encoder
void setup() {
}
void loop() {
MIDI_Controller.refresh();
} | https://forum.pjrc.com/threads/56523-Triggering-multiple-notes-from-single-button-press-mxltiplexer-74hc4051?s=f9cf5d806126ff871619d26af8093c5e&p=208569&viewfull=1 | CC-MAIN-2019-43 | en | refinedweb |
Ethan Fleegler Duke University Durham, NC 2006
Honors thesis submitted in partial fulfillment of the requirements for Graduation withDistinction in Economics in Trinity College of Duke University.
The author would like to extend a heartfelt thanks to Professor Lori Leachman for hercontinued guidance, support, and inspiration throughout the research process. Abstract
The twin deficit theory postulates that sustained fiscal deficits will result in currentaccount deficits. This claim has been widely debated in the economic literature withmost research focusing on its effects in developed economies. This paper attempts tofurther this discussion by examining the potential impacts of fiscal deficits on currentaccount deficits for a cross-section of economies at different stages of development. Thefindings suggest that there may be multiple factors contributing to an economy’ssusceptibility to twin deficits. Specifically, a country’s susceptibility is in part influencedby where the country is in the development process, who it trades with, and what itimports and exports.
1Table of Contents
I. Introduction……………………………………………………………………………3
IV. Data………………………………………………………………………………….17
V. Empirical Analysis…………………………………………………………………..18
IX. Graphs………………………………………………………………………………33
X. Tables………………………………………………………………………………...38
2Introduction
Governments often incur fiscal deficits to grow their economies and provide
certain services to the population. Friedman (2000) argues that when deficits are used
correctly, they are key to financing growth and reducing unemployment. However, many
economists argue against the presumed benefits of deficit spending and counter that
increased deficit spending can only lead to higher inflation and a misallocation of
resources. Additionally, as deficits grow and governments begin financing their budgets
with capital from foreign markets capital inflow increases and liabilities to foreign
Recently, the United States Government has pursued a strategy of increased fiscal
deficits in an effort to finance expanding government programs while providing tax cuts.
The St. Louis Fed reports that the United States Government budget deficit has grown
from $158 billion in 2002 to $412 billion in 2004, a 160 percent increase in just two
years. The recently increased federal deficits have been defended as a means to boost the
American economy. For example, a column in the Wall Street Journal has applauded the
Bush administration’s tax cuts on financial dividends attributing the recent growth
experienced by the United States’ economy to this initiative. The column notes that
“almost from the very day in May of 2003 when those tax reductions became law, the US
has experienced a robust expansion driven by investment and productivity gains” (“The
During this period, the United States has also experienced ballooning current
account deficits. Freund and Warnock (2005) note that the United States current account
deficit was a record $668 billion in 2004, accounting for 5.7 percent of GDP. Summers
3(2004) suggests that 5 percent of GDP is a traditional “danger point” for current account
deficits and that deficits that exceed this critical value face an inevitable disorderly
adjustment that can push up interest rates, depress growth, and cause a large depreciation
Economic theory is somewhat conflicted over the true effects of fiscal deficits on
the economy. One branch of the economic discussion opposed to growing deficits argues
that fiscal deficits may stimulate trade deficits. This relationship is known as twin deficit
phenomenon. Persistent trade deficits lead to fewer jobs and may limit any potential
gains from the initial expansionary policy. If empirical evidence supports twin deficit
theory, then gains in economic growth and employment resulting from fiscal deficits may
deficit relationship exists; and, if so, what is the nature of that relationship and for whom.
Recent studies have focused on developed economies to explore twin deficits. For
example, Leachman and Francis (2002) examine the experience of the United States from
1948 to 1992. They find that trade deficits and fiscal deficits are statistically correlated
during the more recent subperiod of the data sample. Specifically, they find that the
following World War II. However, in the more recent subperiod (1974-1992) these long-
run relationships between current account variables and fiscal variables collapse. This
finding enables them to test for a relationship between fiscal deficits and trade deficits in
4the post 1974 period. They conclude that “th[e] evidence provides some support for the
notion that more recently fiscal deficits may have contributed to external deficits” (p.
1121). As valuable as the findings of Leachman and Francis are, they only apply to the
on the work of Leachman and Francis. Using a data set of one developed economy, two
middle-market economies, and two developing economies, the paper found a degree of
statistical correlation between trade deficits and fiscal deficits for each of the countries in
the sample. To analyze the data the paper uses the multicointegration approach suggested
by Granger and Lee (1989, 1990) and developed in Haldrup (1998) and Engsted et al.
An investigation of the data provides evidence that there are multiple factors
influencing the susceptibility of an economy to the twin deficits dilemma. The findings
indicate that a country’s development status, trading regions, and the composition of its
imports and exports all may influence the persistence of fiscal and current account
deficits. These results suggest that the twin deficit phenomenon may be time-specific and
Section II presents a review of the relevant literature on internal and external debt.
It begins with a discussion of the twin deficit theory and its controversy as it applies to
spending on the developing economy and the potential implications that these budget
5deficits have on trade balances. Section III outlines the theoretical framework underlying
the empirical findings. Section IV presents the data and empirical methodology. Section
V presents the empirical results and discussion. Section VI elaborates upon future
Literature Review
Economic research has recently begun to question what the true impacts of deficit
spending and debt are on an economy. One of the primary concerns is the sustainability
of the current account and capital account positions. According to twin deficit theory,
large budget deficits can have negative implications for the stability of the current
account.
twin deficits, with researchers showing empirical evidence both in support of and against
this theory. To date, these studies have dealt almost exclusively with the experience of
developed economies. Consequently, there has been little research produced on twin
deficit theory as it applies to developing economies. This paper attempts to fill this void
into two parts. First, the paper will address the literature with respect to the stability of
current account deficits, thereby establishing the potential consequences of twin deficits.
This is followed by a discussion of twin deficit theory and how it relates to developed
and the potential implications of this deficit spending on the twin deficit theory.
6 Sustained imbalances in the current account of many advanced and emerging
economies has led to increased concern from domestic and international financial
markets and policymakers. Makin (2004) notes that in deficit countries, including the
United States, where current account deficits have recently reached 5 percent of GDP,
there have been trends towards protectionist measures such as import restrictions and
export subsidies.
persistent current account deficits. They note that correcting for this deficit may result in
a collapse of the domestic currency which would significantly retard growth. Further,
they note that in order for domestic current account deficits to close, faster growth abroad
United States, this condition for foreign economies can be difficult to achieve as growth
in these economies is often motivated by trade and tradeable goods production. The
authors also warn that the private savings needed to close the current account deficit
would result in a negative demand shock sparking a recession. Thus, a sustained current
account deficit would likely lead to economic problems in the medium and long term.
There has been much debate in the economic literature regarding the validity of
twin deficits. In the literature supporting twin deficit theory, researchers suggest two
how budget and trade deficits are related. As a government borrows to finance its deficit,
it drives up borrowing costs or the interest rate. A higher interest rate makes domestic
securities more attractive and leads to an increased demand for the domestic currency
7causing an appreciation of the domestic currency due to the capital inflows. As the
currency appreciates, domestic goods seem more expensive relative to foreign goods
The exchange rate model proposed by Mundell and Fleming offers a framework
reiterated by Martin Feldstein in the 1980s. Feldstein employs the exchange rate
mechanism to argue that, “with a lower level of current and expected future government
borrowing, real interest rates would decline and the dollar would come down with
them…A lower budget deficit would thus reduce the trade deficit” (as quoted in
Reynolds, 2004). Thus, the exchange rate mechanism for twin deficits has had a
A second voice in the economic literature in support of the twin deficit theory
uses the national accounting identities to explain the twin deficit phenomenon. Ball and
one can demonstrate that with a decline in national savings either investment or net
exports or both must decrease. Orszag, Rubin, and Sinai (2004) recall this relationship as
they note how the present current account deficit is due to decreased national savings
resulting from large budget deficits. They argue that the only way to reverse the trends in
the current account is to promote national savings via a more conscious effort to avoid
Until recently, there have been few empirical studies that have searched for twin
deficit relationships. The theoretical work by Fleming and Mundell (Fleming 1962,
Mundell 1963), Ball and Mankiw (1995), and Orszag, Rubin, and Sinai (2005) was
8supported by the empirical findings of Leachman and Francis (2002); a study which
utilized econometric analysis to search for twin deficits in the US economy from 1948 to
1992. Leachman and Francis separate this time-period into two subperiods and find that
in the period from 1948-1975 revenues and expenditures as well as imports and exports
were multicointegrated; ruling out a twin deficit relationship between government and
trade accounts. From 1976-1992, a period of floating exchange rates that marked the end
of Bretton-Woods, Leachman and Francis verify that neither of the series are cointegrated
or multicointegrated. After further analysis, they find a causal relationship during this
period between fiscal and trade accounts with causation running from government
these empirical findings is consistent with the theoretical model proposed by Fleming and
Mundell which depends on floating exchange rates in order for fiscal deficits to affect the
trade deficit. While the empirical work of Leachman and Francis has important
implications for the validity of the twin deficit theory, it fails to suggest a universal nature
At the same time, many economists have questioned the findings of those who
support the twin deficit theory. Specifically, these economists question the fundamental
assumptions of twin deficit theorists. Eisner (1994) proposes that because national
savings in a Ricardian relationship1. Thus, the national savings rate would be unaffected
1 Barro (1974) proposes Ricardian Equivalence which states that citizens will save tax refunds inexpectation of future tax increases due to greater quantities of public debt.
9savings. Empirically, Eisner finds no effect on the private national savings rate from
deficit spending during the period 1972-1991. In fact, he suggests that with an expansion
of the definition of national savings, one finds a reduced national savings rate with
increased taxes2. His findings refute the connection between taxation and national
savings rates discussed above in Ball and Mankiw (1995) and Orszag, Rubin, and Sinai
(2005). Eisner’s findings can therefore be taken as evidence against the twin deficit
theory.
Empirical data and analysis of fiscal and trade deficits has also been used to
counter twin deficit theory. Reynolds (2004) observes that Japan has sustained budget
deficits at a significant level of 7 percent of GDP in recent years. However, this situation
has not resulted in higher interest rates, an appreciation of the currency, or a current
account deficit. Further, Reynolds finds that Japan’s private savings rate remained
exceptionally high during periods of large budget deficits which generally is inconsistent
with the assumptions made by twin deficit theorists. This study additionally argues that
recent decreases in private savings amongst citizens in Japan is largely due to the “near-
zero” rate of return on stocks, bonds, and bank deposits and does not have a very strong
correlation with government deficits. Another interesting feature of the Japanese case is
that large fiscal deficits did not result in high interest rates, a fundamental causality in the
model proposed by Fleming and Mundell. Reynolds also finds similar trends in the
developed economies of Australia and the UK. Because Reynolds looks at multiple
2 Eisner expands the definition of savings to private investment and consumption of durable goods byhouseholds as well as business, government, and university expenditures on education as opposed to theconventional definition which looks at solely business investment in plants and equipment.
10between budget deficits and trade deficits than Leachman and Francis. However, his
The current research into the twin deficit phenomenon is limited in scope to
it comes to developing economies, there is a gap in the literature with respect to the
effects of budget deficits on trade. However, there is some work concentrating on fiscal
Patillo, Poirson, and Ricci (2004) argue that low deficit levels are essential in
However, high deficits and the debt that results can create significant problems for a
developing economy. Specifically, these authors point to the reactions of global investors
percent of GDP, foreign investors worry about default and/or inflation which results from
the government printing money to pay back debt. As investors exit the country’s assets,
the currency depreciates. While Patillo, Poirson, and Ricci find such results, they do not
take the next step in their analysis which is to trace out the potential effects on trade.
Baumol and Blinder (2006) state that as a country’s currency depreciates the
demand for its exported goods and services will necessarily go up as rational agents will
demand more goods at reduced prices. A propensity towards deficits and debt in a
developing nation will lead to a decreased willingness to hold that country’s assets which
11reduction in a country’s trade deficit as the world demands the exports of a country with
a devalued currency. Interestingly, if the developing economy has a fixed exchange rate,
exit by global investors from the country’s assets will lead to a real appreciation in the
currency. Thus, the impact of large levels of government debt on the trade deficit in
developing economies may be intimately linked to the nature of the exchange rate
regime.
Hunt and Rebucci (2003) find that compared to developing countries, investors
have a reduced perception of risk in US assets because of the strength of the economy
and the fact that the United States has never defaulted on debt. Consequently, developed
economies can potentially sustain higher debt levels because of exogenous factors
influencing investors’ willingness to hold assets. Because investors are still willing to
hold the assets of developed economies with heightened levels of debt, the currency
depreciation proposed in Patillo, Poirson, and Ricci does not occur and there is no
positive shock to exports. These observations suggest that the twin deficit phenomenon
Theoretical Framework
phenomenon this paper develops a model of government and external budget constraints
derived from simple accounting identities. First, the paper will look at a government’s
budget constraint where revenues are generated from taxes and issuance of debt.
Following this analysis, the paper inspects the impact of capital raised in the international
12The Fiscal Budget Constraint
Fiscal or budget deficits occur when government spends more than it receives in
revenues from taxation. They are calculated by subtracting the dollar-amount of national
government expenditure from the dollar-amount of tax receipts. Funding for these
current deficits are typically generated through the issuance of debt.3 The government
sovereign interest rate, Bdt = government bonds of one period maturity and R = total
This equation illustrates the fact that whenever government expenditure on goods,
services, transfers, and debt servicing exceed current period revenues there is a positive
Bohn (1995) develops policies for a sustainable government budget. He finds that
government debt must be backed by future surpluses negating a Ponzi scheme whereby a
government continually issues new debt to pay off previous debt holders.4 In addition to
this restriction on sustained deficits, Bohn finds that systematic deficits require
governments to offer higher rates of interest on debt. These higher rates are necessary to
attract lenders and keep others in the market as the debt level rises and perception of risk
increases. Eventually, in such a scenario interest rates on the debt will exceed growth
rates in the GDP. When this occurs the real burden of debt becomes problematic
3 Although a government could also print money and inflate away the debt.4 See Bohn 1995 for proofs
13(Leachman, Bester, Rosas, and Lange, 2005) as the real gains from growth are being
One policy response to avoid this problem is for the government to actively
equation (1_), the paper can infer that the level of debt decreases when such a policy is
A country’s balance of payments (BP) measures the flow of money into and out
of the economy by tracing the current account (CA) and capital account (KA). The long-
Where:
KAt = AF t – ADt
The capital account (KA) is a measure of the flow of money into and out of its
14investment opportunities within the home country. The capital account can also be
Since domestic, private savings provide capital for private investment, if private
investment exceeds domestic savings the capital must come from abroad (driving up KA
as money flows into the country). Under a regime where government allows foreign
increasing KA in order to satisfy equation (3). This observation is crucial to twin deficit
exports. Combining the results of equations (2_) and (3) results in a theoretical
mechanism supporting the existence of twin deficits. Increased budget deficits and
driving a trade deficit [from (2_)]. Thus, twin deficit theory suggests that there should be
Yet, there exists the potential for ambiguity within this mechanism. Examination
of equation (2) shows that if private investment remains constant, the capital account
increases when the private savings rate, Sp , remains constant or declines during periods
national savings declines during periods of budget deficits. The ambiguity lies in
whether private savings (citizens’ savings) compensates for the decline in government
15savings. Ricardian equivalence theory suggests that this compensation will occur. The
theory states that citizens will save tax refunds in anticipation of paying larger taxes in
the future to retire large debts. If the assumption that private savings declines or stays
constant breaks down, KA may not increase during periods of government deficits by the
mechanism stated in (2). If this is the case, there will be no corresponding increase in
imports suggested in (3) and twin deficits will not be realized. However, empirical
research has found that private savings rates do not tend to increase during periods of
Leachman (1996) finds that Ricardian equivalence does not hold due to a short-
sighted population. Rubin, Orszag, and Sinai (2004) argue that private savings decline
markedly during deficit periods. Their claims are supported by statistics regarding the
American saving rate in the past few years. Todorova (2005) notes that, as of September
2005, the average American saves 0.1 percent of his or her disposable income5 which is
significantly less than the recommended 10 percent. This low savings rate has occurred
As noted earlier, Reynolds (2004) empirically finds that Japanese savings rates
declined during the recent period of large government deficits. He does argue that this
which decreased incentives to save. Although this is an exogenous factor, the model
suggested in this paper remains robust because as long as private savings decline or
remain the same during periods of government borrowing, the model suggests that a trade
5 The author received her data from the Commerce Department’s Bureau of Economic Analysis
16Data
The data employed in this study are national accounts data received from the
World Bank (WDI) and the International Monetary Fund (IMF). They are annual
observations that have been expressed as percentages of GDP in order to control for price
level increases and the size of the economy. The countries analyzed fall into three
categories, the developed economy of the United States, the middle-market economies of
South Korea and Mexico, and the developing economies of Peru and Costa Rica6.
the G8 and in 2004 recorded a per capita GDP of $39,195.7 South Korea is labeled as a
middle market because it recorded a per capita GDP in 2004 of $12,743 and has risen to
prominence as one of the Asian tigers. While Mexico’s GDP per capita in 2004 was only
$5,968 its recent inclusion in the OECD as well as its prominence in North American
trade justifies its placement in the middle-market category. Peru and Costa Rica
represent developing economies in Latin America. They recorded GDP per capita of
The World Bank defines exports (imports) to be the value of all goods and other
market services provided (received from) the rest of the world. The values include
merchandise, freight, insurance, transport, travel, royalties, license fees, other services
government services.
6 United States’ data spans the 1970-2004 period; Mexico’s data includes the years from 1981-2004; SouthKorea’s data spans the 1970-2000 period; Costa Rica’s sample is 1970-2002; Peru’s data sample is1979-2004.7 All GDP amounts given are in constant $US (2000 = base year).
17 The International Monetary Fund defines government revenues as being
than grants. Revenue is shown net of refunds and other adjustment transactions. It
government, whether requited or unrequited and whether for current or capital purposes.
Empirical Analysis
In order to test for a long-run equilibrium relationship between fiscal and trade
accounts, this paper will perform a multi-step, multicointegration analysis similar to those
performed by Bohn (1998) and Leachman and Francis (2002). Leachman, Bester, Rosas,
and Lange (2005) note that some countries pursue appropriate policy response
country that has run large budget deficits and accumulated a sizeable stock of debt will
then reduce government expenditures and raise revenues to rid itself of deficits and
reduce the accumulated debt. Such policy mechanisms in either the trade or fiscal
account would rule out a twin deficit relationship. Empirically the presence of such
mechanisms can be tested with multicointegration analysis. Therefore, this paper must
first rule out multicointegrating relationships in the fiscal and trade accounts of each
the variables being tested are stationary. This condition is referred to as integration of
order zero, or I(0). However, many macroeconomic time series variables are not
stationary, instead they trend up or down over time. Trending implies that the data are
18non-stationary, a condition known as integration of order one, or I(1). If a series is non-
correlation between the system of variables exists. Cointegration testing assesses the
To test whether the data series are not stationary -- and therefore
series is executed. The DF test is a statistical regression of a variable at time t on its value
forces which move the variables toward their shared equilibrium path (as opposed to the
single binding force present in the cointegrated systems). These two forces capture both
a flow relationship and a stock-flow relationship which drive the system of variables
employs the procedure developed in Engstead, Gonzalo, and Haldrup (1997). Using this
19 ~ ~ M t = _0 + _1* X + _2* X̂ t + trendt +_t (4)
Where: t ~ M t = ∑ Mˆ i , which is the incremental sum of imports over time and ~ I(2) i =1 t ~ X t = ∑ Xˆi , which is the incremental sum of exports over time and ~ I(2) i =1
The paper then performs a DF test on the residual of the equation, _t to test for
stationarity. However, if the critical tests statistics differ from the standard DF critical
values that are drawn from the work of Haldrup (1998) the two series are said to share a
relationship, tests for cointegration are unnecessary. Moreover, twin deficit tests are
magnitude of _1 or _2, they can be greater than, equal to, or less than one. If _1 is less
than one it implies that the stock of exports tends to exceed the stock of imports and trade
surpluses persist. If it equals one, then on average the current account is in balance.
Finally, if this coefficient is more than one than the stock of imports exceeds that of
exports and trade deficits are present. The optimal magnitude of _2 is a function of the
findings with regard to _1. It captures the long-run relationship between the flow of
20 If the paper rejects multicointegration, it then tests for cointegration between the
two variables. The paper tests for a cointegration relationship by estimating a regression
M̂ t = _0 + _1* X̂ t + _t (5)
Again, the residual, _t, is tested for stationarity using a DF test. Here critical values are
draw from the work of Engsted, Gonzalo, and Haldrup (1997). Acceptance of
After multicointegration and cointegration tests are executed on both the fiscal
variables and the trade variables the next step is to explore the interaction between these
two accounts.
To test for twin deficit relationships, the paper performs the following regression:
Where CAˆ t = the current account deficit in a given year and DFˆ t is the fiscal deficit in a
given year.
Dickey-Fuller tests are then carried out on the residual, _t. If the null hypothesis
is rejected, the residual series is stationary and the current account and fiscal account
The paper first analyzes graphs of the data to look for trends within the series of
interest. Graphs 1A-1C represent the series of interest for the US. Graph 1A exhibits
21upward trending in the import and export series of the United States. Additionally, this
graph also suggests a close relationship between imports and exports as the two series
move in similar directions over time. Graph 1C indicates downward trending in both the
current account and fiscal account. There is also a similar trending pattern between the
balance of the fiscal and current account over the time period. Graphs 2A-2C present the
corresponding data for Mexico. The import and export series trend upward over the time
period as seen in Graph 2A. These series also trend together over the time period. Graph
trending in the current or fiscal account series. However, Graph 2C indicates the
presence of convergence in the balance of the fiscal and current accounts starting in 1994
and continuing through 2004. The South Korean series are represented in Graphs 3A-3C.
They indicate upward trending in every South Korean series except government
consumption which appears stationary. Additionally, these graphs indicate that the
import and export series as well as the government consumption and revenue series all
trend in the same direction. It is also interesting to note that South Korea is the only
country in the sample that runs consistent budget surpluses over the time period as can be
seen in Graph 3B. Graphs 4A-4C depict Costa Rica’s data. Costa Rica exhibits upward
trending in its import and export series as well as its current account series. Moreover,
in each graph the pair of series trend in similar patterns over time. Finally, Graphs 5A-
5C present the relevant data series of Peru. Graph 5A and Graph 5C indicate an upward
trend in Peru’s export series as well as its current account series, respectively. Peru’s
government consumption and revenues series trend together as can be seen in Graph 5B.
22 To conduct the tests regarding the long run relationships between the variables of
interest it is necessary to first assess whether each series is stationary. As noted above,
this is accomplished with Dickey Fuller (DF) tests to determine whether the series are
stationary. In Table 1 the results of these tests are presented. All of the series of interest
belonging to the United States, Mexico, and South Korea are not stationary implying that
they are I(1). However, the test statistics from the DF test of Peru’s import series and
Additionally, tests for stationarity were performed on the current account and
fiscal deficits (surpluses) of the countries in this study. Costa Rica and Peru both exhibit
between our systems to fiscal variables and current account variables. Results of this
exercise are reported in Tables 2A and 3A. The one-equation test for multicointegration
specified by equation (4) yields no test-statistics that exceeded their Engsted, et. al.
relationships are present between the two systems of variables in any of the countries
examined. Having rejected multicointegration for each system of variables, the paper
proceeds to test for a cointegrating relationship between the fiscal and current account
systems. Results of cointegration tests are presented in tables 2B and 3B. Cointegration
is rejected for all systems of variables except Costa Rica’s current account. Focusing on
the Costa Rican results in Table 2B, one can see that over the sample period Costa Rica’s
23exports have been approximately 58 percent of their imports. Thus while this system is
Table 4A presents the tests for long-run equilibrium relationships between fiscal
and current account deficits while Table 4B presents the results from simple regression
analysis on the system of twin deficit variables. The data support a long-run relationship
between the fiscal and the current account for the United States. This relationship is also
apparent graphically, with the two accounts sharing similar trends over time. The
coefficient on the fiscal deficit regressor for the US is -0.178 which indicates that for
every 1 percent increase in the fiscal deficit (as a percentage of GDP) there is a
corresponding 0.178 percent decrease in the current account deficit. This result is
counterintuitive given that the twin deficit theory posits a direct relationship between
fiscal and trade deficits. So what are likely explanations for the results presented here?
Graphically, 1975-77 and 1988-2000 reflect two time periods during which the
balance of the US current account is dramatically opposite the balance of the fiscal.
Thus, it is highly likely that these two periods exert a profound influence on the data.
Recession in the United States during the mid-1970s (Darby, 1982, 738) led to lower
incomes which decreased government tax revenues and stemmed imports. Lower tax
revenues meant higher budget deficits but falling imports resulted in trade surpluses. The
large budget surpluses accompanied by significant trade deficits in the 1990s likely
reflects a more recent trend in America’s propensity to import. Mann (1999) notes that
the American income elasticity for imported goods and services surged to 2.36 in the
latter half of the 1990s, compared to 1.00 from 1973-1987. Thus, while incomes were
growing during the economic boom of the decade – leading to increased tax revenues and
24eventual budget surplus – Americans had an increased appetite for imported goods and
services which fueled a growing trade deficit. Moreover, Ben Bernanke’s (2005) analysis
of a “global savings glut” provides yet another rationale for these results. As pools of
savings rise abroad, foreigners’ appetite for relatively safe US assets increase irrespective
of the level of real return on those assets. As these savings chase US assets, they
motivate an increase in the capital account which, in turn, causes a current account deficit
by (2_). Therefore, even in a period of fiscal surplus and low interest rates in the United
States, there still may be a current account deficit driven by high savings levels abroad.
Not unlike the US results, the data from Mexico indicate a long-run equilibrium
relationship between budget deficits and trade deficits. From the twin deficit regression,
-0.619. This implies that for every 1 percent increase in fiscal deficits (as a percent of
GDP), the current account deficit declines by 0.619 percent of GDP. Here again, this
unique. The Mexican experience is dominated by a period from 1980-1990 where trade
surpluses persisted while the fiscal account was in deficit. This period likely accounts for
the negative relationship between these two accounts. It can be explained in large
measure by oil-driven export revenue and limited fiscal responsibility. Fiscal reforms
and a more diversified trade sector led to the later convergence of balances in these
South Korea also exhibits a long-run, causal relationship between the balance of
the fiscal account and that of the trade account. However, unlike the first two countries,
South Korea has experienced fiscal surpluses over most of the sample period and
25improving current account balances as it moves towards the present. The coefficient of
cointegration for the twin relationship is 1.853. It indicates that for every 1 percent
increase in the fiscal deficit (surplus) there is a corresponding 1.853 percent increase in
the current account deficit (surplus). This direct relationship is consistent with twin
deficit theory. The magnitude of the coefficient indicates a strong sensitivity of the
current account to the balance of the fiscal account. Moreover, it is interesting to note
that only in the system where surpluses are the norm does the paper find a statistical
relationship that is wholly consistent with traditional interpretations of the twin deficit
relationship.
Turning to the last two countries, Costa Rica and Peru, the paper finds that the
fiscal deficit series is stationary for both countries. Therefore, simple regression is
performed on Costa Rica’s and Peru’s current and fiscal account systems. Costa Rica's
current account deficit series is I(1) while its fiscal deficit series is I(0) (as seen in Table
1). Therefore, in order to perform regression analysis, the paper adjusts the current
account series by finding the difference in the current account between two consecutive
periods. This first differencing operation transforms the series from I(1) to I(0).
Regressed on its fiscal deficit, this adjusted series yields a coefficient of 0.955 on the
fiscal deficit variable. It is significant indicating that a 1 percent increase in the fiscal
deficit is associated with a 0.96 percent positive change in the trade deficit. While the
without further testing, the positive coefficient on the fiscal deficit supports a positive
correlation between fiscal and current account deficits. Moreover, the simple regression
26 Like Costa Rica, Peru’s fiscal deficit series is I(0) and its current account deficit
series is I(1). Again, first differencing is performed on the current account series to allow
for regression analysis. Results produce a regression coefficient of 0.686 which was
significant at the 10 percent level. The positive coefficient supports the presence of a
positive correlation between fiscal and current account deficits but, here again, this
equilibrium relationship.
It is interesting to note that certain patterns emerge from the analysis of the data.
First, the United States and Mexico both exhibit an inverse relationship between the
balance of the fiscal account and that of the current account. This result contradicts the
conventional twin deficit theory derived from the Mundell-Fleming model (Fleming
1962, Mundell 1963). Perhaps this finding, in part, can be attributed to the strong trading
relationship that these two economies share. Williamson (2002) notes that the United
States continues to be the leading importer of Mexican goods, accounting for 84 percent
of Mexico’s exports. Graphs 1C and 2C show that in the mid 1990s, Mexico ran a
significant current account surplus while the United States had a large current account
deficit. During this same period, the balance of Mexico’s fiscal account worsened while
that of the United States dramatically improved. Moreover, these two countries are two
of the more developed economies in the sample. Thus, the results could suggest that in
developed economies the nature of the twin deficit phenomenon may be undergoing
major changes. When we fold the South Korean results into the analysis, initially the
array of findings appears even more confounding. However, as was noted earlier, South
27Korea has experienced fiscal surpluses and an improving trade balance over much of the
sample. Taken as a whole, these results could suggest that the nature of the twin deficit
relationship varies according to whether the countries are persistent debtors or creditors.
The fact that both of the developing economies, Peru and Costa Rica, demonstrate
stationary fiscal deficits also has interesting implications. Patillo, Poirson, and Ricci
(2004) note that international investors are wary of investing in developing economies
with large fiscal deficits due to fear of default. Costa Rica and Peru’s stationary fiscal
deficits indicate that they may be aware of the dangers of running larger and larger
deficits. These results suggest that developing economies may be taking active measures
to impose responsibility in the fiscal sector and avoid the issues discussed in the Patillo,
Poirson, and Ricci piece. This trend of fiscal deficit stationarity limits the paper’s ability
to find a long-run equilibrium relationship between the balance of the fiscal and current
accounts within these developing economies. However, the simple regressions on these
these two accounts. Additionally, the respective R2 statistics indicate that a significant
amount of the variation in current account changes in Costa Rica and Peru is accounted
for by variation in their fiscal accounts. While no causal link can be established through
the regressions, correlation confirms a relationship between the accounts and suggests the
importance of viewing potential policy aimed at one account for its effects on the other.
These results suggest that there are multiple factors influencing a country’s
susceptibility to the twin deficits. For middle-market and developed economies the data
indicate that there does exist a long-run, equilibrium relationship between the balance of
28fiscal and current accounts. However, the presence of a direct relationship between these
accounts is more ambiguous. The composition of imports and exports, the influence of
trading partners, and the country’s status as a net debtor or creditor seem to influence
whether there exists a direct relationship between the balance of the current account and
fiscal account. The results for the developing economies were less varied. Although the
findings were not consistent with a causative mechanism, there was a significant positive
correlation in both economies between the balances of the current and fiscal accounts.
These findings indicate that an economy’s susceptibility to the twin deficits may be
Ultimately, the twin deficit dilemma poses interesting policy challenges that
warrant continued study. Future research may choose to include more countries for its
data set as well as a longer time period to analyze. Moreover, to address the impact of
Continued research and commentary into the twin deficits will help increase awareness of
the issue and potentially result in the adoption of new policy measures with universal
applications.
29Reference List
Ball Laurence and N. Gregory Mankiw (1995). What do Budget Deficits Do? National Bureau of Economic Research Working Paper Series. Paper prepared for the Federal Reserve Bank of Kansas City Symposium on Budget Deficits and Debt, in Jackson Hole, Wyoming, on August 31-September 2, 1995.
Barro, Robert J. (1974). Are Government Bonds Net Wealth? Journal of Political Economy, 82, pp. 1095-1117.
Baumol, William J. and Alan S. Blinder (2006). Economics: Principles and Policy. ed. 10. Mason, OH: Thomson Higher Education.
Bernanke, Benjamin (2005). As referenced in The Great Thrift Shift. The Economist, 376, 8445, pp. 3-10.
Darby, Michael (1982). The Price of Oil and World Inflation and Recession. The American Economic Review, 72, 4, 738-751.
Engle, Robert and Byung Yoo (1991). Cointegration of Economic Time Series: A Survey with New Results. Long Run Economic Relations: Readings in Cointegration. Oxford: Oxford University Press, pp. 237-66.
Engle, Robert and Clive Granger (1987). Cointegration and Error Correction: Representation, Estimation and Testing. Econometrica, 55, 1987, 251-271.
Engsted, Tom, Jesus Gonzalo, and Niels Haldrup (1997). Testing for Multicointegration. Economic Letters, 56, 259-66.
Eisner, Robert (1994). National Saving and Budget Deficits. The Review of Economics and Statistics, 76 (1), 181-186.
Fleming, Marcus J (1962). Domestic Financial Policies Under Fixed and Floating Exchange Rates. IMF Staff Papers 9, 369-379.
Friedman, Benjamin M (2000). What Have we Learned from the Reagan Deficits and Their Disappearance? National Bureau of Economic Research Working Paper Series.
30Freund, Caroline and Frank Warnock (2005). Current Account Deficits in Industrial Countries: The Bigger They Are, the Harder They Fall? National Bureau of Economic Research Working Paper Series.
Hunt, Benjamin and Alessandro Rebucci (2003). The US Dollar and the Trade Deficit: What Accounts for the Late 1990s? IMF Working Paper.
Leachman, Lori, Alan Bester, Guillermo Rosas, and Peter Lange (2005). Multicointegration and Sustainability of Fiscal Practices. Journal of Economic Inquiry, 43 (2), 454-466.
Leachman, Lori and Bill Francis (2002). Twin deficits: Apparition or reality? Journal of Applied Economics, 34 (9), 1121-1133. Retrieved August 31, 2005, from
Makin, Anthony (2004). The Current Account, Fiscal Policy, and Medium-Run Income Determination. Contemporary Economic Policy, 22 (3), 309-316.
Mann, Catherine (1999). Is the US Trade Deficit Sustainable? Institute for International Economics.
Mundell, Robert A. (1963). Capital Mobility and Stabilization Policy Under Fixed and Flexible Exchange Rates. Canadian Journal of Economics and Political Science 29, 475-85.
Obstfeld, Maurice and Kenneth Rogoff. The Unsustainable Current Account Position Revisited. National Bureau of Economic Research.
Orszag, Peter R., Robert E. Rubin, and Allen Sinai (2004). Sustained Budget Deficits: Longer-Run US Economic Performance and the Risk of Financial and Fiscal Disarray. Paper presented at the AEA-NAEFA Joint Session, Allied Social Science Associations Annual Meeting, Sunday, January 4, 2004.
Patillo, Catherine, Hélène Poirson, and Luca Ricci (2004). What are the Channels Through Which External Debt Affects Growth? IMF Working Paper.
31Reynolds, Alan (2004). The ‘Conventional’ Hypothesis: Deficit Estimates, Savings Rates, Twin Deficits and Yield Curves. Publications of the US Treasury Department. Paper presented at the Treasury’s Roundtable on the Federal Budget, Taxes, and Economic Growth, February 12, 2004.
Summers, Lawrence H. (2004). The US Current Account Deficit and the Global Economy. The Per Jacobsson Lecture Series. Given Sunday, October 3, 2004. Washington, DC.
The Tax Cut Expansion (2005). The Wall Street Journal, p A16.
Todorova, Aleksandra. Cards That Help you Save (2005). The Wall Street Journal Online. Retrieved on Oct 28 2005 from online.wsj.com/article_print/SB113001277505676810
Williamson, Jeffrey (2002). Winners and Losers Over Two Centuries of Globalization. National Bureau of Economic Research. Paper delivered as the 2002 WIDER annual lecture, Copenhagen (September 5, 2005).
32 Graphs
Graph 1A United States Imports and Exports 20Percentage of GDP
15 10 5
Graph 1B United States Government Consumption and Revenues 24Percentage of GDP
22 20 18 16
Graph 1C United States Current Account and Fiscal Account 2 Percent of GDP
0 -2 -4 -6
33 Graph 2A Mexico Imports and Exports 35Percentage of GDP
30 25 20 15 10
Graph 2B Mexico Government Consumption and Revenues 30Percentage of GDP
25 20 15 10
Graph 2C Mexico Current Account and Fiscal Account 10 Percent of GDP
5 0 -5 -10 -15
34 Graph 3A South Korea Imports and Exports 50Percentage of GDP
40 30 20 10
Graph 3B South Korea Government Consumption and Revenues 20Percentage of GDP
18 16 14 12
Graph 3C South Korea Current Account and Fiscal Account 15 Percent of GDP
10 5 0 -5 -10
35 Graph 4A Costa Rica Imports and Exports 50Percentage of GDP
45 40 35 30 25
Graph 4B Costa Rica Government Consumption and RevenuesPercentage of GDP
20 18 16 14 12
Graph 4C Costa Rica Current Account and Fiscal Account 5 Percent of GDP
0 -5 -10 -15
36 Graph 5A 25 Peru Imports and ExportsPercentage of GDP
20 15 10 5 0
Graph 5B Peru Government Consumption and Revenues 20Percentage of GDP
Graph 5C Peru Current Account and Fiscal Account 0 Percent of GDP
-5 -10 -15 -20
37Tables
38Table 3A: Multicointegration Tests of the Fiscal Account
39Table 4B: Simple Regression Test of Deficit Account Fiscal Deficit Constant R2
40 | https://id.scribd.com/document/376826945/Fleegle-r | CC-MAIN-2019-43 | en | refinedweb |
This detail. We will see how the spaCy library can be used to perform these two tasks.
Parts of Speech (POS) Tagging
Parts of speech tagging simply refers to assigning parts of speech to individual words in a sentence, which means that, unlike phrase matching, which is performed at the sentence or multi-word level, parts of speech tagging is performed at the token level.
Let's take a very simple example of parts of speech tagging.
import spacy sp = spacy.load('en_core_web_sm')
As usual, in the script above we import the core spaCy English model. Next, we need to create a spaCy document that we will be using to perform parts of speech tagging.
sen = sp(u"I like to play football. I hated it in my childhood though")
The spaCy document object has several attributes that can be used to perform a variety of tasks. For instance, to print the text of the document, the
text attribute is used. Similarly, the
pos_ attribute returns the coarse-grained POS tag. To obtain fine-grained POS tags, we could use the
tag_ attribute. And finally, to get the explanation of a tag, we can use the
spacy.explain() method and pass it the tag name.
Let's see this in action:
print(sen.text)
The above script simply prints the text of the sentence. The output looks like this:
I like to play football. I hated it in my childhood though
Next, let's see
pos_ attribute. We will print the POS tag of the word "hated", which is actually the seventh token in the sentence.
print(sen[7].pos_)
Output:
VERB
You can see that POS tag returned for "hated" is a "VERB" since "hated" is a verb.
Now let's print the fine-grained POS tag for the word "hated".
print(sen[7].tag_)
Output:
VBD
To see what VBD means, we can use
spacy.explain() method as shown below:
print(spacy.explain(sen[7].tag_))
Output:
verb, past tense
The output shows that VBD is a verb in the past tense.
Let's print the text, coarse-grained POS tags, fine-grained POS tags, and the explanation for the tags for all the words in the sentence.
for word in sen: print(f'{word.text:{12}} {word.pos_:{10}} {word.tag_:{8}} {spacy.explain(word.tag_)}')
In the script above we improve the readability and formatting by adding 12 spaces between the text and coarse-grained POS tag and then another 10 spaces between the coarse-grained POS tags and fine-grained POS tags.
Output:
I PRON PRP pronoun, personal like VERB VBP verb, non-3rd person singular present to PART TO infinitival to play VERB VB verb, base form football NOUN NN noun, singular or mass . PUNCT . punctuation mark, sentence closer I PRON PRP pronoun, personal hated VERB VBD verb, past tense it PRON PRP pronoun, personal in ADP IN conjunction, subordinating or preposition my ADJ PRP$ pronoun, possessive childhood NOUN NN noun, singular or mass though ADP IN conjunction, subordinating or preposition
A complete tag list for the parts of speech and the fine-grained tags, along with their explanation, is available at spaCy official documentation.
Why POS Tagging is Useful?
POS tagging can be really useful, particularly if you have words or tokens that can have multiple POS tags. For instance, the word "google" can be used as both a noun and verb, depending upon the context. While processing natural language, it is important to identify this difference. Fortunately, the spaCy library comes pre-built with machine learning algorithms that, depending upon the context (surrounding words), it is capable of returning the correct POS tag for the word.
Let's see this in action. Execute the following script:
sen = sp(u'Can you google it?') word = sen[2] print(f'{word.text:{12}} {word.pos_:{10}} {word.tag_:{8}} {spacy.explain(word.tag_)}')
In the script above we create spaCy document with the text "Can you google it?" Here the word "google" is being used as a verb. Next, we print the POS tag for the word "google" along with the explanation of the tag. The output looks like this:
google VERB VB verb, base form
From the output, you can see that the word "google" has been correctly identified as a verb.
Let's now see another example:
sen = sp(u'Can you search it on google?') word = sen[5] print(f'{word.text:{12}} {word.pos_:{10}} {word.tag_:{8}} {spacy.explain(word.tag_)}')
Here in the above script the word "google" is being used as a noun as shown by the output:
google PROPN NNP noun, proper singular
Finding the Number of POS Tags
You can find the number of occurrences of each POS tag by calling the
count_by on the spaCy document object. The method takes
spacy.attrs.POS as a parameter value.
sen = sp(u"I like to play football. I hated it in my childhood though") num_pos = sen.count_by(spacy.attrs.POS) num_pos
Output:
{96: 1, 99: 3, 84: 2, 83: 1, 91: 2, 93: 1, 94: 3}
In the output, you can see the ID of the POS tags along with their frequencies of occurrence. The text of the POS tag can be displayed by passing the ID of the tag to the vocabulary of the actual spaCy document.
for k,v in sorted(num_pos.items()): print(f'{k}. {sen.vocab[k].text:{8}}: {v}')
Now in the output, you will see the ID, the text, and the frequency of each tag as shown below:
83. ADJ : 1 84. ADP : 2 91. NOUN : 2 93. PART : 1 94. PRON : 3 96. PUNCT : 1 99. VERB : 3
Visualizing Parts of Speech Tags
Visualizing POS tags in a graphical way is extremely easy. The
displacy module from the
spacy library is used for this purpose. To visualize the POS tags inside the Jupyter notebook, you need to call the
render method from the
displacy module and pass it the spacy document, the style of the visualization, and set the
jupyter attribute to
True as shown below:
from spacy import displacy sen = sp(u"I like to play football. I hated it in my childhood though") displacy.render(sen, style='dep', jupyter=True, options={'distance': 85})
In the output, you should see the following dependency tree for POS tags.
You can clearly see the dependency of each token on another along with the POS tag.
If you want to visualize the POS tags outside the Jupyter notebook, then you need to call the
serve method. The plot for POS tags will be printed in the HTML form inside your default browser. Execute the following script:
displacy.serve(sen, style='dep', options={'distance': 120})
Once you execute the above script, you will see the following message:
Serving on port 5000... Using the 'dep' visualizer
To view the dependency tree, type the following address in your browser:. You will see the following dependency tree:
Named Entity Recognition
Named entity recognition refers to the identification of words in a sentence as an entity e.g. the name of a person, place, organization, etc. Let's see how the spaCy library performs named entity recognition. Look at the following script:
import spacy sp = spacy.load('en_core_web_sm') sen = sp(u'Manchester United is looking to sign Harry Kane for $90 million')
In the script above we created a simple spaCy document with some text. To find the named entity we can use the
ents attribute, which returns the list of all the named entities in the document.
print(sen.ents)
Output:
(Manchester United, Harry Kane, $90 million)
You can see that three named entities were identified. To see the detail of each named entity, you can use the
text,
label, and the
spacy.explain method which takes the entity object as a parameter.
for entity in sen.ents: print(entity.text + ' - ' + entity.label_ + ' - ' + str(spacy.explain(entity.label_)))
In the output, you will see the name of the entity along with the entity type and a small description of the entity as shown below:
Manchester United - ORG - Companies, agencies, institutions, etc. Harry Kane - PERSON - People, including fictional $90 million - MONEY - Monetary values, including unit
You can see that "Manchester United" has been correctly identified as an organization, company, etc. Similarly, "Harry Kane" has been identified as a person and finally, "$90 million" has been correctly identified as an entity of type Money.
Adding New Entities
You can also add new entities to an existing document. For instance in the following example, "Nesfruita" is not identified as a company by the spaCy library.
sen = sp(u'Nesfruita is setting up a new company in India') for entity in sen.ents: print(entity.text + ' - ' + entity.label_ + ' - ' + str(spacy.explain(entity.label_)))
Output:
India - GPE - Countries, cities, states
From the output, you can see that only India has been identified as an entity.
Now to add "Nesfruita" as an entity of type "ORG" to our document, we need to execute the following steps:
from spacy.tokens import Span ORG = sen.vocab.strings[u'ORG'] new_entity = Span(sen, 0, 1, label=ORG) sen.ents = list(sen.ents) + [new_entity]
First, we need to import the
Span class from the
spacy.tokens module. Next, we need to get the hash value of the
ORG entity type from our document. After that, we need to assign the hash value of
ORG to the span. Since "Nesfruita" is the first word in the document, the span is 0-1. Finally, we need to add the new entity span to the list of entities. Now if you execute the following script, you will see "Nesfruita" in the list of entities.
for entity in sen.ents: print(entity.text + ' - ' + entity.label_ + ' - ' + str(spacy.explain(entity.label_)))
The output of the script above looks like this:
Nesfruita - ORG - Companies, agencies, institutions, etc. India - GPE - Countries, cities, states
Counting Entities
In the case of POS tags, we could count the frequency of each POS tag in a document using a special method
sen.count_by. However, for named entities, no such method exists. We can manually count the frequency of each entity type. Suppose we have the following document along with its entities:
sen = sp(u'Manchester United is looking to sign Harry Kane for $90 million. David demand 100 Million Dollars') for entity in sen.ents: print(entity.text + ' - ' + entity.label_ + ' - ' + str(spacy.explain(entity.label_)))
Output:
Manchester United - ORG - Companies, agencies, institutions, etc. Harry Kane - PERSON - People, including fictional $90 million - MONEY - Monetary values, including unit David - PERSON - People, including fictional 100 Million Dollars - MONEY - Monetary values, including unit
To count the person type entities in the above document, we can use the following script:
len([ent for ent in sen.ents if ent.label_=='PERSON'])
In the output, you will see 2 since there are 2 entities of type PERSON in the document.
Visualizing Named Entities
Like the POS tags, we can also view named entities inside the Jupyter notebook as well as in the browser.
To do so, we will again use the
displacy object. Look at the following example:
from spacy import displacy sen = sp(u'Manchester United is looking to sign Harry Kane for $90 million. David demand 100 Million Dollars') displacy.render(sen, style='ent', jupyter=True)
You can see that the only difference between visualizing named entities and POS tags is that here in case of named entities we passed
ent as the value for the
style parameter. The output of the script above looks like this:
You can see from the output that the named entities have been highlighted in different colors along with their entity types.
You can also filter which entity types to display. To do so, you need to pass the type of the entities to display in a list, which is then passed as a value to the
ents key of a dictionary. The dictionary is then passed to the
options parameter of the
render method of the
displacy module as shown below:
filter = {'ents': ['ORG']} displacy.render(sen, style='ent', jupyter=True, options=filter)
In the script above, we specified that only the entities of type ORG should be displayed in the output. The output of the script above looks like this:
Finally, you can also display named entities outside the Jupyter notebook. The following script will display the named entities in your default browser. Execute the following script:
displacy.serve(sen, style='ent')
Now if you go to the address in your browser, you should see the named entities.
Conclusion
Parts of speech tagging and named entity recognition are crucial to the success of any NLP task. In this article, we saw how Python's spaCy library can be used to perform POS tagging and named entity recognition with the help of different examples. | https://stackabuse.com/python-for-nlp-parts-of-speech-tagging-and-named-entity-recognition/ | CC-MAIN-2019-43 | en | refinedweb |
These instructions tell you how to setup and program the ATtiny85 microcontroller from a Raspberry Pi via the SPI interface. Lots of people use the Ardiuno to do this (then you can use the Arduino IDE and simplified C commands), or you can use a USB based programmer. I do not have an Ardiuno and don't want to buy a dedicated programmer. I do have a Pi, so I was pleased to learn I could use it as a way to get into microcontroller programming.
You will need:
Raspiberry Pi
ATtiny85 chip
5 x 1K resistors (or similar)
LED of your choice
A connection to the GPIO of the Pi, and a breadboard and wire.
Based on...
and...
and...
Teacher Notes
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Setup the Raspberry Pi
At the terminal of the Pi:
Download and build avrdude
sudo apt-get install bison automake autoconf flex git gcc
sudo apt-get install gcc-avr binutils-avr avr-libc
git clone
cd avrdude/avrdude
./bootstrap && ./configure && sudo make install
Setup SPI on the GPIO
sudo raspi-config
and Enable SPI device in the Advanced Options (see picture)
You can check this at the command line with lsmod, no need to reboot. (Maybe need to sudo modprobe spidev)
Download and build WiringPi for the gpio commands
cd ~
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
Step 2: Electrical Connections
Connect up the ATtiny85 to the Raspberry Pi GPIO (wire colours from the picture are given for reference):
GPIO pin ATtiny pin Comment
15 1 GPIO22 to Reset (through 1K, Blue wire)
17 8 3.3 V (Green wire)
19 5 MOSI (through 1K, Yellow wire)
21 6 MISO (through 1K, Orange wire)
23 7 SCLK (through 1K, Red wire)
25 4 GND (Brown wire)
(I could not find a way to do a nice table in instructables)
Step 3: Test Avrdude Connection.
sudo gpio -g mode 22 out
sudo gpio -g write 22 0
sudo avrdude -p t85 -P /dev/spidev0.0 -c linuxspi -b 10000
sudo gpio -g write 22 1
This must give success type messages!
Step 4: Program the ATtiny85
Program the ATtiny85:
cd ~
mkdir ATtiny85
cd ATtiny85
mkdir blinky
cd blinky
create the blinky.c file and add the following code
nano blinky.c
////////////////////////
#define F_CPU 1000000L
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRB = 0xFF; // PORTB is output, all pins
PORTB = 0x00; // Make pins low to start
for (;;) {
PORTB ^= 0xFF; // invert all the pins
_delay_ms(100); // wait some time
}
return 0;
}
////////////////////////
add this code to a Makefile file
nano Makefile
///////////////////////
MCU=attiny85
AVRDUDEMCU=t85
CC=/usr/bin/avr-gcc
CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=$(MCU)
OBJ2HEX=/usr/bin/avr-objcopy
AVRDUDE=/usr/local/bin/avrdude
TARGET=blinky
all :
$(CC) $(CFLAGS) $(TARGET).c -o $(TARGET)
$(OBJ2HEX) -R .eeprom -O ihex $(TARGET) $(TARGET).hex
rm -f $(TARGET)
install : all
sudo gpio -g mode 22 out
sudo gpio -g write 22 0
sudo $(AVRDUDE) -p $(AVRDUDEMCU) -P /dev/spidev0.0 -c linuxspi -b 10000 -U flash:w:$(TARGET).hex
sudo gpio -g write 22 1
noreset : all
sudo $(AVRDUDE) -p $(AVRDUDEMCU) -P /dev/spidev0.0 -c linuxspi -b 10000 -U flash:w:$(TARGET).hex
fuse :
sudo gpio -g mode 22 out
sudo gpio -g write 22 0
sudo $(AVRDUDE) -p $(AVRDUDEMCU) -P /dev/spidev0.0 -c linuxspi -b 10000 -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
sudo gpio -g write 22 1
clean :
rm -f *.hex *.obj *.o
///////////////////////
(Sorry, the instructables text editor has destroyed all the tabs and spacing in the code above, the Makefile will not work without tabs in the correct place)
To compile type:
make
To compile and upload code to the ATtiny:
make install
To optionally send fuses:
make fuse
This program oscillates ALL 5 pins as outputs so the LED should flash.
We are programming the ATtiny directly using avr-libc.
To change the setup of the ATtiny get fuses from :
10 People Made This Project!
Golom made it!
David M2 made it!
ahernandez5 made it!
keaaw made it!
molle17031976 made it!
HenricD made it!
斐郑 made it!
spirail made it!
mva111 made it!
ajohnson134 made it!
See 1 More
32 Discussions
10 months ago on Step 4
What a great article - many thanks for sharing.
I sorted the tabs by looking at the screen dump of step 4.
3 years ago
I am lost when it comes to coding... Where should the TABS go? Can someone please post a picture of the correct code?
Reply 3 years ago
Hi,
I have the code on Github now:...
Cheers!
3 years ago
Thankyou so much! I had purchased 10x ATtiny84a's and had no idea, until I stumbled upon this. Much Appreciated:)
3 years ago
Hi, this helped me to get going, but you should update/change one thing.
After reading this post:-...
I noticed that the 'linuxspi' programmer by default uses the GPIO pin 25 for reset, so your reset wrapper script is not needed. Else, great work ;)
3 years ago
Outstanding!!
4 years ago
Thank you.
4 years ago on Introduction!
Reply 4 years ago on Introduction
Oh, and I used this with an ATmega88; I'm sure you can use it with any ATmega that supports 3.3v operation, which, for all I know, is all of them.
4 years ago on Introduction
Works with atmega8. When I poweroff the Raspberry Pi the Reset pin GPIO 22 gets to zero, stopping the program on the microcontroller. I added a pullup resistor of 10 k to 3.3 v to GPIO22 and now it works after Pi poweroff too :) . Thank you. I made it but I don't yet have a camera / photo capable phone so no images...
4 years ago
Is it possible to program Atmega8-8PU using this?
4 years ago on Introduction
Thank you! Thank you! Thank you! My L.E.D.s are flashing, and my stepper motor is spinning. I could not have gotten this far this fast without your VERY helpful Instructable!
4 years ago
i dont know nothing about makefile, could you help me, which is the path where the file should be, i have to paste or create a new file ?
4 years ago
hi im having this error"28:*** target pattern contains no '%' .Stop
Can anyone help me with this....
4 years ago on Introduction.
Reply 4 years ago on Introduction?
4 years ago on Introduction
I try to upload this code instead of blinky but i got a lot of error and i don't know why if someone can help me... from...
PS : It works perfectly when i upload blinky
Reply 4 years ago on Introduction.
Reply 4 years ago on Introduction
Thanks for the help i understand why it doesn't work now.
I gonna try to directly upload the hex generate by arduino and if it doesn't work i gonna use your code to make mine.
Thanks again
5 years ago | https://www.instructables.com/id/Programming-the-ATtiny85-from-Raspberry-Pi/ | CC-MAIN-2019-43 | en | refinedweb |
l when the lxml library comes to play. The key benefits of this library are that it's ease of use, extremely fast when parsing large documents, very well documented, and provides easy conversion of data to Python data types, resulting in easier file manipulation.
In this tutorial, we will deep dive into Python's lxml library, starting with how to set it up for different operating systems, and then discussing its benefits and the wide range of functionalities it offers.
Installation
There are multiple ways to install lxml on your system. We'll explore some of them below.
Using Pip
Pip is a Python package manager which is used to download and install Python libraries to your local system with ease i.e. it downloads and installs all the dependencies for the package you're installing, as well.
If you have pip installed on your system, simply run the following command in terminal or command prompt:
$ pip install lxml
Using apt-get
If you're using MacOS or Linux, you can install lxml by running this command in your terminal:
$ sudo apt-get install python-lxml
Using easy_install
You probably won't get to this part, but if none of the above commands works for you for some reason, try using
easy_install:
$ easy_install lxml
Note: If you wish to install any particular version of lxml, you can simply state it when you run the command in the command prompt or terminal like this,
lxml==3.x.y.
By now, you should have a copy of the lxml library installed on your local machine. Let's now get our hands dirty and see what cool things can be done using this library.
Functionality
To be able to use the lxml library in your program, you first need to import it. You can do that by using the following command:
from lxml import etree as et
This will import the
etree module, the module of our interest, from the lxml library.
Creating HTML/XML Documents
Using the
etree module, we can create XML/HTML elements and their subelements, which is a very useful thing if we're trying to write or manipulate an HTML or XML file. Let's try to create the basic structure of an HTML file using
etree:
root = et.Element('html', version="5.0") # Pass the parent node, name of the child node, # and any number of optional attributes et.SubElement(root, 'head') et.SubElement(root, 'title', bgcolor="red", fontsize='22') et.SubElement(root, 'body', fontsize="15")
In the code above, you need to know that the
Element function requires at least one parameter, whereas the
SubElement function requires at least two. This is because the
Element function only 'requires' the name of the element to be created, whereas the
SubElement function requires the name of both the root node and the child node to be created.
It's also important to know that both these functions only have a lower bound to the number of arguments they can accept, but no upper bound because you can associate as many attributes with them as you want. To add an attribute to an element, simply add an additional parameter to the (Sub)Element function and specify your attribute in the form of
attributeName='attribute value'.
Let's try to run the code we wrote above to gain a better intuition regarding these functions:
# Use pretty_print=True to indent the HTML output print (et.tostring(root, pretty_print=True).decode("utf-8"))
Output:
<html version="5.0"> <head/> <title bgcolor="red" fontsize="22"/> <body fontsize="15"/> </html>
There's another way to create and organize your elements in a hierarchical manner. Let's explore that as well:
root = et.Element('html') root.append(et.SubElement('head')) root.append(et.SubElement('body'))
So in this case whenever we create a new element, we simply append it to the root/parent node.
Parsing HTML/XML Documents
Until now, we have only considered creating new elements, assigning attributes to them, etc. Let's now see an example where we already have an HTML or XML file, and we wish to parse it to extract certain information. Assuming that we have the HTML file that we created in the first example, let's try to get the tag name of one specific element, followed by printing the tag names of all the elements.
print(root.tag)
Output:
html
Now to iterate through all the child elements in the
root node and print their tags:
for e in root: print(e.tag)
Output:
head title body
Working with Attributes
Let's now see how we associate attributes to existing elements, as well as how to retrieve the value of a particular attribute for a given element.
Using the same
root element as before, try out the following code:
root.set('newAttribute', 'attributeValue') # Print root again to see if the new attribute has been added print(et.tostring(root, pretty_print=True).decode("utf-8"))
Output:
<html version="5.0" newAttribute="attributeValue"> <head/> <title bgcolor="red" fontsize="22"/> <body fontsize="15"/> </html>
Here we can see that the
newAttribute="attributeValue" has indeed been added to the root element.
Let's now try to get the values of the attributes we have set in the above code. Here we access a child element using array indexing on the
root element, and then use the
get() method to retrieve the attribute:
print(root.get('newAttribute')) print(root[1].get('alpha')) # root[1] accesses the `title` element print(root[1].get('bgcolor'))
Output:
attributeValue None red
Retrieving Text from Elements
Now that we have seen basic functionalities of the
etree module, let's try to do some more interesting things with our HTML and XML files. Almost always, these files have some text in between the tags. So, let's see how we can add text to our elements:
# Copying the code from the very first example root = et.Element('html', version="5.0") et.SubElement(root, 'head') et.SubElement(root, 'title', bgcolor="red", fontsize="22") et.SubElement(root, 'body', fontsize="15") # Add text to the Elements and SubElements root.text = "This is an HTML file" root[0].text = "This is the head of that file" root[1].text = "This is the title of that file" root[2].text = "This is the body of that file and would contain paragraphs etc" print(et.tostring(root, pretty_print=True).decode("utf-8"))
Output:
>
Check if an Element has Children
Next, there are two very important things that we should be able to check, as that is required in a lot of web scraping applications for exception handling. First thing we'd like to check is whether or not an element has children, and second is whether or not a node is an
Element.
Let's do that for the nodes we created above:
if len(root) > 0: print("True") else: print("False")
The above code will output "True" since the root node does have child nodes. However, if we check the same thing for the root's child nodes, like in the code below, the output will be "False".
for i in range(len(root)): if (len(root[i]) > 0): print("True") else: print("False")
Output:
False False False
Now let's do the same thing to see if each of the nodes is an
Element or not:
for i in range(len(root)): print(et.iselement(root[i]))
Output:
True True True
The
iselement method is helpful for determining if you have a valid
Element object, and thus if you can continue traversing it using the methods we've shown here.
Check if an Element has a Parent
Just now, we showed how to go down the hierarchy, i.e. how to check if an element has children or not, and now in this section we will try to go up the hierarchy, i.e. how to check and get the parent of a child node.
print(root.getparent()) print(root[0].getparent()) print(root[1].getparent())
The first line should return nothing (aka
None) as the root node itself doesn't have any parent. The other two should both point to the root element i.e. the HTML tag. Let's check the output to see if it is what we expect:
Output:
None <Element html at 0x1103c9688> <Element html at 0x1103c9688>
Retrieving Element Siblings
In this section we will learn how to traverse sideways in the hierarchy, which retrieves an element's siblings in the tree.
Traversing the tree sideways is quite similar to navigating it vertically. For the latter, we used the
getparent and the length of the element, for the former, we'll use
getnext and
getprevious functions. Let's try them on nodes that we previously created to see how they work:
# root[1] is the `title` tag print(root[1].getnext()) # The tag after the `title` tag print(root[1].getprevious()) # The tag before the `title` tag
Output:
<Element body at 0x10b5a75c8> <Element head at 0x10b5a76c8>
Here you can see that
root[1].getnext() retrieved the "body" tag since it was the next element, and
root[1].getprevious() retrieved the "head" tag.
Similarly, if we had used the
getprevious function on root, it would have returned
None, and if we had used the
getnext function on root[2], it would also have returned
None.
Parsing XML from a String
Moving on, if we have an XML or HTML file and we wish to parse the raw string in order to obtain or manipulate the required information, we can do so by following the example below:
root = et.XML('>') root[1].text = "The title text has changed!" print(et.tostring(root, xml_declaration=True).decode('utf-8'))
Output:
<?xml version='1.0' encoding='ASCII'?> <html version="5.0">This is an HTML file<head>This is the head of that file</head><title bgcolor="red" fontsize="22">The title text has changed!</title><body fontsize="15">This is the body of that file and would contain paragraphs etc</body></html>
As you can see, we successfully changed some text in the HTML document. The XML doctype declaration was also automatically added because of the
xml_declaration parameter that we passed to the
tostring function.
Searching for Elements
The last thing we're going to discuss is quite handy when parsing XML and HTML files. We will be checking ways through which we can see if an
Element has any particular type of children, and if it does what do they contain.
This has many practical use-cases, such as finding all of the link elements on a particular web page.
print(root.find('a')) # No <a> tags exist, so this will be `None` print(root.find('head').tag) print(root.findtext('title')) # Directly retrieve the the title tag's text
Output:
None head This is the title of that file
Conclusion
In the above tutorial, we started with a basic introduction to what lxml library is and what it is used for. After that, we learned how to install it on different environments like Windows, Linux, etc. Moving on, we explored different functionalities that could help us in traversing through the HTML/XML tree vertically as well as sideways. In the end, we also discussed ways to find elements in our tree, and as well as obtain information from them. | https://stackabuse.com/introduction-to-the-python-lxml-library/ | CC-MAIN-2019-43 | en | refinedweb |
Probably below:
'K&R style' -- Named.
if () {
'Allman style' --.
if ()
{
'Whitesmiths style' -- popularized by the examples that came with
Whitesmiths C, an early commercial C compiler. Basic indent per level
shown here is eight spaces, but four spaces are occasionally seen.
if ()
{
'GNU style' -- Used throughout GNU EMACS and the Free Software
Foundation code, and just about nowhere else. Indents are always four
spaces per level, with `{' and `' halfway between the outer and inner
indent levels.
if ()
{
My "religious" preference is definitely Allman style, but from what I understand
authors tend to prefer K&R so that they don't lose precious book space when printing
source. The cool thing is that Whidbey lets you format your code and use whatever
indentation style you prefer (there's 60+ other choices you can make to format your
code). What style do you use, and are you religious about it? Say you
found a sample on a web site that used a different bracing style, would you change
the bracing style before running the app? I would, but only if I were planning on
keeping the code...
Definitely Allman style
I find Allman code easiest to read & to write, but it’s no big deal. I care more about tabs. Use an editor that doesn’t convert them to spaces, so I can be happy with my 2-space tabs and you can keep your great big ones.
Well the beauty of VS is that when I type a } it makes everything ‘right’, so most stuff tends to get formatted before running.
And of course Allman style is the only way to write ;).
My current preference is Allman style, but I used to be a K&R guy. Even back when I was doing Delphi I used to write "if (…) then begin" all on one line, all in the name of saving space. Screen real-estate has improved a lot through in recent years so now I prefer the readability advantage of Allman over the space-savings of K&R.
While I’m not religious about it, I do feel that it’s very imporant when doing team development that everyone agrees on the same style – nothing worse than looking at code that has a mix of two or more different styles used interchangeably.
Big tabs are another pet peeve of mine, if you code inside a namespace, and then you have a class with a method and that method has nested logic, you’re talking about four tabs for code, not very pretty…
I definitely agree with Luke that mixing and matching styles is a big no-no…
Definitely Allman for me too.
And I admit that if I pick up code formatted in K&R style that I’m intending to keep/extend, I do reformat it, even though in my heart of hearts I know it’s silly and anal-retentive to do so.
I’m curious as to how I developed this preference (I honestly don’t remember, and my introduction to C was the Kernighan and Ritchie book back in my Amiga days). I always format HTML open/close tags to be balanced and symmetrical in the same way, so either one preference influenced the other or possibly they’re both evidence of a deeper pathology.
Gosh.
Okay, I’ll go against the grain. K&R for me. Don’t really like having a brace on a line by itself. I also always put in my closing brace immediately after the opening brace. Also changed VS.NET settings so that it doesn’t automatically move the brace to a new line.
Check out the java coding conventions, this is the true way to indent if you want other to have a good time reading your code:
Here is the one about methods:
I use K&R and am *extremely* anal about using it, too. And another thing I’m pretty bad about is going through and replacing other people’s:
if (x == y)
x = null;
else
x = y;
with:
if (x == y) {
x = null;
}
else {
x = y;
}
It’s K&R or Java for me too. The brackets just shouldn’t have a line of their own.
if (condition) {
statements;
} else if (condition) {
statements;
} else {
statements;
}
In truth, if you were creating a language today and you weren’t trying to recruit C programmers to it, you wouldn’t have the brackets at all – VB’s like that. The main use for the braces is for bragging rights: C/C++/Java have them and VB/COBOL/APL don’t.
/*
*There is a lot of things VB dosn’t have.
*/
Read the source of Linux which employs the K&R format. The code is easy to read and it is structured nicely. The largest collaborative project in the world uses it, there is no more to say.
I’m a K&R guy, but I’m slowly converting to Allman’s. Each new line used to be pain for me, but the readability is worth it.
I like to use the Horstmann style, which has the advantage of space saving like the K&R style but the readability of the Allman style. After the opening brace, press tab and start typing up the code. If I found a piece of code that I would use in my programs that used a different style, I would probably go ahead and change it, just to be consistent.
K&R style is a abomination that should be stricken
from the face of the planet. 🙂
Allman style is the only way to go, IMNSHO.
Infidels!
Those unfortunates who end up in my employ or training room use K&R or find themselves on the wide end of the LART.
I’ve never understood why Allman style is thought more readable than the One True Brace Style, it’s ugly, and it’s illogical. /Statements/ get a line to themselves (with minor caveats), braces do not.
That said, I have to agree with the other K&R fan who thinks braces should be dropped entirely. Kudos: but only if you’re going to replace them with strict indentation like Python which is cruftless, reaadable /and/ logical. Huzzah!
I program full-time on a 1024×768 laptop screen. Subtract bare minimum VS.NET toolbars etc. You’re left with an area that’s pefectly usable…. if you use K&R.
I can’t understand this readability argument. Your eyes scan down the column that the ‘if’, ‘select’ ‘for’ line starts on, and look for the matching closing brace. I never have to look for the opening brace because it’s instinctive for me to type: if(){ then go and fil in the condition.
ong live K&R. I want to see code on my page not needless white space!
I apparently use ‘Whitesmith’s’. I find it interesting that style guides say that Allman and Whitesmith’s are equal in prevalence as I have come across no-one else who uses the same style as me and have suffered much chastising about it — I do see Allman’s a great deal, though.
Long live Whitesmith’s and all the (evidently hidden) masses who use it.
BTW, I do have to agree with Keith Patrick’s comments about single-statement bodies. I break my own style by allowing opening and closing braces to be on one line in those cases but I’d much rather have the braces than not. I’ve been bitten in the ass a couple times by inferring meaning from misapplied indent (‘misapplied’ meaning from the standpoint of the original code’s own style, not my preferred style; this is of course why Python is preposterous).
Allman style for me too. I think statements like "Braces should not get their own line, only statements" are stupid – for one, braces ARE statements, in a way (think Pascal begin and end). For two, your ending braces get a line to themselves in 1TBS, don’t they?
Allman for almost everything, with K&R for the few pieces of code where Allman is not appropriate (long series of if/else, independant if followed by just a continue/break or goto (yes those can be useful C or C++ but almost never in more modern languages).
And indeed there even even a few occasions where a single line if () { … } is appriate. That’s why you must not be too religious. Strict, yes. Stuborn, no.
Allman style. It is a lot easier to read if the braces line up vertically; makes it clearer what a block is.
i.e. you have an if, while etc. on one line, and the block that it executes on the following line. Block is made up of brace, statements, close brace…
I’m also rather anal about ALWAYS putting braces around even single-line blocks in the interests of readability.
I hate religious arguments about programming style – yet I’m so opinionated that I can’t help to comment and get sucked in to the discussion:
I used to be a strict K&R but have really honed in on Allman in the last two years or so. Allman with inline acceptions (begin-end braces on one line – as long as they do not contain nested braces)
I think I like K&R at the time because of the saving in screen realestate. But now that I’m not limited to an 80×25 CRT display Allman really does make more sense. When you have multiple nestings of {} it helps a great deal to have them in the same column. It also flows well logically – Some block label as the header, and then the code-block:
block-label
{
…
}
Indentations are a must – but must not be over done. Again I find inline acceptable:
block-label { …. }
But never
block-label {…{….}…{….}….}
There are several questions that need to be asked: Who is going to look at my code? Who is going to debug my code? Does my coding style help me?
If you program for yourself – then it really doesn’t matter what you pick. But if your code is going to be read by someone else, then part of your responsibility is to help them out.
Code elegance is small amount of easily readable code. Not code that takes up little space.
-CF
You’ve got to line up your curly brackets! No programming teacher I’ve ever had has ever advocated any other method. I didn’t even know any other methods existed until recently!
What the heck kind of a complaint is "Oh, I just don’t feel comfortable giving a bracket it’s own line"?? It’s the start of an entire enclosed section of code, that’s not important enough for you?
Having brackets that aren’t alligned with one another is like having matching bookends holding your books together but one of them is facing sideways and the other is facing forward. Sure it still works, but it just doesn’t look right!
I’ve had to use all of these styles at one time or another, so I’m pretty flexible. K&R was really useful in the days when most of us programmed on 24×80 terminals. I did find one case where K&R style could prevent a problem. I had a programmer working for me who took the error messages produced by the compiler quite literally. There was a case where the compiler told him that there was a semicolon expected, so he added one:
if (cond) ;
{
code that now always executes
}
With K&R style, the code would still work as written. Of course, the real problem was the programmer…
Being in an "Allman" shop has really made me hate the style. Taking up extra space for a { makes reading the code more difficult because it makes detecting the indentation of the code more difficult. It also makes catching and handling exceptions hard to read because a rather run-of-the mill exception handling routine can take up many screens. I used to use Allman style but converted to R&K when I realised that I found K&R easyer to read.
Allman is best. I have nothing more to add than what others have already posted. I have noticed more programmers have converted from K & R to Allman than vice versa. The arguments for Allman’s win hands down. End of discussion.
I learned C from K&R and even while reading that book, I disliked that style, choosing instead to do what looks like is called Whitesmith’s. Now I do Allmans, since that’s what VS does automatically – it’s hasn’t been much of a switch.
One thing I do which VS’s auto formatter doesn’t like is to line up
case ‘a’:
// with the following
break;
so that it’s easier to spot missing break statements.
Call me stupid… but I am running Visual Studio 2005 express edition, but I can not change the default indentation style to Allman style! Who knows how to do it! Thanks.
Of course, I found Tools/Options/Text Editor…
Hi Matthijs,
To change this, go to Tools…Options…Text Editor…C#…Formatting…New Lines… and make sure all the checkboxes under the "New Line Options for Braces" are checked. As you check and uncheck each one, you will see a "preview" screen that shows how the option will change formatting.
Thanks danielfe that helped !
If the New Line Options aren’t there you need to check the Show All Setting box in the bottom left.
I came across text naming K & R Kernel style – maybe because it is used in the Linux kernel? Kernel seems easier to write to me, so I’ll use this name for it.
I use Allman since ever. I didn’t imagine there could be another style until I encountered it in code written by others or downloaded from the net.
This may be due to historical reasons. My beginnings as a programmer were in Pascal, almost 20 years ago. So switching from begin/end to {/} naturally led me to Allman.
Nevertheless, I always considered Pascal a very readable language, perfect for ppl needing to write lots of code occasionally, but not being mainly busy writing code – back then I needed to code my own programs to drive machinery under DOS, my own programs to do statistical processing on data acquired, and the like, but there were long periods of time where I would only use the programs I wrote, and not enhance them.
So it seems to me reasonable that Allman brings more readability into the code than Kernel.
I encountered the argument that in C and C++, having the opening brace on the same line makes the difference between a function/method declaration and a function/method definition easier to spot. But I find this to be plain BS, since the difference is actually made by the presence or absence of the semicolon.
I agree that at the time when you had to program in text mode in a 24 X 80 console screen real estate was expensive. But even back then you could change your video mode to 50 X 80, or something about that, and double your screen real estate. Besides, back then there were little compilers (any at all?) supporting exceptions, and it is my experience that braces tend to eat up disturbingly much space especially when you code exception handling using Allman.
Today, however, screens have become big enough so you don’t really have a screen real estate problem anymore. You can even use two screens if your development/debugging process or your code is very complex. So why use a style which degrades readability?
Another issue about readability: usually when i experiment with a solution, or in the initial versions of prototype code I write ugly, long blocks. During such tests, I also edit this ugly code a lot, add logging, remove logging, add conditional code in some place, move it into another place, etc. It often happens during such ugly and dirty changes (I wouldn’t call them quick, hoever), that I loose control over my braces. Using the proper indentation and the braces aligned like Allman, I don’t have such a difficult time spotting a missing brace, and I can use the environment to reformat the code after a change. Now, with Kernel I’d surely have a hard time following opening braces in all sorts of positions (at the end of a for/if/while, maybe after a multiline test condition for an if. Using Allman all opening braces are easy to spot in the starting position of individual rows.
I’m about to start writing a coding standard for internal use. I guess anybody can tell which style I’ll recommend. The arguments presented by various ppl above surely helped me decide. until I reached this page, I was still thinking I must be missing somethign about Kernel if so mcuh code and so many coders use it. Now I think it’s just a historically determined bad thing, like many others.
K&R wins hands down for me.
I used to be an Allman guy, since that seemed to be what most people were using. I then worked on a project which used K&R and was far more readable as a result.
Like the person who commented before, I find it far easier to scan for if…} or while…} etc than {…}
This is just plain horrible:
try {
…
}
catch ( … )
{
…
}
I also find it near impossible to get an overall picture of the structure of Allman code since so little of it fits on the screen.
K&R at all times.
Also the style I remember from early C++ (C with Classes anyone?) and Pascal.
Perl let’s you put if/while statements at the end or beginning of a statement to emphasize what’s important.
What’s more important – that there’s a block of code, or that there’s a block of code that might execute, or will loop more than once? Emphasizing the opening statement seems much more sensible to me.
Allman’s style is good if you program for line counters, though. Especially when you do switch – case with braces.
Anything except K&R. I simply find it hard to read. I have some odd SQL coding conventions that I follow, too, all in the name of readability.
IfYouWantToKnowWhatI1Is
{
read this;
forget Allman
}
if_you_want_to_know_what_l1_is {
keep smiling;
use kernel style;
}
Never understood why searching for ‘{‘ is an issue (unless you are trying to remove it); just look at indentation. And 8 spaces of indentation is a blessing for anyone prone to writing unnecessarily complicated, hence less maintainable code.
Just my thoughts…
After I use Python, I enjoy programming in the K&R style.
I need Allman style. If I even use a piece of code that isn’t written in Allman style, I will make it Allman style. This is time consuming. I think of anyone who doesn’t use Allman style as making more work on me to properly indent their code. 😉 As far as how many spaces to indent, I’m not picky, so long as it’s consistent throughout it’s entire scope, and the matching brackets are equally indented.
Allman style, 2-space tabs. I use 4-space tabs in python since blocks are indicated by tabs instead of braces.
Much prefer the K&R style. I used to be an Allman developer in college until I saw the light. More screen space to see your code is a plus but the main reason I like it is that the controlling statement nicely matches up with the ending brace. Visually it’s easier for me to see this than if I had an opening brace right below it.
In the place I work now everyone uses Allman and it’s a nightmare looking at code that has a few lines in each if / else construct. The code just looks so bloated.
I have a lot of c / c++ books, and they mostly use Allman style…which I HATE!!
I can understand the readabilty argument of Allman though, so I leave an additional space like Allman, but keep my opening brace on the first line.
e.g.
int function (params) {
function code;
}
And if/else for loops are pretty similar.
if (condition) {
do this
}
EXCEPT, if there is only one line to be executed, in which case I write it like this.
if (condition)
do this;
I used to favor Allman style, but I switched to K&R when I had to deal with multiple programming languages (VB.NET, C#, Ruby). Although I can agree that Allman style is (at times) more readable, I favor the ability of K&R to allow just about ANY programming language to use the SAME number of lines.
Examples:
C/C++/C#/Java/PHP/Perl:
———-
1 if (expression1) {
2 statement1;
3 statement2;
4 statement3;
5 } else if (expression2) {
6 statement4;
7 statement5;
8 } else {
9 statement6;
10 }
VBScript/VB6/VB.NET:
———-
1 If Expression1 Then
2 Statement1
3 Statement2
4 Statement3
5 ElseIf Expression2 Then
6 Statement4
7 Statement5
8 Else
9 Statement6
10 End If
Pascal/Delphi:
———-
1 if expression1 then begin
2 statement1;
3 statement2;
4 statement3
5 end else if expression2 then begin
6 statement4
7 statement5
8 else
9 statement6
10 end;
Ruby:
———-
1 if expression1
2 statement1
3 statement2
4 statement3
5 elsif expression2
6 statement4
7 statement5
8 else
9 statement6
10 end
COBOL:
———-
1 IF EXPRESSION-1
2 STATEMENT-1
3 STATEMENT-2
4 STATEMENT-3
5 ELSE IF EXPRESSION-2
6 STATEMENT-4
7 STATEMENT-5
8 ELSE
9 STATEMENT-6
10 .
Python's indentation rule is an annoyance, because I strongly feel that progressive INdentation must be followed by eventual progressive DEdentation. If something is indented 4 spaces, there must be something present on a line that dedents this block 4 spaces. I might think of using a comment to denote the end of the block
Python:
———-
1 if expression1:
2 statement1
3 statement2
4 statement3
5 elif expression2:
6 statement4
7 statement5
8 else:
9 statement6
10 #end if
Whitesmiths Style all the way, it makes my code look cleaner, as well as making the distinction that braces are part of the block of code, NOT the opening statement. | https://blogs.msdn.microsoft.com/danielfe/2003/11/24/its-all-a-matter-of-style/ | CC-MAIN-2019-43 | en | refinedweb |
By any other name ... the questions are all the same. They only differ by whether you want the result or its opposite.
The generic questions can be looked from the traditional perspectives of
- what is the question,
- what is the object in the question and
- what are the object properties.
Lets start with a small point data file brought in from Arcmap using the FeatureClassToNumPyArray tool.
Four fields were brought in, the Shape field ( as X and Y values), an integer Group field and a Text field. The data types for each field are indicated in the dtype line. The details of data types have been documented in other documents in the series.
>>> arr
array([(6.0, 0.0, 4, 'a'), (7.0, 9.0, 2, 'c'),
(8.0, 6.0, 1, 'b'), (3.0, 2.0, 4, 'a'),
(6.0, 0.0, 4, 'a'), (2.0, 5.0, 2, 'b'),
(3.0, 2.0, 4, 'a'), (8.0, 6.0, 1, 'b'),
(7.0, 9.0, 2, 'c'), (6.0, 0.0, 4, 'a')],
dtype=[('X', '<f8'), ('Y', '<f8'), ('Group', '<i4'), ('Text', 'S5')])
>>> arr.shape
(10,)
In summary:
- the X and Y fields 64 bit floating point numbers (denoted by: <f8 or float64)
- the Group field is a 32 bit integer field (denoted by: <i4 or int32)
- the text field is just that...a field of string data 5 characters wide.
Is any of this important? Well yes...look at the array above. The shape indicates it has 10 rows but no columns?? Not quite what you were expecting and it appears all jumbled and not nicely organized like a table in ArcMap or in a spreadsheet. The array is a structured array, a subclass of the multidimensional array class, the ndarray. The data types in structured arrays are mixed and NumPy works if the data are of one data type like those in the parent class
Data in an array can be cast to find a common type, if it contains one element belongs to a higher data type. Consider the following examples, which exemplify this phenomenon.
The arrays have been cast into a data type which is possible for all elements. For example, the 2nd array contained a single floating point number and 4 integers and upcasting to floating point is possible. The 3rd example downcast the integers to string and in the 4th example, True was upcast to integer since it has a base class of integer, which is why True-False is often represented by 1-0.
>>> type(True).__base__
<type 'int'>
The following code will be used for further discussion.
def get_unique(arr,by_flds=[]):
""" Produce unique records in an array controlled by a list of fields.
Input: An array, and a list of fields to assess unique.
All fields: Use [] for all fields.
Remove one: all_flds = list(arr_0.dtype.names)
all_flds.remove('ID')
Some fields: by name(s): arr[['X','Y']] # notice the list inside the slice
or slices: all_flds[slice]... [:2], [2:], [:-2] [([start:stop:step])
Returns: Unique array of sorted conditions.
The indices where a unique condition is first encountered.
The original array sliced with the sorted indices.
Duh's: Do not forget to exclude an index field or fields where all values are
unique thereby ensuring each record will be unique and you will fail miserably.
"""
a = arr.view(np.recarray)
if by_flds:
a = a[by_flds].copy()
N = arr.shape[0]
if arr.ndim == 1: # ergo... arr.size == arr.shape[0]
uniq,idx = np.unique(a,return_index=True)
uniq = uniq.view(arr.dtype).reshape(-1, 1) # purely for print purposes
else:
uniq,idx = np.unique(arr.view(a.dtype.descr * arr.shape[1]),return_index=True)
uniq = uniq.view(arr.dtype).reshape(-1, arr.shape[1])
arr_u = arr[np.sort(idx)]
return uniq,idx,arr_u
if __name__=="__main__":
"""Sample data section and runs...see headers"""
X = [6,7,8,3,6,8,3,2,7,9]; Y = [0,9,6,2,0,6,2,5,9,4]
G = [4,2,1,4,3,2,2,3,4,1]; T = ['a','c','b','a','a','b','a','c','d','b']
dt = [('X','f8'),('Y','f8'),('Group','i4'),('Text','|S5')]
arr_0 = np.array(zip(X,Y,G,T),dtype=dt)
uniq_0,idx_0,arr_u0 = get_unique(arr_0[['X','Y']])
frmt = "\narr_0[['X','Y']]...\nInput:\n{}\nOutput:\n{}\nIndices\n{}\nSliced:\n{}"
print(frmt.format(arr_0,uniq_0,idx_0,arr_u0))
Which yields the following results
arr_0[['X','Y']]...
Input:
[(6.0, 0.0, 4, 'a') (7.0, 9.0, 2, 'c') (8.0, 6.0, 1, 'b')
(3.0, 2.0, 4, 'a') (6.0, 0.0, 3, 'a') (8.0, 6.0, 2, 'b')
(3.0, 2.0, 2, 'a') (2.0, 5.0, 3, 'c') (7.0, 9.0, 4, 'd')
(9.0, 4.0, 1, 'b')]
Output:
[[(2.0, 5.0)]
[(3.0, 2.0)]
[(6.0, 0.0)]
[(7.0, 9.0)]
[(8.0, 6.0)]
[(9.0, 4.0)]]
Indices
[7 3 0 1 2 9]
Sliced:
[(6.0, 0.0) (7.0, 9.0) (8.0, 6.0) (3.0, 2.0) (2.0, 5.0)
(9.0, 4.0)]
The arr_0 output is your conventional recarray output with everything wrapped around making it hard to read. The Output section showsn the unique X,Y values in the array in sorted order, which is the default. The Indices output is the location in the original array where the entries in the sorted Output can be found. To produce the Sliced incarnation, I sorted the Indices, then used the sorted indices to slice the rows out of the original array.
Voila...take a table, make it an array...find all the unique entries based upon the whole array, or a column or columns, then slice and dice to get your desired output. In any event, it is possible to terminate the process at any point and just find the unique values in a column for instance.
The next case will show how to deal with ndarrays which consist of a uniform data type and the above example will not work.
Of course there is a workaround. To that end, consider the small def from a series I maintain, that shows how to recast an ndarray with a single dtype to a named structured array and a recarray. Once you have fiddled with the parts, you can
- determine the unique records (aka rows)
- get them in sorted order or
- maintain the original order of the data
# ----------------------------------------------------------------------
# num_42 comment line above def
def num_42():
"""(num_42)...unique while maintaining order from the original array
:Requires: import numpy as np
:--------
:Notes: see my blog for format posts, there are several
:-----
: format tips
: simple ["f{}".format(i) for i in range(2)]
: ['f0', 'f1']
: padded ["a{:0>{}}".format(i,3) for i in range(5)]
: ['a000', 'a001', 'a002', 'a003', 'a004']
"""
a = np.array([[2, 0], [1, 0], [0, 1], [1, 0], [1, 2], [1, 2]])
shp = a.shape
dt_name = a.dtype.name
flds = ["f{:0>{}}".format(i,2) for i in range(shp[1])]
dt = [(fld, dt_name) for fld in flds]
b = a.view(dtype=dt).squeeze() # type=np.recarray,
c, idx = np.unique(b, return_index=True)
d = b[idx]
return a, b, c, idx, d
The results are pretty well as expected.
- Array 'a' has a uniform dtype.
- The shape and dtype name were used to produce a set of field names (see flds and dt construction).
- Once the dtype was constructed, a structured or recarray can be created ( 'b' as structured array).
- The unique values in array 'b' are returned in sorted order ( array 'c', see line 21)
- The indices of the first occurrence of the unique values are also returned (indices, idx, see line 21)
- The input structured array, 'b', was then sliced using the indices obtained.
>>> a
array([[2, 0],
[1, 0],
[0, 1],
[1, 0],
[1, 2],
[1, 2]])
>>> b
array([(2, 0), (1, 0), (0, 1), (1, 0), (1, 2), (1, 2)],
dtype=[('f00', '<i8'), ('f01', '<i8')])
>>> c
array([(0, 1), (1, 0), (1, 2), (2, 0)],
dtype=[('f00', '<i8'), ('f01', '<i8')])
>>> idx
array([2, 1, 4, 0])
>>> d
array([(0, 1), (1, 0), (1, 2), (2, 0)],
dtype=[('f00', '<i8'), ('f01', '<i8')])
>>> # or via original order.... just sort the indices
>>> idx_2 = np.sort(idx)
>>> idx_2
array([0, 1, 2, 4])
>>> b[idx_2]
array([(2, 0), (1, 0), (0, 1), (1, 2)],
dtype=[('f00', '<i8'), ('f01', '<i8')])
I am sure a few of you (ok, maybe one), is saying 'but the original array was a Nx2 array with a uniform dtype? Well I will leave the solution for you to ponder. Once you understand it, you will see that it isn't that difficult and you only need a few bits of information... the original array 'a' dtype, and shape and the unique array's shape...
>>> e = d.view(dtype=a.dtype).reshape(d.shape[0],a.shape[1])
>>> e
array([[0, 1],
[1, 0],
[1, 2],
[2, 0]])
These simple examples can be upcaled quite a bit in terms of the number of row and columns and which ones you need to participate in the uniqueness quest.
That's all for now.
Thanks for sharing Dan Patterson. To bad that blog post can't be "rewarded" as helpful.
Timothy Hales, is this something you can take a look at? Some blog post are more "helpful" than documents, but currently they can't be marked as such. | https://community.esri.com/blogs/dan_patterson/2016/10/23/numpy-lessons-5-identical-duplicate-unique-different | CC-MAIN-2019-51 | en | refinedweb |
debugger;to diagnose what's going on when I'm dispatching actions but I get this screen
Hi guys, i have a question, why the export button on the examples is exporting a stringified JSON instead of a real JSON?
I am trying to export a JSON file of bunch of actions for a analysis, which i have no intent to import later,
i just want to do some "pretty print" on my VIM and analyze by hand, but all exported files is stringified, which become difficult to work with.
This is the result of the todomvc exported state.json
{ "payload": "[{\"type\":\"COMPLETE_TODO\",\"id\":0},{\"type\":\"ADD_TODO\",\"text\":\"Test\"}]" }
The todomvc example there is no serialize configuration, is this format correct? It's a .json extension which isn't actually a "real" json (the payload array is actually a string).
So, is the the exporting button serializing the state with stringify by default? Why?
I played with the serialized option but i felt a little bit overcomplicated for this simple task.
How can i export a real json file?
Thanks in advance for this awesome project.
JSON.stringify(like date, regex, undefined, nan, infinity, error, symbol, map, set and function)
Hello there, I'm facing a problems using Redux DevTools from the simpole way:
const devTools = window.REDUX_DEVTOOLS_EXTENSION && window.REDUX_DEVTOOLS_EXTENSION()
const store = createStore(rootReducer, devTools)
The error is:
"The initialState argument passed to createStore has unexpected type of "Function"
Can someone help me?
Hello everyone, I have been using REDUX-DEV-TOOLS and it is super awesome, but I miss a feature in the UI, or I may not know hot to do it.
I belive it wold be super awesome if this filter field in the UI allow regex filter the actions.
In my case, I work with redux forms that is fantastic and... by it self dispatches SEVERAL actions that I trust and dont care about.
The filter field in the redux dev tool UI allows me to filter a specific action... but I really want is to "hide" all the redux form actions (because I trust and dont care about) So... I belive it wold be super useful this field allow me to filter with a regex like /^[^@@REDUX-FORM].*/
hi! I have a quick question if anyone is able to help. I have built some React components as a library, I am building with
Rollup as many blog articles suggest and creating
dist for npmjs in CommonJS version and ES6.
Unfortunately, when transforming the CommonJS to ES6, there is a wrong import:
import redux, { combineReducers, createStore, applyMiddleware } from 'redux';
When using my components lib in a React app, it fails:
Attempted import error: 'redux' does not contain a default export (imported as 'redux').
If I remove
import { composeWithDevTools } from 'redux-devtools-extension'; from my lib, everything works.
Any idea why it is built with that import? | https://gitter.im/zalmoxisus/redux-devtools-extension?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge | CC-MAIN-2019-51 | en | refinedweb |
I have played with the Keras official image_ocr.py example for a while and want to share my takeaways in this post.
The official example only does the training for the model while missing the prediction part, and my final source code is available both on my GitHub as well as a runnable Google Colab notebook. More technical detail of OCR(optical character recognization) including the model structure and CTC loss will also be explained briefly in the following sections.
The input will be an image contains a single line of text, the text could be at any location in the image. And the task for the model is to output the actual text given this image.
For example,
The official image_ocr.py example source code is quite long and may look daunting. It can be breaking down into several parts.
The model input is image data, and we first feed the data to two convolutional networks to extract the image features, followed by the Reshape and Dense to reduce the dimensions of the feature vectors before letting the bidirectional GRU process the sequential data. The sequential data feed to the GRU is the horizontally divided image features. The final output Dense layer transforms the output for a given image to an array with the shape of (32, 28) representing (#of horizontal steps, #char labels).
And here is the part of the code to construct the Keras model.
img_w = 128 # Input Parameters img_h = 64 # Network parameters conv_filters = 16 kernel_size = (3, 3) pool_size = 2 time_dense_size = 32 rnn_size = 512 minibatch_size = 32 unique_tokens = 28 if K.image_data_format() == 'channels_first': input_shape = (1, img_w, img_h) else: input_shape = (img_w, img_h, 1) act = 'relu' input_data = Input(name='the_input', shape=input_shape, dtype='float32') inner = Conv2D(conv_filters, kernel_size, padding='same', activation=act, kernel_initializer='he_normal', name='conv1')(input_data) inner = MaxPooling2D(pool_size=(pool_size, pool_size), name='max1')(inner) inner = Conv2D(conv_filters, kernel_size, padding='same', activation=act, kernel_initializer='he_normal', name='conv2')(inner) inner = MaxPooling2D(pool_size=(pool_size, pool_size), name='max2')(inner) conv_to_rnn_dims = (img_w // (pool_size ** 2), (img_h // (pool_size ** 2)) * conv_filters) inner = Reshape(target_shape=conv_to_rnn_dims, name='reshape')(inner) # cuts down input size going into RNN: inner = Dense(time_dense_size, activation=act, name='dense1')(inner) # Two layers of bidirectional GRUs # GRU seems to work as well, if not better than LSTM: gru_1 = GRU(rnn_size, return_sequences=True, kernel_initializer='he_normal', name='gru1')(inner) gru_1b = GRU(rnn_size, return_sequences=True, go_backwards=True, kernel_initializer='he_normal', name='gru1_b')(inner) gru1_merged = add([gru_1, gru_1b]) gru_2 = GRU(rnn_size, return_sequences=True, kernel_initializer='he_normal', name='gru2')(gru1_merged) gru_2b = GRU(rnn_size, return_sequences=True, go_backwards=True, kernel_initializer='he_normal', name='gru2_b')(gru1_merged) # transforms RNN output to character activations: inner = Dense(unique_tokens, kernel_initializer='he_normal', name='dense2')(concatenate([gru_2, gru_2b])) y_pred = Activation('softmax', name='softmax')(inner) Model(inputs=input_data, outputs=y_pred)
As we can see in the example image, the text could be located anywhere, how the model align between the input and output to locates each character in the image and turns them into text? That is where CTC comes into play, CTC stands for connectionist temporal classification.
Notice that the output of the model has 32 timesteps, but the output might not have 32 characters. The CTC cost function allows the RNN to generate output like:
CTC introduced the "blank" token, and itself doesn't translate into any character, what it does is to separate individual characters so that we can collapse repeated characters that are not separated by the blank.
So the decoding output for the previous sequence will be "a game".
Let's take a look at another example of the text "speed".
According to for the decoding principle, we first collapse repeating characters that are not separated by blank token, and then we remove the blank tokens themselves. Notice that if there is no blank token to separate the two "e"s they will be collapsed into one.
In Keras, the CTC decoding can be performed in a single function,
K.ctc_decode.
from keras import backend as K K.get_value(K.ctc_decode(out, input_length=np.ones(out.shape[0])*out.shape[1], greedy=True)[0][0])
The
out is the model output which consists of 32 timesteps of 28 softmax probability values for each of the 28 tokens from a~z, space, and blank token. We set the parameter
greedy to perform the greedy search which means the function will only return the most likely output token sequence.
Alternatively, if we want to have the CTC decoder return the top N possible output sequence, we can ask it to perform beam search with a given beam width.
top_paths = 3 results = [] for i in range(top_paths): lables = K.get_value(K.ctc_decode(out, input_length=np.ones(out.shape[0])*out.shape[1], greedy=False, beam_width=top_paths, top_paths=top_paths)[0][i])[0] results.append(lables)
One thing worth mentioning is that if you are new to beam search algorithm, the
top_paths parameter is no greater than the
beam_width parameter since the beam width tells the beam search algorithm exactly how many top results to keep track of in iterating all timesteps.
Right now the output of the decoder will be a sequence of tokens, and we just need to translate the numerical classes back to characters.
So far we only talked about the decoding part of the CTC. You may wonder how the model is trained with CTC loss?
In order to compute the CTC loss, it requires more than the true labels and predicted outputs of the model, but also the output sequence length and the lengths for each of the true labels.
In Keras the CTC loss is packaged in one function
K.ctc_batch_cost.
# the actual loss calc occurs here despite it not being # an internal Keras loss function def ctc_lambda_func(args): y_pred, labels, input_length, label_length = args # the 2 is critical here since the first couple outputs of the RNN # tend to be garbage: y_pred = y_pred[:, 2:, :] return K.ctc_batch_cost(labels, y_pred, input_length, label_length)
Checkpoint results after training the model for 25 epochs.
If you have read this far and experimenting along on the Google Colab you should now have a Keras OCR demo running. If you are still eager for more information about CTC and beam search, feel free to check out the following resources.
Sequence Modeling With CTC - An in-depth elaboration of CTC algorithm and other applications where CTC can be applied to such as speech recognition, lip reading from video and so on.
Coursera Beam search video lecture. Quick and easy to understand.
Don't forget to get the source code from my GitHub as well as a runnable Google Colab notebook.Share on Twitter Share on Facebook | https://www.dlology.com/blog/how-to-train-a-keras-model-to-recognize-variable-length-text/ | CC-MAIN-2019-51 | en | refinedweb |
In this blog, we'll see how to use Angular's route guards to help with authentication.
Angular route guards are interfaces, which checks whether the router allows navigation for the user requested route.
There are different guard types we can use to protect our routes, each of then can be called on particular sequence:
Here we see an Example for canActivate guard type,
Eg: When a user is not authenticated and requested for the user dashboard route, we should not permit that route. the user can access that page only if a user is authenticated.
ng g generate components/UserDashboard
import { ModuleWithProviders } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { UserDashboardComponent } from './components/user-dashboard.component'; export const router: Routes = [ {path: 'user-dashboard' , component: UserDashboardComponent}, ];
Here we haven't given any authguards for route, So everyone can access this page without any permission.
ng g service services/authguard
Now, this will add in your application app.module.ts in providers, So that we can use that service in your entire application.
import { Injectable } from '@angular/core'; import { Router, CanActivate } from '@angular/router'; @Injectable() export class AuthGuard implements CanActivate { constructor(public router: Router) {} canActivate(): boolean { const token = localStorage.getItem('token'); if (!token) { this.router.navigate(['login']); return false; } return true; } }
Now, to provide permission for the specific route add this service for that route. At that time when a user hits the route first checks for the authguard based on the return response renders that page.
If it returns true, then page is visible for that user, otherwise user can't be visible that page.
import { ModuleWithProviders } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { UserDashboardComponent } from './components/user-dashboard.component'; import { AuthGuard } from './services/authguard'; export const router: Routes = [ {path: 'user-dashboard' , component: UserDashboardComponent, canActivate: [AuthGuard]}, ];... | https://micropyramid.com/blog/implementing-angular-authentication-using-route-authguards/ | CC-MAIN-2019-51 | en | refinedweb |
Functional Concurrency in Scala 101
Piotr Gawryś
Who am I?
- One of the maintainers of Monix
- Contributor to Typelevel ecosystem
- Kraków Scala User Group co-organizer
(let me know if you'd like to speak!)
- Super excited to be here!
twitter.com/p_gawrys
What's the talk about
- Concurrency fundamentals on JVM
- Focused around purely functional programming (Cats-Effect, FS2, Monix, ZIO)
Concurrency
- Processing multiple tasks interleaved
- Doesn't require more than one thread to work
Concurrency
Parallelism
- Executing multiple tasks at the same time to finish them faster
Parallelism
Threads
- Basic unit of CPU utilization
- Typically part of Operating System
- Threads can share memory
- Processors can usually run up to 1 thread per CPU's core at the same time
Threads on JVM
- Map 1:1 to native OS threads
- Each thread takes around 1 MB of memory on 64-bit systems by default
JVM Memory Model
Heap
Thread Stack
Objects
call stack
local variables
Thread Stack
call stack
local variables
Thread Stack
call stack
local variables
CPU
CPU's Core 1
Main Memory
registers
CPU
Cache
JVM
CPU's Core 3
registers
CPU
Cache
CPU's Core 2
registers
CPU
Cache
Context Switch
- Happens when new thread starts working on CPU's core
- OS needs to store the state of old task and restore the state of the new one
- Cache locality is lost
- Synchronous => no context switches => best performance
Context Switch
Thread Pools
- Take care of managing threads for us
- Can reuse threads
- Several types, e.g. Cached, SingleThreaded, WorkStealing etc.
- Think ExecutionContext (Future), ContextShift (cats.effect.IO), Scheduler (Monix Task)
Thread Pools
import java.util.concurrent.Executors import monix.execution.Scheduler import scala.concurrent.ExecutionContext val ec = ExecutionContext.fromExecutor(Executors.newCachedThreadPool()) val scheduler = Scheduler(ec)
Extra capabilities
import monix.execution.schedulers.TestScheduler import scala.concurrent.duration._ import cats.implicits._ val sc = TestScheduler() val failedTask: Task[Int] = Task.sleep(2.days) >> Task.raiseError[Int](new Exception("boom")) val f: CancelableFuture[Int] = failedTask.runToFuture(sc) println(f.value) // None sc.tick(10.hours) println(f.value) // None sc.tick(1000.days) println(f.value) // Some(Failure(java.lang.Exception: boom))
Asynchronous Boundary
- Task returns to Thread Pool to be scheduled again
- Many scenarios can occur, e.g.:
- Cancelation
- Another Task starts executing
- The same Task executes on the same thread it was before
- New Thread is created
- and more!
Asynchronous Boundary
val s: Scheduler = Scheduler.global def repeat: Task[Unit] = for { _ <- Task.shift _ <- Task(println(s"Shifted to: ${Thread.currentThread().getName}")) _ <- repeat } yield () repeat.runToFuture(s)
Asynchronous Boundary
// Output: // Shifted to: scala-execution-context-global-12 // Shifted to: scala-execution-context-global-12 // Shifted to: scala-execution-context-global-12 // Shifted to: scala-execution-context-global-14 // Shifted to: scala-execution-context-global-14 // Shifted to: scala-execution-context-global-14 // Shifted to: scala-execution-context-global-12 // Shifted to: scala-execution-context-global-12 // Shifted to: scala-execution-context-global-13 // Shifted to: scala-execution-context-global-13 // Shifted to: scala-execution-context-global-13 // Shifted to: scala-execution-context-global-12 // Shifted to: scala-execution-context-global-12 // ...
val s1: Scheduler = Scheduler( ExecutionContext.fromExecutor(Executors.newSingleThreadExecutor()), ExecutionModel.SynchronousExecution) def repeat(id: Int): Task[Unit] = Task(print(id)).flatMap(_ => repeat(id)) val prog = (repeat(1), repeat(2)).parTupled prog.runToFuture(s1) // Output: // 1111111111111111111111111111111111111111111111111111111111...
Task Scheduling
val s1: Scheduler = Scheduler( ExecutionContext.fromExecutor(Executors.newSingleThreadExecutor()), ExecutionModel.SynchronousExecution) def repeat(id: Int): Task[Unit] = Task(print(id)).flatMap(_ => Task.shift >> repeat(id)) val prog = (repeat(1), repeat(2)).parTupled prog.runToFuture(s1) // Output: // 121212121212121212121212121212121212121212121 ...
Task Scheduling
val s1: Scheduler = Scheduler( // 4 = number of cores on my laptop ExecutionContext.fromExecutor(Executors.newFixedThreadPool(4)), ExecutionModel.SynchronousExecution) val s2: Scheduler = Scheduler( ExecutionContext.fromExecutor(Executors.newFixedThreadPool(1)), ExecutionModel.SynchronousExecution) def repeat(id: Int): Task[Unit] = Task(print(id)).flatMap(_ => repeat(id)) val program = (repeat(1), repeat(2), repeat(3), repeat(4), repeat(5), repeat(6).executeOn(s2)).parTupled program.runToFuture(s1) // Output: // 143622331613424316134424316134243161342431613424316134243 ... // no '5' !
Task Scheduling
Light Async Boundary
- Continues on the same thread by means of a trampoline
- Checks with thread pool for cancelation status (in Monix & Cats-Effect IO)
- Can help with stack safety
- Low level!
Light Async Boundary
implicit val s = Scheduler.global .withExecutionModel(ExecutionModel.SynchronousExecution) def task(i: Int): Task[Unit] = Task(println(s"$i: ${Thread.currentThread().getName}")) >> Task.shift(TrampolineExecutionContext.immediate) >> task(i + 1) val t = for { fiber <- task(0) .doOnCancel(Task(println("cancel"))) .start _ <- fiber.cancel } yield () t.runToFuture // Output: // 0: scala-execution-context-global-11 // 1: scala-execution-context-global-11 // 2: scala-execution-context-global-11 // cancel
Light Async Boundary
val immediate: TrampolineExecutionContext = TrampolineExecutionContext(new ExecutionContext { def execute(r: Runnable): Unit = r.run() def reportFailure(e: Throwable): Unit = throw e })
Blocking Threads
- Don't
- Thread is being wasted, might prevent other tasks from being scheduled if the thread pool is limited
- Use dedicated thread pool for blocking operations
- Use timeouts
Dealing with blocking ops
implicit val globalScheduler = Scheduler.global val blockingScheduler = Scheduler.io() val blockingOp = Task { Thread.sleep(1000) println(s"${Thread.currentThread().getName}: done blocking") } val cpuBound = Task { // keep cpu busy println(s"${Thread.currentThread().getName}: done calculating") } val t = for { _ <- cpuBound _ <- blockingOp.executeOn(blockingScheduler) _ <- cpuBound } yield () t.runSyncUnsafe() // scala-execution-context-global-11: done calculating // monix-io-12: done blocking // scala-execution-context-global-11: done calculating
Semantic / Asynchronous Blocking
- Task waits for certain signal before it can complete
- Doesn't really block any threads, other tasks can execute in the meantime
Semantic / Asynchronous Blocking
val ec = ExecutionContext.fromExecutor(Executors.newSingleThreadExecutor()) implicit val scheduler = Scheduler(ec) val otherTask = Task.sleep(50.millis) >> Task(println("Running concurrently")) val t = for { sem <- Semaphore[Task](0L) // start means it will run asynchronously "in the background" // and the next step in for comprehension will begin _ <- (Task.sleep(100.millis) >> Task(println("Releasing semaphore")) >> sem.release).start _ <- Task(println("Waiting for permit")) >> sem.acquire _ <- Task(println("Done!")) } yield () (t, otherTask).parTupled.runSyncUnsafe() // Waiting for permit // Running concurrently // Releasing semaphore // Done!
Fairness
- Likelihood that different tasks are able to advance
- Without fairness you could get high disparity of latencies between processing different requests
- Monix and ZIO introduce async boundaries from time to time (configurable)
Fairness
Green Threads and Fibers
Green Thread
Thread is scheduled by VM instead of OS. Cheap to start and we can map M Green Threads to N OS Threads.
Fiber
"Lightweight thread". Fibers voluntarily yield control to the scheduler.
Is Task like a Green Thread/Fiber?
- We can map thousands of Tasks to very few OS threads
- Async boundaries give a chance to other tasks from the thread pool to execute, very much like cooperative multitasking
- "Blocking" a Task itself is OK since it doesn't block underlying Threads
Thank you !
I will appreciate any feedback. :)
If you're looking for help/discussion:
FUNCTIONAL CONCURRENCY IN SCALA 101
By Piotr Gawryś
FUNCTIONAL CONCURRENCY IN SCALA 101 | https://slides.com/avasil/fp-concurrency-scalar2019 | CC-MAIN-2019-51 | en | refinedweb |
This is the proxy class for passing read-only input arrays into OpenCV functions. More...
#include "mat.hpp"
This is the proxy class for passing read-only input arrays into OpenCV functions.
It is defined as:::. | https://docs.opencv.org/3.0.0/d4/d32/classcv_1_1__InputArray.html | CC-MAIN-2019-51 | en | refinedweb |
sequence you can pass it a payload. This payload is the starting point of the props to the sequence. Given the sequence:
[actionA, actionB]
someSequence({ store API.
function setSomething({ store }) { store.set('some.path.foo', 'bar') }
All common state operations are available as a method. Instead of first pointing to a value and then operate, you operate first and give the path to the value.
// Traditional approach someArray.push('newItem') // With Cerebral store.push('path.to.array', 'newItem')
This is the one core concept of Cerebral that gives all its power. This simple approach allows for a few important things:
The following methods are available:
The path on the context is only available if there is actually expressed a path after the action in question:
import * as actions from './actions' export default [ actions.actionA, actions.actionB, { foo: actions.actionC } ]
In this scenario only actionB has the path on its context. That means in any action you can check if path is available and what paths can be taken by looking at its keys.
You can grab any tag value by using get:
import { state } from 'cerebral' function someAction({ get }) { const foo = get(state`foo`) }
Get is actually a wrapper around resolve and you should use that. Resolve has some additional functionality though. } | https://cerebraljs.com/docs/api/ | CC-MAIN-2021-10 | en | refinedweb |
Question:
I use one library which is very important and untouchable. The problem is that library declare min, max function, so when I include STL header in project, they conflict. I want to disable min, max function in STL (like #define NOMNMAX) if I could. If I can't, what would be solution?
Important : Sorry, It's not Macro. Two functions are template functions.
like
template<T> T min(const T& a, const T& b) { a < b ? a : b; }
Thanks, in advance.
Solution:1
The min and max functions are defined in the
std namespace, so this code should not compile:
#include <algorithm> int main() { int n = min( 1, 2 ); }
If it does, your Standard Library is non-compliant. Also, your important and untouchable library should be declaring it's functions in a namespace. If it isn't. complain loudly to the vendor.
Edit: As these functions are presumably in a header file, you can touch them. So a hack would be to remove the templates from the header and replace them with the following:
using std::min; using std::max;
though why the writers of the library felt the need to define these templates is anyone's guess.
Solution:2
As both
min and
max (and every other standard library member) are defined in
std namespace, you just mustn't import that namespace, i.e. don't use
using namespace std;. You can still use STL, by explicit namespace resultion, eg.
std::max,
std::cout etc.
Solution:3
If your untouchable library is not in a namespace, you could force the lookup to use global scope, rather than std:
int i = ::min<int>(1,2);
A better solution would be to remove
using namespace std
and get your library in a namespace.
Solution:4
I sometimes have problems with something like that as well, because iirc OpenCV #defines its own min/max, as well as i think does windows.h. Usually I help myself by simply
#undef min #undef max
Neil is right, though, as min is in std:: namespace. For me the problem arises, that with some headers #defining min/max, i can't even use std::min()
Solution:5
Define
NOMINMAX, and you won't get either of these functions.
#define NOMINMAX
Solution:6
I'm guessing your libary defines min/max as macros, so the fact that STL min/min are in a namespace won't help. You could try this:
#define max STL_MAX #define min STL_MIN #include <algorithm> #undef min #undef max
That way, min and max are translated to something else while algorithm is compiled. Of course this only works if you include algorithm before your library.
Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
EmoticonEmoticon | http://www.toontricks.com/2019/06/tutorial-can-i-disable-min-max-in-stl.html | CC-MAIN-2021-10 | en | refinedweb |
python tutorial - Python telephonic interview questions - learn python - python programming
python interview questions :241
code:
testfile = "test.txt" with open(testFile) as f: for line in f: line = line.rstrip() if "#*#*# ham" in line or "#*#*# spam" in line: print line
Another nice form is:
if any(substr in line for substr in (#*#*# ham", "#*#*# spam")): print line
python interview questions :242
MySQL database: lua or python
- Mysql is a database server -- it doesn't have a menu. I think you mean mysql workbench which is a visual database design tool. That option allows you to use lua scripting or python scripting to help you on the design of your database -- it is unrelated to what happens on the mysql server
Learn python - python tutorial - microsoft-visual-studio - python examples - python programs
python interview questions :243]"))
Read AlsoByte objects vs string in python.
python interview questions :244.
python interview questions :245
How to use yield - generator?
- You want to define a function with a generator which can iterate the numbers, which are divisible by 7 within range(n).
code:
def getNum(n,div): for i in range(n): if i % div == 0: yield i DIVIDER = 7 RANGE = 50 print [n for n in getNum(RANGE, DIVIDER)]
Output:
[0, 7, 14, 21, 28, 35, 42, 49]
python interview questions :246.
- dir() - will display the defined symbols. Eg: >>>dir(str) - will only display the defined symbols.
python interview questions :247
Python File ending with .py~?
- It's a backup file -- many editors save the previous version of your file under the same name with a ~ appended.
Read AlsoOject Oriented Python.
python interview questions :248
What style does PyCharm / IntelliJ use for Python docstrings ?
python interview questions :249
Tell whether a character is a combining diacritic mark?
- Use the unicodedata module:
import unicodedata if unicodedata.combining(u'a'): print "is combining character" else: print "is not combining"
python interview questions :250
Which cassandra python pacakge to be used?
- Pycassa is an older python driver that is thrift based while python-driver is a newer CQL3 driver based on cassandra's binary protocol. Thrift isn't going away but it has become a legacy API in cassandra so my advice going forward is to use the newer python driver.
Learn python - python tutorial - python-packages - python examples - python programs
- In the Twissandra example application with the DataStax python-driver to provide an overview of CRUD and using prepared statements etc.
- As for cql I haven't had any experience with this one, but the homepage of the project says it all:
- This driver has been deprecated. Please use python-driver instead | https://www.wikitechy.com/tutorials/python/python-telephonic-interview-questions | CC-MAIN-2021-10 | en | refinedweb |
The State Machine Framework¶
An overview of the State Machine framework for constructing and executing state graphs.
The State Machine framework provides classes for creating and executing state graphs. The concepts and notation are based on those from Harel’s Statecharts: A visual formalism for complex systems ,Object}s.¶
These classes are provided by qt for creating event-driven state machines.
A Simple State Machine¶
To demonstrate the core functionality of the State Machine API, let’s look at a small example: A state machine with three states,
s1,
s2and
s3. The state machine is controlled by a single
QPushButton; when the button is clicked, the machine transitions to another state. Initially, the state machine is in state
s1. The statechart for this machine is as follows:
addTransition()function:s1->addTransition(button, &QPushButton::clicked, s2); s2->addTransition(button, &QPushButton::clicked, s3); s3->addTransition(button, &QPushButton:¶
The above state machine merely transitions from one state to another, it doesn’t perform any operations. The
assignProperty()function can be used to have a state set a property of a
QObjectwhen the state is entered. In the following snippet, the value that should be assigned to a
QLabel‘s
entered()signal is emitted when the state is entered, and the
exited()signal is emitted when the state is exited. In the following snippet, the button’s
showMaximized()slot will be called when state
s3is entered, and the button’s
showMinimized()slot will be called when
s3is exited:QObject::connect(s3, &QState::entered, button, &QPushButton:showMaximized); QObject::connect(s3, &QState::exited, button, &QPushButton::showMinimized);
Custom states can reimplement
onEntry()and
onExit().
State Machines That Finish¶
The state machine defined in the previous section never finishes. In order for a state machine to be able to finish, it needs to have a top-level final state (
QFinalStateobject). When the state machine enters a top-level final state, the machine will emit the
finished()signal and halt.
All you need to do to introduce a final state in the graph is create a
QFinalStateobject and use it as the target of one or more transitions.
Using History States to Save and Restore the Current State¶and
s13in this case).
Such behavior can easily be modeled using history states . A history state (
QHistoryStateobject).
The following code shows how it can be implemented; in this example we simply display a message box when
s3is entered, then immediately return to the previous child state of
s1via); QObject::connect(s3, &QState::entered, mbox, &QMessageBox::exec); s3->addTransition(s1h); machine.addState(s3); s1->addTransition(interruptButton, &QPushButton::clicked, s3);
Using Parallel States to Avoid a Combinatorial Explosion of States¶.
To create a parallel state group, pass
ParallelStatesto the
QStateconstructor¶
A child state can be final (a
QFinalStateobject); when a final child state is entered, the parent state emits the
finished()signal. The following diagram shows a composite state
s1which does some processing before entering a final state:
When
s1‘s final state is entered,
s1will automatically emit
finished(). We use a signal transition to cause this event to trigger a state change:s1->addTransition(s1, &QState:‘s
donestate rather than relying on
s1‘s
finished()signal, but with the consequence that implementation details of
s1are exposed and depended on).
For parallel state groups, the
finished()signal is emitted when all the child states have entered final states.
Targetless Transitions¶, &QPushButton::clicked); s1->addTransition(trans); QMessageBox msgBox; msgBox.setText("The button was clicked; carry on."); QObject::connect(trans, QSignalTransition::triggered, &msgBox, &QMessageBox::exec);
entered()and
exited()signals would be emitted).
Events, Transitions and Guards¶
A
QStateMachineruns its own event loop. For signal transitions (
QSignalTransitionobjects),
QStateMachineautomatically posts a
SignalEventto itself when it intercepts the corresponding signal; similarly, for
QObjectevent transitions (
QEventTransitionobjects) a
WrappedEventis posted.
You can post your own events to the state machine using
postEvent().
When posting a custom event to the state machine, you typically also have one or more custom transitions that can be triggered from events of that type. To create such a transition, you subclass
QAbstractTransitionand reimplement { Q_OBJECT public: StringTransition(const QString &value) : m_value(value) {} protected: bool eventTest(QEvent *e) override { if (e->type() != QEvent::Type(QEvent::User+1)) // StringEvent return false; StringEvent *se = static_cast<StringEvent*>(e); return (m_value == se->value); } void onTransition(QEvent *) override {} private: QString m_value; };
In the
eventTest()reimplementation, we first check if the event type is the desired one; if so, we cast the event to a
StringEventand perform the string comparison.
The following is a statechart that uses the custom event and transition::
For deeply nested statecharts, you can add such “fallback” transitions at the level of granularity that’s most appropriate.
Using Restore Policy To Automatically Restore Properties¶oBarishas two children:
s2and
s3. When
s2is entered, the property
fooBarwill have the value 2.0, since this is explicitly defined for the state. When the machine is in state
s3, no value is defined for the state, but
s1defines the property to be 1.0, so this is the value that will be assigned to
fooBar.
Animating Property Assignments¶, &QPushButton::clicked, s2);
Here we define two states of a user interface. In
s1the
buttonis small, and in
s2it is bigger. If we click the button to transition from
s1to
s2, the geometry of the button will be set immediately when a given state has been entered. If we want the transition to be smooth, however, all we need to do is make a
QPropertyAnimation, &QPushButton:
RestoreProperties, it is possible to also add animations for the property restorations.
Detecting That All Properties Have Been Set In A State¶)); connect(s2, &QState::entered, messageBox, SLOT(exec())); s1->addTransition(button, &QPushButton::clicked, s2);
When
buttonof
buttonis set on the transition between
s1and
s2, the animation will be started when
s2is entered, but the
geometryproperty)); QState *s3 = new QState(); connect(s3, &QState::entered, messageBox, SLOT(exec())); s1->addTransition(button, &QPushButton::clicked, s2); s2->addTransition(s2, &QState::propertiesAssigned, s3);
In this example, when
buttonis clicked, the machine will enter
s2. It will remain in state
s2until the
geometryproperty has been set to
QRect(0, 0, 50, 50). Then it will transition into
s3. When
s3is entered, the message box will pop up. If the transition into
s2has an animation for the
geometryproperty, then the machine will stay in
s2until the animation has finished playing. If there is no such animation, it will simply set the property and immediately enter state
s3.
Either way, when the machine is in state
s3, you are guaranteed that the property
geometryhas been assigned the defined value.
If the global restore policy is set to
RestoreProperties, the state will not emit the
propertiesAssigned()signal until these have been executed as well.
What Happens If A State Is Exited Before The Animation Has Finished¶¶oBarsince this property is assigned by
s2.
Note that animations explicitly set on transitions will take precedence over any default animation for the given property.
Nesting State Machines¶
QStateMachineis a subclass of
QState. This allows for a state machine to be a child state of another machine.
QStateMachinereimplements
onEntry()and calls
start(), so that when the child state machine is entered, it will automatically start running.
The parent state machine treats the child machine as an atomic state in the state machine algorithm. The child state machine is self-contained; it maintains its own event queue and configuration. In particular, note that the
configuration()of the child machine is not part of the parent machine’s configuration (only the child machine itself is).
States of the child state machine cannot be specified as targets of transitions in the parent state machine; only the child state machine itself can. Conversely, states of the parent state machine cannot be specified as targets of transitions in the child state machine. The child state machine’s
finished() signal can be used to trigger a transition in the parent machine.
See also
The Declarative State Machine. | https://doc.qt.io/qtforpython-5/overviews/statemachine-api.html | CC-MAIN-2021-10 | en | refinedweb |
/* X Communication module for terminals which understand the X protocol.>
, Vsystem_name;
char *x_id_name;
/* Initial values of argv and argc. */
extern char **initial_argv;
extern int initial_argc;
/*;
/*;
/* Reusable Graphics Context for drawing a cursor in a non-default face. */
static GC scratch_cursor_gc;
/* Mouse movement..
The silly O'Reilly & Associates Nutshell guides barely document
pointer motion hints at all (I think you have to infer how they
work from an example), and the description of XQueryPointer doesn't
mention that calling it causes you to get another motion hint from
the server, which is very important. */
/*;
/*_row, mouse_face_beg_col;
static int mouse_face_end_row, mouse_face_end_col;
static int mouse_face_past. X and Y can be negative or out of range for the frame. */ Lisp_Object;
static int x_noop_count;
/*_y);
mouse_face_deferred_gc = 0;
}
}
/*Queue (););
FONT_TYPE *font = FACE_FONT (face);
GC gc = FACE_GC (face);
/* HL = 3 means use a mouse face previously chosen. */
if (hl == 3)
cf =) (xgcv.foreground == xgcv.background)
xgcv.foreground = f->display (scratch_cursor_gc)
XChangeGC (x_current_display, scratch_cursor_gc, mask, &xgcv);
else
scratch_cursor_gc =
XCreateGC (x_current_display, window, mask, &xgcv);
gc = scratch_cursor_gc;
#if 0
/* If this code is restored, it must also reset to the default stipple
if necessary. */
if (face->stipple && face->stipple != FACE_DEFAULT)
XSetStipple (x_current_display, gc, face->stipple);
}
}, window, left,
top + FONT_HEIGHT (font),
FONT_WIDTH (font) * len,
/* This is how many pixels of height
we have to clear. */
f->display (x_current_display,;
FONT_TYPE *font;
{
register int len;
Window window = FRAME_X_WINDOW (f);
GC drawing_gc = (hl == 2 ? f->display.x->cursor_gc
: (hl ? f->display.x->reverse_gc
: f->display.x->normal_gc));
if (sizeof (GLYPH) == sizeof (XChar2b))
XDrawImageString16 (x_current_display, window, drawing_gc,
left, top + FONT_BASE (font), (XChar2b *) gp, n);
else if (sizeof (GLYPH) == sizeof (unsigned char))
XDrawImageString (x_current_display,. */
XTclear_end_of_line (first_unused)
register int first_unused;
{
struct frame *f = updating_frame;, FRAME_X_WINDOW (f),
CHAR_TO_PIXEL_COL (f, x - 1),
CHAR_TO_PIXEL_ROW (f, y),
FONT_WIDTH (f->display.x->font),
f->display;
XClearArea (x_current_display, FRAME_X_WINDOW (f),
CHAR_TO_PIXEL_COL (f, x),
CHAR_TO_PIXEL_ROW (f, y),
FONT_WIDTH (f->display.x->font),
f->display.x->line_height, False););
#endif /* 0 */
/* Invert the middle quarter of the frame for .15 sec. */
/* We use the select system call to do the waiting, so we have to make sure
it's available. If it isn't, we just won't do visual bells. */
#if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT)
/* Subtract the `struct timeval' values X and Y,
storing the result in RESULT.
Return 1 if the difference is negative, otherwise 0. */
static int
timeval_subtract (result, x, y)
struct timeval *result, x, y;
{
/* Perform the carry for the later subtraction by updating y.
This is safer because on some systems
the tv_sec member is unsigned. */ is certainly positive. */
result->tv_sec = x.tv_sec - y.tv_sec;
result->tv_usec = x.tv_usec - y.tv_usec;
/* Return indication of whether the result should be considered negative. */
return x.tv_sec < y.tv_sec;
}
XTflash (f)
struct frame *f;
BLOCK_INPUT;
{
GC gc;
/* Create a GC that will use the GXxor function to flip foreground pixels
into background pixels. */
{
XGCValues values;
values.function = GXxor;
values.foreground = (f->display.x->foreground_pixel
^ f->display.x->background_pixel);
gc = XCreateGC );
{
struct timeval wakeup, now;
EMACS_GET_TIME (wakeup);
/* Compute time to wait until, propagating carry from usecs. */
wakeup.tv_usec += 150000;
wakeup.tv_sec += (wakeup.tv_usec / 1000000);
wakeup.tv_usec %= 1000000;
/* Keep waiting until past the time wakeup. */
while (1)
{
struct timeval timeout;
EMACS_GET_TIME (timeout);
/* In effect, timeout = wakeup - timeout.
Break if result would be negative. */
if (timeval_subtract (&timeout, wakeup, timeout))
break;
/* Try to wait that long--but we might wake up sooner. */
select (0, 0, 0, 0, &timeout);
}
}
XFill ()
{ | https://emba.gnu.org/emacs/emacs/-/blame/03b78673fb71aa01a455624ae2a841c7dd1b8767/src/xterm.c | CC-MAIN-2021-10 | en | refinedweb |
component named
locale). Under normal circumstances,
you won't need to do any special configuration to set the locale. Seam
just delegates to JSF to determine the active locale:
If there is a locale associated with the HTTP request (the
browser locale), and that locale is in the list of supported locales
from
faces-config.xml, use that locale for the rest
of the session.
Otherwise, if a default locale was specified in the
faces-config.xml, use that locale for the rest of
the session.
Otherwise, use the default locale of the server. the user selects an item from the drop-down, then clicks the command button, the Seam and JSF locales will be overridden for the rest of the session.
The brings us to the question of where the supported locales are
defined. Typically, you provide a list of locales for which you have
matching resource bundles in the
<locale-config>
element of the JSF configuration file (/META-INF/faces-config.xml). However,
you have learned to appreciate that Seam's component configuration
mechanism is more powerful than what is provided in Java EE. For that
reason, you can configure the supported locales, and the default locale of
the server, using the built-in component named
org.jboss.seam.international.localeConfig. To use it,
you first declare an XML namespace for Seam's international package in the
Seam component descriptor. You then define the default locale and supported
locales as follows:
<international:locale-config
Naturally, if you pronounce that you support a locale, you better provide a resource bundle to match it! Up next, you'll learn how to define the language-specific labels. xmlns=""
xmlns:ui=""
xmlns:h=""
xmlns: | http://docs.jboss.org/seam/2.1.0.SP1/reference/en-US/html/i18n.html | crawl-003 | en | refinedweb |
Representation of a generic image source or destination. More...
#include <vil3d/vil3d_image_view_base.h>
#include <vcl_cassert.h>
#include <vil/vil_smart_ptr.h>
#include <vil/vil_pixel_format.h>
Go to the source code of this file.
Representation of a generic image source or destination.
Definition in file vil3d_image_resource.h.
Use this type to refer to and store a vil3d_image_resource.
This object is used to provide safe manipulation of vil3d_image_resource derivatives. If you want to store an image resource (e.g. an image on disk, type-agnostic memory image), then use this type.
Definition at line 128 of file vil3d_image_resource.h. | http://public.kitware.com/vxl/doc/release/contrib/mul/vil3d/html/vil3d__image__resource_8h.html | crawl-003 | en | refinedweb |
The QS60MainDocument class is a helper class for S60 migration. More...
#include <QS60MainDocument>
This class was introduced in Qt 4.6..
Constructs an instance of QS60MainDocument.
mainApplication should contain a pointer to a QS60MainApplication instance.
Destroys the QS60MainDocument.
Creates an instance of QS60MainAppUi.
See also QS60MainAppUi. | http://doc.trolltech.com/main-snapshot/qs60maindocument.html#CreateAppUiL | crawl-003 | en | refinedweb |
fat.h File Reference
FatFS: kfile interface for FatFS module by ChaN. More...
#include <io/kfile.h>
#include "fatfs/ff.h"
Go to the source code of this file.
Detailed Description
FatFS: kfile interface for FatFS module by ChaN.
This driver needs some low level hardware access functions. An example implementation is provided in sd.h.
Definition in file fat. | http://doc.bertos.org/2.7/fat_8h.html | crawl-003 | en | refinedweb |
SYNOPSIS
#include <libaio.h>
int io_submit(aio_context_t ctx_id, long nr, struct iocb **iocbpp);
Link with -laio.
DESCRIPTION
io_submit() queues nr I/O request blocks for processing in the AIO con-
text ctx_id. iocbpp should be an array of nr AIO control blocks, which
will be submitted to context ctx_id.
RETURN VALUE
On success, io_submit() returns the number of iocbs submitted (which
may, August
2002.
CONFORMING TO
io_submit() is Linux-specific and should not be used in programs that
are intended to be portable.
NOTES
Glibc does not provide a wrapper function for this system call.
The wrapper provided in libaio for io)
COLOPHON | http://www.linux-directory.com/man2/io_submit.shtml | crawl-003 | en | refinedweb |
SYNOPSIS
#include <libaio.h>
int io_destroy(aio_context_t ctx);
Link with -laio.
DESCRIPTION
io_destroy() removes the asynchronous I/O context from the list of I/O
contexts and then destroys it. io_destroy() can also cancel any out-
standing asynchronous I/O actions on ctx and block on completion.
RETURN VALUE
On success, io_destroy() returns 0. For the failure return, see NOTES.
ERRORS
EFAULT The context pointed to is invalid.
EINVAL The AIO context specified by ctx.
NOTES
Glibc does not provide a wrapper function for this system call.
The wrapper provided in libaio for io_destroy()_getevents(2), io_setup(2), io_submit(2)
COLOPHON
This page is part of release 3.23 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at. | http://www.linux-directory.com/man2/io_destroy.shtml | crawl-003 | en | refinedweb |
The QDeclarativeImageProvider class provides an interface for supporting pixmaps and threaded image requests in QML. More...
#include <QDeclarativeImageProvider>
This class was introduced in Qt 4.7.:DeclarativeDeclarativeImageProvider { public: ColorImageProvider() : QDeclarativeImageProvider(QDeclarativeDecl.
Image providers that support QImage..
Images returned by a QDeclarative.
See also QDeclarativeEngine::addImageProvider().
Defines the type of image supported by this image provider.
Creates an image provider that will provide images of the given type.
Destroys the QDeclarativeImageProvider
Note: The destructor of your derived class need to be thread safe.
Returns the image type supported by this provider.
Implement this method to return the image with id. The default implementation returns an empty image..
Note: this method may be called by multiple threads, so ensure the implementation of this method is reentrant.
Implement this method to return the pixmap with id. The default implementation returns an empty pixmap.. | http://doc.trolltech.com/main-snapshot/qdeclarativeimageprovider.html#imageType | crawl-003 | en | refinedweb |
#include <itkFEMLoadBCMFC.h> 64 of file itkFEMLightObject.h.
Const pointer or SmartPointer to an object.
Reimplemented from itk::fem::Load.
Definition at line 54 of file itkFEMLoadBCMFC.h.
Left hand side of the MFC constraint equation
Definition at line 91 of file itkFEMLoadBCMFC.h.
Pointer or SmartPointer to an object.
Reimplemented from itk::fem::Load.
Definition at line 54 of file itkFEMLoadBCMFC.h.
Standard Self typedef.
Reimplemented from itk::fem::Load.
Definition at line 54 of file itkFEMLoadBCMFC.h.
Standard Superclass typedef.
Reimplemented from itk::fem::Load.
Definition at line 54 of file itkFEMLoadBCMFC.h.
Default constructor
Definition at line 103 of file itkFEMLoadBCMFC.h.
With this constructor, we can easy fix the global displacement dof given by node to a value val.
Virtual function to access the class ID
Implements itk::fem::FEMLightObject.
Definition at line 54 of file itkFEMLoadBCMFC 57 of file itkFEMLoadBase.h.
Object creation in an itk compatible way
Definition at line 54 of file itkFEMLoadBCMFC.h.
read a LoadBCMFC..
write a LoadBCMFC object to the output stream.
Reimplemented from itk::fem::FEMLightObject.
Definition at line 125 of file itkFEMLoadBCMFC.h.
Class ID for FEM object factory
Definition at line 54 of file itkFEMLoadBCMFC 165 of file itkFEMLightObject.h.
Referenced by itk::fem::FEMLightObject::FEMLightObject().
used internally by the Solver class
Definition at line 124 of file itkFEMLoadBCMFC.h.
Definition at line 100 of file itkFEMLoadBCMFC.h.
Const string of all whitespace characters. This string is used by SkipWhiteSpace function.
Definition at line 135 of file itkFEMLightObject.h. | http://www.itk.org/Doxygen314/html/classitk_1_1fem_1_1LoadBCMFC.html | crawl-003 | en | refinedweb |
This paper was written by Richard Stallman in 1981 and delivered in the ACM Conference on Text Processing.
EMACS(1) is a real-time display editor which can be extended by the user while it is running..
A coherent set of new and redefined functions can be bound into a library so that the user can load them together conveniently. Libraries enable users to publish and share their extensions, which then become effectively part of the basic system. By this route, many people can contribute to the development of the system, for the most part without interfering with each other. This has led the EMACS system to become more powerful than any previous editor..
To help the user make effective use of the copious supply of features, EMACS provides powerful and complete interactive self-documentation facilities with which the user can find out what is available.
A sign of the success of the EMACS design is that EMACS has been requested by over a hundred sites and imitated at least ten times.
By a display editor we mean an editor in which the text being edited is normally visible on the screen and is updated automatically as the user types his commands. No explicit commands to `print' text are needed.
As compared with printing terminal editors, display editor users have much less need for paper listings, and can compose code quickly on line without writing it on paper first. Display editors are also easier to learn than printing terminal editors. This is because editing on a printing terminal requires a mental skill like that of blindfold chess; the user must keep a mental image of the text he is editing, which he cannot easily see, and calculate how each of his editing command `moves' changes it. A display editor makes this unnecessary by allowing the user to see the `board'.
Among display editors, a real-time editor is one which updates the display very frequently, usually after each one or two character command the user types. This is a matter of the input command language. Most printing terminal editors read a string of commands and process it all at once; a useful feature on a printing terminal. For example, there is usually an `insert' command which inserts a string of characters. When such editors are adapted to display terminals, they often update the display at the end of a command string; thus, the insertion would be shown all at once when it was over. It is more helpful to display each inserted character in its position in the text as soon as it has been typed.
A real-time display editor has (primarily!) short, simple commands which show their effects in the display as soon as they are typed. In EMACS, text (printing characters and formatting characters) is inserted just by typing it; there is no `insert' command. In other words, each printing character is a command to insert that character. The commands for modifying text are nonprinting characters, or begin with nonprinting characters. Many-character commands echo if typed slowly; if there is a sufficiently long pause, the command so far is echoed, and then the rest of the command is echoed as it is typed. Aside from this, EMACS acknowledges commands by displaying their effects.
EMACS is not the first real-time display editor, but it derives much appeal from being one. It is not necessary to know how to program, or how to extend EMACS, to use it successfully.
To illustrate and demonstrate the flexibility which EMACS derives from extensibility, here is a summary of many of the features, available to EMACS users without the need to program, to which extensibility has contributed. Many of them were written by users; some were written by the author, but could just as well have been written by users.
Many minor extensions can be done without any programming. These are called customizations, and are very useful even by themselves. For example, for editing a program in which comments start with `<**' and end with `**>', the user can tell the EMACS comment manipulation commands to recognize and insert those strings. This is done by setting parameters which the comment commands refer to. It is not necessary to redefine the commands themselves. Another sort of customization is rearrangement of the command set. For example, some users prefer the four basic cursor motion commands (up, down, left and right) on keys in a diamond pattern on the keyboard. It is easy to reassign the commands to these positions. It is also possible to rearrange the entire command set according to a different philosophy.
EMACS can be programmed to understand the syntax of the language being edited and provide operations particular to it. Many major modes are defined, one for each language which is understood. Each major mode has the ability to redefine any of the commands, and reset any parameters, so as to customize EMACS for that language. Files can contain special text strings that tell EMACS which major mode to use in editing them. For example, `-*-Lisp-*-' anywhere in the first nonblank line of a file says that the file should be edited in Lisp mode. The string would normally be enclosed in a comment.
For editing English text, commands have been written to move the cursor by words, sentences and paragraphs, and to delete them; to fill and justify paragraphs; and to move blocks of text to the left or to the right. Other commands convert single words or whole regions to upper or lower case. There are also commands which manipulate the command strings for text justifier programs: some insert or delete underlining commands, and others insert or delete font-change commands.
Many commands are controlled by parameters which can be used to further adapt them to particular styles of formatting. For example, the word moving and deletion commands have a syntax table that says which characters are parts of words. There are two commands to edit this table, one convenient for programs to use and an interactive one for the user. The paragraph commands can be told which strings, appearing at the beginning of a line, constitute the beginning of a paragraph. Such parameters can be set by the user, or by a specification in the file being edited. But normally they are set automatically by the major mode (that is, by telling EMACS what language the file is written in) and do not require attention from the user.
A very powerful extension facility is the ability to redefine the graphic and formatting characters as commands. These characters, which include letters, digits and punctuation, are normally all defined as commands to insert themselves into the text. Useful alternate definitions for these characters usually insert the character as usual, and then do additional processing which is in some way meaningfully associated with the insertion of that character.
The single most useful command for editing text is the `auto-fill space'. It is a program intended to be used as the definition of the space character. In addition to inserting a space, it breaks the line into two lines if it has become too long. With the space character redefined in this way, the user can type endlessly ignoring the right margin, and the text is divided into lines of a reasonable length. Of course, this feature is not always desirable. It is turned on or off by redefining the space command. If the auto-fill space did not exist, any user could write it and also the command to turn it on and off.
A bolder use of redefinition of self-inserting characters is the abbreviation facility, part of the standard EMACS system but still implemented as an extension maintained by the user who wrote it. The abbreviation facility allows the user to define abbreviations for words, and then type the abbreviations in order to insert the words. For example, if `cd' were defined as an abbreviation for `command', typing `i/o-cd' would insert `i/o-command' into the text. Abbreviation expansion preserves case, so `Cd' would expand into `Command'. Abbreviation works by redefining all punctuation characters (the list of which can be altered by customization) to run a program which looks at the preceding word and, if it is a defined abbreviation, replaces it with its expansion.
Yet another application of redefining printing characters is automatic parenthesis-matching. When this feature is in use, every time the user inserts a close-parenthesis, the cursor moves briefly to the matching open-parenthesis, then back again. Automatic matching is especially useful in editing Lisp code, but it is helpful with most other programming languages also. It is implemented by redefining the close-parenthesis character.
Extensibility is especially useful for editing programs. One might conceivably design in advance all the editing commands needed for editing English text, but each programming language has its own set of useful syntactic operations, which suggest useful editing commands. Because languages differ so much, simple customization is not in general enough to implement familiar operations for a new language. A new extension package is required.
EMACS commands have been written, for many languages, to move over or kill balanced expressions, to move to the beginning or end of a function definition, and to insert or align comments. But the most useful editing operation for programs, and the first one to be implemented for any programming language, is automatic indentation.
The structure of a program can be made clear at a glance by adjusting the indentation of each line according to its level of nesting. Most programming communities attempt to indent code properly but do it manually. Automatic indentation is used mostly by Lisp programmers.
Automatic indentation was traditionally done by a program which would read in an entire source file, rearrange the indentation, and write out a corrected source file. Such a tool has several disadvantages. For one thing, processing the entire file is likely to take a while. For another, the tool insists on imposing its own idea of proper formatting, which the user cannot override. Even after a lot of effort is put into heuristics for good indentation, users are still dissatisfied.
Automatic indentation in EMACS is done incrementally. The Tab character is redefined, as a command, to update the indentation of the current line only, based on the existing indentation of the preceding lines. The Tab command is used on lines whose nesting has changed. With it, the user can indent code properly as it is first typed in. If he does not agree with the Tab command's choice of indentation, he can override it.
Because the indentation function must understand the syntax of the programming language being edited, each language requires a separate indentation function. It is the job of the major mode for each programming language to redefine the Tab character to run an appropriate indenter. Users can always use the same command to indent, no matter what sort of program they are editing. In addition, another editing command can do indentation by calling the current definition of Tab as a subroutine. (One such function is the one which indents several consecutive lines.)
Conventions such as this are vital, in an extensible system, for enabling unrelated extensions to avoid interacting wrong; one user can write an indentation function for a new language, while another user writes new language-independent operations for requesting indentation, and the two automatically work properly together.
Languages which have support for indentation include Lisp, Pascal, PL/I, Bliss, BCPL, Muddle and TECO.
Comprehension of the user's program reaches its greatest heights for Lisp programs, because the simplicity of Lisp syntax makes intelligent editing operations easier to implement, while the complexity of other languages discourages their users from implementing similar operations for them. In fact, EMACS offers most of the same facilities as editors such as the Interlisp editor which operate on list structure, but combined with display editing. The simple syntax of Lisp, together with the powerful editing features made possible by that simple syntax, add up to a more convenient programming system than is practical with other languages. Lisp and extensible editors are made for each other, in this way. We will see below that this is not the only way.
Large programs are composed of many functions divided among many files. It is often hard to remember which file a given function is in. An EMACS extension called the TAGS package knows how to keep track of this.
The TAGS package makes use of a file called a tag table, which records each function in the program, stating what file it is defined in and at what position in the file. The tag table is made by running a special program named TAGS, which is not part of EMACS. Once the tag table is loaded into EMACS, the command Meta--Period(2) finds the definition of any function, using the information in the tag table to select the proper file and find the function in it.
The positions within the source file, remembered in the tag table, are used to find the function in the file instantly. Changing the file makes the remembered positions inaccurate. If this has happened, Meta--Period searches in both directions away from the remembered position until it finds the definition. So small inaccuracies cause only slight delays.
When many new functions have been added, or moved from one file to another, the TAGS program can reprocess the tag table into an updated one. To make this more automatic, the tag table also remembers which language each source file is written in. This information is needed for recognizing the function definitions in the file.
Interactiveness is useful in many activities aside from editing text. For example, reading and replying to mail from other users ought to be interactive. Many of these activities occasionally involve text editing: for example, editing the text of a reply. If a special editor is implemented for the purpose, it can easily be much more work to write than all the rest of the system. It is easier to write the other interactive system within the framework of an extensible editor.
EMACS has two extensions, RMAIL and BABYL, for reading mail. Commands in RMAIL and BABYL are not like EMACS commands; typical commands include `D' for `delete this message', and `R' for `reply to this message'. Editing the text of the reply is done with ordinary EMACS commands.
DIRED is used for editing a file directory. The normal editing commands, as extended, can be used to move the cursor through the directory listing. Other special commands defined only in DIRED delete, move, compare or examine the file whose name is under the cursor.
The INFO extension is designed for reading tree-structured documentation files. These files are divided textually into nodes, which contain text representing pointers to other nodes. INFO displays one node at a time, and INFO commands move from one node to another by following the pointers.
The primary components of the EMACS system are the text manipulation and I/O primitives, the interpreter, the command dispatcher, the library system, and the display processor.
The text and I/O primitives are used to operate on the text under the command of the program. The interpreter executes programs, using the primitives when called for. The command dispatcher remembers which program corresponds to each possible input character; it reads a character from the terminal and calls the associated function. The library system associates functions with their names and documentation, and allows groups of related functions to be loaded quickly together. The display processor updates the screen to match the text as changed by the text primitives; it is run whenever there is nothing else to do.
An EMACS system actually implements two different languages, the editing language and the programming language. The editing language contains the commands users use for changing text. These commands are implemented by programs written in the programming language. When we speak of the interpreter, we mean the one which implements the programming language. The editing language is implemented by the command dispatcher.
Previous attempts at programmable editors have usually attempted to mix programming constructs and editing in one language. TECO is the primary example of this sort of design. It has the advantage that once the user knows how to edit with the system, he need only learn the programming constructs to begin programming as well.
However, there are considerable disadvantages, because what is good in an editor command language is ugly, hard to read, and grossly inefficient as a programming language. A good interactive editing language is composed primarily of single character commands, with a few commands that introduce longer names for less frequently used operations. As a programming language, it is unreadable if the editor is to be customizable, the user must be able to redefine each character. This in a programming language would be intolerable!
When the programming language is the editing language, the built-in editing commands and the primitive operations they use have to be written in another language. Then the user cannot change part of the standard system slightly by making a small change to its definition; it has to be reimplemented from scratch as a macro. Since the primitives available are only the commands he uses for editing, this will often be impossible because the necessary primitives will be internal routines that the user cannot call. The primitives that an extension would like to use are not always the same as the editing operations the user wants.
The implementor of a macro processor is encouraged to ignore such deficiencies because he himself does not use the language in implementing the rest of the system. Since it is traditional, in designing a macro language, to ignore the standards of readability, power and robustness typically applied to the design of programming languages, these deficiencies are usually considerable. The original TECO is a good example of this sort of problem.
In EMACS, each language is designed for its purpose. The editing language has single-character redefinable commands. The programming language is TECO, modified and extended to be more suitable for writing well-structured and robust programs, and to provide the primitives needed by editing programs as opposed to editor users. It remains hard to read, so the descendents of EMACS generally use Lisp instead. TECO was used only for reasons of historical convenience.
More information on the requirements extensibility imposes on the system's programming language is in the next chapter.
An important part of any practical extensible system is the ability to use more than one extension at one time, and begin using an additional extension at any time. Extensions should be able to override or replace parts of the standard system, or previous extensions. In EMACS the library system is responsible for accomplishing this.
An EMACS library is a collection of function names, definitions and documentation that can be loaded into an EMACS in mid-session. Libraries are read-only and position-independent, so that they can be loaded just by incorporating them into the virtual memory of the EMACS. This allows all EMACSs using a library to share the physical memory. Each library contains its own symbol table which connects function names with definitions, and also with their documentation strings. Libraries are generated from source files in which each function definition is accompanied by its documentation; this encourages all functions to be documented.
When a function name is looked up, all the loaded libraries are searched, most recently loaded first. For the sake of uniformity, the standard EMACS functions also reside in a library, which is always the first one loaded. Therefore, any library can override or replace the definition of a standard EMACS function with a new definition, which will be used everywhere in place of the old. This, together with the fact that EMACS is constructed with explicit function calls to named subroutines at many points, makes it easy for the user to change parts of the system in a modular fashion without replacing it all.
Subroutines are normally called by their full names. The user can also call any command by name, and many commands are primarily intended to be used in that way. However, the most common editing operations need to be more easily accessible. This is the purpose of the command dispatcher, which reads one character and looks it up in the dispatch table, a vector of definitions to find the function to be called (the definition-object, not the name).
Functions residing in the dispatch table can be invoked either by the character command or by name. A function which does not appear in the dispatch table can be called only by name. The user calls functions by name by means of a single-character command (Meta--X) whose definition is to read the name of a function and call that function.
Each user has his own patterns of use. Many functions in EMACS are accessible only by name because we expect most users to use them infrequently. If a particular user uses one such command often, he can place the definition in the dispatch table using the function Set Key. The function calling conventions are designed so that almost any function definition will behave reasonably if called by the command dispatcher. If a function tries to read a string argument from its caller, then when called by the command dispatcher it will automatically prompt and read the argument from the terminal instead.(3)
Some libraries contain functions that are intended to be called with
single character commands. The library can arrange to place those
functions' definitions in the dispatch table by defining a function
called Setup. This will be called automatically when the library is
loaded, and it can redefine character commands as needed. However,
because EMACS is intended to be customized, no library can reasonably
make the assumption that a function belongs on a particular character
without allowing the user who loads the library to override that
assumption. For example, a library might wish to redefine
Control--S on the assumption that it invokes the search function,
but a user might prefer to keep his search on Control--T instead,
and he might prefer that same library to alter the definition of
Control--T when loaded by him. The author of the library cannot
anticipate the details of such idiosyncrasies, but he can provide for
them all by following a convention: in the Setup function of the library
(TAGS, say), he checks for a variable called
TAGS Setup Hook, and
if it exists, its value is called as a function instead of the usual
setting up.
The display processor is the part of EMACS which maintains on the display screen an up-to-date image of the text inside the editor. Since the size of the screen is limited, only a portion or `window' can be shown. The display processor prefers to continue to start its display at the same point in the file, so as to minimize the amount of changes necessary to the screen. However, the text where the editor's own cursor is located must appear on the screen so that the terminal's cursor can show where it is. This sometimes forces a new window position to be computed. The user can also command changes in the window position, moving the text up or down on the screen.
The EMACS display processor embodies an unusual principle which makes for much faster responses to the user: display updating has lower priority than cogitation.
Most display editors change the display after each user command. This is the simplest strategy to implement, since each command knows precisely how it has changed the text. But it is very inefficient, not just of the computer's time, but of the user's time, because it makes the user wait for the completion of display updates that have already been made obsolete by further commands waiting to be executed.
Here is an example of the problem. If the user types Carriage Return to create a new line, all the lines below that point need to be redisplayed in their new positions.
While this is still going on, if he types an additional Carriage Return to create another new line, the rest of the display update is obsolete; there is no use displaying the rest of the lines in their second positions, only to display them again in their third positions.(4)
The EMACS display processor is best understood as being a separate, lower priority process that runs in parallel with the editing process. The editing process reads keyboard input and makes changes in the text. The display process is always trying to change the screen to match the text; it keeps a record of what is on the screen, and in each cycle of operation finds one discrepancy between the editing buffer and the screen record and corrects it. After each cycle, the display process can be pre-empted by the editing process, which has higher priority. The display process can be thought of as chasing an arbitrarily moving target, the edited text, with a speed limited by the terminal baud rate.
Multiple processes are not actually used in the implementation. Instead, after each line of display output, the display processor updates its data base and polls for input.
An additional benefit of this input-before-output philosophy is that it uses less computer resources when the system is heavily loaded. When not enough computer power is available, EMACS gets behind in processing the user's input. When the first command is completed, more input is available, so no effort is put into display updating yet. By saving computer time this way, EMACS eventually catches up with the user and does its display updating all at once.
Since display updating is not necessarily done at the same time as the editing operation which necessitates it, display updating cannot be the responsibility of the editing command itself. Instead, the display update must be done by somehow comparing the hew text with the previous displayed text, or information about it. In EMACS, each editing command returns information on the range of text it has changed, but aside from that the display processor operates independently. This is good for extensibility as well: it is easier to write or change an editing command if it does not have to contain algorithms for updating the screen.
Because the TECO language is not very efficient, the display processor had to be written in assembler language to get adequate performance. This is unfortunate because extensions to the display processor could be very valuable. In later implementations of EMACS, the display processor is written in Lisp along with the editing commands, and can be extended.
Despite its syntactic obscurity, TECO is actually one of the best languages to use for implementing an extensible editor. This is because most traditional programming languages simply cannot do the job! Implementing an extensible system of any sort requires features that they intrinsically lack. Specifically, it requires a language with an interpreter and the ability for programs to access the interpreter's data structures (such as function definitions).
Adherents of non-Lisp programming languages often conceive of implementing an EMACS for their own computer system using PASCAL, PL/I, C, etc. In fact, it is simply impossible to implement an extensible system in such languages. This is because their designs and implementations are batch-oriented; a program must be compiled and then linked before it can be run. An on-line extensible system must be able to accept and then execute new code while it is running. This eliminates most popular programming languages except Lisp, APL and Snobol. At the same time, Lisp's interpreter and its ability to treat functions as data are exactly what we need.(5)
A system written in PL/I or PASCAL can be modified and recompiled, but such an extension becomes a separate version of the entire program. The user must choose, before invoking the program, which version he wants. Combining two independent extensions requires comparing and merging the source files. These obstacles usually suffice to discourage all extension.
The only way to implement an extensible system using an unsuitable language, is to write an interpreter for a suitable language and then use that one. Prime is now implementing an EMACS using a simple Lisp written in PL/I. This technique works because an editor does not require a very efficient interpreter; even the most straightforward Lisp interpreter is more efficient than the TECO interpreter which is empirically observed to be good enough. I would not regard this as implementation `in' the original language, however.
A PASCAL or PL/I implementation which uses an interpreter, and allows the user program to access the interpreter data structures sufficiently, could be used just as a Lisp implementation would be used. However, such implementations are very rare, because these languages are not designed for them. If the implementor appreciates the importance of the interpreter, and of treating functions as data, he will usually choose to implement Lisp.
It is also possible to use dynamic linking--the ability to load additional modules of compiled code during execution, and refer to subroutines therein by name--in place of an interpreter. However, dynamic linking operating systems are rarer than good Lisps, harder to implement, and not as convenient for the job. One of the few such operating systems, Multics, has an EMACS written in Lisp. SINE, the EMACS implementation on Interdata computers, uses dynamic linking to load files compiled from a language which resembles Lisp.
When a language is used for implementing extensible systems, certain control structure and data structure features become vital.
One difference between Lisp (and TECO) and most other programming languages, which is very important in writing extensible systems, is that variable names are retained at run time; they are not lost in compilation.
In typical compiled languages, variable names are meaningful only at compile time. In the compiled code, uses of one variable name become references to one location in memory, but the name itself has been discarded.
By contrast, Lisp remembers the connection between variable names and their values, so that new programs can be defined.
Global variables are essential for parameters used for customization.
EMACS has a variable named
string recognized as starting a comment in the text being edited. Its
value is supposed to be that string. This variable is used by the
comment indenting command to recognize an existing comment. The fact
that the variable name is known at run time enables the user to
Most batch languages use a lexical scope rule for variable names. Each variable can be referred to legally only within the syntactic construct which defines the variable.
Lisp and TECO use a dynamic scope rule, which means that each binding of a variable is visible in all subroutine calls to all levels, unless other bindings override. For example, after
(defun foo1 (x) (foo2)) (defun foo2 () (+ x 5))
then
(foo1 2) returns 7, because
foo2 when called within
foo1 uses
foo1's value of
x. If
foo2 is
called directly, however, it refers to the caller's value of
x,
or the global value. We say that
foo1 binds the variable
x. All subroutines called by
foo1 see the binding made by
foo1, instead of the global binding, which we say is
shadowed temporarily until
foo1 returns.
In PASCAL the analogous; program would be erroneous, because
foo2
has no lexically visible definition of
x.
Dynamic scope is useful. Consider the function
Edit Picture,
which is used to change certain editing commands slightly, temporarily,
so that they are more convenient for editing text which is arranged into
two-dimensional pictures. For example, printing characters are changed
to replace existing text instead of shoving it over to the right.
Edit Picture works by binding the values of parameter variables
dynamically, and then calling the editor as a subroutine. The editor
`exit' command causes a return to the
Edit Picture subroutine,
which returns immediately to the outer invocation of the editor. In the
process, the dynamic variable bindings are unmade.
Dynamic binding is especially useful for elements of the command dispatch table. For example, the RMAIL command for composing a reply to a message temporarily defines the character Control--Meta--Y to insert the text of the original message into the reply. The function which implements this command is always defined, but Control--Meta--Y does not call that function except while a reply is being edited. The reply command does this by dynamically binding the dispatch table entry for Control--Meta--Y and then calling the editor as a subroutine. When the recursive invocation of the editor returns, the text as edited by the user is sent as a reply.
It is not necessary for dynamic scope to be the only scope rule provided, just useful for it to be available.
Some language designers believe that dynamic binding should be avoided,
and explicit argument passing should be used instead. Imagine that
function A binds the variable
FOO, and calls the function B,
which calls the function C, and C uses the value of
FOO.
Supposedly A should pass the value as an argument to B, which should
pass it as an argument to C.
This cannot be done in an extensible system, however, because the
author of the system cannot know what all the parameters will be.
Imagine that the functions A and C are part of a user extension, while
B is part of the standard system. The variable
FOO does not exist in
the standard system; it is part of the extension. To use explicit
argument passing would require adding a new argument to B, which means
rewriting B and everything that calls B. In the most common case, B
is the editor command dispatcher loop, which is called from an awful
number of places.
What's worse, C must also be passed an additional argument. B doesn't refer to C by name (C did not exist when B was written). It probably finds a pointer to C in the command dispatch table. This means that the same call which sometimes calls C might equally well call any editor command definition. So all the editing commands must be rewritten to accept and ignore the additional argument. By now, none of the original system is left!
Suppose one file is formatted with comments starting at column 50.
Editing this file is easier if the variable
Comment Column, which
is used (by convention) to decide where to align comments, is always set
to 50 whenever this file is being editing. EMACS provides a way to
request this; but since it also provides the feature of visiting several
files at once, it must take special care to keep each file's variables
straight. Suppose one file wants
Comment Column to be 50 while
another is formatted with 40?
This is solved by allowing each file to have its own local values for any set of variables. Specially formatted text at the end of the file specifies them:
Local Modes: Comment Column:50 End:
When a file is brought into EMACS, this local modes list is parsed and the variables and values remembered in a local symbol table. While the file is not selected, its local symbol table contains the local values of the variables. While a file is selected, its local symbol table contains the global values, and the real symbol table contains the file's local values instead.
When an extensible system allows the user to provide a function to be
called on certain well-defined occasions, we call it a hook. For
example, we have already mentioned the hook which is executed whenever a
certain library is loaded; for the TAGS library, the hook is named
TAGS Setup Hook.
Another important class of hooks is executed when a major mode is
entered. Each major mode has its own hook. For example, Text mode's
hook is named
Text Mode Hook. This hook can be used to request
arbitrary actions in advance for each time text mode is entered. Many
users always define this hook to turn on Auto Fill mode, so that Auto
Fill mode is always on when Text mode is.
Hooks can be associated with variables as well. Then, each time the
value of the variable changes, its hook is run. Usually these hooks are
used to change other data structures so that they always correspond to
the value of the variable. This is often more efficient and more
modular than checking the variable itself whenever its value is
relevant. For example, changing the value of
Auto Fill Mode to
turn auto-filling on or off calls a function which automatically
redefines the Space character's command definition.
Some hooks are attached to specific points within the interpreter or display processor. For example, there is a hook which is called whenever it is time to read a character of input from the terminal. The hook program can supply the character itself. These hooks can be thought of as compensating for the fact that some parts of the system are written in assembler language and cannot simply be redefined by the user.
A system for programming editor commands needs more sophisticated facilities for handling errors and other exceptional conditions than most programming systems provide. Let us consider what an error is, and what ought to happen when there is an error.
First of all, what exactly is an error? Sometimes the user asks to do something that cannot be done (a user error). Sometimes a program asks to do something which cannot be done (a program error). Program errors often accompany user errors, but either one can happen without the other.
Program errors can be defined objectively: any event which executes a certain part of the interpreter is a program error. User errors cannot be defined objectively in this way because they are a matter of attitude toward events rather than events themselves. If a command has done nothing, we can regard this either as the response to an error or as normal functioning. And this choice of attitude has no necessary connection with whether the command definition required special code to make it do nothing in the circumstances in question.
When a program error happens, EMACS prints the error message and then gives the user the chance to invoke the error handler to debug it. If he does not do this, control returns to the innermost error return point. Programs can create error return points with a special construct. (We use a Lisp-style syntax in these examples for clarity).
(error-return (arbitrary-code-here))
The end of the error-return construct becomes an error return point which is in effect while the code inside the construct is being executed. Error returns are usually used by loops which read and execute commands of some sort, including the built-in one which reads and displays editing commands.
(do-forever (error-return (read-and-execute-one-command)))
Sometimes interpreted functions are called asynchronously or unpredictably. An example is the one which optionally saves the text every so often to reduce the amount lost if the system crashes. If this function gets a program error, it should notify the user, but should not interfere in any way with the user's explicit commands. This requires a construct known in Lisp as errset, which prevents all normal processing of errors that occur within it. An error occurring within an errset does nothing but return control immediately to the end of the errset.
The programming system does not provide any such uniform handling for user errors because the concept of a user error is not defined at that level. Instead, the designer of each editing command must decide what conditions ought to be considered errors, and what to do in each case. Sometimes the command simply does nothing. Sometimes it rings the terminal's bell and perhaps throws away type ahead. This can be best if we expect that, once the user is told that there is something wrong, it will be obvious what it is. When the cause of the error is less obvious, causing a program error deliberately with a specially chosen error message is a good way of informing him. A special primitive is used to cause a program error with an arbitrary specified error message so that the error-return processing can be invoked.
Sometimes the user error leads naturally to an error in the program, which may be all the handling it needs. This can be so if the program error's error message is an adequate explanation for the user, or if the situation is not deemed likely enough to deserve the effort required to make anything else happen.
The error handler for debugging program errors is an interpreted program itself. This is possible because primitives are provided for examining the function call stack and all other data structures which the programmer would want to examine while debugging. Users have actually written extensions and complete replacements for the standard error handler program.
Returning to the example of the user-written command loop, there has to be a command to exit the loop. How can it be done?
(do-forever (error-return (read-and-execute-one-command)))
We do it by means of a non-local control transfer. We create the transfer point by means of a catch construct around the loop. The catch creates a named transfer point at the end of the loop, which is accessible only within the loop.
(catch (do-forever (error-return (read-and-execute-one-command))) exit-my-loop)
At any time during the loop, execution of
(throw exit-my-loop)
transfers control immediately to the end of the catch, thus exiling the
loop. The catch and throw constructs were copied from Maclisp.
Like variable names, catch names have dynamic scope: the program can throw to a catch from any of the subroutines called while inside the catch. This is important because ease of extension dictates that each command which the command-reading loop understands be implemented by a separate function, so that the user can redefine one command without replacing the framework of the loop.(6)
A complex program is much easier to learn if it can answer questions about how to use it. When the program is customizable, it is important for the answers to reflect any customization that has been done. The easiest way to do this is for questions to be answered based on the same tables and data structures that control the functioning of the system. In EMACS, these include the command dispatch table and the loaded libraries.
The most basic kind of question that a user might want to ask is, "What does this command do?" He can inquire about either a function name or a command character. A library contains a documentation string for each function in it, and this is used to answer the question. When the question is about a command character, the dispatch table is used to find the function object which is currently the definition of that character. Then the library system is used to find the name of the function, and then, from that, the documentation string.
The ability to ask what a certain command does only helps users who know what commands to ask about. Other users need to ask, "What commands might help me now?" EMACS attempts to answer this by listing all the functions whose names contain a given substring. Since the function names tend to summarize what the functions do (such as `Forward Word' or `Indent for Comment') and follow systematic conventions, this is usually enough. The list also contains the first line of each function's own documentation, and how to invoke the function with one or two characters, if that is possible.
The documentation for a function is usually just a string of text, but it can also contain programs to be executed to print the documentation, interspersed with text to be printed literally. This comes in handy when the description of one function refers to another function which is usually accessed as a one or two character command. It is better to tell the user the short command, which he would actually use, than the name of the function which defines it. But exactly which command--if any--runs the function in question depends on the user's customization. What we do is to use a program, in the middle of the documentation string, which searches the dispatch table and prints the command which would invoke the desired function. Another application of this facility is for functions which simply load a library and call a function in it. The documentation string for such functions is a program to load the library and print the documentation of the function which would be called.
To help users remember how to ask these questions, we make it simple and standard. A special character, called the Help character, is used. This character is only used for asking for help, and is always available. Help is normally followed by another character which specifies the type of inquiry. If the user does not remember these characters, he can type Help again to see a list of them. To close the remaining loophole of confusion, EMACS prints a message about the Help character each time it starts up.
Help is also available in the middle of typing a command. For example, if you start to type the Replace String command and forget what arguments are required, type Help. The documentation of the Replace String function will be printed to tell you what to do next. Because questions are answered based on the data structures as they are at the moment, many changes in EMACS require no extra effort to update the documentation. It is only necessary to update the documentation of each function whose definition is changed. The format for EMACS library source files encourages this by requiring a documentation string for every function, between the function name and its definition.
I began the development of EMACS in 1974 with an improvement to TECO: the implementation of the display processor and a command dispatcher with a small fixed set of commands. These were inspired by the editor E of the Stanford Artificial Intelligence Lab. They were not considered a new editor, but rather one new feature in TECO to join many existing features. The user would give the TECO command Control-R to enter display editing mode, whose commands were suitable only for making local changes to the file. He would exit display editing mode to do anything else.
But once display editing was implemented, it was fairly easy to allow commands to be redefined to call functions written in TECO. TECO already contained considerable facilities for text manipulation, I/O, and programming, so almost immediately many users began to implement large collections of editing commands, powerful enough to do every part of editing. One of the most popular of these systems was TECMAC. Others included MACROS, RMODE, TMACS, Russ-mode and DOC. The need to exit from display editing mode to use TECO directly became less and less frequent until new users no longer learned how.
But TECO was still missing many at the important control and programming constructs which allow programs to be readable and maintainable (for example, named functions and variables!). So the early TECO-based display editors were very hard to maintain. In 1976 the TMACS system experimented with adding named functions and variables, with good results limited by the inefficiency of implementing them with TECO programs. This inspired me to implement EMACS itself.
Writing EMACS involved simultaneously adding to TECO the features which make up the library system and self-documentation, which permitted a new readable programming style, and writing a new set of display editing commands using this style. The design for the commands themselves was based on examining the command sets of the many TECO-based editors for inspiration, and choosing commands so that the most common operations would take few keystrokes. The first operational EMACS system existed in late 1976.
Since then, development has proceeded steadily, most new code being written in TECO. New features are added to TECO itself only to speed up loops such as table searching and s-expression parsing, or to make possible new kinds of I/O or interface operations.
EMACS was developed on the Digital Equipment Corporation PDP--10 computer using MIT's own Incompatible Timesharing System. By 1977, outside interest in EMACS was sufficient to motivate Mike McMahon of SRI International to adapt it to Digital's Twenex (`Tops--20') operating system. EMACS is now in use at about a hundred sites.
Several post-EMACS editor implementations have copied from EMACS both the specific command set and user interlace and the fundamental principle of being based on a programmable interpreter. The motivation for these projects was to transfer the ideas of EMACS to other computer systems. Two of them, now in use, are Multics EMACS, a Honeywell product, and ZWEI, the editor for the MIT Artificial Intelligence Lab Lisp machine.
Because EMACS supplied the implementors with a clear idea of what was to be implemented, their focus was on making the foundations clean. The essential improvement was the substitution of an excellent programming language, Lisp, for the makeshift extended TECO used in EMACS. Lisp provides the necessary language features in a framework much cleaner than TECO. Also, it is more efficient. A Lisp interpreter is intrinsically more efficient than a string-scanning interpreter such as TECO's, and Lisp compilers are also available. This efficiency is important not just for saving a few microseconds, but because it reduces the amount of the system which must be written in assembler language in order to obtain reasonable performance. This opens more of the system to user extensions. Another improvement has been in the data structure used to represent the editing buffer: Multics EMACS developed the technique of using a doubly-linked list of lines, each being a string. This technique is used in ZWEI as well.
Many other editors imitate the EMACS command set and display updating philosophy without providing extensibility. Despite that deficiency, and despite the greatly reduced set of features that results from it, these can be useful editors, though not as useful as an extensible one. For a computer with a small address space or lacking virtual memory, this is probably the best that can be done.(7)
The proliferation of such superficial facsimiles of EMACS has an unfortunate confusing effect: their users, knowing that they are using an imitation of EMACS, and never having seen EMACS itself, are led to believe that they are enjoying all the advantages of EMACS. Since any real-time display editor is a tremendous improvement over what they probably had before, they believe this readily. To prevent such confusion, we urge everyone to refer to a nonextensible imitation of EMACS as an `Ersatz EMACS'.
The conventional wisdom has it that when a program intended for multiple users is to be written, specifications should be designed in advance. It this is not done, the result will be inferior. The place to try anything new is in a research project which users will not see.
Some people know better than this, but they have been silenced.
The development of EMACS followed a path that most authorities would say is a direct route to disaster. It was the continuous deformation of TECO into something which is totally unlike TECO, from the typical user's point of view. And during the whole process, TECO and programs containing TECO were the only text editors we had on ITS.(8) Indeed, there are ways in which EMACS shows the results of not having been completely thought out in advance: such as, in being based on TECO rather than Lisp. But it is still reliable enough to be widely used and imitated. The disaster which would have been forecast has not occurred. Instead, a new and powerful way of constructing editors has been explored and shown to be good.
I believe that this is no. Each command in EMACS benefits from the experimentation by many different users customizing their editors in different ways since that time. This experimentation was possible only because a programmable display editor existed.
New implementations of EMACS can now be carefully designed, because they have the advantage of hindsight based on the original EMACS. However, the implementor must carefully restrict his careful design to the parts of the editor that are already well understood. To go beyond the original EMACS, he must experiment. But why isn't such a program of exploration doomed to be sidetracked by a blind alley, which will be unrecognized until too late? It is the extensibility, and a flexibility of mind, which solves this problem: many alleys will be tried at once, and blind alleys can be backed out of with minimal real loss.
The traditional attitude towards Lisp holds that it is useful only for esoteric amusements and Artificial Intelligence. The appearance of Multics EMACS as a Honeywell product is the death knell of this view. Now, a mainframe manufacturer is offering a system utility program written in Lisp; a program intended for heavy use by the general user community. The special properties of Lisp, which make extensibility possible, are a key feature, even though many of the users will not be programmers. Lisp has escaped from the ivory tower forever, and is a force to be reckoned with as a system programming language.
The programmable editor is an outstanding opportunity to learn to program! A beginner can see the effect of his simple program on the text he is editing; this feedback is fast and in an easily understood form. Educators have found display programming to be very suited for children experimenting with programming, for just this reason (see LOGO).
Programming editor commands has the additional advantage that a program need not be very large to be tangibly useful in editing. A first project can be very simple. One can thus slide very smoothly from using the editor to edit into learning to program with it..
The way EMACS records what remains on the screen, and compares it with what is now in the text being edited, is determined by the representation used for that text. The post-EMACS editors use better text representations that make for easier display updating algorithms.
The representation used in EMACS is a straightforward linear string of characters. A movable gap which can grow and shrink makes it unnecessary for insertion and deletion within a small region of the file to move half of the file up and down. The gap was essential in making it practical to insert characters one at a time, instead of en masse in an `insert' command, but aside from that it is made invisible at all but the lowest levels of software, so essentially the representation is just a linear string. It is the task of the display processor's auxiliary data to make sense out of the amorphous mass of text.
The lowest level of avoiding wasteful output is a checksum of the characters displayed on each line of the screen. It a screen line is about to be rewritten, the new and old checksums are compared. If they match, the rewriting is skipped. Once in every 2^36 times this will leave old incorrect text on the screen.
Higher levels of display optimization work by preserving information which is a byproduct of writing the display--namely, where in the text string the beginning of each screen line comes--and combining it with information which localizes the regions of the text string in which alteration has taken place. This allows it to restrict display update processing to a horizontal band of screen which contains all the necessary changes (often just one line). While processing the other lines on the screen would do no actual output, because of the checksums, even the time to compute the checksums is noticeable to the user as a delay. The same information can be used to decide when some lines on the screen should be moved up or down. When lines are inserted in the middle of the screen, it is much better to scroll the following lines downward (if the terminal can do this) than to rewrite them all in their new positions.
The record of where in the text string changes have taken place is maintained by requiring every command to return values saying what part of the string it has changed. It can identify a subinterval of the string which contains all the changes made, it can say that no change was made (though the cursor may have been moved), or it can say nothing, which requires the display processor to make no assumptions.
A better way, developed by Bernard Greenberg in Multics EMACS and used in ZWEI, is to represent the buffer as a doubly-linked list containing pointers to strings, one for each line. Newline characters are not actually present, but implicitly appear after each line except the last. This requires the lowest level insert, delete and search subroutines to be more complicated (for example, inserting a string cannot treat Newline characters like other characters), but this is just a finite amount of complexity; and it greatly simplifies efficient display computations. The state of the screen can be remembered in an array of pointers to the string that was displayed on each screen line. When the display is updated, one can compare the strings in the buffer with the strings in the display, both to see whether they are the same objects (the pointers are equal; EQ, in Lisp), and to see whether their contents are the same.
Multics EMACS never changes the contents of a string in the buffer. It creates new strings to replace the old ones when the text changes. Thus, the string pointers in the screen state continue to record the screen as it was.
ZWEI does change the contents of existing strings. To make sure that it does not fail to notice that the text no longer matches the screen, ZWEI maintains a `clock' which increments each time a change is made in the text. Each line records the clock tick of the last modification. Each screen line records the clock tick as of the time it was displayed. If the line in the text matches the line in the screen record, but the tick counts do not match, then the contents of the line have been changed.
Line list representations also eliminate the requirements on commands to say what they have changed. Reducing the need for the programmer to worry about how display will be done is very desirable. Another advantage is that it becomes feasible to have pointers to characters in the text which relocate when insertions or deletions are done, so that they continue to point to the same place in the text.
An EMACS sharable library contains, first of all, a symbol table which can be binary searched for the name of an object to find the object named. The symbol table points at both the names and the definitions using offsets from the beginning of the file, so that the file can be valid at any location in memory. The names and definitions are all examples of the TECO string data type, in the internal TECO format, so that the library does not need to be translated or parsed in any way when it is loaded.
The symbol table points to the documentation of functions in the library
as well as their definitions. The documentation for the function
Visit File is an object entered in the symbol table with the name
~Doc~ Visit File. There is also a string named
~Directory~ whose definition contains a list of the names of all
the objects in the file which the library wishes to advertise. This is
used for documentation purposes, not for looking up names, and it does
not contain names of auxiliary objects such as
~Doc~ V1sit File
or
~D1rectory~.
It is possible to search the symbol table in reverse, to take a
definition and find its name. Since one can tell which library an
object is in by comparing its address with the range of memory occupied
by the library, this makes it possible to find the name of any object
which has one. The ability to do this is important, because when the
user asks what the character Control-K does, it is desirable to be
able to tell him that it runs the function
Kill Line. The names
themselves are not kept in the dispatch table because looking up a name
in the loaded libraries is slow. For other implementations, that is a
reasonable strategy.
EMACS is available for distribution to sites running the Digital Equipment Corporation Twenex (`Tops-20') operating system. It is distributed on a basis of communal sharing, which means that all improvements must be given back to me to be incorporated and distributed. Those who are interested should contact me. Further information about how EMACS works is available in the same way.
A complete manual for use (but not extension) of EMACS is
Various lower level implementation strategies for parts of an EMACS-like editor are treated in
These include the true extensible descendents of EMACS, and the editors which preceded EMACS and supplied some of the ideas for it. The many ersatz EMACS editors are not included.
EMACS stood for Editing Macros, before we realized that EMACS is composed of functions written in a programming language rather than macros in the editor TECO.
Meta is the name of a shift key on the ideal EMACS terminal. On terminals which do not have this key, the ASCII character Escape is used as a prefix instead.
The process of reading the argument from the terminal is implemented by a function which the user can replace.
This particular sequence of events poses no problem on terminals which can move text up and down on the screen. But the same problem can still result from other events.
It is o.k. to use a Lisp compiler, if there is one. What counts is not using the interpreter all the time, but having it available all the time.
Normally the command
reading loop uses the name of the command to compute the name of the
function to call. For example, if RMAIL reads the letter N as a
command, it calls the function
# RMAIL N. This way the user can
easily define new commands.
The standard EMACS system is bigger than the entire 64k-byte address space of the PDP--11, despite constant strenuous efforts to reduce its size. And TECO is equally large. The post-EMACS editors are even larger.
The Incompatible Timesharing System.
This document was generated on 11 Febuary 1998 using the texi2html translator version 1.51a. | http://www.gnu.org/software/emacs//emacs-paper.html | crawl-003 | en | refinedweb |
wcsrtombs - convert a wide-character string to a character string (restartable)
Synopsis
Description
Return Value
Errors
Examples
Application Usage
Rationale
Future Directions
See Also
#include <wchar.h>
size_t wcsrtombs(char *restrict dst, const wchar_t **restrict src,
size_t len, mbstate_t *restrict ps);).
The wcsrtombs() function may fail if:The following sections are informative.
None.
None.
None.
None.
mbsinit() , wcrt . | http://www.squarebox.co.uk/cgi-squarebox/manServer/usr/share/man/man3p/wcsrtombs.3p | crawl-003 | en | refinedweb |
wcsrchr - wide-character string scanning operation
Synopsis
Description
Return Value
Errors
Examples
Application Usage
Rationale
Future Directions
See Also
#include <wchar.h>
wchar_t *wcsrchr(const wchar_t *ws, wchar_t wc);
The.
Upon successful completion, wcsrchr() shall return a pointer to the wide-character code or a null pointer if wc does not occur in the wide-character string.
No errors are defined.
The following sections are informative.
None.
None.
None.
None.
wcsch . | http://www.squarebox.co.uk/cgi-squarebox/manServer/usr/share/man/man3p/wcsrchr.3p | crawl-003 | en | refinedweb |
loxun 1.3
large output in XML using unicode and namespaces
loxun is a Python module to write large output in XML using Unicode and namespaces. Of course you can also use it for small XML output with plain 8 bit strings and no namespaces.
loxun's features are:
- small memory foot print: the document is created on the fly by writing to an output stream, no need to keep all of it in memory.
- easy to use namespaces: simply add a namespace and refer to it using the standard namespace:tag syntax.
- mix unicode and string: pass both unicode or plain 8 bit strings to any of the methods. Internally loxun converts them to unicode, so once a parameter got accepted by the API you can rely on it not causing any messy UnicodeError trouble.
- automatic escaping: no need to manually handle special characters such as < or & when writing text and attribute values.
- robustness: while you write the document, sanity checks are performed on everything you do. Many silly mistakes immediately result in an XmlError, for example missing end elements or references to undeclared namespaces.
- open source: distributed under the GNU Lesser General Public License 3 or later.
Here is a very basic example. First you have to create an output stream. In many cases this would be a file, but for the sake of simplicity we use a StringIO here:
>>> from StringIO import StringIO >>> out = StringIO()
Then you can create an XmlWriter to write to this output:
>>> xml = XmlWriter(out)
Now write the content:
>>> xml.addNamespace("xhtml", "") >>> xml.startTag("xhtml:html") >>> xml.startTag("xhtml:body") >>> xml.text("Hello world!") >>> xml.tag("xhtml:img", {"src": "smile.png", "alt": ":-)"}) >>> xml.endTag() >>> xml.endTag() >>> xml.close()
And the result is:
>>> print out.getvalue().rstrip("\r\n") <?xml version="1.0" encoding="utf-8"?> <xhtml:html xmlns: <xhtml:body> Hello world! <xhtml:img </xhtml:body> </xhtml:html>
Writing a simple document
The following example creates a very simple XHTML document.
To make it simple, the output goes to a string, but you could also use a file that has been created using codecs.open(filename, "wb", encoding).
>>> from StringIO import StringIO >>> out = StringIO()
First create an XmlWriter to write the XML code to the specified output:
>>> xml = XmlWriter(out)
This automatically adds the XML prolog:
>>> print out.getvalue().rstrip("\r\n") <?xml version="1.0" encoding="utf-8"?>
Next add the <html> start tag:
>>> xml.startTag("html")
Now comes the <body>. To pass attributes, specify them in a dictionary. So in order to add:
<body id="top">
use:
>>> xml.startTag("body", {"id": "top"})
Let' add a little text so there is something to look at:
>>> xml.text("Hello world!")
Wrap it up: close all elements and the document.
>>> xml.endTag() >>> xml.endTag() >>> xml.close()
And this is what we get:
>>> print out.getvalue().rstrip("\r\n") <?xml version="1.0" encoding="utf-8"?> <html> <body id="top"> Hello world! </body> </html>
Specifying attributes
First create a writer:
>>> from StringIO import StringIO >>> out = StringIO() >>> xml = XmlWriter(out)
Now write the content:
>>> xml.tag("img", {"src": "smile.png", "alt": ":-)"})
Attribute values do not have to be strings, other types will be converted to Unicode using Python's unicode() function:
>>> xml.tag("img", {"src": "wink.png", "alt": ";-)", "width": 32, "height": 24})
And the result is:
>>> print out.getvalue().rstrip("\r\n") <?xml version="1.0" encoding="utf-8"?> <img alt=":-)" src="smile.png" /> <img alt=";-)" height="24" src="wink.png" width="32" />
Using namespaces
Now the same thing but with a namespace. First create the prolog and header like above:
>>> out = StringIO() >>> xml = XmlWriter(out)
Next add the namespace:
>>> xml.addNamespace("xhtml", "")
Now elements can use qualified tag names using a colon (:) to separate namespace and tag name:
>>> xml.startTag("xhtml:html") >>> xml.startTag("xhtml:body") >>> xml.text("Hello world!") >>> xml.endTag() >>> xml.endTag() >>> xml.close()
As a result, tag names are now prefixed with "xhtml:":
>>> print out.getvalue().rstrip("\r\n") <?xml version="1.0" encoding="utf-8"?> <xhtml:html xmlns: <xhtml:body> Hello world! </xhtml:body> </xhtml:html>
Working with non ASCII characters
Sometimes you want to use characters outside the ASCII range, for example German Umlauts, the Euro symbol or Japanese Kanji. The easiest and performance wise best way is to use Unicode strings. For example:
>>> from StringIO import StringIO >>> out = StringIO() >>> xml = XmlWriter(out, prolog=False) >>> xml.text(u"The price is \u20ac 100") # Unicode of Euro symbol >>> out.getvalue().rstrip("\r\n") 'The price is \xe2\x82\xac 100'
Notice the "u" before the string passed to XmlWriter.text(), it declares the string to be a unicode string that can hold any character, even those that are beyond the 8 bit range.
Also notice that in the output the Euro symbol looks very different from the input. This is because the output encoding is UTF-8 (the default), which has the advantage of keeping all ASCII characters the same and turning any characters with a code of 128 or more into a sequence of 8 bit bytes that can easily fit into an output stream to a binary file or StringIO.
If you have to stick to classic 8 bit string parameters, loxun attempts to convert them to unicode. By default it assumes ASCII encoding, which does not work out as soon as you use a character outside the ASCII range:
>>> from StringIO import StringIO >>> out = StringIO() >>> xml = XmlWriter(out, prolog=False) >>> xml.text("The price is \xa4 100") # ISO-8859-15 code of Euro symbol Traceback (most recent call last): ... UnicodeDecodeError: 'ascii' codec can't decode byte 0xa4 in position 13: ordinal not in range(128)
In this case you have to tell the writer the encoding you use by specifying the the sourceEncoding:
>>> from StringIO import StringIO >>> out = StringIO() >>> xml = XmlWriter(out, prolog=False, sourceEncoding="iso-8859-15")
Now everything works out again:
>>> xml.text("The price is \xa4 100") # ISO-8859-15 code of Euro symbol >>> out.getvalue().rstrip("\r\n") 'The price is \xe2\x82\xac 100'
Of course in practice you will not mess around with hex codes to pass your texts. Instead you just specify the source encoding using the mechanisms described in PEP 263, Defining Python Source Code Encodings.
Pretty printing and indentation
By default, loxun starts a new line for each startTag and indents the content with two spaces. You can change the spaces to any number of spaces and tabs you like:
>>> out = StringIO() >>> xml = XmlWriter(out, indent=" ") # <-- Indent with 4 spaces. >>> xml.startTag("html") >>> xml.startTag("body") >>> xml.text("Hello world!") >>> xml.endTag() >>> xml.endTag() >>> xml.close() >>> print out.getvalue().rstrip("\r\n") <?xml version="1.0" encoding="utf-8"?> <html> <body> Hello world! </body> </html>
You can disable pretty printing all together using pretty=False, resulting in an output of a single large line:
>>> out = StringIO() >>> xml = XmlWriter(out, pretty=False) # <-- Disable pretty printing. >>> xml.startTag("html") >>> xml.startTag("body") >>> xml.text("Hello world!") >>> xml.endTag() >>> xml.endTag() >>> xml.close() >>> print out.getvalue().rstrip("\r\n") <?xml version="1.0" encoding="utf-8"?><html><body>Hello world!</body></html>
Changing the XML prolog
When you create a writer, it automatically write an XML prolog processing instruction to the output. This is what the default prolog looks like:
>>> from StringIO import StringIO >>> out = StringIO() >>> xml = XmlWriter(out) >>> print out.getvalue().rstrip("\r\n") <?xml version="1.0" encoding="utf-8"?>
You can change the version or encoding:
>>> out = StringIO() >>> xml = XmlWriter(out, encoding=u"ascii", version=u"1.1") >>> print out.getvalue().rstrip("\r\n") <?xml version="1.1" encoding="ascii"?>
To completely omit the prolog, set the parameter prolog=False:
>>> out = StringIO() >>> xml = XmlWriter(out, prolog=False) >>> out.getvalue() ''
Adding other content
Apart from text and tags, XML provides a few more things you can add to documents. Here's an example that shows how to do it with loxun.
First, create a writer:
>>> from StringIO import StringIO >>> out = StringIO() >>> xml = XmlWriter(out)
Let's add a document type definition:
>>> xml.raw("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" SYSTEM \"\">") >>> xml.newline()
Notice that loxun uses the generic XmlWriter.raw() for that, which allows to add any content without validation or escaping. You can do all sorts of nasty things with raw() that will result in invalid XML, but this is one of its reasonable uses.
Next, let's add a comment:
>>> xml.comment("Show case some rarely used XML constructs")
Here is a processing instruction:
>>> xml.processingInstruction("xml-stylesheet", "href=\"default.css\" type=\"text/css\"")
And finally a CDATA section:
>>> xml.cdata(">> this will not be parsed <<")
And the result is:
>>> print out.getvalue().rstrip("\r\n") <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" SYSTEM ""> <!-- Show case some rarely used XML constructs --> <?xml-stylesheet href="default.css" type="text/css"?> <![CDATA[>> this will not be parsed <<]]>
Optimization
Loxun automatically optimized pairs of empty start/end tags. For example:
>>> out = StringIO() >>> xml = XmlWriter(out) >>> xml.startTag("customers") >>> xml.startTag("person", {"id": "12345", "name": "Doe, John"}) >>> xml.endTag("person") # without optimization, this would add </person>. >>> xml.endTag() >>> xml.close() >>> print out.getvalue().rstrip("\r\n") <?xml version="1.0" encoding="utf-8"?> <customers> <person id="12345" name="Doe, John" /> </customers>
Despite the explicit startTag("person") and matching endtag(), the output only contains a simple <person ... /> tag.
Contributing
If you want to help improve loxun, you can access the source code at <>.
Future
Currently loxun does what it was built for.
There are is no real plans to improve it in the near future, but here is a list of features that might be added at some point:
- Add validation of tag and attribute names to ensure that all characters used are allowed. For instance, currently loxun does not complain about a tag named "a#b*c$d_".
- Raise an XmlError when namespaces are added with attributes instead of XmlWriter.addNamespace().
- Logging support to simplify debugging of the calling code. Probably XmlWriter would get a property logger which is a standard logging.Logger. By default it could log original exceptions that loxun turns into an XmlError and namespaces opened and closed. Changing it to logging.DEBUG would log each tag and XML construct written, including additional information about the internal tag stack. That way you could dynamically increase or decrease logging output.
- Rethink pretty printing. Instead of a global property that can only be set when initializing an XmlWriter, it could be a optional parameter for XmlWriter.startTag() where it could be turned on and off as needed. And the property could be named literal instead of pretty (with an inverse logic).
- Add a DomWriter that creates a xml.dom.minidom.Document.
Some features other XML libraries support but I never saw any real use for:
- Specify attribute order for tags.
Version history
Version 1.3, 2012-01-01
- Added endTags() to close several or all open tags (issue #3, contributed by Anton Kolechkin).
- Added ChainXmlWriter which is similar to XmlWriter and allows to chain methods for more concise source code (issue #3, contributed by Anton Kolechkin).
Version 1.2, 2011-03-12
- Fixed AttributeError when XmlWriter(..., encoding=...) was set.
Version 1.1, 08-Jan-2011
- Fixed AssertionError when pretty was set to False (issue #1; fixed by David Cramer).
Version 1.0, 11-Oct-2010
- Added support for Python's with so you don not have to manually call XmlWriter.close() anymore.
- Added Git repository at <>.
Version 0.8, 11-Jul-2010
- Added possibility to pass attributes to XmlWriter.startTag() and XmlWriter.tag() with values that have other types than str or unicode. When written to XML, the value is converted using Python's built-in unicode() function.
- Added a couple of files missing from the distribution, most important the test suite.
Version 0.7, 03-Jul-2010
Added optimization of matching start and end tag without any content in between. For example, x.startTag("some"); x.endTag() results in <some /> instead of <some></some>.
- Fixed handling of unknown name spaces. They now raise an XmlError instead
of ValueError.
Version 0.6, 03-Jun-2010
- Added option indent to specify the indentation text each new line starts with.
- Added option newline to specify how lines written should end.
- Fixed that XmlWriter.tag() did not remove namespaces declared immediately before it.
- Cleaned up documentation.
Version 0.5, 25-May-2010
- Fixed typo in namespace attribute name.
- Fixed adding of namespaces before calls to XmlWriter.tag() which resulted in an XmlError.
Version 0.4, 21-May-2010
- Added option sourceEncoding to simplify processing of classic strings. The manual section "Working with non ASCII characters" explains how to use it.
Version 0.3, 17-May-2010
- Added scoped namespaces which are removed automatically by XmlWriter.endTag().
- Changed text() to normalize newlines and white space if pretty printing is enabled.
- Moved writing of XML prolog to the constructor and removed XmlWriter.prolog(). To omit the prolog, specify prolog=False when creating the XmlWriter. If you later want to write the prolog yourself, use XmlWriter.processingInstruction().
- Renamed *Element() to *Tag because they really only write tags, not whole elements.
Version 0.2, 16-May-2010
- Added XmlWriter.comment(), XmlWriter.cdata() and XmlWriter.processingInstruction() to write these specific XML constructs.
- Added indentation and automatic newline to text if pretty printing is enabled.
- Removed newline from prolog in case pretty printing is disabled.
- Fixed missing "?" in prolog.
Version 0.1, 15-May-2010
- Initial release.
- Author: Thomas Aglassinger
- Keywords: xml output stream large big huge namespace unicode memory footprint
- License: GNU Lesser General Public License 3 or later
- Categories
- Development Status :: 5 - Production/Stable
- Environment :: Plugins
- Intended Audience :: Developers
- License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
- Natural Language :: English
- Operating System :: OS Independent
- Programming Language :: Python :: 2.5
- Programming Language :: Python :: 2.6
- Programming Language :: Python :: 2.7
- Topic :: Internet :: WWW/HTTP :: Dynamic Content
- Topic :: Software Development :: Libraries
- Topic :: Text Processing :: Markup :: XML
- Package Index Owner: roskakori
- DOAP record: loxun-1.3.xml | http://pypi.python.org/pypi/loxun/1.3 | crawl-003 | en | refinedweb |
timer_arm.c File Reference
Low-level timer module for ARM (inplementation). More...
#include <cpu/detect.h>
#include <cfg/cfg_arch.h>
Go to the source code of this file.
Detailed Description
Low-level timer module for ARM (inplementation).
- Version:
- Id
- timer_arm.c 2604 2009-04-21 13:13:52Z batt
This module is automatically included so no need to include in test list.
Definition in file timer_arm.c. | http://doc.bertos.org/2.5/timer__arm_8c.html | crawl-003 | en | refinedweb |
Files:
The Simple Selector example shows how to use QWebElement to access the Document Object Model (DOM) in a Web page.
The QWebElement class enables access to the document structure and content in a Web page, as represented by a QWebFrame instance. It can be used for basic traversal of the document structure (see the DOM Traversal Example), to search for particular elements, and to modify any elements found.
This example uses a QWebView widget to display a Web page. A QLineEdit widget and QPushButton allow the user to enter a query and highlight the results in the page. These widgets are contained in an instance of the Window class, which we described below.
The Window class describes the example's user interface and this is partially described by the window.ui file, created using Qt Designer:
#include "ui_window.h" class Window : public QWidget, private Ui::Window { Q_OBJECT public: Window(QWidget *parent = 0); void setUrl(const QUrl &url); public slots: void on_elementLineEdit_returnPressed(); void on_highlightButton_clicked(); };
We use multiple inheritance to include the user interface description. We define slots that will automatically respond to signals emitted by certain user interface controls.
Since the layout of the user interface is provided by the window.ui user interface file, we only need to call the setupUi() in the constructor:
Window::Window(QWidget *parent) : QWidget(parent) { setupUi(this); }
This adds all the controls to the window and sets up connections between their signals and suitably-named slots in the Window class. The QLineEdit instance was given a name of elementLineEdit in Qt Designer, so the on_elementLineEdit_returnPressed() slot is automatically connected to its returnPressed() signal.
This slot performs the main work of this example. We begin by obtaining a QWebFrame instance for the current page shown in the QWebView widget. Each QWebFrame contains a QWebElement instance that represents the document, and we obtain this in order to examine its contents:
void Window::on_elementLineEdit_returnPressed() { QWebFrame *frame = webView->page()->mainFrame(); QWebElement document = frame->documentElement(); QWebElementCollection elements = document.findAll(elementLineEdit->text()); foreach (QWebElement element, elements) element.setAttribute("style", "background-color: #f0f090"); }
Taking the contents of the QLineEdit as the query text, we call the element's findAll() function to obtain a list of elements that match the query.
For each element obtained, we modify its style by setting its style attribute to give it a yellow background color.
Since we also want the query to be performed when the user clicks the Highlight button, we also implement the on_highlightButton_clicked() slot to simply call the on_elementLineEdit_returnPressed() slot when it is invoked:
void Window::on_highlightButton_clicked() { on_elementLineEdit_returnPressed(); }
For completeness, we also implement a setUrl() function which simply passes on a QUrl instance to the equivalent function in the QWebView widget:
void Window::setUrl(const QUrl &url) { webView->setUrl(url); }
The main function implementation is simple. We set up the application, create a Window instance, set its URL, and show it:
#include <QtGui> #include "window.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); Window window; window.setUrl(QUrl("")); #if defined Q_OS_SYMBIAN || defined Q_WS_HILDON || defined Q_WS_MAEMO_5 || defined Q_WS_SIMULATOR window.showMaximized(); #else window.show(); #endif return app.exec(); }
When the application's event loop is run, the WebKit home page will load, and the user can then begin to start running queries against the contents of the page. The highlighting can only be removed by reloading the page. To do this, open a context menu over the page and select the Reload menu item.
The QWebElement documentation contains more information about DOM access for the QtWebKit classes.
In this example, we take advantage of Qt's auto-connection feature to avoid explicitly connecting signals to slots. | http://doc.trolltech.com/main-snapshot/webkit-simpleselector.html | crawl-003 | en | refinedweb |
Created on 2003-07-22 23:07 by nnorwitz, last changed 2010-12-14 16:26 by r.david.murray. This issue is now closed.
I didn't really think this should go into 2.3, but I'll
let you make the decision. This patch fixes the
test_grp failure on RedHat 6.2/Alpha (asmodean) in the
snake-farm. I thought it was specific to RH 6.2,
apparently it's not. If you add a + as the last line
in /etc/group the test will fail on RH 9 too.
Walter Doerwald may know more about how best to fix
this. I'm not certain if it's really a problem in the
extension module or the test.
If you want to fix the test, the patch is included here:
def check_value(self, value):
# check that a grp tuple has the entries and
# attributes promised by the docs
+ if value == ('+', None, 0, []):
+ # some libc's return the last line of +
+ return
Logged In: YES
user_id=12800
Remind me what + on a line means in /etc/group. "man group"
on RH9 gives no clue. I'm still nervous about it, can we
defer until 2.3.1?
Logged In: YES
user_id=89016
pwdmodule.c hasn't changed in 7 months, so I'd say this is a
problem with the test. But ('+', None, 0, []) doesn't seem
to be a valid entry, so (although it's not a bug in Python)
maybe Python should hide this entry.
Logged In: YES
user_id=33168
I don't recall what the + is for either. Does it have
something to do with YP/NIS? I don't think this is really
critical so I'm droping the priority. If pwdmodule.c is
changed, it will be an interface change so it's questionable
for 2.3.1.
This was found on the snake farm, never reported by a user.
Logged In: YES
user_id=832557
The '+ ...' line at the end of the /etc/passwd file tells
the system to also pickup information from the appropriate
map in LDAP, or NIS (yellow pages). See also section 7.2 on
this page:
<>
Logged In: YES
user_id=12800
Thanks Jean for the independent verification. We'll fix
this for Python 2.3.1.
Logged In: YES
user_id=89016
Now that 2.3 is out the door, should this be checked in?
Logged In: YES
user_id=29957
I'll fix this for 2.3.3, because it causes test failures on
the HP testdrive boxes, and that annoys me <wink>.
Logged In: YES
user_id=89016
Anthony, can this go into 2.5?
A few comments on this one:
Perhaps the tests should be patched instead of the grp module? Because
it may be useful for someone to know that old-style NIS maps are being
referenced.
I presume if the change is made in grp that it should also be made in pwd?
Shouldn't the patch do a "continue" instead of a break? I believe the
"+" entry means "include the contents of the NIS map here (I don't
believe it can be used for LDAP), and as far as I know does not HAVE to
be included at the end of the file.
We probably don't care, but just to be canonical it seems that there are
also "+name" and "-name" entries in /etc/group and /etc/passwd. "+name"
in an entry is the same as a "name" entry, but the additional fields are
read from NIS. "-name" means that "name" is not a valid user (in other
words, don't let "name" login, even if they exist in NIS). I can't
imagine we want to implement those though, because...
Note that the "+" syntax is the old syntax from before nsswitch was
introduced. As far as I know, + syntax was deprecated back in 1995 when
nsswitch.conf was added.
In conclusion, I think the tests that the tests that annoy Anthony
should be fixed, but I'm not convinced the behavior of grp should be
changed. Particularly without a corresponding change in pwd.
Thoughts?
See the following URL for more information about the +/- syntax:
Ping. Anyone know if this is still an issue? I don't have access to RH.
I don't have a host where I actually use netgroups in /etc/groups, and so can't provoke the bug::
$ hg branch
release26-maint
$ make
...
$ ./python -E -tt Lib/test/regrtest.py test_grp
test_grp
1 test OK.
I can verify that the patch still applies to the 'release26-maint' branch::
$ patch -p0 < /tmp/grp.diff
patching file Modules/grpmodule.c
Hunk #1 succeeded at 134 (offset 12 lines).
and that the tests still pass aftewards::
$ make
...
$ ./python -E -tt Lib/test/regrtest.py test_grp
test_grp
1 test OK.
I am encountering this issue with py3k on a Debian machine. test_grp consistently fails due to a line with a plus sign in /etc/group
I believe that the previous patch attached to this bug is not correct due to the issues others have raised: It only handles lines with a plus sign as the name (not any name starting with '+' or '-') and it breaks out of the loop when it finds one, silently discarding any remaining lines.
I've attached a new patch which preserves the functionality of getgrall but updates its docstring to document that any group names starting with '+' or '-' represent NIS-related entries. The patch fixes the test itself so that it skips over NIS-related entries rather than attempting to look them up with grp.getgrnam.
With this patch applied (to the py3k branch HEAD), all regression tests pass on my machine.
I think this approach (of file19364) is reasonable.
Martin, are you able to check in this fix? If not, what should I do and whom should I talk to so this can be checked in?
Thanks.
I'm able to, but I may not find time. Ask on python-dev; if you feel you need to push this, offer to review issues in return.
Committed to py3k in r87238, 3.1 in r87239, and 2.7 in r87240. Thanks, Bobby. | http://bugs.python.org/issue775964 | crawl-003 | en | refinedweb |
This module defines names for all object types that are used by the standard Python interpreter (but not for the types defined by various extension modules). It is safe to use ``from types import *'' -- the module does not export any other names besides the ones listed here. New names exported by future versions of this module will all end in Type.
Typical use is for functions that do different things depending on their argument types, like the following:
from types import * def delete(list, item): if type(item) is IntType: del list[item] else: list.remove(item) | http://docs.python.org/release/1.5/lib/node29.html | crawl-003 | en | refinedweb |
SYNOPSIS
#include <signal.h>
int sigaction(int signum, const struct sigaction *act,
struct sigaction *oldact);
feature test macro requirements for glibc (see feature_test_macros(7)):
sigaction(): _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE
DESCRIPTION
The sigaction() system call is used to change the action taken by a
process on receipt of a specific signal. (see signal(7) for an over-
view of signals.) sig-
nal sig-
nal which triggered the handler will be blocked, unless the SA_NODEFER
flag is used.
If signum is SIGCHLD, do not transform children into zombies
when they terminate. see also waitpid(2). this flag is
only meaningful when establishing a handler for SIGCHLD, or
when setting that signal's disposition to SIG_DFL..
SA_NODEFER
Do not prevent the signal from being received from within
its own signal handler. This flag is only meaningful when
establishing a signal handler. SA_NOMASK is an obsolete,
non-standard synonym for this flag.
SA_ONSTACK
Call the signal handler on an alternate signal stack pro-
vided by sigaltstack(2). if an alternate stack is not
available, the default stack will be used. This flag is
only meaningful when establishing a signal handler.
SA_RESETHAND
Restore the signal action to the default state once the sig-
nal handler has been called. This flag is only meaningful
when establishing a signal handler. SA_ONESHOT is an obso-
lete, non-standard synonym for this flag.
SA_RESTART
Provide behavior compatible with BSD signal semantics by
making certain system calls restartable across signals.
This flag is only meaningful when establishing a signal han-
dler. see signal(7) for a discussion of system call
restarting.
SA_SIGINFO (since Linux 2.2)
The signal handler takes 3 arguments, not one. In this
case, sa_sigaction should be set instead of sa_handler.
This flag is only meaningful when establishing a signal han-
dler. */
si_signo, si_errno and si_code are defined for all signals. (si_errno
is generally unused on Linux.) The rest of the struct may be a union,
so that one should only read the fields that are meaningful for the
given signal:
* POSIX.1b signals and SIGCHLD fill in si_pid and si_uid.
* POSIX.1b timers (since Linux 2.6) fill in si_overrun and si_timerid.
The si_timerid field is an internal ID used by the kernel to identify
the timer; it is not the same as the timer ID returned by timer_cre-
ate(2).
* SIGCHLD fills in si_status, si_utime and si_stime. The si_utime and
si_stime fields do not include the times used by waited-for children
(unlike getrusage(2) and time gener-
ated.ILL signal:
ILL_ILLOPC illegal opcode
ILL_BADSTK internal stack error
The following values can be placed in si_code for a SIGFPE signal:
The following values can be placed in si_code for a SIGSEGV signal:
SEGV_MAPERR address not mapped to object
SEGV_ACCERR invalid permissions for mapped object
The following values can be placed in si_code for a SIGCHLD signal:
CLD_EXITED child has exited
CLD_KILLED child was killed
CLD_DUMPED child terminated abnormally
CLD_TRAPPED traced child has trapped
CLD_STOPPED child has stopped
CLD_CONTINUED stopped child has continued (since Linux 2.6.9)
POLL_HUP device disconnected
RETURN VALUE
sigaction() returns 0 on success and -1 on error.
ERRORS
EFAULT act or oldact points to memory which is not a valid part of the
process address space.
EINVAL An invalid signal was specified. This will also be generated if
an attempt is made to change the action for SIGKILL or SIGSTOP,
which cannot be caught or ignored.
CONFORMING TO
POSIX.1-2001, SVr4.
NOTES
a child created via fork(2) inherits a copy of its parent's signal dis-
positions. during an execve(2), the dispositions of handled signals
are reset to the default; the dispositions of ignored signals are left
unchanged. per-
form a wait(2) or similar.
POSIX.1-1990 only specified SA_NOCLDSTOP. POSIX.1-2001 added SA_NOCLD-
WAIT, implementa-
tion allowed the receipt of any signal, not just the one we are
installing (effectively overriding any sa_mask settings).
sigaction() can be called with a null second argument to query the cur-
rent signal handler. It can also be used to check whether a given sig-
nal is valid for the current machine by calling it with null second and
third arguments.
ment of type struct sigcontext. See the relevant kernel sources for
details. This use is obsolete now.
BUGS
In kernels up to and including 2.6.13, specifying SA_NODEFER in
sa_flags prevents not only the delivered signal from being masked dur-
ing execution of the handler, but also the signals specified in
sa_mask. This bug was fixed in kernel 2.6.14.
EXAMPLE
see mprotect(2).
SEE ALSO
kill(1), kill(2), killpg(2), pause(2), sigaltstack(2), signal(2), sig-
nalfd(2), sigpending(2), sigprocmask(2), sigqueue(2), sigsuspend(2),
wait(2), raise(3), siginterrupt(3), sigsetops(3), sigvec(3), core(5),
signal(7)
COLOPHON
This page is part of release 3.23 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at. | http://www.linux-directory.com/man2/rt_sigaction.shtml | crawl-003 | en | refinedweb |
#include <Thyra_SolveSupportTypes.hpp>
List of all members.
In the future, more fields may be added to aid in user diagnostics.
Definition at line 227 of file Thyra_SolveSupportTypes.hpp.
Definition at line 229 of file Thyra_SolveSupportTypes.hpp.
Definition at line 244 of file Thyra_SolveSupportTypes.hpp.
Definition at line 231 of file Thyra_SolveSupportTypes.hpp.
Output the achieveTol field.
Definition at line 249 of file Thyra_SolveSupportTypes.hpp.
The return status of the solve.
Definition at line 233 of file Thyra_SolveSupportTypes.hpp.
The maximum final tolerance actually achieved by the (block) linear solve. A value of
unknownTolerance() means that even an estimate of the the final value of the tolerance is unknown.
Definition at line 237 of file Thyra_SolveSupportTypes.hpp.
A simple one-line message (i.e. no newlines) returned from the solver.
Definition at line 239 of file Thyra_SolveSupportTypes.hpp.
Any extra status parameters. Note that the contents of this parameter list is totally undefined.
Definition at line 242 of file Thyra_SolveSupportTypes.hpp. | http://trilinos.sandia.gov/packages/docs/dev/packages/thyra/src/interfaces/operator_solve/fundamental/doc/html/structThyra_1_1SolveStatus.html | crawl-003 | en | refinedweb |
#include <itkQuadraticTriangleCell.h>
Inheritance diagram for itk::QuadraticTriangleCell< TCellInterface >:
Template parameters for QuadraticTriangleCell:
TPixelType = The type associated with a point, cell, or boundary for use in storing its data.
TCellTraits = Type information of mesh containing cell.
Definition at line 43 of file itkQuadraticTriangleCell.h.
Definition at line 60 of file itkQuadraticTriangleCell.h.
The type of boundary for this triangle's edges.
Definition at line 59 of file itkQuadraticTriangleCell.h.
Definition at line 56 of file itkQuadraticTriangleCell.h.
The type of boundary for this triangle's vertices.
Definition at line 52 of file itkQuadraticTriangleCell.h.
Definition at line 108 of file itkQuadraticTriangleCell.h.
References itkGetStaticConstMacro, and itk::QuadraticTriangleCell< TCellInterface >::m_PointIds.
Definition at line 115 of file itkQuadraticTriangleCell.h.
Given the parametric coordinates of a point in the cell determine the value of its Shape Functions returned through an itkArray<InterpolationWeightType>).
Triangle-specific interface.
Implement the standard CellInterface.
Definition at line 70 of file itkQuadraticTriangleCell.h.
Standard class typedefs.
Standard class typedefs.
Cell visitor interface.
Triangle-specific topology numbers.
Store the number of points needed for a triangle.
Definition at line 119 of file itkQuadraticTriangleCell.h.
Referenced by itk::QuadraticTriangleCell< TCellInterface >::QuadraticTriangleCell(). | http://www.itk.org/Doxygen36/html/classitk_1_1QuadraticTriangleCell.html | crawl-003 | en | refinedweb |
#include <itkQuadraticEdgeCell.h>
List of all members.
Template parameters for QuadraticEdgeCell:
TPixelType = The type associated with a point, cell, or boundary for use in storing its data.
TCellTraits = Type information of mesh containing cell.
Definition at line 42 of file itkQuadraticEdgeCell.h.
Definition at line 55 of file itkQuadraticEdgeCell.h.
The type of boundary for this lines's vertices.
Definition at line 51 of file itkQuadraticEdgeCell.h.
Definition at line 89 of file itkQuadraticEdgeCell.h.
References itkGetStaticConstMacro.
Definition at line 96 of file itkQuadraticEdgeCell.h.
Given the parametric coordinates of a point in the cell returned the values of its ShapeFunctions
QuadraticEdge-specific interface.
Implement the standard CellInterface.
Definition at line 64 of file itkQuadraticEdgeCell.h.
QuadraticEdge-specific interface.
Standard class typedefs.
Standard class typedefs.
Visitor interface
QuadraticEdge-specific topology numbers.
Store number of points needed for a line segment.
Definition at line 107 of file itkQuadraticEdgeCell.h. | http://www.itk.org/Doxygen36/html/classitk_1_1QuadraticEdgeCell.html | crawl-003 | en | refinedweb |
I'm doing a C program that involves printing out a sine wave using the "*" character. The main coding is complete but for some strange reason the "*"'s just won't display on the screen. All I'm getting is blanks. Here's my code:
#include <stdio.h> #include <math.h> int main(void) { /* Declare variables */ int line_count, /* Counts the lines in the program */ no_of_lines; /* The number of lines to display in the graph */ double result, /* The sine result from the calculation */ initial_step_size, /* The initial step size in degrees */ current_step_size, /* The current step size in degrees */ sine_count; /* Counts the values in the sine range */ /* Prompt user for information */ printf("\nEnter the initial step-size in degrees: "); scanf("%lf", &initial_step_size); printf("\nEnter the number of lines to be displayed in the graph: "); scanf("%d", &no_of_lines); /* Assign to current step size */ current_step_size = initial_step_size; /* Display graph */ for (line_count = 0; line_count < no_of_lines; line_count++) { result = sin(current_step_size); for (sine_count = -1; sine_count <= 1; sine_count += 0.01) { if (result == sine_count) printf("\n*\n"); else printf(" "); } /* Increment step size */ current_step_size += initial_step_size; } return 0; }Both for loops run well and displayed the necessary values during tests. The only problem left is the if condition that is supposed to compare the calculated sin result with the sine range value. Basically, if the result matches the sine range value, display a star. Otherwise, display a blank. Is it a problem with my code? Or is it possible that it may be a problem with my compiler?
Any help will be appreciated. Thanks! :) | http://forum.codecall.net/topic/63090-trying-to-draw-a-sine-wave-in-c/ | crawl-003 | en | refinedweb |
Opened 10 years ago
Closed 9 years ago
#3291 closed enhancement (fixed)
[patch] get_absolute_url cannot be encanced with optional parameters, because it gets curried for settings.ABSOLUTE_URL_OVERRIDES (used for {% link_to ... %} implementation)
Description
If you want to have (optional) extra parameters for get_absolute_url(), that's not possible because this method gets curried (because of ABSOLUTE_URL_OVERRIDES). But optional extra-parameters could be an enhancement and a simple way of creating URLs using parameters (for example some URL to edit the object).
I wanted to use this, because I tried to implement an link_to-template tag that can get parameters to add extra functionality to the simple get_absolute_url()-method. This would allow a simple way to get links for object-actions like edit/delete/move/...
It can be fixed by allowing *args and kwargs in django.db.models.base.get_absolute_url:
def get_absolute_url(opts, func, self, *args, **kwargs): return settings.ABSOLUTE_URL_OVERRIDES.get('%s.%s' % (opts.app_label, opts.module_name), func)(self, *args, **kwargs)
If someone is interested...the template-tag-code:
from django import template from django.template import loader class LinkToNode(template.Node): def __init__(self, context_var_name, kwargs): self.context_var_name = context_var_name self.kwargs = kwargs def render(self, context): print self.kwargs try: obj = template.resolve_variable(self.context_var_name, context) except template.VariableDoesNotExist: return '' try: return obj.get_absolute_url(**self.kwargs) except: return '' def link_to(parser, token): tokens = token.contents.split() # Now tokens is a list like this: # ['link_to', 'article', 'foo=bar'] # ['link_to', 'article', 'foo=bar', 'bla=fasl'] if len(tokens) < 1: raise template.TemplateSyntaxError, "%r tag requires more than one argument" % tokens[0] context_var_name = tokens[1] kwargs = dict([tuple(part.split('=')) for part in tokens[1:] if '=' in part]) return LinkToNode(context_var_name, kwargs)
Template example:
{% link_to object action=edit %}
Perhaps there is some really good reason not to do it this way...?
(The args/kwargs that are passed to get_absolute_url() could be filtered like done in the dispatcher I think)
Attachments (1)
Change History (7)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
comment:3 Changed 9 years ago by
Changed 9 years ago by
Adds ability to pass arguments to get_absolute_url method which are passed through to underlying function
comment:4 Changed 9 years ago by
It is not currently possible to modify the method signature of
get_absolute_url
.
We use this simple patch internally and provide defaults for any arguments so that get_absolute_url behaves as expected, but allows for multiple URL schemes per object.
Note: The provided patch does not include the template tag code.
comment:5 Changed 9 years ago by
I can't see any downsides to adding this functionality.
Done this using a second method to get the url now, so I lower the priority/severity. But perhaps someone could look after this anyway.
(second method has one advantage btw: you can use the result of get_absolute_url() there, which makes thing easier) | https://code.djangoproject.com/ticket/3291 | CC-MAIN-2017-09 | en | refinedweb |
Last restarted. I asked when this was occurring and put on my detective’s hat.
In this blog, I will.
Diagnosing the Bug
I read through my service’s log files around the the time the 500 errors started happening. They quickly showed a pretty serious problem: a little before midnight on a Saturday my service would start throwing errors. At first there was a variety of errors occurring, all SQLException, but eventually the root cause became the same:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
This went on for several hours until early the following morning when the service was restarted and the service went back to normal.
Checking with the
cave trolls DBAs, I found the database I was connecting to went down for maintenance. The exact details escape me, but I believe it was a roughly 30-minute window the database was down. So, clearly, my service had an issue re-connecting to a database once the database recovered from an outage.
Fixing the Bug the Wrong Way
The most straightforward way of fixing this bug (and one which I have often went to in the past), would had been to Google “recovering from database outage,” which would likely lead me to a Stack Overflow thread that answers my question. I would then have “copied and pasted” in the provided answer and pushed the code to be tested.
If production was being severely affected by a bug, this approach might be necessary in the short-term. That said, time should be set aside in the immediate future to cover the change with an automated test.
Fixing the Bug the Right Way
So as is often the case, doing the things the “right way” often means a significant font-loaded time investment, and this adage is definitely true here.
The return on investment, however, is less time later spent fixing bugs, increased confidence in the correctness of the code, and, in addition, tests can be an important form of documentation as to how the code should behave in a given scenario.
While this specific test case is a bit esoteric, it’s an important factor to keep in mind when designing and writing tests, be they unit or integration: give tests good names, make sure test code is readable, etc.
Solution 1: Mock Everything
My first crack at writing a test for this issue was to try to “mock everything.” While Mockito and other mocking frameworks are quite powerful and are getting ever easier to use, after mulling over this solution, I quickly came to the conclusion I just wouldn’t ever have the confidence that I wouldn’t be testing anything beyond the mocks I have written.
Getting a “green” result would not increase my confidence in the correctness of my code, the whole point of writing automated tests in the first place! On to another approach.
Solution 2: Use An In-Memory Database
Using an in-memory database was my next attempt at writing this test. I’m a pretty big proponent of H2, I’ve used H2 extensively in the past and was hoping it might address my needs here once again. I probably spent more time here than I should have.
While ultimately this approach doesn’t pan out, the time spent isn’t entirely wasted, I did learn a decent bit more about H2. One of the advantages of doing things the “right way” (though often painful in the moment) is that you learn a lot. The knowledge gained might not be useful at the time, but could prove valuable later.
The Advantages of Using an In-Memory Database
Like I said, I probably spent more time here than I should have, but I did have my reasons for wanting this solution to work. H2, and other in-memory databases, had a couple of very desirable traits:
- Speed: Starting and stopping H2 is quite fast, sub-second. So while a little slower than using mocks, my tests would still be plenty fast.
- Portability: H2 can run entirely from an imported jar, so other developers can just pull down my code and run all the tests without performing any additional steps.
Additionally my eventual solution had a couple non-trivial disadvantages which I will cover as part of that solution below.
Writing the Test
Somewhat meaningful, but to this point I still hadn’t written a single line of production code. A central principle of TDD is to write the test first and production code later. This methodology along with ensuring a high level of test coverage also encourages the developer to only make changes that are necessary. This goes back to the goal increasing confidence in the correctness of your code.
Below is the initial test case I built to test my PROD issue:
@RunWith(SpringRunner.class) @SpringBootTest(classes = DataSourceConfig.class, properties = {"datasource.driver=org.h2.Driver", "datasource.url=jdbc:h2:mem:;MODE=ORACLE", "datasource.user=test", "datasource.password=test" }) public class ITDatabaseFailureAndRecovery { @Autowired private DataSource dataSource; @Test public void test() throws SQLException { Connection conn = DataSourceUtils.getConnection(dataSource); conn.createStatement().executeQuery("SELECT 1 FROM dual"); ResultSet rs = conn.createStatement().executeQuery("SELECT 1 FROM dual"); assertTrue(rs.next()); assertEquals(1, rs.getLong(1)); conn.createStatement().execute("SHUTDOWN"); DataSourceUtils.releaseConnection(conn, dataSource); conn = DataSourceUtils.getConnection(dataSource); rs = conn.createStatement().executeQuery("SELECT 1 FROM dual"); assertTrue(rs.next()); assertEquals(1, rs.getLong(1)); } }
Initially I felt I was on the right path with this solution. There is the question of how do I start the H2 server back up (one problem at a time!) But when I run the test, it is failing and giving an error analogous to what my service is experiencing in PROD:
org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-192]
However, if I modify my test case and simply attempt a second connection to the database:
conn = DataSourceUtils.getConnection(dataSource);
The exception goes away and my test passes without me making any changes to my production code. Something isn’t right here…
Why This Solution Didn’t Work
So using H2 won’t work. I actually spent quite a bit more time trying to get H2 to work than what the above would suggest. Troubleshooting attempts included; connecting to a file based H2 server instance instead of just an in-memory one, a remote H2 server; I even stumbled up the H2 Server class that would had addressed the server shutdown/startup issue from earlier.
None of those attempts worked obviously. The fundamental problem with H2, at least for this test case, is attempting to connect to a database will cause that database to start up if it currently isn’t running. There is a bit of a delay, as my initial test case shows, but obviously this poses a fundamental problem. In PROD, when my service attempts to connect to a database, it does not cause the database to start up (no matter how many times I attempt connecting to it). My service’s logs can certainly attest to this fact. So on to another approach.
Solution 3: Connect to a Local Database
Mocking everything won’t work. Using an in-memory database didn’t pan out either. It looks like the only way I will be able to properly reproduce the scenario my service was experiencing in PROD was by connecting to a more formal database implementation. Bringing down a shared development database is out of the question, so this database implementation needs to run locally.
The Problems With This Solution
So everything before this should give a pretty good indication that I really wanted to avoid going down this path. There are some good reasons for my reticence:
- Decreased portability: If another developer wanted to run this test she would need to download and install a database on her local machine. She would also need to make sure her configuration details match what the test is expecting. This is time-consuming task and would lead to at least some amount of “out of band” knowledge.
- Slower: Overall my test still isn’t too slow, but it does take several seconds to startup, shutdown, and then startup again even against a local database. While a few seconds doesn’t sound like much, time can add up with enough tests. This is a major concern as integration tests are allowed to take longer (more on that later), but the faster the integration tests, the more often they can be run.
- Organizational wrangling: To run this test on the build server means I would now need to work with my already-overburdened DevOps team to setup a database on the build box. Even if the ops team wasn’t overburden, I just like to avoid this if possible as it’s just one more step.
- Licensing: In my code example, I am using MySQL as my test database implementation. However, for my client, I was connecting to an Oracle database. Oracle does offer Oracle Express Edition (XE) for free, however it does come with stipulations. One of those stipulations is two instance of Oracle XE cannot be running at the same time. The specific case of Oracle XE aside, licensing can become an issue when it comes to connecting to specific products offerings, it’s something to keep in mind.
Success! … Finally
Originally this article was a good bit longer, which also gave a better impression of all the
blood, sweat, and tears work that went into getting to this point. Ultimately such information isn’t particularly useful to readers, even if cathartic for the author to write about. So, without further ado, a test that accurately reproduces the scenario my service was experiencing in PROD:
@Test public void testServiceRecoveryFromDatabaseOutage() throws SQLException, InterruptedException, IOException { Connection conn = null; conn = DataSourceUtils.getConnection(datasource); assertTrue(conn.createStatement().execute("SELECT 1")); DataSourceUtils.releaseConnection(conn, datasource); LOGGER.debug("STOPPING DB"); Runtime.getRuntime().exec("/usr/local/mysql/support-files/mysql.server stop").waitFor(); LOGGER.debug("DB STOPPED"); try { conn = DataSourceUtils.getConnection(datasource); conn.createStatement().execute("SELECT 1"); fail("Database is down at this point, call should fail"); } catch (Exception e) { LOGGER.debug("EXPECTED CONNECTION FAILURE"); } LOGGER.debug("STARTING DB"); Runtime.getRuntime().exec("/usr/local/mysql/support-files/mysql.server start").waitFor(); LOGGER.debug("DB STARTED"); conn = DataSourceUtils.getConnection(datasource); assertTrue(conn.createStatement().execute("SELECT 1")); DataSourceUtils.releaseConnection(conn, datasource); }
Full code here:
The Fix
So I have my test case. Now it’s time to write production code to get my test showing green. Ultimately I got the answer from a friend, but likely would stumbled upon it with enough Googling.
Initially the DataSource I set up in my service’s configuration effectively looked like this:
")); return dataSource; }
CodeProject
The underlying problem my service was experiencing is when a connection from the
DataSource’s connection pool failed to connect to the database, it became “bad.” The next problem then was my
DataSource implementation would not drop these “bad” connections from the connection pool. It just kept trying to use them over and over.
The fix for this is luckily pretty simple. I needed to instruct my
DataSource to test a connection when the
DataSource retrieved it from the connection pool. If this test failed, the connection would be dropped from the pool and a new one attempted. I also needed to provide the
DataSource with a query it could use to test a connection.
Finally (not strictly necessary but useful for testing), by default my
DataSource implementation would only test a connection every 30 seconds. However it would be nice for my test to run in less than 30 seconds. Ultimately the length of this period isn’t really meaningful, so I added a validation interval that is provided by a property file.
Here is what my updated
DataSource looks like:
")); dataSource.setValidationQuery("SELECT 1"); dataSource.setTestOnBorrow(true); dataSource.setValidationInterval(env.getRequiredProperty("datasource.validation.interval")); return dataSource; }
One final note for writing integration tests. Initially I created a test configuration file that I used to configure the
DataSource to use in my test. However this is incorrect.
The problem is that if someone were to remove my fix from the production configuration file, but left it in the test configuration file, my test would still be passing but my actual production code would once again be vulnerable to the problem I spent all this time fixing! This is a mistake that would be easy to imagine happening. So be sure to use your actual production configuration files when writing integration tests.
Automating the Test
So the end is almost in sight. I have a test case that accurately reproduces the scenario I am experiencing in PROD. I have a fix that then takes my test from failing to passing. However the point of all this work wasn’t to just have confidence that my fix works for the next release, but for all future releases.
Maven users: hopefully you are already familiar with the surefire plugin. Or, at least hopefully your DevOps team already has your parent pom set up so that when a project is being built on your build server, all those unit tests you took the time to write are being run with every commit.
This article however isn’t about writing unit tests, but about writing integration tests. An integration test suite will typically take much longer to run (sometimes hours) than an unit test suite (which should take no more than 5-10 minutes). Integration tests are also typically more subject to volatility. While the integration test I wrote in this article should be stable –if it breaks, it should be cause for concern– when connecting to a development database, you can’t always be 100% confident the database will be available or that your test data will be correct or even present. So a failed integration test doesn’t necessarily mean the code is incorrect.
Luckily the folks behind Maven have already addressed this and that is with the failsafe plugin. Whereas the surefire plugin, by default, will look for classes that are pre or post-fixed with
Test, the failsafe plugin will look for classes pre or post-fixed with
IT (Integration Test). Like all Maven plugins, you can configure in which goals the plugin should execute. This gives you the flexibility to have your unit tests run with every code commit, but your integration tests to only run during a nightly build. This can also prevent a scenario in which a hot-fix needs to be deployed, but a resource that an integration test depends upon isn’t present.
Final Thoughts
Writing integration tests can be a time consuming and difficult task. It requires extensive thought into how your service will interact with other resources in PROD. This task is even more difficult and time consuming when you are specifically testing for failure scenarios which often requires more control of the resource your test is connecting with and drawing on past experience and knowledge on what scenarios to test for.
Despite this high cost in time and effort, this investment will pay itself back many times over in time. Increasing confidence in the correctness of code, which is only possible through automated testing, is central to shortening the development feedback cycle.
The code that I used in this article can be found here:.
Atta boy, Billy! Too many people blow off any form of unit or automated testing. The time investment costs more up front, but the experience you gained as a developer, and the coverage gained by automated testing, saves time in the long run. Imagine you change connection providers, database drivers, connection pools, etc. Now you know those cases are covered! And trust me; that is going to happen sooner than later.
Author
Thanks for the kind words Dave! Automated testing is something I have come back around to recently. Used to do it half heartedly, but from reading and increased experience, extensive automated test coverage is key to the both the short and long term success of a product. | https://keyholesoftware.com/2016/10/03/automated-integration-tests-failure-scenarios/ | CC-MAIN-2017-09 | en | refinedweb |
Introduction to Feature Engineering
Feature engineering is an important part of designing an effective machine learning pipeline. It is best described as the process of transforming data from its raw form to something more useful to the predictive model. This can result in much better results on your task.
The basic idea is to construct an object, fit it to a dataset, and transform any new data.
# Construct a transformer sf = gl.SFrame({'docs': ["This is a document!", "This one's also a document."]}) f = graphlab.feature_engineering.TFIDF(features = ['docs']) # Fit it to a dataset f.fit(sf) # Now the object is ready to transform new data f.transform(sf)
Feature engineering objects can be combined into pipelines
and deployed on predictive services (see below for more). There is also a
helper function
fit_transform method that combines the last two methods.
GLC has a collection of feature engineering objects are helpful for transforming SFrames of various types. These feature engineering tasks are grouped based on the feature types:
Numeric Features
Categorical Features
Image Features
Text features
Misc.
Transforming single columns
Many of the above transformations have a corresponding one-liner function
whose input is an SArray and output is an SArray. Internally it simply runs
fit_transform on the corresponding transformation.
tfidf_transforms = gl.text_analytics.tf_idf(data['docs']) bag_of_words_transforms = gl.text_analytics.count_words(data['docs']) bag_of_ngrams_transforms = gl.text_analytics.count_words(data['docs'])
Transforming multiple columns
TF-IDF is an example of a feature engineering object that performs a
transformation for each feature (i.e. column name) provided in the
features
argument. Other one-to-one transformations include CategoricalImputer,
CountThreshold, FeatureBinner,
NGramCounter,
NumericImputer, Tokenizer,
WordCounter. If you would prefer to have each transformed
column be included in the SFrame (rather than replacing the original column)
you can use the
column_name_prefix argument to add a prefix the set of
transformed columns.
Other transformations take a set of columns and create a single column.
Examples include FeatureHasher, OneHotEncoder,
and QuadraticFeatures. You may change the name of
the output column using the
output_column_name argument.
Finally, the RandomProjection tool does a "many-to-many" transformation. It takes a set of columns as input and returns a smaller set of (randomly projected) columns.
Deploying feature engineering transformations
The feature engineering toolkit also makes it easy to deploy your feature engineering models and pipelines.
Suppose we have a simple tokenizer:
import graphlab as gl data = gl.SFrame({'docs': ["This is a document", "Another doc"]}) m = gl.feature_engineering.Tokenizer(features=['docs']) m.fit(data)
Now suppose we have created a Predictive Service object
ps.
(For more on that, see the Predictive Services chapter of the user guide.) Then we can take a feature engineering model and add it as a service, apply those changes, and query the model that has been deployed as a service.
ps = gl.deploy.predictive_service.load(my_ps_url) ps.add('my_transformation', m) ps.apply_changes() d = [row for row in data] # Create JSON-serializable version of data ps.query('my_transformation', method='transform', data={'data': d})
The resulting JSON will have a "response" field containing the data transformed by the deployed tokenizer model.
{u'from_cache': False, u'model': u'chris_tmp_wordcounter', u'response': [{u'docs': [u'This', u'is', u'a', u'document']}, {u'docs': [u'Another', u'doc']}], u'uuid': u'6bb3627b-708d-4398-9afd-b13dd170d8e3', u'version': 0}
Feedback
Feedback about the feature engineering toolkit is very welcome. Please post questions and comments on our forum or send a note to support@turi.com. | https://turi.com/learn/userguide/feature-engineering/introduction.html | CC-MAIN-2017-09 | en | refinedweb |
Wolfgang Ha"felinger wrote:
> Hey,
>
>>> Ant's purpose is as a build tools, not a Java library.
>
> Perhaps time to change. After all, there must be a reason why
> Maven's community is growing :-)
Ahh, we arent going to go there.
>>> <presetdef> is just syntactic sugar, and is better not used
>>> IMHO.
>
> I disagree. It's very cool. Almost as cool as "macrodef" which
> I really love.
They are good, but work best if you put stuff into new namespaces as
otherwise you are redefining default things. Just like in C++, this can
get you into trouble. Just like in C++, they do give you near unlimited
power.
Regarding private vs public, private stuff is primarily there to let the
team changing things without fear of breaking stuff. There is a general
assumption that public method calls should stay around, purely for
people using Ant programmatically.
If you can make a good case for something becoming public, it will get
changed, or the underlying cause of your problems may get fixed in some
other way.
-steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org | http://mail-archives.apache.org/mod_mbox/ant-dev/200605.mbox/%3C44732B81.8040204@apache.org%3E | CC-MAIN-2017-09 | en | refinedweb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.