text stringlengths 454 608k | url stringlengths 17 896 | dump stringclasses 91
values | source stringclasses 1
value | word_count int64 101 114k | flesch_reading_ease float64 50 104 |
|---|---|---|---|---|---|
Anybody know of any articles that show how to use a Foriegn Class with in a Dialog Class?
I got it to work, but I want to see if I'm overlooking anything?
Rate this post if it helped you.
What do you mean by "Foriegn Class"?
Accessing the members of another class with the help of ClassWizard.
For Example:
When doing a CRecordSetView you have access to the CRecordSet data members in class wizard.
I use Formview with Dialog boxes. I want to be able to access the FormView datamembers directly from class wizard without having to define a member variable for the CDialog Class and then assigning the value to the CFormview member variable.
If you do it right you classwizard will create the following:
DDX_Text(pDX, IDC_EDIT_VAR1, m_pFView->m_csDg1Var1);
in DoDataExchange,
where:
m_pFView
is a pointer to the Formview class which called the CDialog class. I can then edit the Formview data members directly without having to create an extra variable and assignment statements.
For Example I did the following:
void CMyFormView::OnButtonDialog1()
{
// TODO: Add your control notification handler code here
this->m_Dlg1.m_pFView = this;
this->UpdateData();
this->m_Dlg1.DoModal();
this->UpdateData(FALSE);
}
And I'm able to access the Formview Vars and edit them directly. Classwizard will list all the CFormView Vars so I can edit them directly.
I'm surprised that there is not much info on this approach to using CDialog since it is more effiecient (computing and memory wise) as well esier to code. I don't even have to filter ID_OK since the framework does it already. Data will only be updated if you hit OnOk.
It's pretty cool.
Intersting, I've never done it this way. What version of the VS do you use it with?
VS6, it has a class wizard. I read that VS2003 and up don't have a class wizard, up until VS2010.
However, if you do a CRECORDSETVIEW project it SHOULD have a foriegn class variable, that is where I got the idea. You might want to try that.
You have to do a forward class definition though to implement the technique I talked about.
I did the following:
In my Dialog Header File
class CMyFormViiew;
In my Cpp file:
#include "MyClassDoc.h"
#include "MyFormView.h"
When you declare the foriegn variable, classwizard will create the member variable.
..It works pretty cool, I'm surprised there is not much written about this approach.
Originally Posted by ADSOFT
VS6, it has a class wizard. I read that VS2003 and up don't have a class wizard, up until VS2010.
They actually did away with it in VS2002 that followed VS6, and you're correct they resurrected it in VS2010. IMO, I really liked the class wizard in VS6 and was missing it a big time in VS2002, but as time passed (8 years for god's sake) I got used to the other way so now I'm not sure if I'd be going back to the wizard in VS2010 any time soon. The Add Member and Add Function replacements introuced in VS2002 that stayed until VS2008 are so fickle and unreliable that I learned to code most of my class members manually (without using any sort of IDE automation).
Another thing that suffered a big time (in my opinion) is the Intellisense (since VS2003). Even though they added some good features to it (like the ability to unfold and view structures during debugging) it is still very slow to respond and at times doesn't show the correct or helpful info. I really want it to go back to the way it used to be in VS6 or VS2002.
On the sidenote, I'm not sure that I'd be using VS2010 any time soon either. The reason is simple -- the CRT and MFC (that I'm using the most) are so bloated in size, plus the code VS2010 compiler makes is only compatible with Windows XP and up, so I'm going to stick with VS2008 w/o SP1 for awhile.
A question I have to you, is it actually legal (or documented) to use class members like you do? It wouldn't cause some internal conflict with the MFC stuff itself, would it? (If you want to post a sample of what you're doing and I can test it to see if it works under VS2010)
That's why I posted my approach to get opinions from others.
I have a simple app(VS6 ) which might not be compatible with some of the newer VS versions.
The more I think about it I don't think it should be a problem since the all you are really doing is
DDX_Text(pDX, IDC_EDIT_VAR1, m_pFView->m_csDg1Var1);
which should be ok because you are just pointing to a string.
You can try this youself, create a pointer to another dialog box and access the member via a pointer, you should be able to update the varialbe.
I do have a question for you though, in VS2003 and Up, when you do a CDAORECORDVIEW or CRECORDVIEW does VS give you a list of database fields when you are biniding variables to the Editbox's?
Originally Posted by ADSOFT
I do have a question for you though, in VS2003 and Up, when you do a CDAORECORDVIEW or CRECORDVIEW does VS give you a list of database fields when you are biniding variables to the Editbox's?
Listen, I haven't done anything with databases for quite a long time. Either post a test project with what you mean, or give me the database specs you're using in your project?
Forum Rules | http://forums.codeguru.com/showthread.php?500824-Pass-to-another-text-file-while-writing&goto=nextnewest | CC-MAIN-2015-48 | refinedweb | 946 | 69.72 |
Article updated for webpack 2
React is a Javascript library, by Facebook, that is used for building user interfaces. It is a bomb library that offers so many advantages but one of the biggest setbacks is the steep learning curve. When I started out, one of the things that bugged me a whole lot was that most of the tutorials skipped over the React environment set-up.
So here we go, this article is best suited for beginners who aren't afraid to get their hands dirty setting up a React environment, from scratch. My number one mission is to keep this article simple and easy to understand. I will not use any boilerplates and you can find the whole set-up on my github repo here. We will be using the following:
Table of Contents
- Webpack - A module bundler
- Babel - A Javascript compiler
- ES6 - A relatively new Javasript standard
- Yarn - A package manager
- React - As expected
This article is best suited for beginners who aren't afraid to get their hands dirty setting up a React environment from scratch.
By the end of the tutorial, we will have set-up a working React environment and just for fun we will have a simple webpage displaying Hello World.
Brace yourselves for some fun!!
Pre-requisites
We require Yarn and Node pre-installed on our machines before we dive into the project.
As mentioned above we'll use Yarn Package Manager. It is quite similar to npm and has almost the same commands provided by npm. It also comes with a few extra features that npm does not provide. Just to catch you up, a few of the main reasons I use yarn are:
- If you had already installed a package before, you can install it again without any internet connection. Apart from the fact that you can install packages offline, this also increases the speed of your installments.
- The same exact dependencies are installed on any machine. This essentially means that an install on one machine will work the same exact way on any other machine.
For more information you could go over the Yarn documentation.
For Mac Os users, the commands below will suffice to install Yarn and because I got all your backs, anyone using any other OS can head on over to the Yarn installation page to get the right instructions on installation.
> brew update > brew install yarn
Getting Started
Open your terminal and create a new folder. You can name it as you wish. Navigate into the folder and initialize the project by running
yarn init.
yarn init just like
npm init will give you a few prompts, just press
enter till the end or configure it as you'd like to.
> mkdir hello-world-react > cd hello-world-react > yarn init
When
yarn init is finished you will notice in your folder, in this case 'hello-world-react', you'll have a new file
package.json just like if you had done
npm init.
Webpack installation and configuration
Next, we need to install webpack and a few dependencies.
> yarn add webpack webpack-dev-server path
Inside 'hello-world-react' a new file
yarn.lock is created. This file is what Yarn uses to lock down the exact dependencies to use on another machine, you don't really have to worry about this file as it is automatically generated.
Now that we have webpack installed we need a config file to give it instructions on what to do. Create a new file,
webpack.config.js, on the project folder and open it on your preferred text editor.
> touch webpack.config.js
We can then update the configuration file:
/* ./webpack.config.js */ const path = require('path'); module.exports = { entry: './client/index.js', output: { path: path.resolve('dist'), filename: 'index_bundle.js' }, module: { rules: [ { test: /\.css$/, use: [ { loader: "style-loader" }, { loader: "css-loader" } ] }, { test: /\.js$/, exclude: /node_modules/, use: "babel-loader" }, { test: /\.jsx?$/, exclude: /node_modules/, use: "babel-loader" } ] } }
Basically, to get a running instance of webpack we need to specify an
entry point and an
output.
entry: Specifies the entry file where the bundler starts the bundling process.
output: Specifies the location where the bundled Javascript code is to be saved.
We, however, also have loaders. These are needed because we want the browser we use to be able to interprate and run JSX code (for React) and code written in ES6.
loaders: They are transformations that are applied on a file in our app.
The
loaders key property takes in an array of loaders. For our basic set-up we specified that the
babel-loader goes through and transpiles every file that ends with a
.js or
.jsx extension excluding the files inside the
node_modules folder. You could always add more loaders as needed. For example, if you had separate style sheets in your project you'd require a CSS loader. All these loaders can be found in the webpack documentation. Feel free to test them out.. Notice we have installed
babel-preset-es2015 and
babel-preset-react, presets are Babel plugins that simply tell Babel what to look out for and transform into plain, vanilla Javascript.
We then have to configure Babel and we can do this in a new file which we'll name
.babelrc.
> touch .babelrc
Then we can update the file to:
/* ./.babelrc */ { "presets":[ "es2015", "react" ] }
That is it. Now when
babel-loader is called in the webpack config file it knows what to do.
Setting up our React Components
So far our file structure looks like this:
. |-- node_modules |-- .babelrc |-- package.json |-- webpack.config.js |-- yarn.lock
Its high time we add the React side don't you think? We'll create a new folder
client and add an
index.js file and an
index.html file.
> mkdir client > cd client > touch index.js > touch index.html > cd ..
Now we have this:
. |-- client |-- index.html |-- index.js |-- .babelrc |-- package.json |-- webpack.config.js |-- yarn.lock
Next we need to add some code. We'll start out with something simple just to verify that our set-up so far works.
Open up
index.js and add:
/* ./client/index.js which is the webpack entry file */ console.log('Hey guys and ladies!!')
Update
index.html to:
/* ./client/index.html basic html skeleton */ <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>React App Setup</title> </head> <body> <div id="root"> </div> </body> </html>
The
index.html is the actual webpage which loads our React Components on the browser. I mentioned before that we need
babel in order to compile our code into a syntax that browsers support. We code our React components using
JSX and in our case we will also use
ES6. The syntax of these two modules is not supported by most browsers therefore, we have to run this code through the
babel loaders and then the bundled output is what we'll specify to be displayed on index.html.
One way to add the bundled file to our HTML is to insert a
script tag and pass the location of the bundled file into the script tag. A better way to do this is to use this nifty package called
html-webpack-plugin. It provides an easy way to have all your HTML generated for you. All you need is the standard HTML skeleton and it'll take care of your script insertions with just a few configurations. Let's do that next.
Html-Webpack-Plugin
First, we'll install the plugin. Make sure your terminal is currently reading you're root project folder,
hello-world-react, then enter the following command:
> yarn add html-webpack-plugin
Then open up your webpack.config.js and add a few configurations.
/* ./webpack.config.js */ const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({ template: './client/index.html', filename: 'index.html', inject: 'body' }) module.exports = { ... module: { rules: [ ... ] }, // add this line plugins: [HtmlWebpackPluginConfig] }
The configuration is pretty self-explanatory. We require the
html-webpack-plugin and then create a new instance of it, and set our skeleton HTML as the
template.
filename refers to the name of the HTML that the plugin will generate.
inject body tells the plugin to add any JavaScript into the bottom of the page, just before the closing
body tag.
Run it!
We are almost at the finish line. Let's try run our setup. We just need to do one tiny thing first. Open up your
package.json and let's add a start script.
/* ./package.json */ { "name": "hello-world-react", "version": "1.0.0", "main": "index.js", "license": "MIT", // add the scripts key to your package.json "scripts": { "start": "webpack-dev-server" }, "dependencies": { ... }, "devDependencies": { ... } }
Now we can go to our terminal and run:
> yarn start
Open your browser on. If you check your console you'll see our message
"Hey guys and ladies!!". The reason we use localhost:8080 is because
webpack-dev-server serves all our files on port
8080. Notice
webpack-dev-server is run when we execute our start script.
Yay, it works. So let's add a simple React Component and see what happens.
React, React, React
I'll do a very basic Hello World React Component. We need to install React dependencies first.
> yarn add react react-dom
Next in the
client folder we can add a folder named
components and create a file
App.jsx.
> cd client > mkdir components > cd components > touch App.jsx > cd ../..
So our file structure now looks like this:
. |-- client |-- components |-- App.jsx |-- index.html |-- index.js |-- .babelrc |-- package.json |-- webpack.config.js |-- yarn.lock
While naming component files in React the convention is to use
PascalCase thats why our file name starts with a capitalized letter.The extension could be either
.jsx or
.js, I find it better to explicitly use the
.jsx extention on files that I intend to use
JSX syntax.
Next let's update the
App.jsx file:
/* ./client/components/App.jsx */ import React from 'react'; export default class App extends React.Component { render() { return ( <div style={{textAlign: 'center'}}> <h1>Hello World</h1> </div>); } }
Lastly, we render our component from our start file,
index.js. Let's replace the
console.log() with:
/* ./client/index.js */ import React from 'react'; import ReactDOM from 'react-dom'; import App from './components/App.jsx'; ReactDOM.render(<App />, document.getElementById('root'));
Open bash and start our project. Make sure your terminal reads that you are on the project root folder.
> yarn start
There we go! Ecstatic that you got all the way to the end!!
Conclusion
We now have a working React Environment set-up. I hope that this tutorial shed some light on what the configurations really do and why we need them. Also, if the set-up is a bit too tasking to do on every project you can always fork my repo and have a base to start from.
Please feel free to experiment around with different webpack configurations and hit me up with any cool things you've discovered on the comment section.
Finally, you can and should try build up a more in depth React Project after the tutorial. Cheers!! | https://scotch.io/tutorials/setup-a-react-environment-using-webpack-and-babel?utm_source=mybridge&utm_medium=blog&utm_campaign=read_more | CC-MAIN-2018-22 | refinedweb | 1,858 | 66.74 |
GKE Autopilot is a fully managed Kubernetes cluster solution from Google, released last week in GA, that brings together all the best features in scaling, security, data operations the Google way. And the key to this new product, you only pay for the pods that you use, and the billing is based on the total of vCPU, memory and storage requested!
But hang on, was the “old” Google Kubernetes Engine not fully managed already?
GKE was indeed already a very hands-off Kubernetes cluster. With the standard GKE cluster, you don’t have to worry about the control planes as these are managed by Google. You also don’t have to worry about setting up storage providers and networking. Load balancers are created on-demand based on your ingresses, with secure cluster authentication switched on by default and the ability to auto-scale the number of nodes using the GKE cluster autoscaler. Automatic upgrades using release channels, etc.
So what is GKE Autopilot adding?
With GKE Autopilot, you no longer need to worry about the cluster nodes and what CPU/memory each node requires. Also since you no longer need to worry about nodes, there’s no need to guess how many nodes you need to run your workloads. And with that, you no longer need to guess how big your cluster nodes should be.
With GKE Autopilot, all you need to worry about is to have a bit more discipline in detailing the workloads that will run in the kubernetes cluster. This means that it is very important for your Kubernetes resources Yaml to have an accurate figure for how much vCPU and Memory each container requires, no more no less(more on that later).
With this in mind, instead of being charged a cost per node, you get charged a cost based on the total amount of CPU, memory, and ephemeral storage that is requested. The key here is, requested.
For example, see the following resource request for a wordpress pod :
...
containers:
- name: wordpress
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "128Mi"
cpu: "100m"
In the YAML definition above we request for a 1/10 of a CPU core and a 128Mb of memory to be allocated to the WordPress container.
What you actually pay for, with GKE Autopilot, is the requested resources.
Just to have an idea of how much it would cost using GKE Autopilot, I did a completely random simulation for the potential cost of a workload that totals 730 vCPU hours and 712,891 memory hours for a single pod that requests a whole CPU core to itself. You end up paying at least 39.99 USD per month. Note that this value is just an estimation and varies between different GCP regions.
GKE AutoPilot Management Fee
Now we need to talk about the management fee. There is $0.10/hour/cluster management fee for a GKE Autopilot cluster to also pay.
If you only have one GKE Autopilot cluster, you receive a credit of $74.40 which covers the total of the management fee. This means that you have zero management fee in that case.
If you need to have more than one GKE AutoPilot cluster or any other cluster in the same project or in other projects linked to the same billing account, then the management fee kicks in.
Google thinks that for large customers they definitely save money because most of us are incredibly bad at estimating the correct amount of nodes and resources needed to run a production workload. I think I agree.
GKE Autopilot Restrictions
GKE Autopilot does have plenty of restrictions, however. Let’s just briefly discuss some of the ones that caught my attention. You can see an exhaustive list here.
You can’t modify kube-system namespace
First of all, you are not able to modify the kube-system namespace anymore. Therefore you will be prevented from adding new storage providers or do any changes related to networking.
No permissions to modify cluster nodes
Since you don’t have to worry about how many nodes you need to run, you no longer have access to modify anything to do with the nodes. You can actually see the nodes with Kubectl. But you can’t touch them.
No Node affinity pods anymore
Since you can’t control how many nodes your cluster has or when/how they run it is only natural that you no longer can use node affinity for your pods. Instead, you can rely on pod affinity if you need two or more pods to run in the same node.
A limited number of Storage Classes available to use
You are also limited from using many storage classes available in Kubernetes as that would require access privileges to the nodes.
Resource limits need to be equal to requested resources
Perhaps, this restriction is to make it easier for Google to bill you better, with GKE Autopilot, you lose the ability to set a resource limit higher than the requested CPU and memory resources. You need to ensure that you give from the start enough resources to your pod, no less, no more.
You might have noticed in the example YAML above that the requested resources(CPU and Memory) are equal to the upper limit of resources. This is not a mistake. If you try to set a higher limit, GKE Autopilot will just override your limit and make it equal to the requested value.
Security
We all love security, don’t we? GKE Autopilot comes with Workload Identity enabled and Shielded GKE Nodes, and there is no choice.
Shielded GKE nodes are great, not much to say against that. Who wants a potential attacker to pretend they are a node in your cluster.
However, being forced to use Workload Identity?
This is indeed more secure, but it also means that configuring access to GCP resources to using IAM service accounts will be a lot more involved and complicated.
This is all I have to say for now. I am currently working on my own POC using GKE Autopilot and will share any more findings soon!
Do look at the links below for further information. And feel free to comment in case I have missed something important, or if I am completely wrong!
Resources: Podcast from Google: Episode 139 – GKE Autopilot, with Yochay Kiriaty
LIN SUN: Yeah, it was in San Diego at one of the ports, and we went out for a cruise for, I think, two hours? And there…kubernetespodcast.com
How do you create a zonal AutoPilot cluster? seems to indicate that you can only create regional clusters with AutoPilot.
Hi Bryan,
Thanks for the question. My mistake, I got confused with the pricing. The free credit applies to an autopilot cluster and it can only be regional. So you don’t have an option to select.
Which is great. Better deal than I initially thought.
Kind Regards,
Armindo | https://spltech.co.uk/my-initial-thoughts-on-googles-launch-of-gke-autopilot/ | CC-MAIN-2021-31 | refinedweb | 1,158 | 71.55 |
The objective of this tutorial is to explain how to set an asynchronous HTTP web server on the ESP8266, using the Arduino core. This tutorial was tested on a DFRobot’s ESP8266 FireBeetle board.
Introduction.
In order to setup the server using a high level API, we will use this library, which takes care of all the lower level details. The library is also available for the ESP32 and you can check here an introductory tutorial for that microcontroller.
This tutorial was tested on a DFRobot’s ESP8266 FireBeetle board.
Installing the libraries
As mentioned in the introduction section, we will need to install the ESPAsyncWebServer library in order to access the high level functions needed to setup the HTTP webserver.
Additionally, we will also need to install the ESPAsyncTCP library, which is an asynchronous TCP library for the ESP8266. This library is used under the hood by the ESPAsyncWebServer library and thus is a dependency that we need to satisfy.
In order to install the libraries, we can download their source code and place it under the Arduino libraries folder of our installation.
To download each library, go to their GitHub page and click the “Clone or download” button at the top of the page, as indicated in figure 1.
Figure 1 – Downloading the libraries source code.
Then, simply select the “Download ZIP” option and the files should be transferred to your computer.
After that, extract the files to your Arduino IDE libraries directory, which is usually located in the following path:
C:\Users\UserName\Documents\Arduino\libraries
Take in consideration that the extracted folders should have a -master appended in the name. Delete that appended -master and keep the remaining name.
Once the procedure is complete for both of the libraries, they should be available to use on the Arduino environment.
The code
We start the code by making the necessary library includes. First of all, we will need the ESP8266WiFi.h, so we can connect the device to a WiFi network and later receive the HTTP requests.
Then, we will also need to include the two libraries we have just installed, namely the ESPAsyncTCP.h and the ESPAsyncWebServer.h.
#include "ESP8266WiFi.h" #include "ESPAsyncTCP.h" #include "ESPAsyncWebServer.h"
We will also declare two global variables which will hold the credentials of the WiFi network to which we are going to connect the ESP8266. We will need both the network SSID (network name) and password.
const char* ssid = "YourNetworkName"; const char* password = "YourNetworkPassword";
To finalize the global variables section, we will declare an object of class AsyncWebServer, which will expose the methods needed for us to setup the HTTP server and handle the incoming requests.
It’s important to take in consideration that the constructor of this class receives as input the port where the HTTP server will be listening for incoming requests. This value is relevant for the client to be able to connect to the server.
In our case, we will use port 80, which is the default HTTP port. Thus, since our client will be a web browser, it will use port 80 by default and we don’t need to explicitly specify it. In case we use a port different than 80, we need to specify it when contacting the server using a web browser.
AsyncWebServer server(80);
Moving on to the setup function, we will open a serial connection and then we will connect the ESP8266 to the WiFi network to which we provided the credentials as global variables.
WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting to WiFi.."); }
After the connection is established, we will print the ESP8266 IP on the local network, so we can then reach the server. Please note that we will only be able to reach the web server from inside the local network to which the ESP is connected.
In order to reach the web server from outside the local network we would need to portforward the router, which is a more advanced procedure that we will not cover here.
Serial.println(WiFi.localIP());
Now that we have connected the device to a WiFi network and obtained its local IP, we will handle the web server configuration.
Thus, we will setup a server route and a handling function that will be executed when a request is made on that route. To do it, we simply call the on method on our previously declared server object.
As first input of this method, we pass a string with the route where the server will be listening for incoming requests. We will be listening on the “/rand” route.
As second argument, we need to pass an enumerated value which indicates the HTTP methods allowed on the route. For this example, since we are simply getting random numbers generated by the ESP8266, we will be listening only for HTTP GET requests. Thus we pass the HTTP_GET value.
As third and final argument, the on method receives the handling function that will be executed upon receiving the request. This function needs to follow a fixed signature, more precisely, it needs to return void and receive as input a pointer to an object of class AsyncWebServerRequest.
Each client that makes a request will have one of these objects associated with it and we will also use this object to send back the response.
In order to keep the code compact and to avoid declaring a named function, we will define our route handling function as a C++ lambda.
Although for this simple example the overhead of declaring a named function wouldn’t be big, for more complex projects where we have many routes that have simple implementations, declaring a named function for each one would make the code more complex.
server.on("/rand", HTTP_GET, [](AsyncWebServerRequest *request){ // Handling function implementation });
To send back a response to the client, we just need to call the send method of the AsyncWebServerRequest object that we receive on our handling function.
This method receives as first input the HTTP return code, which will be 200 (OK) for our example.
As second argument, it receives the content-type, which will be “text/plain“, since we are simply going to return a random number.
As third argument we will pass the actual content to be returned to the client. In our case, it will be a random number that we can generate by calling the Arduino random function
The random function can be called passing as input the upper bound (exclusive) of the random generated numbers. We will pass 1000 and thus this function should return a value between 0 and 999.
Note that we need to convert the integer returned by the random function to a string, so we can pass it to the send method.
server.on("/rand", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(200, "text/plain", String(random(1000))); });
To finalize the server setup, we need to call the begin method of the server object, so the server starts listening for incoming requests. With this we finish the Arduino setup function.
server.begin();
Since the server implementation is asynchronous, we don’t need to call any handling function on the main loop, which we can leave empty. This is a better approach regarding the original ESP8266 HTTP server implementation, where we would need to call a client handling function periodically. You can check here a tutorial on that implementation.
You can check the full source code for this ESP8266 tutorial below.
#include "ESP8266WiFi.h" #include "ESPAsyncTCP("/rand", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(200, "text/plain", String(random(1000))); }); server.begin(); } void loop(){}
Testing the code
To test the code, first compile it and upload it to your ESP8266 microcontroller using the Arduino IDE.
When the uploading procedure finishes, open the Arduino IDE serial monitor and wait for the device to connect to the WiFi network. Once it is connected with success, an IP should get printed. Copy that IP.
Finally, to make the request to the server and obtain the random number, open a web browser of your choice. On the address bar, type the following, changing #yourDeviceIp# by the IP you just copied.
You should get an output similar to figure 2, which shows the random number returned by the ESP8266. Naturally, each request should return a different number, since a value between 0 and 999 is being randomly generated.
Figure 2 – Random number generated by the ESP8266.
Final notes
This simple example illustrates how to setup an asynchronous HTTP server on the ESP8266, which removes the overhead of periodically needing to check for incoming requests.
This is a far superior approach since, as mentioned in the library page, it allows handling more than one connection at the same time.
One important thing to mention is that we have the freedom to do whatever we want on the handling function. In our simple example, we were just generating a random number, but we could have been sending commands to some actuator or retrieving measurements from a sensor.
Related posts
- ESP32 Arduino HTTP server: Running multiple server instances
- ESP32 Arduino HTTP server: Getting query parameters
- ESP32 Arduino async HTTP server: Serving a HTML page from FLASH
- ESP32 Arduino async HTTP server: Serving HTML
- ESP32 Arduino: Asynchronous HTTP webserver
20 Replies to “ESP8266 Arduino: Asynchronous HTTP web server”
Hi thank you very much for this post, but we are not able to include these libraries in our project.It will be very helpful if you instruct us
Hi, I am using ESPAsyncWebServer for a HomeBridge lock project.
I am still trying to learn Arduino and ESP because I am not from this field but have enormous interest in them and found myself loving them.
I have always tried to stay away from http/client/server because I thought these topics were pretty hard to understand but since starting this hobby project, I found them getting easier to understand especially after your tutorials. For that, I thank you.
Now, my problem is as follows.
I was trying to send a http.GET request as a httpClient to ASyncWebServer set up on the same ESP8266 like:
server.on(“/lockTargetState/1”, HTTP_ANY, [](AsyncWebServerRequest *request){
request->send(200, “text/plain”, “OK”);
…
http.begin(“”);
http.GET();
…
}
That gives me a http.code -1 “connection refused” error.
So, I thought it must be because of the httpGet request inside the server handler function and thus move the httpGet out of the lambda function and instead just used a boolean flag inside lambda function so that the httpGet request can be called from the main loop.
But the “-1 connection refused” error still persists.
I thought it was because I was using both Server and httpClient inside the same sketch and/or same ESP8266, so, I inserted the httpGet JSON example link and it works and I got JSON response but when I reverted to the problem link, the error returns. I searched google and found that there are people who have multiple servers and multiple clients on the same ESP and have no problem with them.
I think my problem is due to the client trying to send httpGet request as a client while on the same server. But actually I have no idea. I’ve been stuck in this situation for like 2 weeks already. I’ve even added boolean flags like
while(!serverBusy){;}
to check and wait if the server is handling clients before sending httpGet request but still getting connection refused.
Please kindly advise. | https://techtutorialsx.com/2018/01/01/esp8266-arduino-asynchronous-http-web-server/ | CC-MAIN-2020-40 | refinedweb | 1,917 | 60.75 |
Opened 12 years ago
Closed 10 years ago
#5667 closed defect (fixed)
[Patch] Added compatibility with PostgreSQL
Description
Based on #3290, I have modified formdb.py to work with PostgreSQL. The changes done by #3290 basically worked except the creation of tables and indexes. Following changes were required to make it work with PostgreSQL:
- The syntax for auto incrementing fields of PostgreSQL differs from sqlite and mysql. - Primary keys must be defined in the line of the column, instead of at the end of the CREATE TABLE statement. - Use DROP INDEX ... instead of ALTER TABLE ... DROP INDEX ... - Omit DESC keyword when creating indexes.
Maybe you can switch for the database backend when creating the tables and indexes. It would be nice if it would work out of the box with PostgreSQL. TracFormsPlugin is the only of 5 plugins I am using which didn't worked out of the box after migrating to MySQL.
Attachments (7)
Change History (32)
Changed 12 years ago by
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
comment:3 Changed 11 years ago by
Thanks for the ground work.
Patch looks good so far (not tested by now), so you made fixing that issue really easy as far as I can see. So this should be resolved soon.
comment:4 Changed 10 years ago by
Uh, this is not a patch but a whole new file.
I may find some time to diff it against a current version and add similar syntax to the newer upgrades as well. Still in general a true diff (diff -u upstream_file modified_file) plus mentioning the code revision used as base for the modifications would be appreciated.
comment:5 follow-up: 6 Changed 10 years ago by
I don't remember why I don't have created a patch. However as far as i remeber it was based on TracForms 0.2.
comment:6 Changed 10 years ago by
Replying to s.noack@placement24.com:
I don't remember why I don't have created a patch. However as far as i remeber it was based on TracForms 0.2.
Ok, thanks for clarification.
I'm very busy integrating new features these days, so you could largely reduce the time between now and PostgreSQL of the current db schema by updating your patch to
trunk. Interested? I'm ensure, that I'm willing to integrate changes that look reasonable and come pre-tested, only I still can't do testing of alternative db engines on my own due to time constraints.
Changed 10 years ago by
patch derived from previous contribution, last db schema changes adapted too
comment:7 follow-up: 8 Changed 10 years ago by
Anyone able and willing to test the updated changes?
Your feedback would significantly speedup that work. Thanks in advance.
comment:8 follow-up: 9 Changed 10 years ago by
Anyone able and willing to test the updated changes?
Your feedback would significantly speedup that work. Thanks in advance.
I've been following the development of TracFormsPlugin, and I was happy to know that it is progressing. My system is: Trac 0.12 + PostgreSQL 8.4 + Python 2.6.
I applied the referred patch in 0.3 and 0.4dev releases, and when running
trac-admin <...> upgrade I got some sintaxe error messages, which I correct manually in the code. Here is the little diff:
382d381 < ); 558d556 < ) 765d762 < )
But still I got another error message:
ProgrammingError: type "tracform_id" does not exist LINE 4: tracform_id 'id', updated_on 'time', ^
This SQL appear in the line 630 from
formdb.py, and I don't know what changes need to be make..
Changed 10 years ago by
revised compatibility patch
comment:9 Changed 10 years ago by
Nice to hear about interest in the development.
![...] I got some sintaxe error messages, which I correct manually in the code. Here is the
Ok, this is easy. Just missed correct matching brackets. I think that the semicolon is not needed in this statements as it appears inconsistently. Please check, if this is clean now.
But still I got another error message: ![...] This SQL appear in the line 630 from
formdb.py, and I don't know what changes need to be make.
I've checked the PostgreSQL docs and this is most probably related:
The AS Key Word
In the SQL standard, the optional key word AS is just noise and can be omitted without affecting the meaning. The PostgreSQL parser requires this key word when renaming output columns because ...
I've added a specific, alternative statement that could work. Only I'm not entirely convinced regarding the quoted and unquoted column names..
Don't worry. I think we could get it working in no time, if you stay with me for resolving this ticket. 0.2 is history, actually focussing on 0.4, but I deferred 0.3.1 until now to include the PostgreSQL compatibility code there as well.
Because you mentioned submit buttons: Be sure to grant required permission (
FORM_EDIT_VAL) as needed to re-enable them for TracForms >= 0.3 .
comment:10 follow-up: 11 Changed 10 years ago by
Thanks for the response. I tried the new patch (
TracForms-0.4dev_r10152). Here is the log:
SQL ERROR: syntax error at or near "'id'" LINE 4: tracform_id AS 'id', updated_on AS 'tim... ^
Although I use PostgreSQL, I don't know much about databases - barely know something about SQL itself. Learn more about this is in my TO-DO list.
I also tried the following:
'id' AS tracform_id, which fix sintax error, but generates a new one (which is not so surprising):
ProgrammingError: column "id" does not exist LINE 1: SELECT id,time,old_state FROM forms_history
'tracform_id' AS id.
ERROR: EXECUTING SQL: CREATE INDEX forms_history_id_idx ON forms_history(id) () SQL ERROR: data type unknown has no default operator class for access method "btree" HINT: You must specify an operator class for the index or define a default operator class for the data type.
This was me fooling around, little blindly. Hope to be more helpful next time.
Changed 10 years ago by
unquoted column names for PostgreSQL
comment:11 Changed 10 years ago by
Thanks for the response. I tried the new patch (
TracForms-0.4dev_r10152). Here is the log:
Thank you for the quick response. So it was at least a partial fix.
This was me fooling around, little blindly. Hope to be more helpful next time.
Never mind. I've attached another small variation, that could get it done. I'm looking forward to your findings. Good luck.
comment:12 follow-up: 13 Changed 10 years ago by
Moving foward! I've tested the new patch. In deed, the right sintax is
tracform_id AS id - without single quotes. SQL for table
forms_history did run OK, but there was another one for table
forms_fields (line 703) - I adapted by creating a postgre option and correcting sintaxe just like in
forms_history instructions. Finally, the all the db update did run OK. permission.
comment:13 Changed 10 years ago by
Moving foward! I've tested the new patch. In deed, the right sintax is
tracform_id AS id- without single quotes. SQL for table
forms_historydid run OK, but there was another one for table
forms_fields(line 703) - I adapted by creating a postgre option and correcting sintaxe just like in
forms_historyinstructions. Finally, the all the db update did run OK.
Got it, so this should be fine. Thank you.permission.
If you didn't grant that permission, it simply wouldn't be there. "Doesn't work" is a functional problem. This time it's about the db cursor implementation (see
tracdb.py too).
The error is raised from executing
formdb.py line 131-138:
form_id = cursor(""" INSERT INTO forms (realm, resource_id, subcontext, state, author, time) VALUES (%s, %s, %s, %s, %s, %s) """, realm, resource_id, subcontext, state, author, updated_on) \ .last_id('forms', 'id')
and the logic behind the
last_id property is in
tracdb.py line 103-104:
def last_id(self, cursor, table, column='id'): return self.db.get_last_id(self, table, column)
inherited from the logic in Trac itself (see trac.db.postgres_backend):
def get_last_id(self, cursor, table, column='id'): cursor.execute("SELECT CURRVAL('%s_%s_seq')" % (table, column)) return cursor.fetchone()[0]
Information explaining what's going on here could be found i.e. at
Especially from the last two definitions you can see that
last_id in
formdb.py line 138 is missing the
cursor attribute. I've tested with SQLite, and it does no harm. This is included in the next patch version for you. I suspect, that we've found a hidden bug due to stricter parser logic of PostrgreSQL. Looks like digging into the new SQL flavor has already payed back.
Summary of late changes:
tracformsplugin/trunk/0.11/tracforms/formdb.py
diff --git a/tracformsplugin/trunk/0.11/tracforms/formdb.py b/tracformsplugin/trunk/0.11/tracforms/formdb.py
Since this has been a travel to the outer perimeters of my programming and SQL knowledge, I'm eagerly awaiting your findings. Good luck.
Changed 10 years ago by
compatibility patch updated with second create table and
-last_id fix
comment:14 follow-up: 15 Changed 10 years ago by
Hi. I put the missing
cursor attribute like in the diff. Something curious happen: the handler
/form/update sends the following message (that I coudn't find in debug log):
'DBCursor' object has no attribute 'fetchone'
When trying refresh the page (resending
/form/update), I got
Conflict message - values already set in db? Going back to the wiki page: the values was recorded in deed. I've try new submits: all works fine!
I also try with new pages: this error really just happen in the first submit. And with tickets, I have to use the macro
[[subpage()]] because
[[Include()]] doesn't work - also here, the error occours only in the first submit.
comment:15 Changed 10 years ago by
Hi. I put the missing
cursorattribute like in the diff. Something curious happen: the handler
/form/updatesends the following message (that I coudn't find in debug log):
'DBCursor' object has no attribute 'fetchone'
Last thing first: I often encounter such a situation myself, that there's nothing in the logs, if the error is displayed in the browser window. Maybe I'll find some time to improve direction/duplication of output for such events. But this is more of a long-term goal.
Another research is needed for the error regarding the
fetchone attribute. I'll look into it and comment later. Thank you again for your testing effort. But it looks encouraging, that we've obviously moved beyond the point, where we encounter fatal errors.
When trying refresh the page (resending
/form/update), I got
Conflictmessage - values already set in db? Going back to the wiki page: the values was recorded in deed. I've try new submits: all works fine!
Expected. You can't send the same revision twice. You need to go back to the parent page URL. I could only try to add a redirect-back-to-referrer-on-error logic and show the failure on top of the page. What do you think?
I also try with new pages: this error really just happen in the first submit.
This is a very helpful observation indeed.
And with tickets, I have to use the macro
[[subpage()]]because
[[Include()]]doesn't work - also here, the error occours only in the first submit.
Really? I did use the IncludeMacro hundreds of times in my tickets with Trac 0.13dev without problems. But regarding TracFormsPlugin this is slightly off-topic here. Better mention this inside a ticket directly assigned to IncludeMacro, please.
Changed 10 years ago by
enable debug traceback for all calls to
fetchone
comment:16 Changed 10 years ago by
comment:17 Changed 10.
Changed 10 years ago by
major SQL rewrite following best practice for Trac < 0.12, see Trac db API docs
comment:18 Changed 10 years ago by
Attached latest changes, that should lead to code for the next major TracForms version:
formdb.py | 717 +++++++++++++++++++++++--------------------------------------- model.py | 6 tracdb.py | 212 +++++++----------- web_ui.py | 1 4 files changed, 356 insertions(+), 580 deletions(-)
As you'll see this is a big code-cleanup resulting in totally different db handling. By design this will release db connections faster i.e. optimized for concurrent db access. And largely based on proved Trac core code we'll be able to support upcoming Trac versions without major headache.
I'd be happy, if you could patch this on-top of current
trunk, test and report back your findings.
Hint: I've introduced a second, direct install method that is executed, if no previous TracForms version is detected. So you're no longer jumping through all the loops of TracForms db schema history but will be lifted up to the top in an instant. This should improve first install experience a lot. Give it a try inside of a (fresh) test environment with PostgreSQL db configured as well, please.
comment:19 Changed 10 years ago by
Side-note: We'll need compatibility code or a dedicated 0.13 branch to cope with the current
with_transaction db handling since 0.12 - again slightly modified in 0.13, where the old
env.get_db_cnx is already strongly depreciated now. Obviously it will no longer be available in future Trac versions.
comment:20 follow-up: 21 Changed 10 years ago by
Sorry about the delay. Today I've tested the newest
trunk, with both a "fresh" enviroment, and with the old one (with tables already created). Neither of them did work. I mean, the error
'DBCursor' object has no attribute 'fetchone' still happens only in the first submit.
I put the
traceback calls like in the debug patch and did sent the
debug log to your email (
hoff.st@web.de, as in
setup.py). I hope it can be useful.
Nice work with de plugin and the dedication to make it right.
comment:21 Changed 10 years ago by
Sorry about the delay.
Hey, np.
Today I've tested the newest
trunk, [...]
Well, the last patch has not been committed 'til now, so this was most probably not the correct code for the test. Since it's such a big change, I intended to test more before actually committing it. Sorry for the irritation caused that way at your side. See your mail for my direct reply/next step.
comment:22 Changed 10 years ago by
Just a quick catch-up for public tracking of some private test releases and corresponding testing.
After a request at trac-dev and kindly response by Remy Blank with some valuable hints on the right way to use Trac db cursors I was able to improve the code to a nearly working state by now:
Commenting an email by nelsojost on 05/17/2011 20:27:
I've tested "20110514_tracforms_sql-fixup.tgz" first with the existing db. All works really well! Not a single error message on a debug log. I also took a look into database records: all seems ok.
But when testing in a fresh new enviroment, an error occours in upgrade attempt: IntegrityError: duplicate key value violates unique constraint "system_pkey"
So a final commit is near, hopefully this week considering the current pace of development. The shortcut saved us some more useless iterations here.
More testers for MySQL and PostgreSQL still very welcome. Please contact me, if you're interested in the early (pre-release) beta for TracForms 0.4 - before the next commit. Soon it'll be all public again anyway.
comment:23 Changed 10 years ago by
comment:24 Changed 10 years ago by
(In [10211]):.
comment:25 Changed 10.
See also #5608. | https://trac-hacks.org/ticket/5667 | CC-MAIN-2021-39 | refinedweb | 2,624 | 66.74 |
>
I'm new to Unity and scripting in general. I am currently learning the basics and have created a simple character move script that includes jumping.
In Unity I have just drawn a couple of cube game objects to act as a platform with 2D colliders attached.
My 'character' is just another 2D cube that can travel left and right across the platform's and jump by detecting the ground with a Linecast.
My problem is this: When moving the character cube along the platform and pressing the jump key I have assigned, it sometimes doesn't jump as if it doesn't realise I've pressed the jump key. It's almost like it has to delay the next jump?
Here is my code (comments for my own learning):
sing UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour { //this script is attached to the player game object
//player
public float speed; //declare the player move speed in Unity inspector
public int jumpHeight; //this is set in the Unity Inspector
public bool isGrounded = false; //this can be seen working in the Unity inspector
public Transform groundedEnd; //declares the empty game object in Unity acting as a collider set to the position of the player
void Start () {
}
void FixedUpdate ()
{
Movement (); //call the movement function below
isGrounded = Physics2D.Linecast(this.transform.position, groundedEnd.position, 1 << LayerMask.NameToLayer("Ground"));
//the above line of code draws a linecast downwards to detect the ground game objects that have been placed in a ground layer
}
void Movement()
{
//Move Right
if (Input.GetKey (KeyCode.D))
{
transform.Translate (Vector2.right * speed * Time.deltaTime);
transform.eulerAngles = new Vector2(0,0);
}
//Move Left
if (Input.GetKey (KeyCode.A))
{
transform.Translate (Vector2.right * speed * Time.deltaTime);
transform.eulerAngles = new Vector2(0,180); //flip the character on its x axis
}
//Jump by detecting if the user presses W and then checking to see if the linecast is touching the ground
if (Input.GetKeyDown (KeyCode.W) && isGrounded == true)
{
//Add force to the players rigidbody allowing it to move upwards if the above if statement is true
rigidbody2D.AddForce (Vector2.up * jumpHeight);
}
}
}
Here is the Unity view:
Thanks in advance for any help!!
I would like to say that flipping your character on the x axis might be useless if your character is a square, but I'm not sure if you were going to change the sprites at some point.
i highly recommend OnCollisionStay to detect if your player is grounded. It's easier on the CPU and more accurate if you are walking on angles surfaces!
Answer by mrlchristie
·
May 08, 2014 at 06:26 PM
Putting the jump part of my code in an Update function seemed to sort it out.
Ideally, you're supposed to have all calls to Input in Update functions, and physics calls, including most calls to Rigidbody2D, in FixedUpdate functions.
Cheers, Pyrian. I've also just watched the 2D character controller tutorial on the Learn section and it's also mentioned.
2D Sidescroller enemy AI jump help! Picture Included!
3
Answers
Creating A wall Jump
0
Answers
I only want my character to jump when touching the ground
4
Answers
How to fix Jump problem with 2d Platformer Unity demo game?
0
Answers
2d Platformer Jumping Not Working
1
Answer | https://answers.unity.com/questions/699929/advice-needed-on-my-first-c-2d-jump-script.html | CC-MAIN-2019-22 | refinedweb | 544 | 59.43 |
Zippers continue to fascinate me. Let’s recap a bit: a zipper is a data structure representing the navigation and mutation of an otherwise immutable structure. We’ve looked at several different implementations here on the LShift blog, in several different languages.
Today, we’re going to see what else we can do with zippers.
When we implement a Huet-style zipper (in other words, we use a recursive structure based on one-hole contexts instead of directly using partial continuations), we implement a bunch of primitive behaviours – left, right, replace, insert child, and so on. Let’s assume we have all that.
The first obvious thing to do is to define a traversal. We need two essential elements for a traversal – a means of knowing when we’re done, and a means of moving to the next element. Now there’s a teeny hitch. Given a zipper over some hierarchical structure, it seems most natural to describe our traversal in terms of recursion – after all, we’re working with a recursive structure. Ruby doesn’t require proper tail call elimination (even though, apparently, some implementations support it). We don’t want stack overflows from too-deep recursion, so we’ll reach into our toolbox and haul out a trampoline:
result = unary_block.call(initial_value)
while result.kind_of?(Proc) do
result = unary_block.call(result.call)
end
result
end
A trampoline will take some block, and invoke it with the given initial value. If the block yields a
Proc (what the Lispers would call a thunk – a parameterless
Proc that delays the evaluation of some chunk of code), it will invoke the block with this
Proc, and repeat that process until the block yields something that’s not a
Proc. Finally, it will return that non-
Proc value. With tool in hand, we can now write a recursive pre-order traversal, confident that we won’t blow our stack even on large structures. Note that this particular zipper uses “safe” navigation, wrapping up results in the Either monad.
# traversal of my children, left to right".
def next
if not has_next? then
return @zipper
end
if @zipper.branch?(@zipper.value) then
return @zipper.down
end
right_sibling = @zipper.safe_right
if right_sibling.right? then
return right_sibling.value
end
# Return a Zipper if there's a next, with a distinguishable context
# for the last element of the traversal.
# This algorithm returns a thunk when it wishes to recurse.
# The trampoline converts this CPS-like algorithm into one
# that runs in constant space.
trampoline(@zipper) { |z|
parent = z.safe_up
parent.either(->parent_z{
uncle = parent_z.safe_right
uncle.either(->z{ next z},
->unused_error{ next ->{parent_z}}) # Recur
},
->unused_error{
# We've popped up the structure all the way to the root node.
z.new_zipper(z.value, EndOfTraversalContext.new(z.context))
})
}
end
It’s easy to wrap up
next inside some object, and simply invoke the entire traversal with
each:
tree = Tree.new(1, [Tree.new(2, [Tree.new(3, [])]),
Tree.new(4, [Tree.new(5, []),
Tree.new(6, [])])])
t = PreOrderTraversal.new(tree.zipper)
answers = []
t.each { |value|
answers << value.value
}
answers.should == [1, 2, 3, 4, 5, 6]
end
where
each is defined thusly:
map { |node|
block.call(node)
node
}
end
# Return a same-shaped structure with the relevant mapping performed on
# each node.
def map(&unary_block)
# It's ridiculous to store the previous zipper to avoid a one-past-the-end
# error. It works, and it's simple, but it's _ugly_.
prev = @zipper
while has_next? do
@zipper = @zipper.replace(unary_block.call(@zipper.value))
prev = @zipper
@zipper = self.next
end
prev
end
We could just mix in
Enumerable and get
map and a whole lot more For Free… but
Enumerable#map returns an
Array, and I want
map to return something of whatever type it was fed.
Of course there’s nothing stopping us from implementing other traversals – post-order, in-order (for binary trees), or even breadth-first. What’s nice is that none of these traversal strategies have any knowledge about the structure over which they move! They just know about the zipper… and the zipper knows nothing about the structure, except
- Can this node have children?
- What are this node’s children?
- Given a parent node and children nodes, how do I make a new node?
With a traversal in hand, we’re free to jump into the land of higher order functions – map, fold, and the like. Now of course, as we just saw, these traversals know nothing about the underlying structure. That means that while we can implement a fold –
# and a binary block taking the thus-far-computed value (accumulator) and
# the current node.
def fold(initial_value, &binary_block)
accumulator = initial_value
each { |node|
accumulator = binary_block.call(accumulator, @zipper.value)
}
accumulator
end
– we will obviously have to tell the fold what to do. Actually, this is no different from your usual fold in Common Lisp or Smalltalk or Haskell. So given some kind of tagged tree with
Node and
Leaf elements, we could have
t = Node.new(:root, [Node.new(:left_subchild, [Leaf.new(1)]), Leaf.new(2)])
PreOrderTraversal.new(t.zipper).fold(0) { |sum, node|
sum + case node
when Node then 0
when Leaf then node.value
end
}.should == 3
end
So here we see how to apply all manner of transformations – mapping a tree to another tree of the same shape, folding a tree, insert our fondest desire – with the core mechanisms remaining firmly decoupled from our types. | https://tech.labs.oliverwyman.com/blog/2011/12/23/implementing-maps-and-folds-using-zippers/ | CC-MAIN-2019-26 | refinedweb | 903 | 57.57 |
In the user guide, we will look upon the BME680 environmental sensor, which is used to measure ambient temperature, barometric pressure, relative humidity, and gas (VOC) or Indoor air quality (IAQ). We will learn how to interface it with ESP32 and ESP8266 NodeMCU using MicroPython firmware. For demonstration, firstly, we will a simple MicroPython program for reading the BME680 sensor data and displaying it on the shell console of uPyCraft IDE and Thonny IDE. Furthermore, we will also see an example to display BME680 sensor readings on an OLED display.
><<
BME680 Sensor Module
- 0.96 inch OLED.
MicroPython BME680: Getting Temperature, Humidity, Pressure, and Gas Air Quality Values
As we have already uploaded the BME680 library to ESP32/ESP8266 boards. Now we can use the functions available in the BME680 library to get sensor readings.
Let’s now look at an example to show the working of the sensor. We will connect our BME680 sensor with the ESP module via the I2C protocol as shown above in the connection diagrams. We will see a MicroPython script code and after uploading it to our ESP boards, we will get readings of temperature, humidity, pressure, and Gas Air Quality printed on the MicroPython shell terminal.
BME680 MicroPython Code
Now let’s look at the MicroPython script for BME680 to get sensor readings. Copy the following code to the main.py file and upload the main.py file to ESP32/ESP8266 by following the same process we followed to upload the library file. This microPython script reads Temperature, Humidity, Pressure, and Gas Air Quality Values values from BME680 over I2C bus and prints them on the MicroPython shell console.
from machine import Pin, SoftI2C from time import sleep from bme680 import * # ESP32 Pins for SoftI2C i2c = SoftI2C(scl=Pin(22), sda=Pin(21)) # ESP8266 Pins for SoftI2C #i2c = I2C(scl=Pin(5), sda=Pin(4)) bme = BME680_I2C(i2c=i2c) while True: try: temperature = str(round(bme.temperature, 2)) + ' C' #temp = (bme.temperature) * (9/5) + 32 #temp = str(round(temp, 2)) + 'F' humidity = str(round(bme.humidity, 2)) + ' %' pressure = str(round(bme.pressure, 2)) + ' hPa' gas = str(round(bme.gas/1000, 2)) + ' KOhms' print('Temperature:', temperature) print('Humidity:', humidity) print('Pressure:', pressure) print('Gas:', gas) print('-------') except OSError as e: print('Failed to read bme680 sensor.') sleep(5)
How the Code Works?
Importing Libraries
Firstly, we will be importing the Pin class and SoftI2C class from the machine module. This is because we have to specify the pins for I2C communication. We also import the sleep module so that we will be able to add a delay of 5 seconds in between our readings. Also, import the BME680 library which we have previously uploaded to ESP32 or ESP8266.
from machine import Pin, SoftI2C from time import sleep from bme680 import *
The reason we have using SoftI2C class. Because I2C library has deprecated in MicroPython. We can define any GPIO pin to be used as SDA and SCL pins for I2C communication.
Defining ESP32/ESP8266 I2C Pins for BME680.
# ESP32 Pins for SoftI2C i2c = SoftI2C(scl=Pin(22), sda=Pin(21)) # ESP8266 Pins for SoftI2C #i2c = I2C(scl=Pin(5), sda=Pin(4)
Now, create an object of BME680_I2C() class from bme860 module with the name of “bme”.
bme = BME680_I2C(i2c=i2c)
Getting Sensor Values
Inside the while loop, get the sensor reading by using an object “bme” on temperature, humidity, pressure, and gas methods.
temperature = str(round(bme.temperature, 2)) + ' C' #temp = (bme.temperature) * (9/5) + 32 #temp = str(round(temp, 2)) + 'F' humidity = str(round(bme.humidity, 2)) + ' %' pressure = str(round(bme.pressure, 2)) + ' hPa' gas = str(round(bme.gas/1000, 2)) + ' KOhms'
After that print the values on the micropython shell console.
print('Temperature:', temperature) print('Humidity:', humidity) print('Pressure:', pressure) print('Gas:', gas) print('-------')
Demo
To test the MicroPython script for BME680 with ESP32 and ESP8266, upload the main.py file to ESP32/ESP8266. After uploading the MicroPython script, click on Enable/Reset button of ESP32 or ESP8266:
You will see the Temperature, Humidity, Pressure, and Gas Air Quality values on shell console as follows:
MicroPython: Displaying BME680 Sensor values on OLED Display
In this section, we will see how to display Gas, Pressure, Temperature, Humidity values on a 0.96 SSD1306 OLED display using MicroPython and ESP32/ESP8266.
SSD1306 OLED Display MicroPython Library
We have already uploaded BME680 MicroPython library to ESP32 and ESP8266 NodeMCU. For an OLED display, we will also need to upload library to ESP boards.
Copy the following code which is a MicroPython library of OLED and upload library using either uPycraft or Thonny IDE by giving it a name of ssd1306.py. You should follow the same procedure to upload library as we did for bme680.py.
# MicroPython SSD1306 OLED driver, I2C and SPI interfaces from micropython import const import time import framebuf import sys currentBoard="" if(sys.platform=="esp8266"): currentBoard="esp8266" elif(sys.platform=="esp32"): currentBoard="esp32" elif(sys.platform=="pyboard"): currentBoard="pyboard" import pyb #(self.buffer, self.width, self.height, framebuf.MVLSB)) def hline(self, x, y, w, col): self.framebuf.hline(x, y, w, col) def vline(self, x, y, h, col): self.framebuf.vline(x, y, h, col) def line(self, x1, y1, x2, y2, col): self.framebuf.line(x1, y1, x2, y2, col) def rect(self, x, y, w, h, col): self.framebuf.rect(x, y, w, h, col) def fill_rect(self, x, y, w, h, col): self.framebuf.fill_rect(x, y, w, h, col) def blit(self, fbuf, x, y): self.framebuf.blit(fbuf, x, y) #IF SYS : global currentBoard if currentBoard=="esp8266" or currentBoard=="esp32": self.i2c.writeto(self.addr, self.temp) elif currentBoard=="pyboard": self.i2c.send(self.temp,self.addr) #ELSE: def write_data(self, buf): self.temp[0] = self.addr << 1 self.temp[1] = 0x40 # Co=0, D/C#=1 global currentBoard if currentBoard=="esp8266" or currentBoard=="esp32": self.i2c.start() self.i2c.write(self.temp) self.i2c.write(buf) self.i2c.stop() elif currentBoard=="pyboard": #self.i2c.send(self.temp,self.addr) #self.i2c.send(buf,self.addr) self.i2c.mem_write(buf,self.addr,0x40).low() self.cs.low() global currentBoard if currentBoard=="esp8266" or currentBoard=="esp32": self.spi.write(bytearray([cmd])) elif currentBoard=="pyboard": self.spi.send(bytearray([cmd])) self.cs.high() def write_data(self, buf):.high() self.cs.low() global currentBoard if currentBoard=="esp8266" or currentBoard=="esp32": self.spi.write(buf) elif currentBoard=="pyboard": self.spi.send(buf) self.cs.high() def poweron(self): self.res.high() time.sleep_ms(1) self.res.low() time.sleep_ms(10) self.res.high()
Schematic – OLED with ESP32 and BME680
The table below shows the terminals of the three devices which would be connected together.
Assemble the circuit as shown in the schematic diagram below:
As you can see above, we have connected all the VCC terminals with a 3.3V power supply. The SCL terminals are connected with GPIO22 and the SDA terminals are connected with GPIO21. The grounds are also common.
MicroPython Code: Displaying BME680 readings on OLED Display
from machine import Pin,I2C from time import sleep import ssd1306 from time import sleep from bme680 import * i2c = I2C(scl=Pin(22), sda=Pin(21)) lcd=ssd1306.SSD1306_I2C(128,64,i2c) bme = BME680_I2C(i2c=i2c) while True: lcd.fill(0) try: temp = str(round(bme.temperature, 2)) + ' C' #temp = (bme.temperature) * (9/5) + 32 #temp = str(round(temp, 2)) + 'F' hum = str(round(bme.humidity, 2)) + ' %' pres = str(round(bme.pressure, 2)) + ' hPa' gas = str(round(bme.gas/1000, 2)) + ' KOhms' print('Temperature:', temp) print('Humidity:', hum) print('Pressure:', pres) print('Gas:', gas) print('-------') lcd.text("Temp. "+temp, 0, 0) lcd.text("PA "+pres, 0, 16) lcd.text("Hum. "+hum, 0,32) lcd.text("gas. "+gas, 0, 48) except OSError as e: print('Failed to read sensor.') lcd.show() #display pix sleep(5)
How Does the Code Work?
In the section, we only explained the Micropython code part which is used to display sensor values on OLED. Because reset of the code is the same as we have used in previous sections to display sensor readings on the shell console.
Import SSD1306 OLED library.
import ssd1306
Create an instance of the SSD1306_I2C() method by giving it the name of “lcd”. The first two arguments to SSD1306_I2C() are the size of OLED that is the number of columns and rows. A last argument is an object of I2C pins which we define with SoftI2C().
lcd=ssd1306.SSD1306_I2C(128,64,i2c)
Clears the OLED display with led.fill() routine.
lcd.fill(0)
Finally display the text along with sensor readings on OLED.
lcd.text("Temp. "+temp, 0, 0) lcd.text("PA "+pres, 0, 16) lcd.text("Hum. "+hum, 0,32) lcd.text("gas. "+gas, 0, 48)
At the end, call the show() method on lcd method for changes to show on OLED.
lcd.show() #display pix
Demonstration
Upload the above code as main.py file along with bme680.py and ssd1306.py to ESP32 or ESP8266. After that press the reset button on your ESP board. You will get sensor readings on OLED display as follows:
Video Demo:
If you want to display BME680 sensor values on a web page, you can check our BME680 web server project here:
We have other guides with popular sensors:
- MPU-6050 with ESP32/ESP8266 (Accelerometer, Gyroscope, and temperature)
- ESP32/ESP8266: Send Sensor Readings via Email (IFTTT)
- BME280 with ESP32 and ESP8266 – Measure Temperature, Humidity, and Pressure
- BME280 Web Server with ESP32/ESP8266 (Weather Station)
- MicroPython: DS18B20 Web Server with ESP32/ESP8266(Weather Station)
- MicroPython: DHT11/DHT22 Web Server with ESP32/ESP8266 (Weather Station) | https://microcontrollerslab.com/micropython-bme680-esp32-esp8266-gas-pressure-temperature-humidity/ | CC-MAIN-2021-39 | refinedweb | 1,602 | 50.33 |
The Data Science Lab
It's not quite like C# or Python, but the R language's object-oriented programming capabilities are getting better with each iteration. Let's take a look at what .NET developers are able do now with OOP in R6.
The R language was created primarily to perform statistical analyses in an interactive environment using hundreds of built-in functions such as t.test for Welch's t-test and aov for analysis of variance. From the very beginning R has had a basic scripting language with loop control structures, if...then decision control, and so on, but until recently, R object-oriented programming (OOP) capabilities were somewhat limited compared to languages such as C# and Python.
About 18 months ago, OOP with R took a significant step forward with the release of the R6 package. In this article I'll give you a quick tour of OOP with R6. Although the documentation for R6 is quite good, it's very detailed, which obscures some of the main ideas, and it assumes you're an experienced R user. I'll explain programming with R6 (technically scripting because R is interpreted rather than compiled) from the point of view of a .NET developer who is new to R.
To get an idea of where this article is headed, take a look at the screenshot of a demo R session in Figure 1. The outer container window is the Rgui.exe shell. Inside the shell, the window on the left is the R Console where you can issue interactive commands. Here, I use the setwd function to set the working directory to the location of my demo R files, then I use the source function to execute the TestPerson.R file.
The upper-right window inside the shell is the source R code for the TestPerson.R script. That script uses a R6 class that defines a Person object. In most realistic scenarios an R6 class would contain numeric arrays and matrices, but a Person class is easy to understand and is a common "Hello World" example for OOP. The source code for the Person class is partially shown in the lower-right window.
In Figure 1, notice that there's a warning message displayed in the console after the demo script finishes execution because I wrote the demo code using R version 3.1.2 (a slightly older version released in 2015), but the R6 code was written with R version 3.1.3. Because R is open source and has many authors, and different packages have different dependencies, maintaining R package compatibility can be mildly annoying at times. Some R users and programmers sometimes call this situation "package hell."
Installing R and R6
If you don't have R on your system, installing R (and uninstalling) is very easy. Do an Internet search for "Install R" and you'll find a page on the cran.r-project.org Web site with a link labeled, "Download R 3.2.x for Windows." Click that link and you'll get an option to run a self-extracting installer file named something like R-3.2.x-win.exe. Click on the Run button presented to you by your browser to launch the installer. You can accept all the configuration defaults and installation is quick.
To launch the Rgui program, open a file explorer and navigate to the C:\Program Files\R\R-3.2.x\bin\x64 directory. To launch Rgui in standard mode, double-click on file Rgui.exe and the Rgui shell with an R Console window will launch. However, you might need administrator privileges to install packages, so I suggest right-clicking on Rgui.exe and selecting the "Run as administrator" option from the context menu. After the shell launches, you can clear the start messages with Ctrl+L.
The base R language does not include the R6 package. R has hundreds of available packages written by the R open source community. You can display a list of all the packages that are currently installed on your machine by typing the command:
> installed.packages()
To install the R6 package, make sure you're connected to the Internet, then type the command:
> install.package("R6")
This will launch a tall, thin window that lists approximately 130 mirror sites that might contain the R6 package. Click on a mirror site. If that mirror site is up and running, and has the R6 package, R6 will be installed on your system quickly and you'll see a success message that reads, "package R6 successfully unpacked and MD5 sums checked. The downloaded binary packages are in C:\xxx."
If the R6 installation fails because the mirror site you selected was down, you can try a different mirror site by typing the command:
> chooseCRANmirror(graphics=getOption("menu.graphics"))
To remove an R package you can type a command like:
> remove.packages("R6")
Package removal, like installation, is quick and easy.
The Class Definition Code
When learning about OOP in a new programming language, there's always a chicken-and-egg issue: do you look at the class definition first and then see how the class is used to create an object, or do you look at the calling code first and then examine the class definition code? I'll present the class definition first.
To create the class definition script, on the Rgui menu bar I clicked File | New Script. This gave me an editor window. I clicked File | Save As and saved the (currently empty) script as PersonClass.R in C:\OopUsingR6 on my machine.
The complete code for file PersonClass.R is presented in Listing 1. The first three lines of code are:
# file: PersonClass.R
# R 3.1.2
library(R6)
After commenting the name of the script, I place a comment that indicates which version of R I'm using. Notice that my version of R is slightly out of date. Next, the library function is used to load the R6 package. You can think of this as somewhat similar to adding a reference to a .NET DLL assembly to a C# program. Instead of using the library function, I could've used the require function.
# file: PersonClass.R
# R 3.1.2
library(R6)
Person <- R6Class("Person",
private = list(
last.name = NULL,
first.name = NULL,
pay.rate = NULL
), # private
public = list(
initialize = function(last.name, first.name, pay.rate) {
private$last.name <- last.name
private$first.name <- first.name
private$pay.rate <- pay.rate
},
setRate = function(rate) {
private$pay.rate <- rate
},
getRate = function() {
return(private$pay.rate)
},
display = function() {
cat("[", private$last.name, ", " ,
private$first.name, ", $" ,
formatC(private$pay.rate, digits=2, format="f") ,
"]\n", sep="")
}
) # public
) # Person
The structure of the class definition is:
Person <- R6Class("Person",
private = list(
# private variables and functions here
),
public = list(
# public variables and functions here
)
}
If you're a C# programmer, the syntax might look a bit unusual, but should make sense. Instead of declaring member fields and methods with public and private scope qualifiers, in R6 you have a list collection of private items and a list collection of public items. This somewhat resembles C++ class definitions that have private and public code areas.
Notice that the class definition has two names: Person with and without quotes. Although the two names don't have to match, there's no reason to make them different.
The private variables are:
private = list(
last.name = NULL,
first.name = NULL,
pay.rate = NULL
),
In R, it's common to use the '.' character in variable names to make them more readable. I prefer using an underscore (last_name) or camel casing (lastName) but use the '.' here to illustrate the idea.
The public class constructor is:
initialize = function(last.name, first.name, pay.rate) {
private$last.name <- last.name
private$first.name <- first.name
private$pay.rate <- pay.rate
},
In R6, the initialize function is used to instantiate an object. Here, the parameter names are the same as the field variable names. This is OK because private and public class variables are accessed by prepending the "private" or "self" keywords, respectively. Alternatively, I could've written code like:
initialize = function(ln, fn, pr) {
private$last.name <- ln
private$first.name <- fn
private$pay.rate <- pr
},
The class definition has two public methods to fetch and modify the pay.rate member variable:
setRate = function(rate) {
private$pay.rate <- rate
},
getRate = function() {
return(private$pay.rate)
},
These functions closely resemble their C# property method counterparts. I could've defined similar functions for the last.name and first.name variables.
The function names used here, setRate and getRate, aren't very good style because they don't quite match the corresponding class variable pay.rate name. A better naming approach -- in my opinion – would've been to call the member variable payRate and name the functions set_payRate and get_payRate, similar to the Java naming convention.
The last function defined in the Person class displays an object directly to the R Console:
display = function() {
cat("[", private$last.name, ", " ,
private$first.name, ", $" ,
formatC(private$pay.rate, digits=2, format="f") ,
"]\n", sep="")
}
Calling this function produces output like:
[Smith, James, $19.00]
In C# the usual approach would be to define a ToString method for the object and then call like:
Console.WriteLine(p1.ToString());
You could take this approach with R, too, but in R displaying directly to the console is more common.
The Demo Script
To create the test script, on the Rgui menu bar I clicked File | New Script. This gave me an editor window. I clicked File | Save As and saved the (empty) script as TestPerson.R in a C:\OopUsingR6 directory (the same location as the PersonClass.R file).
The first four lines of the test script are:
# file: TestPerson.R
# R 3.1.2
source("PersonClass.R") # load
cat("\nBegin OOP using R6 demo \n\n")
The source function is used to load into memory the file that contains the code that defines the Person class. Because there's no path to the file name, it's assumed that the file is located in the same directory as the test harness script. The cat function displays a start message.
Next, the test script instantiates a Person object:
cat("Creating Person object p1 using new() \n\n")
p1 <- Person$new("Smith", "James", 19.00)
This creates a Person object named p1 with a last name of "Smith" and a first name of "James" and a pay rate of $19.00. The key idea here is that you use the new function appended to a class name with the '$' character to instantiate an R6 object by calling the class initialize function. In C#, this would look like:
Person p1 = new Person("Smith", "James", 19.00);
The R6 design and calling syntax should feel familiar to you. In this example, it's clear that "Smith" is almost certainly the last name and "James" is the first name, but because R supports named-parameter calls, for improved readability at the expense of wordiness you can write code like:
p1 <- Person$new(last.name="Smith",
first.name="James",
pay.rate=19.00)
Next, the demo script displays the newly created Person object:
cat("Calling p1.display() member function \n\n")
cat("p1 : ")
p1$display()
The Person class definition contains a program-defined member function display that prints directly to the R Console. The output is:
Calling p1.display() member function
p1 : [Smith, James, $19.00]
Next, the demo prints the Person object in a different way:
cat("\nCalling print(p1)\n\n")
print(p1)
Here, the R built-in print function is used instead of the class member function. The output is:
<Person>
Public:
clone: function (deep = FALSE)
display: function ()
getRate: function ()
initialize: function (last.name, first.name, pay.rate)
setRate: function (rate)
Private:
first.name: James
last.name: Smith
pay.rate: 19
Notice that there's an extra clone function listed. I'll explain in a moment. In general, you'll use a custom display function in program-defined scripts, and use the built-in print function interactively to examine objects.
Next, the test script illustrates the use of the clone function:
cat("\nMaking person p2 using p1.clone() \n")
p2 <- p1$clone()
cat("\nModifying p2 pay.rate to 22.00 using setRate() \n\n")
p2$setRate(22.00)
cat("p2 : "); p2$display()
cat("p1 : "); p1$display()
The output is:
Making person p2 using p1.clone()
Modifying p2 pay.rate to 22.00 using setRate()
p2 : [Smith, James, $22.00]
p1 : [Smith, James, $19.00]
The point here is that when you define an R6 class, you automatically get a clone function. When you call clone, you get a value copy rather than a reference copy. In other words, the cloned object is separate from the original object. Notice that the change to the Person p2 pay.rate has no effect on the p1 pay.rate variable.
Next, the demo illustrates how to make a reference copy:
cat("\nAssigning p3 <- p1 \n\n")
p3 <- p1
cat("Modifying p3 pay.rate to 30.00 using setRate() \n\n")
p3$setRate(30.00)
cat("p3 : "); p3$display()
cat("p1 : "); p1$display()
Assigning p3 <- p1
Modifying p3 pay.rate to 30.00 using setRate()
p3 : [Smith, James, $30.00]
p1 : [Smith, James, $30.00]
Here, a change to the Person p3 pay.rate also affects the original p1 pay.rate. Both p3 and p1 point to the same object in memory so a change to one object affects the other object, too. To summarize, value copies and reference copies in R6 work in much the same way as they do in C# and you have to be careful to avoid accidentally creating any unwanted side effects.
The two demo scripts are organized with the class definition code and the calling code are in separate files. It would've been possible to place the class definition code directly inside the test script.
Wrapping Up
The explanation presented in this article should give you all the information you need to get up and running with R6 classes. R6 classes support some additional features. R6 classes support inheritance, but at least in my experience, this is rarely needed when programming with R. Other rarely used features of R6 classes include active bindings, non-portable classes, extending a class definition, deep cloning, and finalizers.
The base R language has three different built-in OOP models named S3, S4 and RC ("Reference Classes"). The S3 and S4 models are named as they are because they were created in the S language, which is the predecessor of R. At one point there was a project to create a more modern OOP model and it was named R5 (R for the language, 5 because the previous models were 3 and 4) but work on R5 was discontinued. RC classes are more sophisticated than S3 and S4 classes and R6 classes are essentially an improved version of RC classes.
I spoke with the author of the R6 package, Winston Chang. Winston considers the R6 package stable and he doesn't have any immediate plans for significant changes to R6. He said he may consider adding support for static variables and functions to R6 at some point in the future. | https://visualstudiomagazine.com/articles/2016/06/01/how-the-r-language-does-oop.aspx | CC-MAIN-2020-40 | refinedweb | 2,551 | 66.13 |
384 bits long.
An HMAC can be used to determine whether a message sent over a nonsecure channel has been tampered with, provided that the sender and receiver share a secret key. The sender computes the hash value for the original data and sends both the original data and the hash value as a single message. The receiver recalculates the hash value on the received message and checks that the computed HMAC matches the transmitted HMAC.384 accepts all key sizes and produces a hash sequence that is 384 bits long.
The following example shows how to sign a file by using the HMACSHA384 object, and then how to verify the file.
using System; using System.IO; using System.Security.Cryptography; public class HMACSHA384[64]; / (HMACSHA384 hmac = new HMACSHA384 (HMACSHA384 hmac = new HMACSHA384 2.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe. | https://msdn.microsoft.com/en-us/library/system.security.cryptography.hmacsha384(v=vs.110).aspx | CC-MAIN-2018-34 | refinedweb | 159 | 65.83 |
In today’s Programming Praxis exercise, our goal is to implement the well-known “Petals Around the Rose” game. Let’s get started, shall we?
Some imports:
import Control.Monad import System.Random import Text.Printf
We’ll need to show the intro text.
showIntro :: IO () showIntro = putStrLn "Let's play 'Petals Around The Rose.'\n\ \The name of the game is significant.\n\ \At each turn I will roll five dice,\n\ \then ask you for the score, which\n\ \will always be zero or an even number.\n\ \After you guess the score, I will tell\n\ \you if you are right, or tell you the\n\ \correct score if you are wrong. The game\n\ \ends when you prove that you know the\n\ \secret by guessing the score correctly\n\ \six times in a row.\n"
When playing, we keep a count of the current streak length. After 6 consecutive correct guesses we assume the player has figured out the trick. Otherwise, we roll 5 dice and see if the player’s guess is correct.
play :: Int -> IO () play 6 = putStrLn "Congratulations! You are now a member\n\ \of the Fraternity of the Petals Around\n\ \The Rose. You must pledge never to\n\ \reveal the secret to anyone." play streak = do dice <- replicateM 5 $ randomRIO (1,6) putStrLn $ "The five dice are: " ++ unwords (map show dice) putStr "What is the score? " guess <- readLn if guess == score dice then putStrLn "Correct\n" >> play (streak + 1) else printf "The correct answer is %d.\n\n" (score dice) >> play 0
And here’s the heart of the program: the score function. It’s pretty simple, once you know the secret.
score :: [Int] -> Int score = sum . map ([0,0,0,2,0,4,0] !!)
To play a game, just show the intro and start playing.
main :: IO () main = showIntro >> play 0
Advertisements
Tags: around, bonsai, code, game, Haskell, kata, petals, praxis, programming, rose | https://bonsaicode.wordpress.com/2012/12/18/programming-praxis-petals-around-the-rose/ | CC-MAIN-2017-22 | refinedweb | 324 | 84.68 |
Building Perfect Anti-Facades - Almost Without Layers, For Better Maintainability
Sometimes you own the database and the requirements are driven by the customer / sponsor and so mainly by the UI. Decoupling from your own database is, in such scenario, not beneficial. In contrary the decoupling would make your code more complex and harder to maintain. In the case of a feature enhancement, you will have to maintain / enhance the mapping logic and all indirections as well.
Instead of hiding your domain objects behind a Service Facade, you could directly derive the objects from the database (e.g. through generation) and expose them directly (=per reference) to the UI. The presentation tier (JSF, Wicket and other server-centric frameworks) could even bind the persistent objects declaratively to the UI-components.
A stateful session bean is perfectly suitable for this job. The EXTENDED EntityManager keeps all, already loaded, JPA-entities managed. This approach has a significant advantage - there is no synchronization and manual loading of lazy references needed. The EntityManager reacts to transactions and flushes all "dirty" entities into the database. The transaction is initiated the empty save method. The EJB 3.X gateway is simple. It exposes the root / aggregate entity and is very similar to a domain repository:
@Stateful @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public class OrderGateway{ @PersistenceContext(type=PersistenceContextType.EXTENDED) EntityManager em; private Load current; public Load find(long id){ this.current = this.em.find(Load.class, id); return this.current; } public Load getCurrent() { return current; } public void create(Load load){ this.em.persist(load); this.current = load; } public void remove(long id){ Load ref = this.em.getReference(Load.class, id); this.em.remove(ref); } @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void save(){ //nothing to do } }
The Gateway remembers the root entity and makes it accessible through a getter. This can be leveraged in declarative data binding (you could even navigate from the backing bean, through the Gateway into a JPA entity). A Gateway is very easy to test outside, as well as, inside the EJB-container.
The EJB 3.1 / JSF 2.0 project GatewayWarDeployment was tested with Glassfish v3 and NetBeans 6.8 / 6.7.1 and pushed into:.
[See Gateway, page 101 in "Real World Java EE Patterns Rethinking Best Practices" book for more in-depth
Have you ever made any measurements on how large a footprint it leaves on a typical App Server to maintain this client/server-like scenario with the UI and RDMS linked directly with a Gateway?
I could easily see the memory footprint explode on an average WebSphere cluster ... :-) Or is there a trick to minimizing this impact or perhaps even building a better performing system compared to using Service Facades everywhere? I guess it very much depends on how containers optimizes handling of stateful session beans behind the scenes.
Posted by Martin K on September 23, 2009 at 01:40 PM CEST #
"(in such cases) decoupling would make your code more complex and harder to maintain. In the case of a feature enhancement, you will have to maintain / enhance the mapping logic and all indirections as well."
So true. Too often programmers blindly follow the "must decouple" mantra w/o realizing its downsides.
Posted by Itay Maman on September 23, 2009 at 02:31 PM CEST #
Sorry but I feel queasy with such an approach.
I can not imagine that all what we've learned in the past was wrong (the statelesser the better paradigm).
I aggree with the trend to slimming the excessive layering.
But when I have an application with a certain complexity, with business functionality which has to be used not only from one UI and so on it is really hard for me to believe that this is the right approach from an application designing point of view.
Also the resource consumption would be much more expensive...
Posted by Martin on September 23, 2009 at 03:29 PM CEST #
@Martin K
Gateway isn't viable for all scenarios - it is stateful and can consume a significant amount of memory. The newer versions for WebSphere are actually leaner than expected :-) The problem, however is the EntityManager - it will cache all managed entities for the length of the transaction...
I will cover that in some upcoming posts...
thanks!,
adam
Posted by Adam Bien on September 24, 2009 at 12:12 AM CEST #
@Martin,
you are right - Gateway is not suitable for all use cases. Stateless ServiceFacades are still viable - especially for more procedural (service oriented) use cases.
Gateway itself is simplistic - the exposes rich domain objects may be really complex.
In one of my past projects we had about 10-20 Gateways and several hundred entities. It was one of the most complex projects I worked on.
thanks for your feedback!
adam
Posted by Adam Bien on September 24, 2009 at 12:16 AM CEST #
Have a look at JBoss Seam. They propose the architecture with a Gateway. And there are - at least for web applications - some performance and memory problems. But they can be resolved if you understand the business and the frameworks. There is a very good article about JBoss Seam () at JSFCentral from Dan Allen.
From my experience, you are really fast developing applications with this approach and if you have a good IDE(A) which supports declarative access to Domain Object - your done (Seam Support in IDEA). And this is what counts.
Posted by Cyrill on September 24, 2009 at 12:35 AM CEST #
Adam,
You can't imagine how am I with you on this one. Many developers still program the way they did in about 2004-2005 and still generate tons of layers, just because "it's decoupling". Sometimes I advise people to have a look at Ruby on Rails (as a kind of extreme opposition to excessive layering in web apps) just to see the difference.
I am also with Cyrill on Seam - it allows to expose session beans as managed beans in the view layer by thus eliminating yet another useless glue layer who's purpose is to bind ejb's with the jsf managed beans (if you want to use extended persistence context, for example). Even better- it provides functionality like you've given above but without single line of (java) code.
Regards,
Siarhei
Posted by Siarhei on September 25, 2009 at 04:58 PM CEST #
Unfortunally the approach ain't work in a clustered environment (with session replication enabled) without an EntityManager that is Serializable and replicates the changes to the entities to the other servers in the cluster. The container is also not able to passivate such SFSB without a Serializable EM. I may be wrong, but I'm not aware of a persistenceprovider that allready supports this? In other words: as long theres no such support in JPA you first have to decide against high availability of your application before going down this road.
Posted by ntruchsess on September 26, 2009 at 12:17 AM CEST #
How do you recommend to work with lists of objects (reports, tables of objects and so on)? Do you recommend to create both Facade (to get list of objects at the first step) and Gateway (to view and edit properties of one selected object)?
Regards,
Roman
Posted by Roman on September 28, 2009 at 06:02 PM CEST #
@Ntruchsess,
your question was too interesting too be answered here :-). I wrote a post about that:
regards!,
adam
Posted by Adam Bien on September 29, 2009 at 12:37 PM CEST #
Very interesting. But does the entities are shared across the sessions ?
If 100 clients access the same 100 entities, will we have 100 shared entities in memory or 100x100=10000 non-shared entities ?
Posted by Arnaud on September 29, 2009 at 06:11 PM CEST #
Hello Adam,
I am new in EJB technology and may be my questions are strange, but I cannot catch the idea how I can make full system with using your approach.
As I understand the layer of Facades is not only a way how to connect client layer with domain objects, but it also can be used for some 'common tasks' like logging, notifications and so on.
For example, I need to log all changes in domain objects. Do you recommend to do this from domain objects by self? In this variant domain objects will be clients by self, using other facades/gateways, processing events. What do you think about this?
I also need to notify set of listeners (modules-plugins) about changes in configuration (domain objects) through JMS. The problem is that if I do this from domain objects, JMS messages will be sent before transaction's commit, but this is too early. Is there a way to do that from gateway's 'save' method by getting the list of changed objects, for example?
Is it possible/convenient to use your approach in my situation or my examples are just not typical and in this particular case I should use classic approach with facades and interceptors?
Thank you in advance!
Roman
Posted by Roman on October 15, 2009 at 05:59 PM CEST #
Hi Adam,
on Websphere I only was able to update the database with this save-method:
public void save {
em.flush();
}
It seems like the commit of the transaction does not necessarily makes changes visible to other EntityManagers...
Dirk
Posted by Dirk on February 04, 2010 at 12:07 PM CET #
Hi! Can you help me pls.
I have two glassfishv3 servers and
statefull session bean.
public class TestSession implements TestSessionRemote, TestSessionLocal {
private
List<String> list;
public void add(String parameter) {
list.add(parameter);
}
I want to implement replication session copies of these objects between the two servers, but do not know how to do it. :(
Posted by Alex on March 22, 2010 at 01:15 PM CET #
What about the notion of conversations (single page in my case). Maybe a single stateful order gateway works just fine, but what if I need multiple coversations. Can I @ViewScoped a @Stateful bean?
Posted by Alex on August 27, 2010 at 01:57 AM CEST #
The is a feature that can make the Entitymanager survive after passivation in Jboss Seam 2 framework. I didn´t test this solution, because I have my eyes on Seam 3, not Seam 2.
Posted by Flávo Henrique on September 16, 2010 at 05:32 AM CEST #
Maybe I missed the Point, but how can I make a change undo.
I miss something like refresh all.
I have a save method but no cancle method.
Can anyone help me on that point.
Chris
Posted by Chris on September 03, 2011 at 01:08 AM CEST #
Hi Adam,
I can't catch one thing. Facade should be designed in a way where its methods should take as argument some primitive types, entity objects, transfer objects or mixed?
For example: is it better to create method:
1) addEntry(Entry e, List<Long> dictionaryIds),
2) addEntry(String name, String value, ..., List<Long> dictionaryIds)
3) addEntry(Entry e), where Entry e contains list of dictionary objects
4) addEntry(AddEntryTO e), where AddEntryTO is a specific transfer object containing name, value and list of dictionaries id.
(Let's define {Entry: String name, String value, List<Dictionary> dictionaries}, {Dictionary: String name, List<Entry> entries}
Taking into account your other posts and book about patterns I would follow the third option, but then there are two problems:
- I can pass some values which are not interesting for client (should I null them before returning? or create TO object which is an overkill..)
- client can send me the Entry object (as inpput argument for some method) containing some element which should affect changes to database - or example he pass Dictionary object which has the same id as an exisiting object in the database but has some other fields changed (name). In this case my method addEntry will persist entry object merging changes to existing dictionary object (that is lack of security). Shuld I then rewrite gathered object (treat it as TO) to newly created object coping only necessary information?
Thank you and I am waiting for your response!
wojciech
Posted by Wojciech on October 06, 2012 at 01:15 AM CEST #
Hi Adam,
Quick question concerning the gateway pattern. Even in your last book I don't see anything about "clearing" the entity manager. In fact, I'm trying to use this pattern for a ui screen with a table and a small editor corresponding to the current selected row in the table. So, I'm keeping the reference to the gateway and for each selection change event in the table, I'm setting the corresponding "entity" in my gateway. My main concern is that I'm having more and more objects in my first level cache (the entity manager). I'm wondering if it could be a good idea, in that case, to provide a function in my gateway allowing to clear the cache.
Thanks in advance for your valuable input.
Best regards
Steve
Posted by Steve on September 09, 2013 at 07:53 PM CEST #
@Steve
I'm using a CDI interceptor to clear the entity manager at some point. For example, if I have some pagination, changing of page would clear my persistence context to always keep a limited number of entities loaded at all time.
Posted by Xavier on August 28, 2014 at 10:30 AM CEST #
I use this pattern as described and it works perfectly well with Glassfish 3.1.2.2. But when I deploy to Glassfish 4.1 nothing gets persisted :-(
Any ideas welcome...
Posted by Michael on January 03, 2015 at 10:06 PM CET #
This post is really confusing for me due to all experience with software, that is totally opposite to what you present here (so, Uncle Bob and his Clean Architecture) - but still, this post is great - and worth to consider ;)
Cheers !
Posted by Bartek on July 08, 2015 at 11:10 PM CEST # | http://adambien.blog/roller/abien/entry/building_perfect_anti_facades_almost | CC-MAIN-2017-09 | refinedweb | 2,325 | 61.67 |
import java.io.*; public class Number{ public static void main(String args[]){ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String num=""; try{ System.out.println("Please enter a number:"); num=br.readLine(); String numToken="[\\p{Digit}&&[123456789]]+"; if(num.matches(numToken)) System.out.println("you enter a VALID number format"); else System.out.println("you enter a INVALID number format"); } catch(Exception e){} } }
sample output:
Please enter a number:
1234
you enter a VALID number format
------
Please enter a number:
01234
you enter a INVALID number format
------
that code accept 1-9 no.'s only
but i need to include special character -,. with a conditon that . would only appear once but everytime time i use [-,.] the program error.
ex. i will input -123,111.00
this should be a VALID input
another ex.
i will input -123,111,000.00
still this is a VALID input
another ex.
i will input -123-111,000.00
it is INVALID input
but i don't know what to do for the program to accept those special character and for the - as well as . to appear once but , can appear more than once.
anyone knows what should i do?
*Edited: after more than 40 posts you should know the rules
This post has been edited by pbl: 26 November 2009 - 10:27 PM | http://www.dreamincode.net/forums/topic/84626-number-format-validation/ | CC-MAIN-2017-17 | refinedweb | 221 | 61.63 |
/* . */ /* Collect and manage hardlink info associated with a particular file. */ #include "cvs.h" #ifdef PRESERVE_PERMISSIONS_SUPPORT # include "hardlink.h" /* The structure currently used to manage hardlink info is a list. Therefore, most of the functions which manipulate hardlink data are walklist procedures. This is not a very efficient implementation; if someone decides to use a real hash table (for instance), then much of this code can be rewritten to be a little less arcane. Each element of `hardlist' represents an inode. It is keyed on the inode number, and points to a list of files. This is to make it easy to find out what files are linked to a given file FOO: find FOO's inode, look it up in hardlist, and retrieve the list of files associated with that inode. Each file node, in turn, is represented by a `hardlink_info' struct, which includes `status' and `links' fields. The `status' field should be used by a procedure like commit_fileproc or update_fileproc to record each file's status; that way, after all file links have been recorded, CVS can check the linkage of files which are in doubt (i.e. T_NEEDS_MERGE files). TODO: a diagram of an example hardlist would help here. */ /* TODO: change this to something with a marginal degree of efficiency, like maybe a hash table. Yeah. */ static void delhardlist (Node *p) { if (p->data) dellist ((List **)&p->data); } List *hardlist; /* Record hardlink information for working files */ char *working_dir; /* The top-level working directory, used for constructing full pathnames. */ /* Return a pointer to FILEPATH's node in the hardlist. This means looking up its inode, retrieving the list of files linked to that inode, and then looking up FILE in that list. If the file doesn't seem to exist, return NULL. */ Node * lookup_file_by_inode (const char *filepath) { char *inodestr; const char *file; struct stat sb; Node *hp, *p; /* Get file's basename, so that we can stat it. */ file = strrchr (filepath, '/'); if (file) ++file; else file = filepath; if (stat (file, &sb) < 0) { if (existence_error (errno)) { /* The file doesn't exist; we may be doing an update on a file that's been removed. A nonexistent file has no link information, so return without changing hardlist. */ free (inodestr); return NULL; } error (1, errno, "cannot stat %s", file); } /* inodestr contains the hexadecimal representation of an inode. */ inodestr = Xasprintf ("%lx", (unsigned long) sb.st_ino); /* Find out if this inode is already in the hardlist, adding a new entry to the list if not. */ hp = findnode (hardlist, inodestr); if (hp == NULL) { hp = getnode (); hp->type = NT_UNKNOWN; hp->key = inodestr; hp->data = getlist (); hp->delproc = delhardlist; (void) addnode (hardlist, hp); } else { free (inodestr); } p = findnode (hp->data, filepath); if (p == NULL) { p = getnode (); p->type = NT_UNKNOWN; p->key = xstrdup (filepath); p->data = NULL; (void) addnode (hp->data, p); } return p; } /* After a file has been checked out, add a node for it to the hardlist (if necessary) and mark it as checked out. */ void update_hardlink_info (const char *file) { char *path; Node *n; struct hardlink_info *hlinfo; if (file[0] == '/') { path = xstrdup (file); } else { /* file is a relative pathname; assume it's from the current working directory. */ char *dir = xgetcwd (); path = Xasprintf ("%s/%s", dir, file); free (dir); } n = lookup_file_by_inode (path); if (n == NULL) { /* Something is *really* wrong if the file doesn't exist here; update_hardlink_info should be called only when a file has just been checked out to a working directory. */ error (1, 0, "lost hardlink info for %s", file); } if (n->data == NULL) n->data = xmalloc (sizeof (struct hardlink_info)); hlinfo = n->data; hlinfo->status = T_UPTODATE; hlinfo->checked_out = 1; } /* Return a List with all the files known to be linked to FILE in the working directory. Used by special_file_mismatch, to determine whether it is safe to merge two files. FIXME: What is the memory allocation for the return value? We seem to sometimes allocate a new list (getlist() call below) and sometimes return an existing list (where we return n->data). */ List * list_linked_files_on_disk (char *file) { char *inodestr, *path; struct stat sb; Node *n; /* If hardlist is NULL, we have not been doing an operation that would permit us to know anything about the file's hardlinks (cvs update, cvs commit, etc). Return an empty list. */ if (hardlist == NULL) return getlist (); /* Get the full pathname of file (assuming the working directory) */ if (file[0] == '/') path = xstrdup (file); else { char *dir = xgetcwd (); path = Xasprintf ("%s/%s", dir, file); free (dir); } /* We do an extra lookup_file here just to make sure that there is a node for `path' in the hardlist. If that were not so, comparing the working directory linkage against the repository linkage for a file would always fail. */ (void) lookup_file_by_inode (path); if (stat (path, &sb) < 0) error (1, errno, "cannot stat %s", file); /* inodestr contains the hexadecimal representation of an inode. */ inodestr = Xasprintf ("%lx", (unsigned long) sb.st_ino); /* Make sure the files linked to this inode are sorted. */ n = findnode (hardlist, inodestr); sortlist (n->data, fsortcmp); free (inodestr); return n->data; } /* Compare the files in the `key' fields of two lists, returning 1 if the lists are equivalent and 0 otherwise. Only the basenames of each file are compared. This is an awful hack that exists because list_linked_files_on_disk returns full paths and the `hardlinks' structure of a RCSVers node contains only basenames. That in turn is a result of the awful hack that only basenames are stored in the RCS file. If anyone ever solves the problem of correctly managing cross-directory hardlinks, this function (along with most functions in this file) must be fixed. */ int compare_linkage_lists (List *links1, List *links2) { Node *n1, *n2; char *p1, *p2; sortlist (links1, fsortcmp); sortlist (links2, fsortcmp); n1 = links1->list->next; n2 = links2->list->next; while (n1 != links1->list && n2 != links2->list) { /* Get the basenames of both files. */ p1 = strrchr (n1->key, '/'); if (p1 == NULL) p1 = n1->key; else ++p1; p2 = strrchr (n2->key, '/'); if (p2 == NULL) p2 = n2->key; else ++p2; /* Compare the files' basenames. */ if (strcmp (p1, p2) != 0) return 0; n1 = n1->next; n2 = n2->next; } /* At this point we should be at the end of both lists; if not, one file has more links than the other, and return 1. */ return (n1 == links1->list && n2 == links2->list); } /* Find a checked-out file in a list of filenames. Used by RCS_checkout when checking out a new hardlinked file, to decide whether this file can be linked to any others that already exist. The return value is not currently used. */ int find_checkedout_proc (Node *node, void *data) { Node **uptodate = data; Node *link; char *dir = xgetcwd (); char *path; struct hardlink_info *hlinfo; /* If we have already found a file, don't do anything. */ if (*uptodate != NULL) return 0; /* Look at this file in the hardlist and see whether the checked_out field is 1, meaning that it has been checked out during this CVS run. */ path = Xasprintf ("%s/%s", dir, node->key); link = lookup_file_by_inode (path); free (path); free (dir); if (link == NULL) { /* We haven't seen this file -- maybe it hasn't been checked out yet at all. */ return 0; } hlinfo = link->data; if (hlinfo->checked_out) { /* This file has been checked out recently, so it's safe to link to it. */ *uptodate = link; } return 0; } #endif /* PRESERVE_PERMISSIONS_SUPPORT */ | http://opensource.apple.com/source/cvs/cvs-42/cvs/src/hardlink.c | CC-MAIN-2014-41 | refinedweb | 1,196 | 67.08 |
Secured communications (SSL/TLS)¶
You can encrypt the internal communication between CrateDB nodes and the external communication with HTTP and PostgreSQL clients. When you configure encryption, CrateDB secures connections using Transport Layer Security (TLS).
You can enable SSL on a per-protocol basis:
If you enable SSL for HTTP, all connections will require HTTPS.
By default, if you enable SSL for the PostgreSQL wire protocol, clients can negotiate on a per-connection basis whether to use SSL. However, you can enforce SSL via Host-Based Authentication.
If you enable SSL for the CrateDB transport protocol (used for intra-node communication), nodes only accept SSL connections (ssl.transport.mode set to
on).
Tip
You can use
on SSL mode to configure a multi-zone cluster to ensure
encryption for nodes communicating between zones. Please note, that SSL has
to be
on in all nodes as communication is point-2-point, and intra-zone
communication will also be encrypted.
Table of contents
-
Configuring a separate Truststore
Connecting to a CrateDB node using HTTPS
Connecting to a CrateDB node using the PostgreSQL wire protocol with SSL/TLS
Setting up a Keystore/Truststore with a certificate chain
SSL/TLS configuration¶
To enable SSL a
keystore and a few configuration changes are necessary.
These changes need to be made in the
crate.yml file on each node that
should have secure communications enabled.
Skip to Generate Keystore with a private key for a step-by-step instruction on how to
create a
keystore.
Once the
keystore (and optional
truststore) is created, continue with
the following steps:
-
Set
ssl.psql.enabledor
ssl.http.enabledto
true.
-
Set
ssl.transport.modeto
on.
-
-
(Optional) Configuring a separate Truststore
Note
CrateDB monitors SSL files such as keystore and truststore that are configured as values of the node settings. If any of these files are updated CrateDB dynamically reloads them. The polling frequency of the files is set via the ssl.resource_poll_interval setting.
Configuring the Keystore¶
SSL/TLS needs a keystore. The keystore holds the node certificate(s) which should be signed by a certificate authority (CA). A third-party CA or your organization’s existing CA can be used.
When a client connects to a node using SSL/TLS, the client receives the certificate provided by the node and will determine if the node’s certificate is valid, trusted, and matches the hostname or IP address it is trying to connect to.
Caution
Technically, it’s possible to disable CA checks for certificates on the client. It is strongly recommended however to use certificates signed by an official CA or by a private CA (company PKI) that is also known to the client. This will help to ensure that establishing trust is as painless as possible.
See Generate Keystore with a private key for information about how to create a keystore.
Once the keystore is prepared, define the absolute file path to the keystore
.jks file on the node using
ssl.keystore_filepath setting.
Note
Make sure that the keystore file has the right permissions and is
accessible by the system user
crate.
Also, define the password needed to decrypt the keystore by using the
ssl.keystore_password setting.
Use
ssl.keystore_key_password setting to define the key password used when
creating the Keystore.
For a full list of the settings needed to configure SSL/TLS, refer to SSL configuration reference.
Configuring a separate Truststore¶
Trusted CA certificates can be stored in a node’s keystore or a separate truststore can be used to store them.
If you want to use a separate truststore, create a node truststore and import
the CA certificate(s) you want to trust. Once the truststore is prepared,
define the absolute file path of the truststore
.jks file on the node
using the
ssl.truststore_filepath setting.
Note
Make sure that the truststore file has the right permissions and is
accessible by the system user
crate.
Also define the password needed to decrypt the keystore by using the
ssl.truststore_password setting.
For a full list of the settings needed to configure SSL/TLS, refer to SSL configuration reference.
Connecting to a CrateDB node using HTTPS¶
Connect to a CrateDB node using the Admin UI¶
Crate’s HTTP endpoint remains unchanged. When you have turned on secure communication, it will use HTTPS instead of plain HTTP. Simply point your browser to the same URL you used before but changing the protocol to HTTPS:
For example, becomes.
If you have not configured the CrateDB node’s keystore with a signed
certificate from a Certificate Authority (CA), then you will get something
like the following:
NET::ERR_CERT_AUTHORITY_INVALID. You either need to
get your certificate signed from one of the CAs included in your browser or
import your owned certificates into the browser. A third option is storing
an exception for the CrateDB node certification in your browser after
verifying that this is indeed a certificate you trust.
Connect to a CrateDB node using Crash¶
You can connect to a CrateDB node using a secure communication:
crash --hosts
To validate the provided certificates, please see the options
--verify-ssl and
--key-file.
Connect to a CrateDB node using REST¶
Issue your REST requests to the node using the
https:// protocol. You
may have to configure your client to validate the received certificate
accordingly.
Connecting to a CrateDB node using the PostgreSQL wire protocol with SSL/TLS¶
Connect to a CrateDB node using JDBC¶
JDBC needs to validate the CrateDB node’s identity by checking that the node certificate is signed by a trusted authority. If the certificate is signed by a certificate authority (CA) that is known to the Java runtime, there is nothing further to do (as Java comes with copies of the most common CA’s certificates).
If you have a certificate that is signed by a CA not known to the Java runtime, you need to configure a truststore which contains the node’s certificate and provide the path to the truststore file along with the password when starting your Java application:
java -Djavax.net.ssl.trustStore=mystore -Djavax.net.ssl.trustStorePassword=mypassword com.mycompany.MyApp
In case you face any issues extra debugging information is available by adding
-Djavax.net.debug=ssl to your command line.
Last but not least, the connection parameter
ssl=true must be added to the
connection URL so that the JDBC driver will try and establish an SSL
connection.
For further information, visit JDBC SSL documentation.
Connect to a CrateDB node using
psql¶
By default,
psql attempts to use SSL if available on the node. For further
information including the different SSL modes please visit the
PSQL documentation.
Setting up a Keystore/Truststore with a certificate chain¶
In case you need to setup a Keystore or a Truststore, here are the commands to get you started. All the commands use a validity of 36500 days (about 100 years). You might want to use less.
Generate Keystore with a private key¶
The first step is to create a Keystore with a private key using the RSA algorithm. The “first and last name” is the common name (CN) which should overlap with the URL the service it is used with.
Command:
keytool -keystore keystore -genkey -keyalg RSA -alias server -validity 36500
Output:
Enter keystore password: Re-enter new password: What is your first and last name? [Unknown]: ssl.crate.io What is the name of your organizational unit? [Unknown]: Cryptography Department What is the name of your organization? [Unknown]: Crate.io GmbH What is the name of your City or Locality? [Unknown]: Berlin What is the name of your State or Province? [Unknown]: Berlin What is the two-letter country code for this unit? [Unknown]: DE Is CN=ssl.crate.io, OU=Cryptography Department, O=Crate.io GmbH, L=Berlin, ST=Berlin, C=DE correct? [no]: yes Enter key password for <server> (RETURN if same as keystore password): Re-enter new password:
Generate a certificate signing request¶
To establish trust for this key, we need to sign it. This is done by generating a certificate signing request.
If you have access to a certificate authority (CA), you can skip the next steps and get the signed certificate from the CA using the signing request which we will generate with the command below. If you don’t have access to a CA, then follow the optional steps after this step to establish your own CA.
Command:
keytool -keystore keystore -certreq -alias server -keyalg RSA -file server.csr
Output:
Enter keystore password: Enter key password for <server>
Import the signed certificate¶
Now we have a signed certificate, signed by either from a official CA or from our own CA. Let’s import it to the Keystore.
Command:
keytool -import -keystore keystore -file server.crt -alias server
Output:
Enter keystore password: Enter key password for <server> Certificate reply was installed in keystore
Configuring CrateDB¶
Finally, you want to supply the Keystore/Truststore in the CrateDB configuration, see Secured communications (SSL/TLS). | https://crate.io/docs/crate/reference/en/4.8/admin/ssl.html | CC-MAIN-2022-33 | refinedweb | 1,492 | 53.41 |
So a co-worker of mine was setting up IIS 7.0 on a new Windows 7 machine, and when they were browsing to they were getting a 503 Service Unavailable error as shown here:
This seemed pretty trivial so I went through the following checklist.
2010-02-17 17:28:47 ::1%0 49991 ::1%0 80 HTTP/1.1 GET / 503 - N/A -
So what could be going on here? After a bit of troubleshooting I was able to find a event in the event log that led me in the correct direction. Here is a summary of the event:
Log Name: System
Source: Microsoft-Windows-HttpEvent
Date: 2/17/2010 9:26:44 AM
Event ID: 15007
Task Category: None
Level: Information
Keywords: Classic
User: N/A
Computer: computer.domain.com
Description:
Reservation for namespace identified by URL prefix was successfully added.
Event Xml:
<Event xmlns=">
<System>
<Provider Name="Microsoft-Windows-HttpEvent" Guid="{7b6bc78c-898b-4170-bbf8-1a469ea43fc5}" EventSourceName="HTTP" />
<EventID Qualifiers="16384">15007</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2010-02-17T17:26:44.064479100Z" />
<EventRecordID>42570</EventRecordID>
<Correlation />
<Execution ProcessID="4" ThreadID="44" />
<Channel>System</Channel>
<Computer>computer.domain.com</Computer>
<Security />
</System>
<EventData>
<Data Name="DeviceObject">\Device\Http\ReqQueue</Data>
<Data Name="Url"></Data>
</EventData>
</Event>
The key part of this event is that it mentions the namespace was successfully added. What exactly does this mean? I am not going to go into detail in this blog, but this blog explains why URL reservations are typically used. In our case we first need to list all of the registered URLs via the following command, run from an Administrative command prompt.
netsh http show urlacl
Reserved URL :
User: NT SERVICE\Machine
Listen: Yes
Delegate: No
SDDL: D:(A;;GX;;;S-1-5-21-2127521184-1604012920-1887927527-67210)
We can see that the URL is reserved. The "+" sign means any host header, and the :80 means anything on port 80. Since there is no application path after the final "/" it reserves anything that runs on port 80. This is what is causing the 503 Service Unavailable errors, as this reservation will prevent W3SVC from obtaining the rights to listen on port 80 when it tries to start the site. Furthermore, applications that run in IIS do not need explicit reservations to run, only non-IIS applications have to reserve a URL namespace if they want to use HTTP to listen for requests. One example are WCF applications that are running on HTTP, as these are non-IIS applications that use HTTP to listen for requests. To resolve the problem for the default web site, we have to remove the reserved namespace for port 80 with the following command.
netsh http delete urlacl
URL reservation successfully deleted
After removing this namespace, WCF applications or other non-IIS applications running on this server may break. So a new URL reservation may be needed for those applications. The new URL reservation should point to the specific application on port 80, not the root. This will prevent the URL reservation from blocking all applications under port 80. The next question is who added the namespace in the first place? There is no real way to identify that, however the HTTPEvent 15007 in the System Event log will give a good indication of the Date and Time the reservation was made.
To summarize, if you are getting a 503 Service Unavailable that looks like the one in this blog post, and you have checked all of the items in the checklist. It is probably time to look at the URL Reservations, and make sure their are not any all inclusive registrations for the port the web site is running on. Meaning, a registration for is OK, as it only registers the Application_Name namespace, not the entire port 80 namespace.
Author: bretb | https://techcommunity.microsoft.com/t5/iis-support-blog/a-not-so-common-root-cause-for-503-service-unavailable/ba-p/347268 | CC-MAIN-2020-16 | refinedweb | 652 | 51.38 |
Lightweight state management using React Context
Lightweight state management using React Context.
React State Context
Lightweight state management using React Context.
✔ Built on React primitives
✔ Provides a familiar API
✔ Designed with a minimal learning curve in mind
✔ Reasonable file size (~2kb gzipped)
Motivation
When you are getting started with React, storing all of your application state within individual Components' state tends to work well. Component state is a good solution for storing data.
A limitation of component state is that it can be tedious to share it between components that are not near one another within your application's component tree. This problem may become more pronounced as your application grows, and as some of your data needs to be made available to a larger number of separated components.
React provides an API to solve this problem: Context. Context is a mechanism to more easily share data between components, even when they are not close.
As delightful as the Context API is, it is a low-level tool, so using it directly can be a little verbose sometimes. It also doesn't provide opinions on how it should be used, so it can take some time to figure out an organized system for working with it. Lastly, it has some caveats that can trip you up. For these reasons I created React State Context.
React State Context is a thin wrapper around Context that provides a small amount of structure. This structure helps reduce the boilerplate that you must write, and it also helps you to stay organized. Plus, when you use State Context, you can be confident that you are avoiding the caveats that accompany using Context directly.
Installation
npm install react-state-context
yarn add react-state-context
Concepts
React State Context has three concepts.
StateContext
A StateContext is a wrapper around a normal React Context object. Like a regular Context object, it has two properties:
Provider and
Consumer.
You use StateContexts in the same way as regular Context. If you have used the new Context API, then it should feel familiar to use StateContexts. If you haven't, don't worry. If I was able to learn it, then you can, too!
:information_desk_person: The React documentation on Context is a great resource. It can be helpful to familiarize yourself with the content on that page before using State Context.
What is different about a StateContext is that the value that the Consumer provides you with has the following structure:
{ state, ...actions }
State and actions are the other two concepts of React State Context. Let's take a look!
State
Every StateContext object has an internal state object. Behind the scenes, it is a regular Component's state object. When you render
a
StateContext.Consumer, the value passed to the render prop will include a
state attribute.
<MyStateContext.Consumer> {value => { console.log('The current state is:', value.state); }} </MyStateContext.Consumer>
Like a React Component's state, the StateContext state must be an object or null.
Actions
Actions are functions that you define, and they are how you modify the state. If you have used Redux, then you can think of them as serving a similar role to action creators.
To update state, return a new value from your action. The returned value will be shallowly merged with the existing state.
Let's take a look at an example action:
export function openModal() { return { isOpen: true, }; }
When you call an action from within your application, you can pass arguments to it. Let's use this to create an action to toggle a modal state based on what is passed into the action:
export function toggleModal(isOpen) { return { isOpen }; }
Sometimes, you may need the previous state within an action. In these situations, you can return a
function from your action. This function will be called with one argument,
setState. Use
setState to update
the state as you would using a React Component's
setState:
export function createTodo(newTodo) { return function(setState) { setState(prevState => { return { todos: prevState.todos.concat([newTodo]) ); }); }; }
Note that
setState differs from the Component
setState in that there is no second argument.
:information_desk_person: Heads up! The actions API was inspired by redux-thunk. If you have used that API, you may notice the similarity. In redux-thunk, the thunks are passed the arguments
(dispatch, getState). In this library, you are passed
(setState).
Along with
state, the actions that you define will be included in the
value that you receive from the Consumer:
<MyStateContext.Consumer> {value => { console.log('I can add a todo using:', value.createTodo); console.log('I can delete todos using:', value.deleteTodo); }} </MyStateContext.Consumer>
Once you feel comfortable with these concepts, you are ready to start using React State Context.
API
This library has one, default export:
createStateContext.
createStateContext( actions, [initialState] )
Creates and returns a StateContext.
actions[Object]: The actions that modify the state.
[initialState][Object|null]: Optional initial state for the StateContext.
import createStateContext from 'react-state-context'; import * as todoActions from './actions'; const TodoContext = createStateContext(todoActions, { todos: [], }); export default TodoContext;
Use a StateContext as you would any other Context.
import TodoContext from './contexts/todo'; export function App() { // To begin, you must render the Provider somewhere high up in the Component tree. return ( <TodoContext.Provider> <SomeComponent /> </TodoContext.Provider> ); }
import TodoContext from './contexts/todo'; export function DeeplyNestedChild() { // From anywhere within the Provider, you can access the value of the StateContext. return ( <TodoContext.Consumer> {value => { console.log('The current state is', value.state); console.log('All of the todos are here', value.state.todos); console.log('I can add a todo using:', value.createTodo); console.log('I can delete todos using:', value.deleteTodo); }} </TodoContext.Consumer> ); }
What version of React is required?
You need to be using at least React v0.14.
Although the new Context API was introduced in 16.3.0, this library is built using the excellent create-react-context library, which polyfills the API for older React versions.
Why would someone use this over Redux?
The reason that I initially started using Redux was to more easily share data between components. Although Redux can seem like a simple system once you become familiar with it, the number of concepts it has can make it daunting to newcomers. At least, that's how I felt when I was learning it.
For me, React State Context solves the problems that I originally used Redux for in a more straightforward way, which is why I think a solution like this seems promising.
What does one lose by migrating away from Redux?
The Redux library supports middleware, and it enables time travel debugging, which are both things that you do not get from React State Context. If you rely heavily on those features of Redux, then this library may not be suitable for your needs.
Outside of the Redux source code itself, there is an enormous community around that library. There are considerable benefits to using a library that has such a large number of users, and you will lose that community by switching to this library, or most other alternative state management libraries, for that matter.
With that said, React State Context is built on top of React's built-in Context API. Although the new Context API is likely not very familiar to most React developers today, we believe that that will change as time goes on.
How is this different from Unstated?
Unstated is a fantastic library, and it served as inspiration for this library. The primary difference is that
Unstated introduces new concepts for state management, like
Container and
Subscribe. One of the design goals of React State Context was to avoid
introducing additional concepts whenever possible in an effort to reduce the learning curve.
We believe that we avoided introducing those new concepts while still getting a remarkably similar developer experience. Perhaps you will feel the same way!
Contributing
Are you interested in helping out with this project? That's awesome – thank you! Head on over to the contributing guide to get started. | https://codespots.com/library/item/2997 | CC-MAIN-2019-47 | refinedweb | 1,330 | 58.08 |
news.digitalmars.com - digitalmars.D.learnDec 10 2012 "overlapping" structs (1)
Dec 10 2012 Why the lack of networky bits in the standard library (2)
Dec 10 2012 Type value (4)
Dec 10 2012 std.algorithm Map using a external variable (5)
Dec 10 2012 Hide console of gui program coded by gtkD (7)
Dec 09 2012 how to make new C return other static type than C (5)
Dec 09 2012 static code generation (14)
Dec 08 2012 alias this private? (13)
Dec 08 2012 struct in class access (8)
Dec 08 2012 AES-NI (5)
Dec 08 2012 What D module defines EINTR etc? (3)
Dec 08 2012 struct throws errors if it has a DTor (6)
Dec 07 2012 question on buffer passed in to recvFrom (2)
Dec 07 2012 Profiling (3)
Dec 07 2012 concurrency send() error (2)
Dec 06 2012 Visual D - Solution with Static Lib and Console App. (7)
Dec 06 2012 constructor is not callable using argument types () (9)
Dec 06 2012 error with reading file name (6)
Dec 06 2012 More templated type argument inference (10)
Dec 06 2012 Unit tests and segfaults (2)
Dec 05 2012 Getting memory size of class (3)
Dec 05 2012 Appending immutable char implicit cast to int, bug or feature? (1)
Dec 05 2012 Appending immutable char implicit cast to int, bug or feature? (3)
Dec 04 2012 Type polymorphism and type variance (10)
Dec 04 2012 Type polymorphism and type variance (1)
Dec 04 2012 Type polymorphism and type variance (1)
Dec 04 2012 Type polymorphism and type variance (1)
Dec 04 2012 opEquals (2)
Dec 04 2012 opEquals for same type (3)
Dec 04 2012 C# implementation of Nullable (May) (3)
Dec 04 2012 Default template type for class? (3)
Dec 04 2012 Type aliasing (3)
Dec 03 2012 MS ODBC encoding issue (10)
Dec 03 2012 Template return values? (23)
Dec 03 2012 How to import modules? (5)
Dec 03 2012 Array indexing (4)
Dec 03 2012 Most elegant representation of a card's rank (4)
Dec 03 2012 Introspection: TLS and __gshared variables (1)
Dec 02 2012 "Aliases to mutable thread-local data not allowed" when using spawn() (3)
Dec 02 2012 Initialize multi dimensional associative dynamic array (5)
Dec 02 2012 default implemented opAssign purity (9)
Dec 02 2012 VisualD solution configuration (7)
Dec 01 2012 struct initialization and assignment by field name (3)
Dec 01 2012 static initialization of structs (4)
Dec 01 2012 How works internally ParallelForEach (5)
Nov 30 2012 get address of object if opCast is overridden (11)
Nov 30 2012 Compile And Run in emacs (6)
Nov 30 2012 Linker error (3)
Nov 30 2012 How can I store delegates in array? (5)
Nov 30 2012 alias this (9)
Nov 29 2012 Type converter from build in to user type (5)
Nov 29 2012 prune with dirEntries (12)
Nov 29 2012 Templated Function pointers (4)
Nov 29 2012 Newb's questions constructor (1)
Nov 29 2012 Initializing values in associative arrays (2)
Nov 29 2012 Can operators "return" type? (6)
Nov 29 2012 opSlice Bug? (8)
Nov 29 2012 canFind typing (3)
Nov 29 2012 static assert (2)
Nov 28 2012 assertion failure with template instantiation of forward reference (3)
Nov 28 2012 Apparent problem with GC not collecting on Windows (14)
Nov 27 2012 safety of move (2)
Nov 27 2012 auto ref and arrays (6)
Nov 27 2012 path matching problem (10)
Nov 26 2012 #define trouble (3)
Nov 26 2012 Windgb debug a dll (1)
Nov 26 2012 type determination (6)
Nov 26 2012 What to use instead of array.join if RHS is not a range? (3)
Nov 26 2012 telnet and D (7)
Nov 26 2012 How to compile D application without the D runtime? (1)
Nov 26 2012 SList/DList ranges (4)
Nov 26 2012 Segfault with std.container.Array but not regular dynamic array (1)
Nov 25 2012 Bug with offsetof? (8)
Nov 25 2012 Libraries for machine learning or artificial intelligence. (2)
Nov 25 2012 std.bigint: BigInt conversion (4)
Nov 24 2012 Returning const ref (structs) in D (5)
Nov 24 2012 constructor instead of opCall for an instance of a template alias (7)
Nov 24 2012 passing struct literals by reference (dmd 2.060, Windows) (3)
Nov 23 2012 sort associative array by key (5)
Nov 23 2012 Can functions add properties? (3)
Nov 23 2012 Complex C typedef decl replacement (7)
Nov 22 2012 CTFE Memory Hogging Workaround? (3)
Nov 22 2012 Converting a number to complex (13)
Nov 22 2012 enum detection (7)
Nov 21 2012 unqualified types in tuple (2)
Nov 21 2012 template ref parameter (16)
Nov 20 2012 parallelism with message passing (1)
Nov 20 2012 making COW and ownership (4)
Nov 20 2012 Array literal template parameter? (4)
Nov 20 2012 hash design problem: both string and int[] keys (6)
Nov 20 2012 runtime static arrays (18)
Nov 20 2012 template library like Jinja (8)
Nov 20 2012 foreach loop + counter iter + Phobos range (7)
Nov 19 2012 Broken Hyperlinks on the Web server. (2)
Nov 19 2012 Default template arguments (9)
Nov 19 2012 Strange observation when using rdmd (1)
Nov 18 2012 using std.regex with (A|B) patterns. (2)
Nov 18 2012 declaration/initialization of multidimensional arrays (9)
Nov 18 2012 struct + writeln (3)
Nov 18 2012 Strange template alias behaviour (3)
Nov 17 2012 Stack allocated arrays (8)
Nov 17 2012 template error instantiating (13)
Nov 17 2012 DWT vs GtkD (2)
Nov 16 2012 Can I call the default opAssign after overloading opAssign? (21)
Nov 16 2012 How to call external program in D (4)
Nov 16 2012 how to count number of letters with std.algorithm.count / (8)
Nov 15 2012 foreach on const(V[K]) (1)
Nov 15 2012 weird constness by AA's (3)
Nov 15 2012 shouldn't const cast always be allowed (even if shunned) (3)
Nov 15 2012 Calls to struct methods and immutable (25)
Nov 15 2012 is hash iteration cast required (1)
Nov 15 2012 is is cast on hash required (2)
Nov 14 2012 Some stuff about unittests, contracts, etc (2)
Nov 14 2012 funky property error with assoc array (1)
Nov 14 2012 funky property error with assoc array (1)
Nov 14 2012 funky property error with assoc array (8)
Nov 14 2012 taskPool.map using functions with more than one input (1)
Nov 14 2012 Safely writing to the same file in parallel foreach loop (1)
Nov 14 2012 Coverting ubyte to string. (3)
Nov 14 2012 operations on rectangular arrays (2)
Nov 13 2012 Extent of tail call optimization in D? (1)
Nov 13 2012 Shared value types can not be destructed (2)
Nov 13 2012 ref return function using foreach ref result segfaults. Compiler bug? (3)
Nov 12 2012 Regarding ranges (4)
Nov 12 2012 Pointer to string allows assigning int[]? (7)
Nov 12 2012 Inferring function argument types from other argument types (4)
Nov 11 2012 Base Class Hitting Derived Class Invariant (3)
Nov 11 2012 Is Override Still Mandatory? (11)
Nov 11 2012 shared lib and __data_start (6)
Nov 11 2012 alias this versus opDot (7)
Nov 11 2012 Fasta parser (10)
Nov 11 2012 Template mixin identifier as template alias parameter (4)
Nov 10 2012 no size for type nothrow extern (Windows) int() (4)
Nov 10 2012 Serialization library with support for circular references? (3)
Nov 10 2012 A refinement for pure implementation (5)
Nov 10 2012 Casting an array form an associative array (3)
Nov 09 2012 Is there a way to initialize a non-assigned structure declaration (or (6)
Nov 09 2012 attribute bug? (12)
Nov 09 2012 Incrementing a variable in CTFE? (3)
Nov 09 2012 delegate bug? (15)
Nov 09 2012 hashes of hashes not supported (6)
Nov 08 2012 C++/D platform matrix (2)
Nov 07 2012 Recursive data structure using template won't compile (67)
Nov 07 2012 Manually freeing up memory (9)
Nov 06 2012 Performance of hashes and associative arrays (15)
Nov 06 2012 Current status of DLLs (8)
Nov 06 2012 *in* vs *const ref* (3)
Nov 06 2012 How do I store an immutable value into a mutable associative array? (7)
Nov 06 2012 const ref template vs non-template (3)
Nov 06 2012 Extracting template parameters (3)
Nov 06 2012 current GC behavior (8)
Nov 05 2012 Memory overhead for a fiber? (2)
Nov 05 2012 some mixin utilities (4)
Nov 05 2012 removing element from DList (10)
Nov 04 2012 question on [Issue 7853] (6)
Nov 04 2012 why my tail implementation is much more slower than coreutil ? (4)
Nov 04 2012 implib error with opencv dll (max 450 chars) (1)
Nov 04 2012 heap allocate empty S with variadic ctor (3)
Nov 03 2012 Runtime.unloadLibrary does not return (1)
Nov 03 2012 Miscellaneous question regarding std.container? (3)
Nov 02 2012 Check/Compare a value using "in" (4)
Nov 02 2012 Derelict3: can't load a shared library (4)
Nov 02 2012 How to fix opAssign signature (3)
Nov 01 2012 SList of chars not possible? (4)
Nov 01 2012 vestigial delete in language spec (5)
Nov 01 2012 How to add n items to TypeTuple? (4)
Nov 01 2012 Vibe: I found the problem, but don't know how to fix it (2)
Nov 01 2012 struct Yes in std.typecons (2)
Oct 31 2012 Ranges and Library and toir.c internal error (3)
Oct 31 2012 modules in other directory trees (2)
Oct 31 2012 cast question (4)
Oct 31 2012 getters and setters not an lvalue (14)
Oct 30 2012 finding composed structs (11)
Oct 30 2012 DFL Button.backColor (2)
Oct 30 2012 Callbacks and interfacing with C (6)
Oct 30 2012 Interesting C header translation problem (3)
Oct 29 2012 How to place char* of stringZ to ubyte[]? (7)
Oct 29 2012 UTF-8 strings and endianness (10)
Oct 29 2012 Exception class descendants (3)
Oct 29 2012 __traits(compiles,...) <=> ? is(typeof(...)) (12)
Oct 28 2012 Reading results from dmd -profile (1)
Oct 28 2012 What is the proper way to handle pointers in variable arguments list? (5)
Oct 28 2012 crash suggestions (5)
Oct 28 2012 portable windowing und graphics libraries (2)
Oct 27 2012 Where are the strings in std.string? (2)
Oct 27 2012 mousehandler (4)
Oct 27 2012 Simple reading of binary data (2)
Oct 27 2012 Copying with immutable arrays (6)
Oct 26 2012 Why is "delete" unsafe? (6)
Oct 26 2012 Compiling shared example. (4)
Oct 26 2012 scope(failure): get exception (9)
Oct 26 2012 How to "extend" built-in types (7)
Oct 25 2012 Proxy addition (3)
Oct 25 2012 TypeInfo manipulation (7)
Oct 25 2012 installation and configuration of vibe (6)
Oct 24 2012 Sort order of dirEntries (2)
Oct 24 2012 cgdb searching patch to support d syntax (1)
Oct 24 2012 Intended Security Hole? (12)
Oct 24 2012 Multidimensional slicing (3)
Oct 24 2012 Error: no property 'opCall' for type 'app1.ReturnContent' (2)
Oct 23 2012 long compile time question (15)
Oct 23 2012 exception messages (5)
Oct 23 2012 overriding private interface methods (3)
Oct 23 2012 Threading Question (9)
Oct 23 2012 Narrow string is not a random access range (31)
Oct 23 2012 msgpack unresolved question (6)
Oct 23 2012 How to start new command with arguments, pass data to its stdin read (5)
Oct 22 2012 Correct way to map C #define to version (8)
Oct 21 2012 Reordered class fields? (11)
Oct 21 2012 Slices and array appending (4)
Oct 21 2012 class opBinary overloading. value + null and null + value (4)
Oct 21 2012 Overload resolution (value vs reference) (6)
Oct 20 2012 Deimos organization (4)
Oct 20 2012 Reflection: is type an inner class (7)
Oct 20 2012 SFML-D working example (4)
Oct 20 2012 override toString of Exception (7)
Oct 19 2012 synchronization + nothrow (1)
Oct 19 2012 import inside function sometimes causes link errors (3)
Oct 19 2012 incomprehensible bug with import side effects (1)
Oct 19 2012 Resizing array of classes (5)
Oct 18 2012 Implicit Conversions in Struct Construction (7)
Oct 18 2012 opCast using in template struct (16)
Oct 18 2012 Extending library functions (8)
Oct 18 2012 undefined identifier (2)
Oct 18 2012 Friends? (14)
Oct 17 2012 std.concurrency msg passing (8)
Oct 17 2012 independent or parallel process (4)
Oct 17 2012 std.range.chunks for char[] (2)
Oct 17 2012 Returning dynamic array from the function (11)
Oct 16 2012 optlink and weak symbols (9)
Oct 16 2012 with(a,b,c, ...) blocks.. (3)
Oct 16 2012 How to define an interator to provide array like behaviour in a class? (11)
Oct 16 2012 private module members (4)
Oct 16 2012 Stack trace output on windows (9)
Oct 16 2012 Problem with UFCS (4)
Oct 16 2012 Returning reference to integer from property setter function (3)
Oct 15 2012 clear array (8)
Oct 15 2012 Code review: JSON unmarshaller (16)
Oct 15 2012 how to create a local copy of shared pointer? (5)
Oct 15 2012 templated static array (11)
Oct 15 2012 More automated interfacing of D with C codebases (24)
Oct 15 2012 Pegged: error I am unable to fix (3)
Oct 15 2012 Sorting algorithms (10)
Oct 14 2012 Do we have GC-free hash map implementation sitting somewhere? (4)
Oct 14 2012 Specifying precision in %(...%) print format (2)
Oct 14 2012 To: Johannes Pfau (2)
Oct 14 2012 toStringz note about keeping references (3)
Oct 14 2012 What am I doing wrong here? (3)
Oct 14 2012 Ignoring defaults from sc.ini? (3)
Oct 13 2012 COM Example work for anyone? (3)
Oct 13 2012 std.stream, BOM, and deprecation (7)
Oct 13 2012 opIs broke for structs? (4)
Oct 13 2012 Good D book (8)
Oct 13 2012 Operator overloading through UFCS doesn't work (42)
Oct 12 2012 Calling un-overridden class method (2)
Oct 12 2012 Why doesn't DMD recreate folder structure when using multiple .d (1)
Oct 12 2012 equivalent of c++ private inheritance with using (3)
Oct 12 2012 Import Libs, DLLs, 64bit and 32bit (1)
Oct 12 2012 Automated D code editing? (8)
Oct 11 2012 In Expression for Static and DYnamic Arrays (1)
Oct 12 2012 LockingTextWriter/Reader (3)
Oct 12 2012 Save JSONValue binary in file? (6)
Oct 12 2012 Is there a thread safe single linked list? (8)
Oct 11 2012 Latest Version of Ali's Book (3)
Oct 11 2012 floating point divide (4)
Oct 11 2012 revamped candydoc (19)
Oct 11 2012 About demangling (12)
Oct 10 2012 Linking with phobos on compiled dmd, osx 64bit (2)
Oct 10 2012 How many std.concurrency receivers? (19)
Oct 10 2012 non-const reference to const instance of class (3)
Oct 10 2012 Unable to understand this compiler error (6)
Oct 10 2012 Best way to store postgresql's "numeric" type in D? (3)
Oct 09 2012 "Best" way of passing in a big struct to a function? (12)
Oct 09 2012 Detect if running 32 bit program on 64 bit Windows OS (2)
Oct 09 2012 Splitting a string on multiple tokens (4)
Oct 09 2012 Error: function wgdb.to_string is not accessible from module wgdb (1)
Oct 09 2012 this() in struct (10)
Oct 09 2012 Unexpected OPTLINK termination (7)
Oct 09 2012 How can I know that all child thread are gone out? (3)
Oct 09 2012 not expected pointers for struct members from foreach (6)
Oct 09 2012 bigger then size_t (8)
Oct 08 2012 VisualD: Is keyboard navigation in project properties broken? (1)
Oct 08 2012 CFTE+DevIL=? (4)
Oct 08 2012 Growing multidimensional dynamic arrays (3)
Oct 08 2012 Unicode encodings and string literals (2)
Oct 07 2012 Any sample for DFL library? (8)
Oct 07 2012 Assign to element of DList (3)
Oct 07 2012 std.csv.csvReader operating on File.byLine() (6)
Oct 07 2012 How to generate / where to download .LIB files for WindowsAPI (1)
Oct 07 2012 Function pointer variable not recognized as function by is-operator (4)
Oct 06 2012 Struct members align in DMD 2.060 (8)
Oct 06 2012 Struct polymorphism? (7)
Oct 06 2012 Remove element from DList (17)
Oct 06 2012 next power of 2 (8)
Oct 06 2012 ddoc - documenting private variables (10)
Oct 06 2012 version(debug) (15)
Oct 06 2012 How to create immutable struct? (3)
Oct 06 2012 First experience with Threads (4)
Oct 06 2012 connect to an SQL Server database (4)
Oct 05 2012 What does 'd' in dchar stand for? (2)
Oct 05 2012 Missing entry (2)
Oct 05 2012 Workarounds for forward reference bugs (4)
Oct 05 2012 is array an InputRange? (5)
Oct 05 2012 std.algorithm.skipOver broken / misbehaving? (5)
Oct 05 2012 How to create library with exported functions (5)
Oct 05 2012 How to iterate all k-subsets of a range in a specific order? (6)
Oct 04 2012 Can't print inout parameter (1)
Oct 04 2012 Best way to Identify Endianness? (3)
Oct 04 2012 Floats 1E-7 != 1.0E-7 (3)
Oct 04 2012 Using inout in delegates (11)
Oct 03 2012 Question about memoize (2)
Oct 03 2012 redefine extern(C) function in a shared library (4)
Oct 03 2012 Question about anonymous delegates. (2)
Oct 02 2012 how to call std_stdio_static_this from a dynamically loaded shared (13)
Oct 02 2012 zip.map.reduce at CT? (1)
Oct 02 2012 Functional vs simple code (10)
Oct 02 2012 Tips for debugging EXC_BAD_ACCESS (1)
Sep 30 2012 Troubleshooting Linker error (Symbol Undefined) (11)
Sep 30 2012 WIC and Direct X (1)
Sep 30 2012 Metaprogramming: check for ref (7)
Sep 29 2012 Very strange problem with comparing floating point numbers (20)
Sep 29 2012 liittle question about reduce (3)
Sep 29 2012 Struct assignment, possible DMD bug? (10)
Sep 28 2012 compiler assertion (5)
Sep 28 2012 Windows MinGW and DMD (2)
Sep 28 2012 How to register class member function as lpfnWndProc? Cannot convert (5)
Sep 28 2012 Using Cairo library bindings on Windows (9)
Sep 27 2012 Something wrong with std.math.pow? (6)
Sep 27 2012 template instantiation in D (2)
Sep 27 2012 template condition (8)
Sep 27 2012 scope as storage class (6)
Sep 26 2012 Finite state machine in D (7)
Sep 26 2012 importing executables (2)
Sep 26 2012 append element to variantArray (1)
Sep 26 2012 enum of tuples (6)
Sep 26 2012 read single characters from stdin (9)
Sep 25 2012 GUI development libraries in D? (5)
Sep 25 2012 Runtime termination hook? (6)
Sep 25 2012 How can I hide implementation details when make a library (6)
Sep 24 2012 Zipped sorting (7)
Sep 24 2012 How do I use std.zlib to write a struct of data to a binary file with (8)
Sep 24 2012 full duplex std.socket (1)
Sep 24 2012 FormattedRead hex string (4)
Sep 23 2012 memory de-allocation? (2)
Sep 23 2012 alias to a property as an argument to a mixin template (10)
Sep 23 2012 educational graphics library for D (2)
Sep 22 2012 How to Instantiate struct defined in template (5)
Sep 22 2012 Testing for template argument being result of takeExactly (26)
Sep 22 2012 system vs. execvp ? (7)
Sep 22 2012 object.error: Privileged Instruction (5)
Sep 22 2012 Assembly JIT library? (1)
Sep 22 2012 how is this considered hiding methods? (7)
Sep 21 2012 function is not function (9)
Sep 21 2012 Passing associative array to another thread (13)
Sep 21 2012 how to get version identifiers set during compilation? (1)
Sep 20 2012 how to parse a demangled symbol into parse tree or other form (1)
Sep 20 2012 tuple(tuple(1)) fails to compile, but tuple(tuple(1),1) works (3)
Sep 20 2012 std.datetime TimeOfDay missing 'add' method? (4)
Sep 20 2012 bearophile (18)
Sep 20 2012 Stupid scope destruction question (7)
Sep 20 2012 Optional function invocation parentheses (8)
Sep 19 2012 static init cycle detection problem (9)
Sep 19 2012 std.json: SkipWhitespace = false ? (5)
Sep 19 2012 access enclosing type from shared static this() (4)
Sep 19 2012 Running unittests in a D library (10)
Sep 19 2012 Writing/Reading Compressed Binary Files (2)
Sep 19 2012 D object model (1)
Sep 19 2012 move object from heap to stack (24)
Sep 19 2012 Problem with environ variable (Mac OS X) (10)
Sep 18 2012 splitting numbers from a test file (12)
Sep 18 2012 inconsistent behavior with "is a nested function and cannot be (1)
Sep 18 2012 Variant opArithmetic (3)
Sep 18 2012 String mixin in templates (3)
Sep 17 2012 undefined reference to `_D6deimos6python6Python12__ModuleInfoZ' (4)
Sep 17 2012 lockstep alternative for StoppingPolicy.longest (8)
Sep 17 2012 problems with nothrow (2)
Sep 17 2012 ctfe slicing (1)
Sep 17 2012 std.net.curl - how to set custom Content-Type? (5)
Sep 17 2012 Get identifier of "this" (6)
Sep 17 2012 Regarding type deduction (2)
Sep 17 2012 ref keys (7)
Sep 16 2012 Can't install DMD 2.060 on OS X 10.6.8 (8)
Sep 16 2012 template class name unconsistent behavior (4)
Sep 16 2012 Type checking on typed enum (5)
Sep 16 2012 Compiler should error when goto over initialization? (3)
Sep 16 2012 Error: WndProc - nothrow (16)
Sep 16 2012 Packaging D libraries, cross compiler compatibility (4)
Sep 15 2012 How to copy a const multi-dimensional array to mutable? (2)
Sep 15 2012 std.parallelism and map questions (2)
Sep 15 2012 Automatic return type covariance for functions that return this? (6)
Sep 15 2012 const void* when wrapping C++ (1)
Sep 14 2012 Quick question about new semantics (2)
Sep 14 2012 Task management (1)
Sep 14 2012 Quick int pointer allocation question (19)
Sep 13 2012 member function as template parameter workaround needed (7)
Sep 13 2012 Reading stdout of an external process using pipes under windows (1)
Sep 13 2012 Writing UFCS function for any instance of a templated struct (5)
Sep 12 2012 built-in int[] opSliceOpAssign throws? (4)
Sep 11 2012 auto limitation? (29)
Sep 11 2012 scons and D: flags (4)
Sep 11 2012 Handling DirectX 9 texture (2)
Sep 11 2012 Templates class member functions not conditional? (16)
Sep 10 2012 How to change DList elements by means of foreach? (6)
Sep 09 2012 Using traits to detect alias declaration (3)
Sep 09 2012 filter out compile error messages involving _error_ (7)
Sep 09 2012 inconsistent behavior with implicit imports (4)
Sep 09 2012 Find indexes of elements matching a given value in an array (4)
Sep 09 2012 import all except specified symbols: eg import (4)
Sep 09 2012 object.factory with template classes for serializing subclasses (8)
Sep 09 2012 delegate from lambda expression (9)
Sep 09 2012 regexex, enforce and purity (4)
Sep 09 2012 Associative array of dynamic array (6)
Sep 08 2012 const attribute makes whole element const? (18)
Sep 08 2012 since when was this valid syntax? (12)
Sep 08 2012 string to thread (6)
Sep 07 2012 int[3][4]* (6)
Sep 07 2012 linker _ (3)
Sep 07 2012 typeof(enum) (4)
Sep 07 2012 offsetof + foreach (3)
Sep 05 2012 bigint <-> python long (38)
Sep 05 2012 RTP/RTCP in D? (2)
Sep 05 2012 DMD flags (3)
Sep 04 2012 Linking with LLVM on Windows (1)
Sep 04 2012 How to have strongly typed numerical values? (15)
Sep 04 2012 Aliasing specialized template stuct in his module leads troubles (6)
Sep 04 2012 modulename (17)
Sep 04 2012 import doesn't import jpg (6)
Sep 03 2012 DerelictGL program draw nothing (12)
Sep 02 2012 Can i rewrite methods in one line? (7)
Sep 02 2012 How to call one anonymous function from another (2)
Sep 01 2012 Some strange parameter deduction problems in opOpAssign and opBinary (6)
Sep 01 2012 trying setjmp or throwing from signal handler crashes on OSX (4)
Sep 01 2012 Derelict3+SFML2 (3)
Aug 31 2012 import std.random fails (6)
Aug 31 2012 segfault (4)
Aug 31 2012 popFront with input variables (2)
Aug 31 2012 Assigning global and static associative arrays (26)
Aug 31 2012 Trait to get function parameter names (7)
Aug 30 2012 my own directx tutorials (2)
Aug 30 2012 Learning D in Atlanta (3)
Aug 30 2012 Use .get() in MultiD Assoc Array? (15)
Aug 29 2012 CTFE toUpper/toLower (7)
Aug 29 2012 rdmd & exception def & multiple files (16)
Aug 29 2012 Call a function on an entire slice (3)
Aug 28 2012 CTFE question (11)
Aug 27 2012 Comparing pointers with "is" (3)
Aug 27 2012 static struct definition (7)
Aug 26 2012 opUnary overloading (5)
Aug 26 2012 struct opCmp confustion (7)
Aug 26 2012 RefRange (13)
Aug 25 2012 Lazy range of hashes? (8)
Aug 25 2012 celerid and cygwin (1)
Aug 25 2012 Reading bytes and converting to int (16)
Aug 25 2012 std.regex - ctRegex (5)
Aug 25 2012 float comparison (4)
Aug 24 2012 how to get fully qualified name of a template function (if possible at (3)
Aug 24 2012 abnormal program termination (10)
Aug 24 2012 Check for ctfe (9)
Aug 24 2012 types of ranges (3)
Aug 23 2012 Memory detection (7)
Aug 23 2012 inout functions (4)
Aug 23 2012 Surprise with array idup method (3)
Aug 23 2012 call member function alias (3)
Aug 23 2012 struct init property (20)
Aug 23 2012 opDispatch with implicit receiver (3)
Aug 23 2012 Iterating over a variant conaining an associative array (1)
Aug 22 2012 SSE2 movddup Not Moving Values (2)
Aug 22 2012 function pointer and default argument (5)
Aug 22 2012 Link against MinGW libraries (5)
Aug 22 2012 std.widows.registry (2)
Aug 22 2012 struct with disable(d) default constructor doesn't work with arrays? (3)
Aug 21 2012 reduce!"a+b"(R) syntax question (5)
Aug 20 2012 to!string(double) at compile time (3)
Aug 20 2012 demangling (Ubuntu 64bit 12.04, dmd 64bit 2.060) (4)
Aug 20 2012 template and constraints (4)
Aug 20 2012 demangling (Ubuntu 64bit 12.04, dmd 64bit 2.060) (6)
Aug 20 2012 user defined no bounds check (7)
Aug 19 2012 Contracts for interfaces and abstract classes (2)
Aug 19 2012 Unexpected OPTLINK termination (3)
Aug 19 2012 math.pow fails at compile-time; is this a bug? (1)
Aug 19 2012 D1: Passing 0x00000000 value to a Windows COM function (7)
Aug 19 2012 std.complex will replace the built-in types (2)
Aug 19 2012 -noboundscheck (14)
Aug 19 2012 stdlib.exit() (14)
Aug 19 2012 Where to place function attributes? (4)
Aug 18 2012 CT Busy Beaver (10)
Aug 18 2012 Non-immutable char[] doesn't change? (4)
Aug 17 2012 Stringy Weirdness (6)
Aug 17 2012 Recursive expansion (7)
Aug 17 2012 DMD CTFE Bug? (4)
Aug 16 2012 Memoize and other optimization. (6)
Aug 16 2012 How create a operator tree? (8)
Aug 16 2012 Matrix Multiplication benchmark (5)
Aug 15 2012 Question on Octal (4)
Aug 15 2012 Global variables read at compile time? (9)
Aug 14 2012 Unions and array length... (1)
Aug 14 2012 Sudoku Py / C++11 / D? (71)
Aug 14 2012 dmd -Df (1)
Aug 14 2012 passing 0 to const char[] (7)
Aug 13 2012 where is parameterNames? (10)
Aug 13 2012 Link .s file with dmd? (3)
Aug 13 2012 AA rehash link error (2)
Aug 13 2012 prevent multiple calls to rt_term (5)
Aug 13 2012 Linker errors after updating to DMD 2.060 (3)
Aug 12 2012 char ***argc problems. (4)
Aug 12 2012 char ***argc problems. (11)
Aug 12 2012 complete initialization of the static allocated array (8)
Aug 12 2012 Iterating through enumeration (10)
Aug 11 2012 vector Cross/Dot using core.simd? (4)
Aug 11 2012 Null Object works still fine (4)
Aug 11 2012 Specialize mixin templates (3)
Aug 11 2012 Check whether a type is a instantiated by a template struct (5)
Aug 11 2012 "For" infinite loop (15)
Aug 09 2012 An example of Rust code (4)
Aug 09 2012 Reading a csv file (7)
Aug 09 2012 Internally recursion with map (2)
Aug 09 2012 How does "immutable" work. (5)
Aug 09 2012 Convert little imperative code to functional coding style (7)
Aug 09 2012 Using MinGW DLL with DMD? (6)
Aug 09 2012 std.algorithm.copy target not passed by reference (bug?) (2)
Aug 09 2012 HOWTO: automatic test a D program (4)
Aug 08 2012 Features of D to Emphasize for Academic Journal (2)
Aug 08 2012 template - aliasing a member function (5)
Aug 08 2012 DWiki tables (4)
Aug 08 2012 overloading a function taking a void[][] (6)
Aug 08 2012 Error: SIMD vector types not supported on this platform (10)
Aug 07 2012 two-dimensional C array and its analog in D (9)
Aug 07 2012 thread exceptions (8)
Aug 07 2012 Re: DMD out of memory issues (1)
Aug 07 2012 ctRegex - named submatch (4)
Aug 07 2012 enum string (13)
Aug 07 2012 Daemon Threads (9)
Aug 07 2012 How to create TypeTuple/ExpressionTuple from tuple/tuples (14)
Aug 07 2012 How to const-overload opEquals(R)(R rhs)? (5)
Aug 07 2012 Is this a std.regex bug? (4)
Aug 07 2012 Why __traits(compile,...) fails here? (8)
Aug 06 2012 Nested struct member has no access to the enclosing class data (6)
Aug 06 2012 Missing destructor call using clear and base interface ref. (4)
Aug 06 2012 Error while trying to allocate memory (malloc) (11)
Aug 06 2012 Function that calculates in compile time when it can (21)
Aug 06 2012 how implement takeWhile (9)
Aug 05 2012 How to define a constructor in a struct? (7)
Aug 05 2012 Looking for D Programming tutorials (3)
Aug 04 2012 casting from variant (5)
Aug 04 2012 unittest vs exceptions? (10)
Aug 04 2012 Random Numbers (8)
Aug 04 2012 Return doesn't really return (6)
Aug 04 2012 Using map to create a sequence (1)
Aug 04 2012 Inconsistency with function pointers (8)
Aug 04 2012 Variadic Template: cast problem (5)
Aug 04 2012 Why does foreach with __traits ignore ForeachTypeList's type ? (4)
Aug 03 2012 Templates and stringof... (21)
Aug 03 2012 NotNull Parser (9)
Aug 02 2012 How to use "read_bool"? (15)
Aug 02 2012 how to pass a variable name in the template in this case? (8)
Aug 02 2012 std.variant and delegate (4)
Aug 02 2012 Converting some C++ code help. (2)
Aug 02 2012 Cannot build ws2_32.lib (5)
Aug 02 2012 Making array elements truly const/immutable (7)
Aug 01 2012 instanceof? (4)
Aug 01 2012 Octree D realization (2)
Jul 30 2012 AES decrypt/encrypt Stream (1)
Jul 30 2012 Top level array constness discarding and Variant (3)
Jul 30 2012 Detector for unused variables (38)
Jul 30 2012 Has AA .keys the same order as .values? (6)
Jul 30 2012 Why must butfields sum to a multiple of a byte? (42)
Jul 30 2012 sorting failed error (30)
Jul 29 2012 sort strings by interpreting them as integrals (3)
Jul 29 2012 Ranges and backward iteration (4)
Jul 29 2012 How do I set file attributes? (3)
Jul 29 2012 Help Converting from C++ (4)
Jul 29 2012 Is "delete" really going away? (5)
Jul 28 2012 FYI my experience with D' version (9)
Jul 28 2012 BitArray/BitFields - Review (53)
Jul 28 2012 template with more than one tuple parameter (8)
Jul 28 2012 sum across an array of objects (8)
Jul 27 2012 Differing levels of type-inference: Can D do this? (14)
Jul 27 2012 Implementing a Monitor (3)
Jul 27 2012 copying the targets of pointers (7)
Jul 27 2012 A matter of inout (7)
Jul 27 2012 Just a matter of parentheses (3)
Jul 27 2012 A few questions (44)
Jul 27 2012 Assert prints an "array of char" when used why to!string (7)
Jul 26 2012 Writing very large files 50+ GB (5)
Jul 26 2012 Why are scope variables being deprecated? (11)
Jul 26 2012 normal function and template function conflict (9)
Jul 26 2012 profiling with -profile (2)
Jul 26 2012 an enum inside another enum (4)
Jul 26 2012 Simple D Questions (static if / #pragma / int[3][3]) (4)
Jul 25 2012 opCast problem with 2.060 (3)
Jul 24 2012 tupleof for inherited classes. (2)
Jul 24 2012 Recipe and best practice for accessing COM (13)
Jul 24 2012 float[] =?UTF-8?B?4oaSIFZlcnRleFtdIOKAkyBkZWNyZWFzZXMgcGVyZm9ybWE=?= (49)
Jul 24 2012 Mailbox limits and dead/livelocks? (3)
Jul 24 2012 Tid is not a process id? (4)
Jul 23 2012 Optional extra return value? Multiple return values with auto? (15)
Jul 23 2012 best way to convert string array of floats to a float array (6)
Jul 23 2012 shared immutable issues (5)
Jul 23 2012 Explicit call of ternary compare (3)
Jul 23 2012 const ref void[] =?UTF-8?B?4oCTIGZsb2F0W10gbm90IGltcGxpY2l0bHkgYw==?= (4)
Jul 22 2012 Non-global template cannot use local lambda (3)
Jul 22 2012 datetime/time quickie (4)
Jul 22 2012 Compile-Time module info (2)
Jul 21 2012 Chaining a dynamic number of Ranges (7)
Jul 21 2012 functions that do not sleep and recovery points (1)
Jul 20 2012 Parameter specialization (4)
Jul 20 2012 Problem: handling a function dependent on release mode. (11)
Jul 20 2012 Predictable seed for pseudo-random number generation (1)
Jul 20 2012 More WinAPI problems (4)
Jul 19 2012 ~= call copy ctor? (58)
Jul 19 2012 WinAPI LowLevel Keyboard Hooks (17)
Jul 18 2012 opDot == alias this? (5)
Jul 18 2012 is() and const (4)
Jul 17 2012 Segmentation fault while creating a class object by dlsym-ed function (8)
Jul 17 2012 foreach for ranges? (12)
Jul 17 2012 Is there a graphing library for D? (3)
Jul 17 2012 Magic type return (9)
Jul 17 2012 Getting the underlying type of enum? (2)
Jul 16 2012 Is this actually supposed to be legal? (17)
Jul 16 2012 How to make a unique copy in a generic manner? (2)
Jul 16 2012 conv parse imported file bug? (4)
Jul 15 2012 Can't create immutable type in template (3)
Jul 15 2012 Object Pointer (8)
Jul 15 2012 using GC needs particular skills? (14)
Jul 15 2012 How to instantiate class object NOT in the GC heap (10)
Jul 15 2012 TypeInfo_Class getMembers() and offTi() (2)
Jul 14 2012 ufcs and integer params (34)
Jul 14 2012 ICFP2012 (2)
Jul 13 2012 caller trouble (6)
Jul 13 2012 Creating a shared reference type (5)
Jul 13 2012 Reading file contents when file has changed (3)
Jul 13 2012 string vs. const(char)[] on the function signature (4)
Jul 13 2012 Immutable array initialization in shared static this (8)
Jul 13 2012 cast from void[] to ubyte[] in ctfe (4)
Jul 12 2012 stdarg x86_64 problems... (3)
Jul 11 2012 immutability and constness (6)
Jul 11 2012 deimos libX11 undefined reference (9)
Jul 11 2012 (a,b,c) syntax (2)
Jul 11 2012 Check if template param is null (3)
Jul 10 2012 readonly? (25)
Jul 10 2012 Return type inference on template (2)
Jul 09 2012 how to consume less memory (1)
Jul 09 2012 linker error (6)
Jul 08 2012 Linking OpenSSL on Windows (4)
Jul 08 2012 Compilation failure (15)
Jul 08 2012 Portable way to obtain member function pointer (and invoke it)? (3)
Jul 08 2012 multiple inheritance (9)
Jul 08 2012 How to execute cleanup code on Ctrl-C (Break)? (7)
Jul 08 2012 opEquals for multiple types (3)
Jul 08 2012 read Ogg/Mp3 file (9)
Jul 07 2012 Need som assistense with readf(); (3)
Jul 07 2012 What was the reason for not including std.net.curl in the Windows (4)
Jul 06 2012 Garbage Collection Pitfall in C++ but not in D? (12)
Jul 06 2012 extending std.encoding (2)
Jul 06 2012 NotNull struct : ready to use? (1)
Jul 05 2012 LDC -noruntime (19)
Jul 05 2012 How to learn the D standard library? (4)
Jul 05 2012 Interfaces with structs...? (6)
Jul 04 2012 Winamp plugin (6)
Jul 04 2012 Parser generator? (12)
Jul 03 2012 Literals starting with 0 will not work with UFCS (9)
Jul 03 2012 bad unary function (5)
Jul 03 2012 Redirect stdout and stderr. (5)
Jul 02 2012 Debug output functions (6)
Jul 02 2012 Help translating C/C++ snippet to D (6)
Jul 02 2012 popFront causing more memory to be used (16)
Jul 02 2012 Build WindowsApi bindings with dmd? (2)
Jul 02 2012 D and gmp (1)
Jul 02 2012 rdmd failing to generate init data from dependant file (1)
Jul 02 2012 Debugging compiler crashes? (7)
Jul 02 2012 Error: null dereference in function _Dmain (13)
Jul 01 2012 state of an object (9)
Jul 01 2012 Using std.net.curl (4)
Jun 30 2012 Regarding topN and topNCopy (1)
Jun 30 2012 function pointer when a function is overloaded. (3)
Jun 30 2012 CURL: Save response to string (3)
Jun 30 2012 Fixed size multidimensional array at runtime (17)
Jun 30 2012 Coexistence of static and unstatic method (4)
Jun 29 2012 why is string not implicit convertable to const(char*) ? (17)
Jun 29 2012 Range to array (5)
Jun 29 2012 opCall() property (6)
Jun 29 2012 How would I sort an associative array by value? (3)
Jun 29 2012 foreach syntax (37)
Jun 27 2012 Concurrency in D (9)
Jun 27 2012 Removing from SList (std.container)... (24)
Jun 27 2012 Bug in Auto Functions and Template? Or Am I Just Crazy... (5)
Jun 26 2012 What is the 'macro' keyword for? (3)
Jun 26 2012 [linux, ubuntu] personal D module not found in the same directory (5)
Jun 26 2012 Circle Calculator Help (17)
Jun 26 2012 How to overload opertators for enums (2)
Jun 26 2012 Problem this names of shared libraries (7)
Jun 25 2012 std.file.copy (3)
Jun 25 2012 implicit conversion to alias this (6)
Jun 25 2012 front doesn't compile for arrays of immutable data (8)
Jun 24 2012 Problem about using struct (4)
Jun 24 2012 A little story (16)
Jun 24 2012 about std.file.copy (2)
Jun 24 2012 Retain struct when using alias this and passing using the alias..? (3)
Jun 24 2012 It is a bug or not? (2)
Jun 24 2012 AA with immutable values (8)
Jun 23 2012 aa.remove in a destructor (8)
Jun 23 2012 Address of TLS variables (2)
Jun 23 2012 Learning asynchronous sockets in D (well actually C...) (7)
Jun 23 2012 Passing a ubyte[] to a function taking a 'ref ubyte[16]' (8)
Jun 23 2012 Strange exception using threads (7)
Jun 23 2012 phobos and splitting things... but not with whitespace. (18)
Jun 22 2012 Passing class references between threads (2)
Jun 22 2012 immutable ref foreach on values (5)
Jun 22 2012 Stack overflow (43)
Jun 22 2012 const behaviour (5)
Jun 22 2012 to!(ubyte[])("") (2)
Jun 21 2012 Allocate an Array!T on the heap? (3)
Jun 21 2012 how to handle shared arrays? (4)
Jun 21 2012 Lack of warning messages (5)
Jun 21 2012 filename.writeln() across network (5)
Jun 21 2012 Object Cast (5)
Jun 20 2012 How use "toHash" without cast (9)
Jun 20 2012 Array/list of objects of different type but with same interface (5)
Jun 20 2012 what is the difference between static method of the class, module (6)
Jun 19 2012 property returning a reference vs returning a value (4)
Jun 19 2012 Does the 'with' statement affect object lifetime? (4)
Jun 19 2012 D: Unexpected output when using a delegate and EnumMembers (6)
Jun 18 2012 Small code review (4)
Jun 18 2012 Why doesn't alias this work with arrays? (2)
Jun 18 2012 Swap furthest element type of an array (7)
Jun 18 2012 Idiomatic D? (6)
Jun 18 2012 Formatted input from text file (7)
Jun 17 2012 Simulating rectangular array (2)
Jun 17 2012 Writing .di files (5)
Jun 17 2012 COM-Interfaces (2)
Jun 17 2012 Casting the Result of splitter() into a string array (6)
Jun 17 2012 readText fails to open file (6)
Jun 16 2012 Getting started with threads in D (6)
Jun 16 2012 compile time regex (3)
Jun 16 2012 Implicit conversion from class in parent class fails? (3)
Jun 16 2012 sorting associative array's keys by values (23)
Jun 16 2012 Using consistently auto as function return type (4)
Jun 16 2012 dirEntries fails with option -inline (2)
Jun 15 2012 Lazy KMP range (6)
Jun 15 2012 Getting a range over a const Container (11)
Jun 14 2012 Create an array with immutable elements (8)
Jun 14 2012 Switch Statement case '0': .. case '9' (5)
Jun 14 2012 How to specialize templates for l-value and non-l-value arguments? (11)
Jun 14 2012 Constraining template's function parameter signature (2)
Jun 14 2012 [profiling] D and code analysis (2)
Jun 14 2012 facebook/graph/fdl library for D (2)
Jun 14 2012 Immutability and other attributes, please review (38)
Jun 13 2012 Package and virtual functions (12)
Jun 13 2012 What exact GDB version has decent native D support? (2)
Jun 13 2012 DMD can't link opengl32.lib (7)
Jun 12 2012 Does D have high-performance sockets (6)
Jun 12 2012 From number of seconds in a day to a formatted time string (3)
Jun 12 2012 Idea: writeln and file functions that return the data passed to them (3)
Jun 12 2012 Windows program instant crash: no messages. (6)
Jun 12 2012 Code-File structure (10)
Jun 11 2012 static switch (4)
Jun 11 2012 Using C macros without massive rewrites (4)
Jun 11 2012 Ddoc inheritance (6)
Jun 11 2012 Template argument types (2)
Jun 11 2012 Auto-conversion in array literals? (2)
Jun 11 2012 Module level privacy (2)
Jun 11 2012 Build all combinations of strings (3)
Jun 11 2012 Float compare broke! (10)
Jun 10 2012 align(16) struct member throws an exception with movdqa (13)
Jun 10 2012 GtkD compile failed. shift by 32 (4)
Jun 10 2012 what is the difference between template and mixin template (8)
Jun 10 2012 Is it possible to force CTFE? (11)
Jun 09 2012 Why is to(T) pure but roundTo(T) impure? (4)
Jun 09 2012 Is D actually |-----------this-----powerful-----------|? (4)
Jun 09 2012 Using keyword as package name (1)
Jun 08 2012 Segmentation fault hell in D (10)
Jun 08 2012 const version for foreach/opApply (6)
Jun 08 2012 Array Concatenate (9)
Jun 07 2012 Rational numbers in D (1)
Jun 06 2012 std.net.curl get webpage asia font issue (6)
Jun 06 2012 Templated Enums? (6)
Jun 06 2012 gdc and gcc object linking issues (13)
Jun 06 2012 alias this with property enforce (2)
Jun 06 2012 Function constraint vs const parameter? (4)
Jun 06 2012 Multi-Dimensional Associative Arrays ".get" and "in" (2)
Jun 06 2012 Ordering an associative array - or - another option (4)
Jun 06 2012 rdmd and -I args in Windows (1)
Jun 05 2012 using pragma to link to gcc-compiled c library (3)
Jun 05 2012 regex.d(6050): not enough preallocated memory (2)
Jun 05 2012 Calling main() from WinMain() (5)
Jun 05 2012 Package Declaration (6)
Jun 04 2012 D interface to Fortran (3)
Jun 04 2012 enum arrays are created for every use (2)
Jun 04 2012 bitfields - Default values? (7)
Jun 03 2012 alias this with template class? (3)
Jun 02 2012 D and windows console kbhit, getch etc (2)
Jun 02 2012 std.format.formattedRead and File.readln() (1)
Jun 02 2012 delegates with references to local strings (4)
Jun 02 2012 Static function conflicts with Non-Static?! (20)
Jun 01 2012 Bypassing const with a union (8)
Jun 01 2012 String and opBinary (9)
May 31 2012 D for Raspberry, Toradex-T20, Android (2)
May 31 2012 Merge tuples (6)
May 31 2012 Socket identification key (4)
May 30 2012 Interfacing D to C R standalone math library (7)
May 30 2012 std.path.buildPath() and string enumeration (5)
May 30 2012 Multidimensional arrays, foreach loops and slices (3)
May 30 2012 problem with template arguments deduction (26)
May 30 2012 Build / Package system (8)
May 29 2012 Exception caused by calling a pure function repeatedly (12)
May 29 2012 ref fields of .tupleof (5)
May 28 2012 Converting from string to enum by name (3)
May 26 2012 BitArray - Is there one? (30)
May 26 2012 Windows - ZeroMemory macro (4)
May 26 2012 Struct hash issues with string fields (5)
May 26 2012 speeding up + ctfe question (15)
May 26 2012 alias parameter tuples: need this to access member (2)
May 25 2012 Why doesn't this throw? (2)
May 24 2012 Multi-library project path issue (3)
May 24 2012 null matches typed pointers before void pointers (4)
May 24 2012 get Class from Pointer of member (4)
May 23 2012 D under Linux Mint (6)
May 23 2012 OPTLINK : Error 63: DOSNEWSIZE Error ? (1)
May 23 2012 Sorry for posting this here. Not sure where else. (3)
May 23 2012 pure functions calling impure functions at compile-time (3)
May 21 2012 "repeating pair" regex (4)
May 21 2012 std.range.put? (4)
May 20 2012 static functions? (4)
May 20 2012 detecting POD types (2)
May 20 2012 druntime investigation troubles (24)
May 19 2012 state of web programming (2)
May 19 2012 Limit number of compiler error messages (9)
May 19 2012 vibe.d how build it / intall it? (4)
May 19 2012 std.concurrency.send (7)
May 19 2012 unsynchronized access to primitive variables (4)
May 18 2012 using deimos.portaudio (6)
May 18 2012 directory wildcard (3)
May 18 2012 How do I view assembly? (8)
May 18 2012 Distributed work load (5)
May 18 2012 moveAt vs opIndex (2)
May 18 2012 How to test for equality of types? (13)
May 17 2012 Simplified socket creation and handling (18)
May 16 2012 convert ubyte[k..k + 1] to int (12)
May 16 2012 ProjectEuler problem 35 (20)
May 15 2012 DMD Bug or not? foreach over struct range (14)
May 15 2012 Thread safety of AAs (6)
May 15 2012 Translating C const (12)
May 15 2012 .dup on an array of BitArray not duplicating (8)
May 15 2012 is there a common type? (6)
May 15 2012 std.file, std.stdio(File), std.stream(File:Stream) (7)
May 15 2012 allocate array with new (18)
May 14 2012 void pointer syntax (11)
May 14 2012 struct vs class for a simple token in my d lexer (18)
May 14 2012 Problem using Interfce (12)
May 14 2012 problem with byLine (9)
May 13 2012 std.mmfile issues (3)
May 13 2012 Reading ASCII file with some codes above 127 (exten ascii) (15)
May 13 2012 Auto-casting in range based functions? (3)
May 13 2012 shared associative array initialization (2)
May 13 2012 optlink (2)
May 13 2012 shared attribute (7)
May 12 2012 libraries and c++ compatibility (4)
May 12 2012 How do I do printf/writefln debugging in CTFE? (3)
May 12 2012 Weird integral promotion issue (?) (2)
May 12 2012 Errors compiling programs using Derelict 3 under DMD 2 (7)
May 11 2012 What is a good strategy for finding undefined symbols... (10)
May 11 2012 Assigning value to a lazy parameter in a function call (6)
May 11 2012 Read Complete File to Array of Lines (16)
May 11 2012 std.concurrency and module constructors (4)
May 10 2012 std.algorithm.remove strange behavior (removing items for the dynamic (7)
May 10 2012 Detect unused variables (4)
May 10 2012 [Derelict2] Code SOMETIMES seg. faults! (10)
May 10 2012 Specifying which Phobos modules to unittest (9)
May 10 2012 Put Tuple in templates in a class fails (3)
May 10 2012 Linking to static libraries (6)
May 10 2012 Right way to share object through threads (3)
May 10 2012 Runtime.loadLibrary() on Linux (7)
May 09 2012 Searching for user Mike Vertex gmx.at (1)
May 09 2012 foreach_reverse error (8)
May 09 2012 How to unittest nested functions (3)
May 09 2012 How to structure templated classes (7)
May 09 2012 std.math.sqrt(real x) && std.math.sqrt(float x) overloads (3)
May 09 2012 Method-call based on template argument (3)
May 08 2012 Make all functions from std.typecons "Proxy" inout (12)
May 08 2012 getgrgid() for Posix (3)
May 07 2012 Storing arbitrary type info in XML (2)
May 07 2012 simple "find" question (3)
May 07 2012 Clunky syntax (5)
May 06 2012 Ref / NotNull struct (14)
May 06 2012 problem parsing xml (std.xml) (2)
May 05 2012 undefined reference - Derelict2 (8)
May 05 2012 Get systype for FTP-cmd "TYPE" (1)
May 05 2012 c C deimos (4)
May 05 2012 Problem about multi-thread programming (10)
May 04 2012 Read integer from console and sleep (8)
May 03 2012 opAssign and const? (24)
May 03 2012 How to prevent direct public creation of a struct? (4)
May 03 2012 Mixins are not inherited? (3)
May 03 2012 string find and replace (4)
May 03 2012 Fixed-size arrays and randomShuffle() (12)
May 02 2012 extern and opaque structs (2)
May 02 2012 Test if an enum value is in a range of a derived enum (2)
May 02 2012 Transforming a range back to the original type? (37)
May 02 2012 Access Violation in callback from sort (2)
May 02 2012 std.stdio File doesn't support Win UTF16 file systems? (1)
May 01 2012 Derelict3 running (1)
May 01 2012 Stack overflow checking? (1)
May 01 2012 "static" means too many things (4)
May 01 2012 How to make a directory? (4)
Apr 30 2012 Does dmd use static or dynamic linking with the Phobos Library? (4)
Apr 30 2012 Help: running a method from the importing file's method "space" (9)
Apr 30 2012 DWT: synchronized toHash nothrow (2)
Apr 30 2012 is there a difference between those two notations (7)
Apr 30 2012 Compute in one pass 3 tokens position (6)
Apr 29 2012 this compare not using opCmp? (4)
Apr 29 2012 type conversions (6)
Apr 29 2012 struct to/from void, object to/from void (7)
Apr 29 2012 restrict alias this? (5)
Apr 28 2012 Should I wait for the new edition of TDPL ? (6)
Apr 28 2012 mysql binding/wrapper? (19)
Apr 28 2012 cannot cast (19)
Apr 28 2012 Conditional compilation for non-release version (5)
Apr 27 2012 -lib question(s) (3)
Apr 27 2012 [OT] functional programming resources ? (3)
Apr 27 2012 alias this and null reference (13)
Apr 27 2012 Passing array as const slows down code? (37)
Apr 27 2012 Returning a tuple (3)
Apr 27 2012 Use of mutex in destructors (16)
Apr 27 2012 Malloc in D (3)
Apr 26 2012 Fix iota for unsigned reverse counting (1)
Apr 25 2012 Pointer to variables in D (8)
Apr 25 2012 Using input ranges with std.regex? (2)
Apr 25 2012 Why is List(T) documented in std.concurrency? (6)
Apr 25 2012 [Kinda OT] httpd permissions (8)
Apr 25 2012 Power of D (8)
Apr 25 2012 ptrace (process trace system call) on Linux from D (11)
Apr 25 2012 Bitarray size limits (3)
Apr 25 2012 D static lib called from C on Mac OS X (6)
Apr 25 2012 Internal error: ..\ztc\cod3.c 485 (3)
Apr 25 2012 newb question re. reading lines from stdin (2)
Apr 25 2012 Strange measurements when reproducing issue 5650 (16)
Apr 25 2012 Help with C struct by value on OSX 64bits (6)
Apr 24 2012 No implicitly convert derived ptr to base ptr? (3)
Apr 24 2012 Extending std.format.formattedRead (3)
Apr 24 2012 Recommended way to access numeric_limits epsilon() (3)
Apr 24 2012 How to pass list of strings as compile-time parameters? (5)
Apr 24 2012 Object Serialization? (7)
Apr 24 2012 Forcing static foreach (2)
Apr 24 2012 Why has base class protection been deprecated? (7)
Apr 23 2012 Stack overflow / recursive expansion with alias this (8)
Apr 23 2012 Are there any mixin tutorials? (3)
Apr 22 2012 Issue calling methods using std.concurrency (6)
Apr 22 2012 Pacikage level access broken? (9)
Apr 22 2012 Passing a function (with arguments) as function input (3)
Apr 22 2012 What am I doing wrong ? (5)
Apr 22 2012 opPropDispatch (8)
Apr 22 2012 Module zlib cannot be read (3)
Apr 21 2012 Regarding the more precise GC (2)
Apr 21 2012 avoid toLower in std.algorithm.sort compare alias (25)
Apr 21 2012 using ntfs write_through option to create an efficient unzipped layout (3)
Apr 21 2012 Question about arrays (8)
Apr 21 2012 Keyword to avoid not null references (32)
Apr 21 2012 Broken link to D Programming Language Specification (2)
Apr 21 2012 Nested RegEx (5)
Apr 21 2012 BigInt Bug or just me? (4)
Apr 20 2012 Derelict2 openGL3 issues (7)
Apr 20 2012 Formatting dates in std.datetime? (2)
Apr 20 2012 primitive type operator overload (4)
Apr 20 2012 variadic mixin templates and other stuff (5)
Apr 20 2012 pure functions/methods (6)
Apr 19 2012 Docs: Section on local variables (32)
Apr 19 2012 Operator overloading (15)
Apr 19 2012 new std.process && new aa status (3)
Apr 19 2012 Github/Git Pull 482 (4)
Apr 19 2012 How does this work ? (2)
Apr 19 2012 Allow empty field function arguments for default? (12)
Apr 19 2012 Immutable Structs and std.concurrency (6)
Apr 19 2012 Access violation using chain() (4)
Apr 18 2012 Is this a bug in iota? (13)
Apr 18 2012 delegates vs functions => practical consequences (8)
Apr 18 2012 Cast Object - get null (33)
Apr 18 2012 GLUT glutCreateWindow error (1)
Apr 18 2012 collectExceptionMsg and emptyExceptionMsg (1)
Apr 18 2012 .empty and .length Amend language manual? (3)
Apr 18 2012 learning D. Experienced issue very quickly. (9)
Apr 18 2012 Clearly Label D1/D2/Tango/Phobos (8)
Apr 18 2012 learn.newbie forum (4)
Apr 18 2012 File Ex from std_stdio won't compile (3)
Apr 17 2012 Not-so-unpredictable seed? (5)
Apr 17 2012 appending newly initialized struct to array (18)
Apr 17 2012 Hacking on Phobos (11)
Apr 17 2012 Range returned by iota and const (2)
Apr 17 2012 retro() on a `string` creates a range of `dchar`, causing array() (13)
Apr 17 2012 Metaprogramming work around (6)
Apr 16 2012 Memoizing a templated function (3)
Apr 16 2012 Exception education (1)
Apr 16 2012 tupleof.length of a class in a template return 0 (5)
Apr 16 2012 arrays and foreach (18)
Apr 16 2012 Aquivalent References as in C++? (25)
Apr 16 2012 "No stack address" (7)
Apr 16 2012 const AB c = {a,20, numbers}; (9)
Apr 15 2012 making ntfs do faster deletes (3)
Apr 15 2012 this() const (4)
Apr 15 2012 Return const object through mutable Object (3)
Apr 15 2012 Templates in classes => what is wrong? (22)
Apr 15 2012 Spawn threads and receive/send (3)
Apr 14 2012 Thread join behaviour (6)
Apr 14 2012 A "general" tag (6)
Apr 14 2012 D 50% slower than C++. What I'm doing wrong? (38)
Apr 14 2012 Calling delegate properties without parens (7)
Apr 14 2012 "shared" status (7)
Apr 13 2012 floats default to NaN... why? (64)
Apr 13 2012 Contracts inheritance (4)
Apr 13 2012 T : T* (4)
Apr 13 2012 Creating a file in ~/.config (ubuntu) (4)
Apr 13 2012 D-Cocoa Port (4)
Apr 13 2012 Avoid compile time evaluation (3)
Apr 12 2012 FormatSpec struct (3)
Apr 12 2012 Library search path on Windows? (5)
Apr 12 2012 Trying to understand RandomSample struct in std.random (4)
Apr 12 2012 Chaining std.algorithm functions (3)
Apr 12 2012 Sampling algorithms for D (16)
Apr 12 2012 Question Object.factory and namespaces. (4)
Apr 11 2012 Name of files causes error. Why? (10)
Apr 11 2012 stdout redirect (4)
Apr 11 2012 Passing function as values and returning functions (10)
Apr 10 2012 Higher-order functions? (13)
Apr 10 2012 Dear ChrisMiller: This is day 4 of me trying to Compile a (tutorial) (10)
Apr 09 2012 isRandomAccessRange on static array (4)
Apr 09 2012 Multiple %s format specifiers with a single argument (5)
Apr 09 2012 Issue with const (8)
Apr 08 2012 "How to set up QTD?". (4)
Apr 08 2012 A problem with mutable toString (3)
Apr 08 2012 Operator Overloading with class template (8)
Apr 08 2012 template member function confusion (5)
Apr 08 2012 D and QtCreator (1)
Apr 08 2012 Latest versions of Entice Designer and DFL? (16)
Apr 08 2012 Operator Overloading : opOpAssign (8)
Apr 08 2012 DMD/Windows: Inspect generated ASM? (6)
Apr 07 2012 string concatenation (4)
Apr 07 2012 Static Associative Arrays (1)
Apr 07 2012 Input from a newbie (16)
Apr 07 2012 asm stackframe question (6)
Apr 07 2012 License for D setup (5)
Apr 07 2012 GC-less tutorial? (4)
Apr 06 2012 D1, D2, Tango, Phobos, Std, Runtime (6)
Apr 06 2012 Win GUI Single Exe - Newbie (7)
Apr 05 2012 D slower ~1s from C ?! (7)
Apr 05 2012 Up to date documentation on D implementation. (15)
Apr 05 2012 Remove dir contents? (1)
Apr 04 2012 Binary Heap Errors Class level vs function level (3)
Apr 04 2012 Insert an element into an Associative Array ? (8)
Apr 04 2012 Re: log2 buggy or is a real thing? (3)
Apr 04 2012 log2 buggy or is a real thing? (5)
Apr 03 2012 Questions about the slice operator (22)
Apr 03 2012 making args global (6)
Apr 03 2012 upload with curl (1)
Apr 02 2012 parallel unzip in progress (6)
Apr 02 2012 Custom Allocators (2)
Apr 02 2012 Equivalents to policy classes in D (4)
Apr 02 2012 Min-Heap and Hash Table help (12)
Apr 02 2012 Length of an SLIst ? (9)
Apr 02 2012 Help with C++ (3)
Apr 01 2012 Add Element to list not Working (6)
Apr 01 2012 DDoc with cross-references (10)
Apr 01 2012 Nested interface (4)
Mar 31 2012 Regarding nWayUnion (1)
Mar 31 2012 Initializing multidimentional Array with a struct (4)
Mar 31 2012 "ref const" parameters in functions (12)
Mar 31 2012 Getting only the data members of a type (10)
Mar 31 2012 Simulating multiple inheritance (4)
Mar 31 2012 Read a unicode character from the terminal (24)
Mar 31 2012 Whats the best way to get a struct/class member type? (9)
Mar 31 2012 UFCS for types? (2)
Mar 30 2012 std.typecons.Ref(T).opImplicitCastTo() (10)
Mar 30 2012 Is this a bug in overload resolution? (2)
Mar 29 2012 Compiling DMD's source code in Mac OSX (5)
Mar 29 2012 Where does "U" in Rebindable.Rebindable come from? (11)
Mar 29 2012 Problem interacting with the console (2)
Mar 29 2012 Stack traces in 2.059HEAD? (2)
Mar 29 2012 "don't know how to make 'src\unittest.d'" error while rebuilding (8)
Mar 29 2012 Does D have a Verbatim String Literal? (3)
Mar 29 2012 Function definition in multiple modules (7)
Mar 28 2012 Installing Modules (10)
Mar 28 2012 [Ubuntu] Linking to static libraries (2)
Mar 28 2012 Regex question (3)
Mar 27 2012 Get indexes of character in array (1)
Mar 27 2012 How to remove element from an SList? (3)
Mar 27 2012 D Dll injection problem (21)
Mar 27 2012 Problem about lambda expressions (13)
Mar 27 2012 std.stream.File help required (and classes) (14)
Mar 27 2012 Printing stacktrace on segfault (5)
Mar 27 2012 Installing x32 packages on x64 debian (or fix a dmd bug) (7)
Mar 25 2012 opDispatch(string name, E...) (E e) question. (9)
Mar 25 2012 GC collecting "too much".. (8)
Mar 25 2012 Problem with receiveOnly and classes (3)
Mar 25 2012 std.json (12)
Mar 25 2012 GUI library (10)
Mar 25 2012 Parser (not parser generators) and ctfe (1)
Mar 24 2012 trouble calling function from windows dll (6)
Mar 24 2012 Making sense of ranges (13)
Mar 24 2012 Newbie prolem building with SCons (1)
Mar 24 2012 Referencing an overloaded function (10)
Mar 23 2012 in / out for C++ programmers (9)
Mar 23 2012 Confused by refusal to expand template (5)
Mar 23 2012 Map with maintained insertion order (3)
Mar 23 2012 string[] to char** (10)
Mar 23 2012 Calling c shared library (2)
Mar 23 2012 Template constraint and specializations (9)
Mar 22 2012 Freeing memory allocated at C function (3)
Mar 22 2012 problems countered after while(read()){} terminated with ^D or EOF (2)
Mar 22 2012 anything that would provide support for zip filesystem? (2)
Mar 21 2012 Vector operations optimization. (8)
Mar 21 2012 Calculating/Averaging over a struct value (8)
Mar 21 2012 Question about using regex (3)
Mar 21 2012 anonymous static array (7)
Mar 20 2012 Regarding writefln formatting (5)
Mar 20 2012 Converting C .h Files to D Modules (2)
Mar 20 2012 Is there an elegant way of making a Result eager instead of lazy? (6)
Mar 19 2012 XML Parsing (8)
Mar 19 2012 Comparison issue (7)
Mar 18 2012 Tail call optimization? (5)
Mar 18 2012 nested csv into tsv (6)
Mar 18 2012 Initializing constant AA and shared problems.. (2)
Mar 17 2012 rt_attachDisposeEvent (1)
Mar 17 2012 Error 42 Symbol Undefined (1)
Mar 17 2012 Re: Problem about Tuple.opEquals, const qualifier (1)
Mar 17 2012 HelloWordl in Webserver (19)
Mar 17 2012 Problem about Tuple.opEquals, const qualifier (11)
Mar 16 2012 Capturing caller's file/line number in variadic template functions (7)
Mar 16 2012 State of D toolchain & architecture support? (2)
Mar 15 2012 regex issue (18)
Mar 15 2012 Build errors and VS Macros for Build Commands (1)
Mar 15 2012 Confused about github rebasing (9)
Mar 15 2012 preprocessor pass equivalent? (14)
Mar 14 2012 DLL's and D (7)
Mar 14 2012 comma inside is expression (3)
Mar 14 2012 Checking for possibility of implicit conversions (3)
Mar 14 2012 Vector Swizzling in D (8)
Mar 13 2012 Proper Use of Assert and Enforce (6)
Mar 13 2012 Simple operator precidence chart (and associativity)? (9)
Mar 13 2012 Does synchronized support recursive locking? (3)
Mar 13 2012 Math Libraries (and vectors, matrices, etc) (11)
Mar 13 2012 What's the correct opEquals signature for structs? (24)
Mar 13 2012 toUTFz again (1)
Mar 12 2012 Why doesn't this have a length? (8)
Mar 12 2012 Sorting char arrays (10)
Mar 11 2012 how to know at compile time pagesize? (1)
Mar 11 2012 Parse issue (3)
Mar 11 2012 is not an lvalue (2)
Mar 11 2012 Immutable unions (1)
Mar 10 2012 Who works std.mmfile ? (1)
Mar 10 2012 does std.stdio.File.byChunk has double buffer (1)
Mar 10 2012 inout/const issue: assignments to field not allowed if field (2)
Mar 10 2012 Re: Assert and the optional Message (1)
Mar 09 2012 Why can't I have overloading and generics? (5)
Mar 09 2012 Tempfiles in unittests (14)
Mar 08 2012 Assert and the optional Message (49)
Mar 08 2012 matrix and fibonacci (8)
Mar 08 2012 Frustrations with const (4)
Mar 08 2012 Parallelization issues (7)
Mar 08 2012 [Inline assembler] Sequential `asm` blocks and return via EAX (6)
Mar 08 2012 Remarks on std.container (2)
Mar 07 2012 Can I do an or in a version block? (23)
Mar 07 2012 Ddoc: no docs generated for nested structs? (1)
Mar 07 2012 Method invocation -- why it's not working? (23)
Mar 07 2012 SocketStream exceptions and disconnect handling (1)
Mar 06 2012 0 < negative loop condition bug or misunderstanding on my part (19)
Mar 06 2012 Why constructs can not be private? (1)
Mar 06 2012 Is there a wrapper for libuv? (4)
Mar 06 2012 How to cast a int to a string? (3)
Mar 06 2012 Why is std.algorithm.reduce impure? (3)
Mar 06 2012 Re: htod - const (1)
Mar 06 2012 Array of derived class objects? (4)
Mar 06 2012 htod - const (5)
Mar 05 2012 How do I force something onto the heap? (need for libev) (9)
Mar 05 2012 How to check type of an object to a class name? (3)
Mar 05 2012 Translate for chars to strings (3)
Mar 05 2012 duplicate symbol linker errors, my fault or D's? (12)
Mar 05 2012 D RTTI? (5)
Mar 04 2012 Redis client (2)
Mar 04 2012 Shutting down thread with Socket blocking for connection (6)
Mar 04 2012 strange file behaviour (4)
Mar 04 2012 abstract base class and class members (9)
Mar 04 2012 Some compile time help.. (5)
Mar 04 2012 Multiple definition of .../std/regex.d.912_ModuleInfoZ (3)
Mar 03 2012 [SUCCESS] delegator (3)
Mar 03 2012 How to avoid code duplication in static if branches? (4)
Mar 03 2012 Problem when building LDC (1)
Mar 03 2012 cluster computing (1)
Mar 03 2012 Delegator (8)
Mar 03 2012 Build error about LockingTextWriter (4)
Mar 03 2012 Sending Tid in a struct (2)
Mar 02 2012 typeof(string.front) should be char (18)
Mar 02 2012 Evaluating __FILE__ and __LINE__ of caller? (10)
Mar 02 2012 Read csv data into a struct (8)
Mar 02 2012 Define .empty property for hashes? (3)
Mar 02 2012 How to indicate that a memory block contains no GC pointers? (3)
Mar 01 2012 QR code based twitter --slightly OT (1)
Mar 02 2012 Getting the mutable version of a type (3)
Mar 01 2012 Cocoa bindings? (3)
Mar 01 2012 Char * character and string (6)
Mar 01 2012 Using lazily ? (6)
Mar 01 2012 Dumb question about git (3)
Mar 01 2012 SysTime in a Struct (9)
Mar 01 2012 Should uniform(-real.max, real.max) be inf? (5)
Feb 29 2012 Why do bitfields throw exceptions instead of wrapping? (2)
Feb 29 2012 Regarding std.array.Appender (14)
Feb 29 2012 how to use raw sockets (13)
Feb 29 2012 GUI or more human readable -profile data? (6)
Feb 29 2012 Trouble with -lib in linux "undefined reference to `_Dmain'" (3)
Feb 29 2012 More general Cartesian product (3)
Feb 29 2012 about std.csv and derived format (8)
Feb 29 2012 How can I use structs in a named enum? (8)
Feb 29 2012 Pretty fields string (3)
Feb 28 2012 passing a string with the & character as an argument (6)
Feb 28 2012 Comparison of TickDuration and StopWatch.peek (1)
Feb 28 2012 Random behavior using a wrapped C library (9)
Feb 27 2012 Reflection (8)
Feb 27 2012 Is empty array null? (5)
Feb 27 2012 Binary I/O for Newbie (13)
Feb 27 2012 Re: Re: class templates and static if (8)
Feb 26 2012 class templates and static if (1)
Feb 26 2012 A very strange bug. DMD 2.058 64-bit Linux (3)
Feb 26 2012 Syntax highlighting for CodeRunner (2)
Feb 26 2012 produced binary is quite big (2)
Feb 25 2012 Re: std.socket with GDC (1)
Feb 25 2012 Make alias parameter optional? (15)
Feb 25 2012 Write struct to file (16)
Feb 25 2012 Supporting and signature-checking all foreach variations (7)
Feb 24 2012 struct init() method (14)
Feb 24 2012 deh_end (3)
Feb 24 2012 Cannot cast void* to arrays..? (12)
Feb 24 2012 std.socket with GDC (5)
Feb 24 2012 Using delegates in callbacks for extern(C) functions (5)
Feb 24 2012 About CTFE and pointers (3)
Feb 24 2012 Compiling with -unittest on a c wrapper (2)
Feb 23 2012 std.net.curl not working in 2.058 for Windows (3)
Feb 23 2012 2.058 broke my build. Is this a bug? (6)
Feb 23 2012 vfprintf equivalent in D (5)
Feb 23 2012 GDC: how to link with alternate version of Phobos? (3)
Feb 23 2012 UnitTest and visual D (11)
Feb 23 2012 D runtime Garbage Collector details (4)
Feb 23 2012 Linking with d3d11.dll/lib (5)
Feb 23 2012 fedora/ldc where are druntime headers? (6)
Feb 23 2012 Pure and higher-order functions (7)
Feb 23 2012 SONAME and D (20)
Feb 23 2012 IPC: Pipes & std.process (2)
Feb 23 2012 DbC bug? (3)
Feb 23 2012 Wrapping c variadic functions (8)
Feb 22 2012 Weird opEquals Problem (1)
Feb 22 2012 Re: Examples of Windows services in D? (2)
Feb 22 2012 Re: Everything on the Stack (1)
Feb 22 2012 D, Derelict2, and OpenGL (14)
Feb 22 2012 Alias this with array can only be used once (12)
Feb 22 2012 MySQL connection strange behavior (again...) (10)
Feb 21 2012 inout problems (4)
Feb 21 2012 Adding overloaded methods (14)
Feb 21 2012 Avoiding const? (9)
Feb 21 2012 Mixins: Using the type name to generate a method name (4)
Feb 21 2012 mixin template FAIL (10)
Feb 21 2012 delegate as memeber (19)
Feb 21 2012 Examples of Windows services in D? (3)
Feb 21 2012 Naming methods from strings using mixin (8)
Feb 21 2012 Executable size when compiling with GDC (6)
Feb 21 2012 interface final members (5)
Feb 21 2012 Compress spaces to one space (4)
Feb 20 2012 Problems linking libdl? (5)
Feb 20 2012 A inner pure function problem (3)
Feb 19 2012 Everything on the Stack (9)
Feb 19 2012 RedBlackTree.lowerBound (3)
Feb 19 2012 replacement for rfind in 2.058 (2)
Feb 19 2012 vim tips for D development (6)
Feb 19 2012 Compiling DMD on MAC OS X (5)
Feb 18 2012 Template Inheritance (14)
Feb 17 2012 temp file (4)
Feb 17 2012 Range question (1)
Feb 17 2012 Let this() figure out T implicitly? (13)
Feb 17 2012 Removing items from an Array (10)
Feb 16 2012 Flushing denormals to zero (3)
Feb 16 2012 split with delimiter (5)
Feb 15 2012 Default Implementation For an Interface (13)
Feb 15 2012 Re: maketrans and translate (1)
Feb 15 2012 warning: size of symbol changed (5)
Feb 15 2012 Hex floats (8)
Feb 15 2012 How to get Visual D working with Derelict2? (3)
Feb 15 2012 AA's with dstring key (1)
Feb 15 2012 Const module globals and static this() (2)
Feb 15 2012 Compiling Lua for D (9)
Feb 15 2012 writeln(Range) fails on 2.058 (6)
Feb 14 2012 D for game Development (12)
Feb 14 2012 wildcard expansion for D args (2)
Feb 14 2012 Delimited strings (3)
Feb 14 2012 Anti-OOP... stupid? (18)
Feb 14 2012 More octal questions (14)
Feb 14 2012 float.nan is not itself ? (8)
Feb 13 2012 Named character entities (2)
Feb 13 2012 Chatting with a server (1)
Feb 13 2012 Instance-specific unittests (2)
Feb 13 2012 CMake for D (4)
Feb 12 2012 maketrans and translate (6)
Feb 12 2012 Object.factory failed with nested class (3)
Feb 12 2012 Regarding a recent copy() fix (1)
Feb 12 2012 File[string] associative array & initialization of static member (2)
Feb 12 2012 Stride (23)
Feb 11 2012 Templated aliases name in compilation error output (5)
Feb 11 2012 shifting array slices (7)
Feb 10 2012 toString multiple overrides (6)
Feb 10 2012 Re: Socket: The connection was reset (1)
Feb 10 2012 dmd thrashes fedora (13)
Feb 10 2012 Re: Socket: The connection was reset (2)
Feb 10 2012 Bug? taskPool.map() with bufSize and writeln() gets stuck (2)
Feb 10 2012 Signature conditions (6)
Feb 10 2012 Immutable immutable strings?? (3)
Feb 09 2012 Re: Socket: The connection was reset (2)
Feb 09 2012 Socket: The connection was reset (1)
Feb 09 2012 Compiler error with static vars/functions (2)
Feb 09 2012 Makefile, compilation and linkage (2)
Feb 09 2012 Arrays - Inserting and moving data (19)
Feb 08 2012 D at work (6)
Feb 08 2012 is this a bug? opUnary!"++" Error: var has no effect (4)
Feb 08 2012 Checking runtime object type (5)
Feb 08 2012 Event library (3)
Feb 08 2012 std.regex named matches (5)
Feb 07 2012 A GUI library to begin with (17)
Feb 07 2012 Could use some help with porting problems (4)
Feb 07 2012 How to reverse char[]? (13)
Feb 07 2012 post/pre-increment/decrement and property (5)
Feb 07 2012 For: [your code hear] (2)
Feb 07 2012 DLL Injection (17)
Feb 07 2012 Conversion to output ranges (7)
Feb 06 2012 Mixture of type tuple and expression tuple (3)
Feb 06 2012 Extra packet sent when using socket/socketstream (3)
Feb 06 2012 linux linenumbers in stacktraces and druntime/phobos debug builds.. (5)
Feb 06 2012 Pitfall (3)
Feb 06 2012 Purity and enum (4)
Feb 05 2012 Using the Variant (Setting it's memory location) (9)
Feb 05 2012 Function returning pointer to itself (2)
Feb 04 2012 Raw socket TCP/IP (11)
Feb 04 2012 What should do a D lint? (2)
Feb 04 2012 Contracts vs debug (5)
Feb 04 2012 Less typed ranges (3)
Feb 04 2012 Struct "inheritance" (16)
Feb 03 2012 Associative array literal is non-constant? (2)
Feb 03 2012 Re: i18n (1)
Feb 03 2012 Re: i18n (1)
Feb 03 2012 char[] and wchar[] cannot be used as OutputRange (2)
Feb 03 2012 why have protection attributes on/in interfaces abstract classes/methods (1)
Feb 02 2012 Function signature constraint syntax (2)
Feb 02 2012 linker meaning and how to compile static libs (2)
Feb 02 2012 How far can CTFE go? (7)
Feb 02 2012 Re: Segment violation (was Re: Why I could not cast string to int?) (2)
Feb 02 2012 i18n (11)
Feb 02 2012 Why I could not cast string to int? (51)
Feb 01 2012 Assigning to char[N] (8)
Jan 31 2012 Formatted input specifiers not implemented (1)
Jan 31 2012 Class Initialization (8)
Jan 31 2012 std.parallelism: TaskPool adjustment (1)
Jan 31 2012 regex: force entire string to match (5)
Jan 31 2012 opAssign and references (8)
Jan 31 2012 Scoped Class Instance (5)
Jan 31 2012 Structs and Classes (2)
Jan 30 2012 About to!int (6)
Jan 30 2012 RPC module for D ? (10)
Jan 30 2012 sub() in D2? (6)
Jan 30 2012 Compile Time Printing (2)
Jan 30 2012 Chained Catch Statements (15)
Jan 30 2012 combine different data type (3)
Jan 29 2012 Overriding Template Methods (4)
Jan 29 2012 Does D supply basic error codes? (5)
Jan 29 2012 Partial classes (8)
Jan 29 2012 A tutorial on D templates: updates (2)
Jan 28 2012 Re: Char & the Extended ascii set (1)
Jan 28 2012 Pure Contract bug? (unnecessarily strict) (12)
Jan 28 2012 Char & the Extended ascii set (1)
Jan 28 2012 delete and MmFile (4)
Jan 28 2012 Missing __ModuleInfoZ symbol when using dll (1)
Jan 27 2012 It is safe to remove references to volatile? (1)
Jan 27 2012 Clutter GObject bindings (8)
Jan 26 2012 newbie confusion with arrays and structs (6)
Jan 26 2012 Re: unittests running before static ctors?? (1)
Jan 26 2012 TypeTuple of functions (3)
Jan 26 2012 unittests running before static ctors?? (1)
Jan 26 2012 dmd & gdc (16)
Jan 26 2012 Using Clang with D (4)
Jan 25 2012 inout constructor? (4)
Jan 25 2012 GC and void* (5)
Jan 24 2012 Definition of extern(System)? (6)
Jan 25 2012 A bug due to negating object.sizeof (1)
Jan 25 2012 immutable bug? (3)
Jan 25 2012 Re: Invalid bounding interval [, ] (1)
Jan 25 2012 Singleton question (shared class) (7)
Jan 24 2012 Invalid bounding interval [, ] (6)
Jan 24 2012 Meaning of const (1)
Jan 24 2012 char* to long (5)
Jan 24 2012 Proper way to work with huge binary files (3)
Jan 24 2012 Calling a C++ Object from D (6)
Jan 24 2012 dstep/internal/Reflection.d:205:0 expression "objcObject_"c == (3)
Jan 23 2012 floating-WTF (24)
Jan 23 2012 KeyType, ValueType traits for hashes (10)
Jan 23 2012 Extend Enum (4)
Jan 23 2012 Indexed foreach on struct? (8)
Jan 23 2012 actors library? (7)
Jan 22 2012 Re: MySQL (1)
Jan 22 2012 no-argument constructor: is this a bug? (2)
Jan 22 2012 Re: MySQL (1)
Jan 22 2012 eof of socketstream? (2)
Jan 22 2012 for loop (13)
Jan 22 2012 Re: MySQL (2)
Jan 21 2012 Re: MySQL (2)
Jan 21 2012 MySQL (9)
Jan 21 2012 learn D & TDPL (14)
Jan 20 2012 foreach with classes like associative array? (4)
Jan 20 2012 Merging two hashes (3)
Jan 20 2012 tdlp: higher-order functions (8)
Jan 20 2012 Passing arguments to a new thread (3)
Jan 20 2012 sameness (3)
Jan 20 2012 Strict aliasing in D (1)
Jan 19 2012 Switch and break (13)
Jan 19 2012 Changes for newer version... (3)
Jan 19 2012 Reading web pages (28)
Jan 19 2012 tdpl: function literals versus delegate lierals (4)
Jan 18 2012 strings and endianness (4)
Jan 17 2012 Pure functions and delegates (2)
Jan 17 2012 tdpl: partial ordering of functions: conflict error (1)
Jan 17 2012 lambda template literals? (5)
Jan 17 2012 Could assertThrown be made safe/trusted? (12)
Jan 17 2012 Exceptions documentation (2)
Jan 16 2012 Meaning of pure member function (3)
Jan 16 2012 Error: 'this' is only defined in non-static member functions, (16)
Jan 16 2012 Re: OOP Windows (2)
Jan 16 2012 Struct initialization, implicit conversions and delegates (2)
Jan 16 2012 std.stream.Stream.read([...]) matches both (1)
Jan 16 2012 Error: "template instance ... is not a template declaration, (1)
Jan 16 2012 std.math and std.mathspecial (1)
Jan 15 2012 OOP Windows (6)
Jan 15 2012 std.mathspecial conflicts with std.math (2)
Jan 15 2012 output minimal .di files? (15)
Jan 15 2012 Get name of enum val at compile-time? (8)
Jan 14 2012 Fixed matrix rows joining (5)
Jan 14 2012 Constant function/delegate literal (7)
Jan 14 2012 Re: import std.c.windows.windows; (1)
Jan 14 2012 Re: A tutorial on D templates (1)
Jan 13 2012 Re: function pointer from DLL (1)
Jan 13 2012 function pointer from DLL (1)
Jan 13 2012 std.algorithm.startsWith with maximal matching (1)
Jan 13 2012 Re: A tutorial on D templates (1)
Jan 13 2012 Re: A tutorial on D templates (9)
Jan 13 2012 A tutorial on D templates (5)
Jan 13 2012 Absolute beginner (12)
Jan 13 2012 const violation? (2)
Jan 13 2012 Error creating thread (4)
Jan 13 2012 Fast way to append to an SList (2)
Jan 13 2012 Streams vs ranges (3)
Jan 13 2012 CTFE and cast (4)
Jan 12 2012 Mixin on a bunch of foreach fails. (2)
Jan 12 2012 opApply with/without ref (3)
Jan 12 2012 About implicit array cast (3)
Jan 11 2012 floating point precision (3)
Jan 10 2012 Const lazy arguments? (3)
Jan 10 2012 etc.c.curl...? (3)
Jan 10 2012 Re: import std.c.windows.windows; (2)
Jan 10 2012 import std.c.windows.windows; (4)
Jan 10 2012 Taking a function or delegate as argument. (13)
Jan 10 2012 Bad thread_attachThis() design (1)
Jan 09 2012 Problem with interfacing C code to D (7)
Jan 09 2012 Waiting around (1)
Jan 09 2012 Exceptions in safe D (5)
Jan 09 2012 How do you overload new and delete for a class? (3)
Jan 09 2012 How to get runtime args from shared static this module ctor? (3)
Jan 09 2012 std.csv (4)
Jan 09 2012 Learning With D (3)
Jan 08 2012 Ref local variables? (10)
Jan 08 2012 Object initializers (1)
Jan 07 2012 associative arrays (47)
Jan 06 2012 Is this really a bug? (3)
Jan 06 2012 Compile-time evaluation of real expressions? (12)
Jan 05 2012 Singleton Pattern (8)
Jan 05 2012 MX records (1)
Jan 05 2012 Problem with Hiredis Binding (17)
Jan 04 2012 An issue with lazy delegates (4)
Jan 04 2012 out default argument of void (8)
Jan 04 2012 __gshared and static constructors (3)
Jan 04 2012 question -property (1)
Jan 03 2012 AA char[] as key (9)
Jan 03 2012 opCast!bool (5)
Jan 03 2012 Enumerating structs? (3)
Jan 03 2012 Using "in" with associative arrays and then indexing them (efficiency) (2)
Jan 02 2012 Re: Mixing D and C - Windows (1)
Jan 02 2012 Re: Mixing D and C - Windows (4)
Jan 02 2012 Array of array (19)
Jan 02 2012 rvalue references template ? (5)
Jan 02 2012 Nightly builds (2)
Dec 31 2011 Mixing D and C - Windows (3)
Dec 30 2011 Programming on OSX (9)
Dec 30 2011 typedef deprecated - now what ? (9)
Dec 29 2011 Bug or feature? std.c.stdlib.exit() breaks RAII (18)
Dec 21 2011 Are D classes always garbage collected? (11)
Dec 21 2011 writing iterators without code duplication. inout? (12)
Dec 14 2011 Cartesian product of ranges? (6)
Dec 01 2011 std.json dynamic initialization of JSONValue (6)
Nov 09 2011 Is there a portable way to limit memory/cpu usage of a D application? (4)
Oct 10 2011 problems with DPL example. (12)
Other years:
2012 2011 2010 2009 2008 2007 2006 2005 | http://www.digitalmars.com/d/archives/digitalmars/D/learn/index.html | CC-MAIN-2013-20 | refinedweb | 13,719 | 63.22 |
Hi
hi
online multiple choice examination hi i am developing online multiple choice examination for that i want to store questions,four options,correct answer in a xml file using jsp or java?can any one help me?
Please
Struts Hi i am new to struts. I don't know how to create struts please in eclipse <p>hi here is my code can you please help me to solve...
{
public ActionForward execute(ActionMapping am,ActionForm af...(ActionMapping am,HttpServletRequest req)
{
ActionErrors ae=new ActionErrors I have connected mysql with jsp in linux and i have used JDBC connectivity but when i run the program, its not working the program is displaying!
hi! how can i write aprogram in java by using scanner when asking... to to enter, like(int,double,float,String,....)
thanx for answering....
Hi...);
System.out.print("Enter integer: ");
int i=input.next>...)
{
System.out.println(e);
}
%>
</body>
</html>
when i compiled it!!!!!!!!!!!!!!!!!!!!!
HI!!!!!!!!!!!!!!!!!!!!! import java.awt.*;
import java.sql....=con.createStatement();
int i=st.executeUpdate("insert into bankdata(name,pass...
:( I am not getting Problem (RMI)
I am not getting Problem (RMI) When i am excuting RMI EXAMPLE 3,2
I am getting error daying nested exception and Connect Exception
struts internationalisation - Struts
struts internationalisation hi friends
i am doing struts iinternationalistaion in the site
i followed the procedure as mentioned but i am not- login problem - Struts
struts- login problem Hi all, I am a java developer, I am facing problems with the login application. The application's login page contains fields like username, password and a login button. With this functionality
Struts
Struts Am newly developed struts applipcation,I want to know how to logout the page using the strus
Please visit the following link:
Struts Login Logout Application" for understanding.so please guide for the same.
thanks Please visit the following link:
Struts Tutorials
use of Struts - Struts
use of Struts Hi,
can anybody tell me what is the importance of sturts? why we are using it?
Hitendra Hi,
I am sending... example.... is not showed even i check the file size also and generating excetion for dummies pdf download I am looking for a PDF for struts beginners.Thanks
Struts Project Planning - Struts
Struts Project Planning Hi all,
I am creating a struts application.
Please suggest me following queries i have.
how do i decide how many..., | http://www.roseindia.net/tutorialhelp/comment/22738 | CC-MAIN-2015-35 | refinedweb | 395 | 56.25 |
Google Summer of Code (GSoC) () is a program that offers student developers stipends to write code for various open source projects. Google will be working with several open source, free software, and technology-related groups to identify and fund several projects over a three month period.
The following is a list of Mono project ideas that students can apply for. Additionally, we encourage students to submit their own interesting Mono-related project proposals. In 2007, roughly 20% of the accepted proposals were original ideas from students instead of from our suggestions. You can submit more than one proposal, so you can submit your own ideas as well as apply for one from this list. (Only one can be chosen of course!)
Please note that to apply for GSoC, you will need to go through the standard Google application process. You do not apply directly to the Mono Project. Any questions or comments about this page can be sent to Miguel (miguel@novell.com).
For inspiration, here are the projects from previous years:
- 2008 Projects ()
- 2007 Projects
- 2006 Projects
- 2005 Projects (follow-up review ())
Table of Contents
4.1 Improve and extend the logging profiler GUI
4.2 LLVM Back-End
4.3 Rewrite Remoting to use DynamicMethod
4.4 Mono.Simd ports
4.5 Add support for X86 to use SSE for FP math
4.6 Use Mono.Simd in the classlibs
4.7 Improve and optimize ParallelFX
4.8 Add COM support for other COM runtimes
6.1 PixelShader pipeline
6.2 VDPAU VC-1/H.264 Support
6.3 Silverlight 3 Demuxers
6.4 Silverlight GUI Designer
6.5 Silverlight/Web-based "Garage-Band"-like application
6.6 Silverlight/Web-based video editing sofwtare
6.7 Silverlight/Moonlight Web-based: Suggest Your Own
6.8 Platform Abstraction layer
6.9 Dirac Support
6.10 Vorbis/Theora Support
6.11 Ogg Container Support
8.1.1 Class Designer Addin
8.1.2 Online Project/File Templates
8.1.3 Interactive C#/F#/IronPython Console
8.1.4 Bug tracker integration
8.1.5 Documentation Addin
8.1.6 Debugger Visualizers
8.1.7 Translation Resources Editor
8.1.8 Profiling addin
8.3.1 Implement a new Language Binding
8.3.2 Improve C/C++ Binding
8.3.3 Improve VB.NET Binding
8.3.4 Improve Boo Binding
8.3.5 Java/IKVM Binding
8.4 Moonlight/Silverlight
8.7 Version control addins
Important: Projects
If a project is not listed here, but you think you got yourself a great idea, feel free to contact our mentors, Miguel or to suggest your own project.
Over the past three.
Ground Rules
Language: Code must be written in the same language as the host of the project:
- GCC extensions in C
- Mono VM extensions in C
- Tools extensions in C#
- APIs in C#
- etc.
Licensing: All of the code submitted must be contributed under the terms of the MIT X11.
Applying, suggestions. From the hundreds of requests that we got last year, in the first few hours we discarded all of the one-line requests that read something like:.
We especially want to see:
- A concrete list of goals/deliverables for the time period.
- A rough estimate of the steps it will take to complete your project.
- A timeline showing how long you believe each step will take.
- Multiple people may apply for the same project, tell us why you are the best candidate.
During the summer of code, we will invest significant resources from existing team members to guide you, answer your questions, and help you architect the software in a way that is acceptable to Mono and that has a high chance of having an impact on the larger community of Mono users.
Contacting the Mono Team
If you have questions or suggestions that you want to make in real-time and talk to a member of the team, please join us on IRC on the server irc.gnome.org in channel #monosoc or the #mono channel. Various mentors and students from past years are usually there and can answer some quick questions about the program and about Mono.
Runtime
Improve and extend the logging profiler GUI
Extend the current logging profiler GUI to support all of it's operation mode and provide good visual feedback and exploration capabilities to the results.
This should be a Gtk# or Web-based application that consumes the profiler data and implements a UI for common profiler-based operations.
Priority: High.
Deliverable: An improved profiler GUI to enable better heap and performance evaluation.
LLVM Back-End
Complexity: Hard.
Investigate using LLVM () as an optional back-end optimizer for the Mono JIT, useful in Ahead-Of-Time compilation or server environments, where the quality of generated code is more important than compilation time. Some of the integration issues are discussed here ().
Rewrite Remoting to use DynamicMethod
Complexity: Medium-Hard.
The current implementation of Remoting use System.Reflection.Emit to generate classes to optimize some remoting tasks. However the types are not GC'able due to the nature of how TypeBuilder and friends work. The idea is to re-implement this part of the code to use DynamicMethod, which would result in less memory utilization and allow for GC'able data.
Deliverable: Patches re-implementing the related parts of Remoting.
Mono.Simd ports
Complexity: Medium-Hard
Port the Mono.Simd API to any of the following architectures:
- AMD64
- VMX
- NEON
The VMX and NEON ports should be pretty straight forward as the whole machinery is there. It's a matter of adding the proper instruction intrinsics.
Add support for X86 to use SSE for FP math
Complexity: Medium-Hard
Add the required machinery to make mono emit SSE code for FP math. It should be dynamically detected, should play nicely with Mono.Simd and not preclude optimizations that are disabled under stack based FP.
Use Mono.Simd in the classlibs
Implement encrpyption, hashing and big num functionality in the class libraries.
Complexity: Medium-Hard
Deliverables:
-SHA1 -BigInteger basic ops -More stuff TBD
Improve and optimize ParallelFX
Complexity: Medium-Hard
Improve the ParallelFX library.
Build a test suite to assert it's performance and scalability up to 8 cores machines. Optimize as needed.
Add COM support for other COM runtimes
Complexity: Medium. Priority: Medium.
Currently Mono has support for Mainsoft's COM and Mozilla XPCOM, we would like to add support for OpenOffice's UNO to bridge their APIs using the native COM support in Mono.
See Three Com Interop Updates (), COM Interop in SVN (), COM Interop in Mono Progress () and COM Interop in Mono () blog posts for more details.
Deliverable: Code that enables support for OpenOffice's UNO with an example program that connects to OO and performs some small task.
Applications
We are looking for improvements to the existing Gnome/Mono applications like F-Spot, Banshee, Gnome-Do, Tasque, Tomboy, Beagle and others.
Axiom Engine
The Axiom 3D Engine () is an open-source, cross-platform 3D graphics rendering engine for .NET and Mono. The engine is a high-performance C# port of the powerful OGRE engine.
Some ideas can be found on the Axiom wiki (). We're interested in things that will make it easier to write cross-platform games and 3D applications using Mono.
Mentors: please add new ideas and applications.
Students: feel free to suggest ideas and projects for the summer from those alternative web sites.
Moonlight/Silverlight related projects
Many of these projects are intended to help us create software that we can use to test drive our implementation, find problems with Moonlight, our SDK and the development process.
The software will live on its own, but expect to find challenges with our implementation.
PixelShader pipeline
Silverlight 3 introduces support for Pixel shaders (implementing the ps2.0 API). These shaders are not executed on the gpu, but are actually run thru a JIT and executed by the CLR. This project will implement a HLSL PS2.0 compatible parser that emits the pixel shaders as dynamic methods..
Silverlight 3 Demuxers
Implement demuxers into the Moonlight pipeline compatible with the new Silverlight 3 beta support for .mov, .f4v, .m4a and .mp4
Silverlight GUI Designer
Two summers ago Alan McGovern (of MonoTorrent fame) worked on LunarEclipse, an GUI editor for Siverlight XAML files. This editor was being built as Moonlight was being developed, so it was a great test for Moonlight and exposed many bugs and limitations on it.
This year, Moonlight is more mature and we would like to have this GUI designer completed, first in standalone mode.
Deliverables:
- Complete the editing features available for figures.
- Complete the recording and animation framework.
- Add support for loading and saving files.
Silverlight/Web-based "Garage-Band"-like application
Using Silverlight 2.0 build the UI for a Garage-Band like application (sequencing of instruments, showing audio, beats, select ranges, cut and paste) that would be fully implemented with Silverlight and Moonlight.
Important: Do not worry about actual music output for this project, we are only interested in the UI. The actual media hookup would take place later (and would likely require server-side provided on-demand audio generation).
Silverlight/Web-based video editing sofwtare
Using Silverlight 2.0 build the UI for video editing software (import clips, select regions, cut regions, combine regions, mix regions, do transitions, effects).
Deliverables:, assuming that all audio and video sources are available on the server (ie, do not worry about the actual storage and web presence, that will be sorted out independently):
- Preview area for the video
- Timeline editor
- Cut, paste, slice, transitions.
- List of resources
- Show a timeline for the various clips
Silverlight/Moonlight Web-based: Suggest Your Own
Remember that all the Silverlight apps can be ran locally on the Linux desktop: what would be a great application that we could run unmodified on the web and on the client?
Platform Abstraction layer
Abstract the Moonlight engine away from having hard dependencies on Gtk+/Gdk/Glib and build a platform abstraction layer that will facilitate easy porting to other platforms like Windows and Mac. The successful completion of this project would include a reference implementation for 1 other platform.
Dirac Support
Silverlight 3 supports a pluggable media backend allowing developers to write new codecs in C#.
Develop the Dirac video decoding framework for Moonlight 3/Silverlight 3
Vorbis/Theora Support
Silverlight 3 supports a pluggable media backend allowing developers to write new codecs in C#.
Develop the Theora/Vorbis video decoding framework for Moonlight 3/Silverlight 3.
Ogg Container Support
Silverlight 3 supports a pluggable media backend allowing developers to write new demuxers for media formats in C#
Develop the OGG container format Moonlight 3/Silverligh 3.
Hosting Mono
The Mono runtime could be hosted into several open-source applications (e.g. extensibility, scriptability). Each one would be a different challenge with varying complexity levels. Got other hosting ideas/projects ? Let us know!
Inkscape
Create bindings to Inkscape so that Mono can be used to script Inkscape with any of the .NET provided programming languages.
Deliverables: Bindings that expose the Inkscape API to C# code as well as code to host the Mono runtime inside Inkscape.
Database Server
Develop a database server plugin to execute C# (or any .NET language) stored procedures. Mono can either be hosted inside the database engine or out-of-process.
Notes
- An open-source database server would be more useful than a proprietary one ;-)
- Like hosting Mono inside FireFox the security implications of managed storedproc limits the usefulness of this tool until our security manager is completed. However it is still useful for fully trusted code and will provide an excellent test environment for a secure Mono runtime.
Deliverable: A plugin that can execute basic C# statements as a stored procedure with examples.
ClickOnce
A ClickOnce () implementation could be done using either a managed or unmanaged host (e.g. Firefox). Besides a host this would require adding the missing pieces in the Mono class library (e.g. manifest support).
Since CAS is not supported in Mono its usefulness would be somewhat limited. However a basic use case, from an enterprise point of view, is to distribute/update applications on an intranet. In this case having only NoTrust (no execution) and FullTrust (execution) is a valid and interesting scenario.
Ideally the NoTrust/FullTrust decision would be based on host security policies (e.g. strongnames, url, ...) or by custom host logic.
Deliverable: A host environment and necessary Mono pieces to enable clicking on a link in a browser which will download, install, and run Mono applications.
MonoDevelop
MonoDevelop () is Mono's integrated development environment, and aims to provide all of the RAD features that users expect in a modern IDE. Its architecture is highly flexible, so new features can easily be implemented in an "add-in". Students would be expected to write a new add-in or complete an existing, unmaintained addin.
Note that it would be acceptable to combine several smaller projects into one proposal. Additional information on MonoDevelop's development can be found on the MonoDevelop website (), with some more feature ideas.
If you are interested in discussing these projects, please contact the MonoDevelop mailing list or IRC channel (). In IRC, ask for mhutch or lluis.
Misc
Class Designer Addin
Provide a class designer canvas based on Moonlight that allows users to visualise their class hierarchy via MD's built in code DOM, and stub out new code automagically. Should allow performing operations already made possible by MD's refactory tools such as adding and renaming members. Bonus points if it can load class designer files from VS2005+. N.B. #develop has some related code already.
Deliverables: A class designer canvas that can be used to view and make simple edits on the MonoDevelop project's classes.
Online Project/File Templates
This would consist of a simple web service for project/file templates, and integrating use of this service into the new file/project dialog. This would require a substantial rewrite of the new file dialog.
Deliverables: Implement a simple web service for serving templates. Rework the New File / New Project dialogs to improve their usability and add support for online templates. May have to include other tasks to make this a full-size project.
Interactive C#/F#/IronPython Console
Implement a console pad for embedding interactive shells, e.g C#, IronPython, IronRuby, F# etc. Such a pad exists for Boo already. Should have syntax highlighting and hooks for code completion. Might be useful for scripting MonoDevelop itself too.
Deliverables: Develop an abstract console pad infrastructure based on Mono.TextEditor, including support for running in a remote process, and code completion hooks. Implement a language addin for at least one .NET language, ideally C#. Might also include code completion support.
Bug tracker integration
Integration with an online bug tracker, ideally an abstract framework with a plugin for bugzilla.
Deliverables: Design and develop a framework for integrating with online bugtrackers: browsing bug lists, changing bug assignments and states, linking bugs from source code and from VCS messages. Should include Bugzilla support.
Documentation Addin
Integrate the MonoDoc documentation system into MonoDevelop to make it easy to generate and update documentation for a project. The main feature would be a contextual pad that allows editing MonoDoc documentation. It should use the MonoDevelop parser services to determine the current position in the editor, and show the documentation for that class/method/property etc. Possible extensions to this addin would include displaying the documentation inline in the text editor, allowing "refactoring" of documentation from XML comments into the MonoDoc system, and autocompletion of references within the documentation editor.
Deliverables: Develop an addin for addin MonoDoc support to a project, including compilation of the documentation, and some form of contextual viewing and editing of the docs.
Debugger Visualizers
Implement debugger visualizers for all common BCL and GTK data types, so that when viewing values in the debugger, common types can be displayed in a more readable format. For example, an IDictionary would be shown as a list of key-value pairs, maybe searchable; a GDK.Pixbuf would be rendered as a preview; and Gdk.Color would be shown as a color swatch.
Deliverables: Add debugger visualize support to the debugger addin. Proposal should include a list of data types for which visualizers will be added; you must design and implement visualizers for them.
Translation Resources Editor
An editor for Translation resources, particularly useful for ASP.NET where there is no (easy) Gettext availability.
Deliverables: Full support for translation resources for ASP.NET. Should extend or share code with the Gettext addin.
Profiling addin
Bring the profiling addin to a state where we can ship it. Add support for the mono logging profiler, and support statistical profiling as well as memory profiling. Possibly add support for live updating, and unmanaged profilers such as valgrind.
Deliverables: Logging profiler support for the profiling addin, including allocation and statistical profiling.
Database Addin
Database Designer
Implement a database designer canvas using Moonlight that can be used to visualise and modify the table structures and relationships in a database. This could share code with the class designer.
Deliverables: A database designer canvas that can be used to view and modify database tabs and their relations.
Database integration
Integrate the database addin with other parts of MonoDevelop. This could possibly include the GTK# data widgets in Stetic, the databound controls in ASP.NET, or persistence layers such as DBLinq and NHibernate.
Deliverables: Databinding extension points and services in the database addin, and and addin that provides these features for the ASP.NET addin or the GTK# designer.
Language Bindings
Language binding extensions integrate support for programming languages: compilation, code completion, etc. We are primarily interested in bindings for languages with an open-source implementation that can target Mono, but the architecture of MonoDevelop does not preclude other languages.
Implement a new Language Binding
Implement a language binding for a language currently unsupported by MonoDevelop. It should include complete code parsing and simple code completion, and possibly refactoring operations.
Possible languages include F#, IronPython, IronRuby and LuaCLR.
Deliverables: A new language binding, with full parsing support and code completion.
Improve C/C++ Binding
Implement a mini parser and local type resolver in order to provide code completion for instance members and contextual code completion. Make the code completion more "eager". Refactor out the ctags layer so that it can be used to provide basic completion for other ctags-supported languages. Add features to facilitate managed bindings, such as DllImport completion and SWIG integration. Consider implementing some refactoring tools.
Deliverables: Negotiable, but should include a new parser, and reasonably accurate member completion.
Improve VB.NET Binding
Finish the VB.NET bindings for MonoDevelop. Improve the code completion "eagerness". Implement the basic refactoring operations so that it can be used with Stetic and the ASP.NET codebehind. Implement automatic code insertion (insert 'End If' after 'If', etc).
Deliverables: Restore code parsing and code completion support to the VB.NET binding. Add refactoring operations necessary for the GTK# designer to work. Implement some advanced completions, e.g. override completion.
Improve Boo Binding
The Boo () Binding is in a similar state to the VB.NET binding, so similar tasks would apply.
Deliverables: Restore code parsing and code completion support to the Boo binding. Add refactoring operations necessary for the GTK# designer to work. Implement some advanced completions, e.g. override completion.
Java/IKVM Binding
Implement a parser for the IKVM Java binding to provide code completion. Further work is possible, as for VB.NET binding.
Deliverables: Add code parsing and simple code completion support to the Java/IKVM binding.
Moonlight/Silverlight
Complete Moonlight project Support
Complete the Moonlight project support in MonoDevelop, completing xap compilation and run support. Implement full XAML code completion, and add an embedded Moonlight widget to show a live preview of the XAML in a code/preview split. Allowing use of the property grid to edit XAML controls in the text editor would be nice.
Deliverables: Complete XAML code completion. Live Moonlight preview alongside text editing. Complete Moonlight build/run support, including xbuild tasks.
Designer Integration
Integrate the Lunar Eclipse moonlight designer as an alternative editor for XAML files.
Deliverables: Integrate the Lunar Eclipse designer as an alternate editor for xaml files, including toolbox, document outline and property grid integration.
Web Tools
Webkit-based HTML editor
An HTML editor based on GTK WebKit. The key feature of this editor should be to synchronise edited changes to and from the text editor in real time, allowing a designer/code split view. It should also include support for "regions" of uneditable code that can be rendered and updated by the ASP.NET addin. The will require close mentoring by mhutch to make sure it can be used to replace Composer for the ASP.NET editor.
Deliverables: WebKit-Gtk-based HTML editor widget, based on synchronization to/from a text editor, with support for non-editable regions.
CSS Support
This would involve implementing CSS code completion, both for standalone JS files, and for JS in HTML and ASPX files. Some code already exists for this, from a failed GSoC project last year. This should be quite easy, so there would be potential to investigate more interesting and advanced features such as support for browser profiles, checking for common errors, pads for interactive editing of styles.
Deliverables: CSS code completion in standalone files and inline in HTML/ASPX files. Interface for managing CSS classes. CSS browser profiles.
JS Support
This would involve implementing JavaScript code completion, both for standalone JS files, and for JS in HTML and ASPX files. It should be capable of handling common JS frameworks such as JQuery.
FlashDevelop has an ActionScript parser that could perhaps be adapted.
Deliverables: JavaScript code completion in standalone files and inline in HTML/ASPX files.
HTML Validation
Live validation of HTML (and possibly CSS and Javascript) against the different feature sets supported by different browsers.
Deliverables: An addin that validates HTML, CSS and JavaScript against the features known to exist in different browsers. Browser profile support.
Code analysis
Gendarme Addin
Take over the Gendarme addin (it will need to be mostly rewrittten) and improve its usability and feature set.
Deliverables: Completed gendarme addin. Support for selecting rulesets, excluding rules, exceptions, viewing list of violations and possible solutions. Templates for gendarme rules.
Code metrics
The code metrics addin could also be improved, adding more complex metrics such as documention coverage, tests coverage, classes per file, methods per class, LOC per method etc.
Deliverables: Develop a framework for code metrics, and a number of code metrics for C#. Details negotiable.
On-the-fly analysis
On-the-fly code analysis, searching for common coding problems. Will require infrastructure for post-processing parse units.
Deliverables: A framework for on-the-fly code analysis, detecting and suggesting solutions for common problems.
Version control addins
The version control integration in MonoDevelop can be extended to support new version control systems via providers. Since the only completed provider is the Subversion provider, it is unknown whether the provider extension point is flexible enough to support all other version control systems; some patches to the core version control addin may be required.
Implement a new Version Control Provider
MonoDevelop has a version control addin into which providers for VCS systems can be plugged. Currently there's only a SVN provider. We'd like more.
Deliverables: A version control provider for any popular open-source VCS, such as GIT.
Visualisation tools
In order to fully support distributed development, MonoDevelop needs tools to perform visual merging of changes (ideally three-way merge) and visualising branch and file history. Although most useful with distributed VCS, these will be useful with Subversion too.
Deliverables: A graphical three-way merge tool for the VCS system, and support for this in the SVN provider.
Compilers
VB.Net 9
The current VB.Net compiler, vbnc, fully implements VB.Net 8. We would like to extend it to implement VB.Net 9. This may be too much for one summer, so your application should list which parts you plan on implementing.
Deliverable: Code and tests for vbnc which implement the proposed VB 9 features.
Class Libraries and Bindings
GIT# implementation
Importance: High
A fully managed implementation of the GIT framework, this would be a class library that would implement the GIT file format and operations in C#, including its test suite.
This could be a port of the EGit Java implementation to C# or assisting any of the current GIT efforts for .NET hosted on github.
It should be possible to implement command-line equivalents to the GIT command line tools on Unix using the library.
There are various benefits in this project:
- It would allow tools like MonoDevelop to integrate GIT support natively.
- Bring GIT support to Windows easily
- Allow for the creation of new tools that use GIT storage as their backend.
Deliverable: A managed library that implements GIT functionality with unit tests.
Windows.Forms VisualStyles Support
Currently, Mono only supports the VisualStyles namespace on Windows. We would like to support this on Linux (Gtk) and Mac (Cocoa) as well. This can be done in one of three ways:
- P/Invoke the necessary Gtk and Cocoa libraries, allowing them to draw on the given graphics surface.
- Write your own managed rendering code that mimics Clearlooks or Aqua.
- Adapt Wine's () uxtheme.dll code to run under Mono. (This would be able to run any VisualStyles theme, including many existing ones that mimic Clearlooks and Aqua.)
Deliverable: A complete implementation of the VisualStyles namespace for either Linux/Gtk or Mac/Cocoa.
GTK#
GTK# Applications
We are extremely proud to have some exciting and innovative Mono/GTK# based applications, like F-Spot (), Tomboy (), and Banshee (). We are interested in expanding this to include the next generation of Gnome apps. If you have an idea for a new, innovative application, please feel free to write a proposal for it. Note we are not interested in "I would like to rewrite application XYZ in Mono". We want fresh, new applications that provide value to the Linux desktop.
Deliverable: A GTK# application that contains the features specified in the proposal.
Summer of Profiling
The new 2.0 profile support in Mono is larger than 1.0 and also includes many new code paths that might affect regular applications running by using more memory that they should.
Since performance of managed applications is deeply tied to memory allocation, reducing memory allocation in Mono applications will lead to performance increase.
The Summer of Profiling would be a project to identify, tune, patch and improve the memory usage of Mono applications in every aspect: ASP.NET, web services, XML handling, core libraries, Gtk#.
Deliverable: Patches to reduce Mono's memory usage.
Tools
Gendarme related projects
Mono has a tool, Gendarme to inspect .NET software to detect potential problems within them. It is similar, in goal, to the FxCop tool available to Windows developers.
Gendarme is composed of a runner (a command-line tool) that execute a set of rules over binary assemblies. The rules are written in C#, or possibly any .NET language, by using Cecil, a managed API to manipulate an assembly IL and metadata.
Questions ? See us on IRC, #gendarme channel on GIMPNet, or drop us a mail on our Google Group ().
Here are some potential projects related to Gendarme. We expect you to develop them further in your proposals.
Apply Gendarme to Mono
This project goal is to enhance Gendarme to be even more useful to Mono itself.
This project includes:
- Creating, or tweaking existing, rule sets (profiles) for
- stable assemblies, where API cannot be changed
- unstable assemblies, where the API can be changed
- non-core assemblies, those the Mono project doesn't directly support
- tools, all managed tools provided with mono
- Create a special runner to ease the execution and reporting over Mono different profiles.
- NET_1_1, NET_2_0, Silverlight ... assemblies and tools
- Wrap some rules for Mono usage.
- E.g. a lot of Gendarme's rules cannot be used because they would turn out valid issues that cannot be solved and retain compatibility with MS .NET framework (e.g. naming rules). However some rules would still be useful for private and internal classes/methods.
- Analyze Gendarme results to find:
- False positives. Create new unit tests for them and either fix the rules or fill bugs for them.
- Bugs on class libraries (and tools). File bugs for real problems (which can include patches) or add ignore entries for unsolvable issues (e.g. compatibility)
- Propose changes (framework and/or rules) to Gendarme to make it more useful to Mono
Apply Gendarme to FOSS projects
This project's goal is similar to the previous one but with a different target(s). Here the idea is to enhance Gendarme by helping other FOSS projects that run on top of Mono, e.g. MonoDevelop (), Tomboy (), Banshee (), F-Spot (), Gnome-DO (), Beagle (), NUnit () ... The number of FOSS projects to be analyzed depend on their size and support. Since the latter may vary during the project (e.g. vacations) it could be possible to add more project(s) during the summer.
This project includes:
- Contacting the project maintainers to see
- their interest (and free time) in fixing the reported issues. Ideally this should be done before sending us the proposal!
- if binary compatibility is an issue, since this will influence the number of rules that can be used
- For each project you must
- Create scripts that contain:
- the set of rules used on the projects (actually it should be all of them - minus some specific ones)
- the list of assemblies to be evaluated
- File (or fix) bugs for
- Gendarme, e.g. in case of false positives
- the selected FOSS projects
- Produce a small report (in the form of a special blog entry) with statistics
- size of the project
- how many problems were found (e.g. per category, per rule)
- how many problems were false-positives
- how many problems could be / could not be fixed
- ...
- Propose changes (framework and/or rules) to Gendarme to make it more useful to FOSS projects
Statistics & Performance Analysis
As Gendarme gains more rules performance will become an important concern. Gendarme's default rule set must be kept fast enough so that using it regularly, or as part of the build process, doesn't become an issue.
Part I: Statistics
This includes enhancements to the Gendarme.Framework to, optionally, keep statistics like:
- the number of times a rule was used, not applicable, successful, failed
- the required time for each case
The results should be added, on demand, to the default console runner to help developers see the impact of their changes.
Part II: Performance Profiling
This includes using the profilers available with Mono to find where we spend our time (and memory) while executing Gendarme (and potentially Mono.Cecil too). This should enable to create/refine the developer FAQ by documenting good practice for rules development.
Part III: Optimization
This last part includes changes (proposals and, if accepted, some implementation) to Gendarme (runners, framework and/or rules) to optimize the current time/memory requirements. It's also possible to propose (or write) some rules to check rules :)
Write some cool rules
For this project your proposal must include a list of a few, moderately complex(*), rules for Gendarme. Writing rules is a great way to learn C#, IL and the metadata internals by using the Cecil managed library.
To be considered complete each rule must:
- include its source code;
- include unit tests to ensure the rules works correctly, i.e. to confirm both positive and negative findings;
- include documentation for the wiki, e.g. [Gendarme.Rules.Design];
- be reviewed (to ensure it's been tested against the Mono class library and doesn't return too many false positives);
(*) there are a lot of small and simple rules still missing from Gendarme (requiring less than 5 days of work). However they are not candidates for GSoC projects since they offer a great introduction to new contributors, a way to relax (and try new stuff) for existing contributors (when short on time) and are very popular for GHOP tasks.
Additional sources of information:
- Existing rules ()
- The FindBugs () software for Java
- .NET Framework Guidelines ()
ILASM
Convert the ILASM backend to to use Cecil () as its backend instead of PEAPI (this is only a backend change, not a rewrite of ILASM).
Deliverable: A version of ILASM that uses Cecil.
Monodoc
- Write PDF export support for documentation.
- Multi-threaded file generation support
- Use multiple threads to update the .xml files, using one thread per .xml file.
- Most .xml file generation/updating shouldn't depend upon multiple resources, so this should be a net performance gain.
- Migrate to use System.Xml.Linq from System.Xml (to decrease memory requirements, and perhaps to use PLinq for the parallel updates).
- Create an on-demand member generation API.
- Mike Kestner wants to change the XML format so that the XML only stores documented members, not all members, and the undocumented members would be generated at mdoc-assemble.
- This would be to better support a decent documentation editor, minimize the amount of XML "churn" when committing updates to XML, minimize the amount of changes that need to be reviewed during svn commits, etc.
- Fix Monodoc.Node.URL so that it's sane
- MonoDevelop uses Monodoc "out of process" to show documentation. (See monodoc -remote-mode for details.)
- This "out of process" mode reads stdin to determine which nodes to show.
- Node names are formed by Monodoc.Node.URL
- Monodoc.Node.URL is currently of the form ecma:51#Console/
- Problem: this format is unique to the currently executing Monodoc. Thus, that "url" may be valid for, but it won't be valid the next time go-mono.com is restarted.
- Similarly, on the local desktop it uses the same format, but the numbers/etc. will vary, e.g. if you install additional documentation.
- The result: in some circumstances, MonoDevelop tries to navigate to a particular URL, but gets either the wrong documentation no documentation, becaues the monodoc library within MonoDevelop has a different set of URLs than the Monodoc in the external processs.
- Oops.
- Solution: come up with a sane, consistent, Monodoc.Node.URL mechanism.
- Preferred solution: use the cref format, so in stead of ecma:51#Console/ for System.Console documentation, it should be T:System.Console.
- This is preferred because monodoc already has support to parse cref formats to perform documentation lookup.
- Write a decent documentation editor.
- Random thought: integrate the new documentation editor with MonoDevelop, and alter the editor so that when viewing C# source you see "normal" XML documentation comments, but those documentation comments are not saved within the .cs file. Instead, they're kept separate in the normal .xml file, and the .cs and .xml files are "merged" within the MonoDevelop editor.
- Requirements:
- Must support "bulk copying" of documentation between members. For overloaded members particularly, lots of the documentation will be similar or identical (the summary text, parameter text, etc.). The problem with current monodoc --edit is that there's no easy way to copy and paste identical text between different members, so (for me) it's far faster and more efficient to edit documentation within vim or MonoDevelop.
- Must support adding additional sections. The XML format supports many elements such as exceptions, permission, remarks, etc., none of which monodoc --edit allows to be created.
- WYSIWIG editing, especially for lists and tables.
- "Code completion" style support for cref tags, to cut down on mis-typing e.g. Systme.Collections.Generic.List{T} (as I often mis-spell System).
Extend daap-sharp to d[amp]ap-sharp, integrate it with f-spot for photo sharing
Complexity: Medium Priority: Medium
DPAP is the protocol used by iPhoto for sharing images, similar to DAAP for sharing audio between iTunes and other music app (banshee, rhythmbox, ...). Right now banshee consume the daap-sharp bindings, and this bindings should be extended to support dpap too (both daap and dpap are based on dmap). F-Spot should use this new library to 1)browse remote dpap shares from the --view mode and 2)expose it's collection via dpap.
Deliverables: a working managed dpap library and a set of patches to showcase it's usage in f-spot (exposing f-spot db, browsing shared items) | http://www.mono-project.com/StudentProjects | crawl-002 | refinedweb | 6,052 | 56.66 |
One of these days I’ll figure this out, but in the meantime help me be a
better programmer by eliminating some excess code:
I’m trying to check to see if somebody trying to view/edit/update a
product is the owner. In my scaffold I have this code that works:
def edit
@owner = Product.find(params[:id].to_i)
if @owner.user_id == @user.id @product = Product.find(params[:id]) else flash[:notice] = 'Sorry, you're not the owner.' redirect_to :action => 'list' end
end
Ok, so to simplify it, I wrote a private method called confirm_user:
def confirm_owner
@owner = Product.find(params[:id].to_i)
unless @owner.user_id == @user.id
flash[:notice] = ‘Sorry, you’re not the owner.’
redirect_to :action => ‘list’
end
end
Now, how can I call this in my edit? I tried to use a before_filter
within my edit function but rails didn’t like that saying before_filter
is an undefined method:
def edit
before_filter :confirm_owner
@product = Product.find(params[:id])
end
Any suggestions on how to do this please? | https://www.ruby-forum.com/t/yet-another-dry-question/94126 | CC-MAIN-2021-39 | refinedweb | 171 | 58.18 |
I am using the IsNumeric() function in visual basic 2012.
my code is this
Dim input As String = "123"
If isNumeric(input) Then
'number codes
Else
'not a number codes
End If
isNumeric is a namespace and cannot be used as an expression
It sounds like you've created a name clash. You have presumably named your project 'IsNumeric'. The root namespace for the project is named after the project by default so you now have a root namespace named 'IsNumeric' and that takes precedence over the
IsNumeric method.
There are a number of options to fix this. Firstly, you can change the root namespace for the project to something other than 'IsNumeric', which you would do in the project properties. Alternatively, you can qualify the method name with its namespace, its module or both, i.e. use
Microsoft.VisualBasic.IsNumeric,
Information.IsNumeric or
Microsoft.VisualBasic.Information.IsNumeric.
I'd tend to suggest not using IsNumeric anyway. It can't distinguish between types of numbers and provides no access to the actual numeric value. If you need to do any of that sort of thing then call the appropriate
TryParse method instead, e.g.
Dim number As Double If Double.TryParse(someText, number) Then 'The input was a valid Double and the value is in 'number'. Else 'The input was not a valid Double. End If
Note that
IsNumeric actually calls
Double.TryParse internally and is the reason it was created in the first place. That's why calling
IsNumeric and then something like
CDbl is bad: you're parsing the same text twice in that case. | https://codedump.io/share/uPXnJDXYi49g/1/error-using-isnumeric-in-vb | CC-MAIN-2017-17 | refinedweb | 267 | 56.55 |
The Java
BlockingQueue interface in the
java.util.concurrent class represents a queue
which is thread safe to put into, and take instances from. In this text I will show you how to use
this
BlockingQueue.
This text will not discuss how to implement a
BlockingQueue in Java yourself. If you are interested
in that, I have a text on Blocking Queues in my
more theoretical Java Concurrency Tutorial.
BlockingQueue Usage
A
BlockingQueue is typically used to have on thread produce objects, which
another thread consumes. Here is a diagram that illustrates this principle:
The producing thread will keep producing new objects and insert them into the queue, until the queue reaches some upper bound on what it can contain. It's limit, in other words. If the blocking queue reaches its upper limit, the producing thread is blocked while trying to insert the new object. It remains blocked until a consuming thread takes an object out of the queue.
The consuming thread keeps taking objects out of the blocking queue, and processes them. If the consuming thread tries to take an object out of an empty queue, the consuming thread is blocked until a producing thread puts an object into the queue.
BlockingQueue Methods
A
BlockingQueue has 4 different sets of methods for inserting, removing and examining
the elements in the queue.).
It is not possible to insert
null into a
BlockingQueue. If you try to insert null, the
BlockingQueue will throw a
NullPointerException.
It is also possible to access all the elements inside a
BlockingQueue, and not just the elements at the start and end.
For instance, say you have queued an object for processing, but your application decides to cancel it. You can then
call e.g.
remove(o) to remove a specific object in the queue. However, this is not done very efficiently,
so you should not use these
Collection methods unless you really have to.
BlockingQueue Implementations
Since
BlockingQueue is an interface, you need to use one of its implementations to use it.
The
java.util.concurrent package has the following implementations of the
BlockingQueue
interface (in Java 6):
Click the links in the list to read more about each implementation. If a link cannot be clicked, that implementation has not yet been described. Check back again in the future, or check out the JavaDoc's for more detail.
Java BlockingQueue Example
Here is a Java
BlockingQueue example. The example uses the
ArrayBlockingQueue
implementation of the
BlockingQueue interface.
First, the
BlockingQueueExample class which starts a
Producer and a
Consumer
in separate threads. The
Producer inserts strings into a shared
BlockingQueue,
and the
Consumer takes them out.
public class BlockingQueueExample { public static void main(String[] args) throws Exception { BlockingQueue queue = new ArrayBlockingQueue(1024); Producer producer = new Producer(queue); Consumer consumer = new Consumer(queue); new Thread(producer).start(); new Thread(consumer).start(); Thread.sleep(4000); } }
Here is the
Producer class. Notice how it sleeps a second between each
put() call.
This will cause the
Consumer to block, while waiting for objects in the queue.
public class Producer implements Runnable{ protected BlockingQueue queue = null; public Producer(BlockingQueue queue) { this.queue = queue; } public void run() { try { queue.put("1"); Thread.sleep(1000); queue.put("2"); Thread.sleep(1000); queue.put("3"); } catch (InterruptedException e) { e.printStackTrace(); } } }
Here is the
Consumer class. It just takes out the objects from the queue,
and prints them to
System.out.
public class Consumer implements Runnable{ protected BlockingQueue queue = null; public Consumer(BlockingQueue queue) { this.queue = queue; } public void run() { try { System.out.println(queue.take()); System.out.println(queue.take()); System.out.println(queue.take()); } catch (InterruptedException e) { e.printStackTrace(); } } } | http://tutorials.jenkov.com/java-util-concurrent/blockingqueue.html | CC-MAIN-2014-52 | refinedweb | 607 | 57.57 |
jGuru Forums
Posted By:
avdhut_nate
Posted On:
Friday, September 20, 2002 01:48 PM
Hi,
Can you pls tell me how do I retrieve Complete request URL from the servlet. I am using virtual URL...So I need to know the virtual URL from my servlet.
Is there any cookie or header...or some other parameter/method in the request object which wil solve my problem???
Thanks,
Avdhut.
Re: How to retrieve complete request URL from servlet
Posted By:
Laurent_Mihalkovic
Posted On:
Friday, September 20, 2002 07:42 PM
The information is available, although not directly. The servlet specification has provision for accessing the original request as separated components. The following is the section of the spec you would be interested in:
The request path that leads to a servlet servicing a request is composed of manyimportant sections. The following elements are obtained from the request URI pathand exposed via the request object: Context Path: The path prefix associated with the ServletContext that thisservlet is a part of. If this context is the default context rooted at the base ofthe web servers URL namespace, this path will be an empty string. Otherwise,if the context is not rooted at the root of the servers namespace, the path startswith a/ character but does not end with a/ character. Servlet Path: The path section that directly corresponds to the mappingwhich activated this request. This path starts with a/ character except in thecase where the request is matched with the /* pattern, in which case it is theempty string. PathInfo: The part of the request path that is not part of the Context Path orthe Servlet Path. It is either null if there is no extra path, or is a string with aleading /.The following methods exist in the HttpServletRequest interface to accessthis information: getContextPath getServletPath getPathInfoIt is important to note that, except for URL encoding differences between therequest URI and the path parts, the following equation is always true:requestURI = contextPath + servletPath + pathInfoTo give a few examples to clarify the above points, consider the following:Table 1: Example Context Set UpContext Path /catalogServlet Mapping Pattern: /lawn/* Servlet: LawnServletServlet Mapping Pattern: /garden/* Servlet: GardenServletServlet Mapping Pattern: *.jsp Servlet: JSPServletThe following behavior is observed:Request Path Path Elements/catalog/lawn/index.html ContextPath: /catalog ServletPath: /lawn PathInfo: /index.html/catalog/garden/implements/ ContextPath: /catalog ServletPath: /garden PathInfo: /implements//catalog/help/feedback.jsp ContextPath: /catalog ServletPath: /help/feedback.jsp PathInfo: null
cheerslaurent | http://www.jguru.com/forums/view.jsp?EID=1002220 | CC-MAIN-2014-42 | refinedweb | 406 | 53 |
oak
A middleware framework for Deno's http server, including a router middleware.
This middleware framework is inspired by Koa and middleware router inspired by koa-router.
Application, middleware, and context
The
Application class wraps the
serve() function from the
http package. It
has two methods:
.use() and
.listen(). Middleware is added via the
.use() method and the
.listen() method will start the server and start
processing requests with the registered middleware.
A basic usage, responding to every request with Hello World!:
import { Application } from ""; (async () => { const app = new Application(); app.use(ctx => { ctx.response.body = "Hello World!"; }); await app.listen("127.0.0.1:8000"); })();
The middleware is processed as a stack, where each middleware function can control the flow of the response. When the middleware is called, it is passed a context and reference to the "next" method in the stack.
A more complex example:
import { Application } from ""; (async () => { const app = new Application(); // Logger app.use(async (ctx, next) => { await next(); const rt = ctx.response.headers.get("X-Response-Time"); console.log(`${ctx.request.method} ${ctx.request.url} - ${rt}`); }); // Timing app.use(async (ctx, next) => { const start = Date.now(); await next(); const ms = Date.now() - start; ctx.response.headers.set("X-Response-Time", `${ms}ms`); }); // Hello World! app.use(ctx => { ctx.response.body = "Hello World!"; }); await app.listen("127.0.0.1:8000"); })();
Context
The context passed to middleware has several properties:
.app
A reference to the
Applicationthat is invoking this middleware.
.request
The
Requestobject which contains details about the request.
.response
The
Responseobject which will be used to form the response sent back to the requestor.
.state
A "map" of application state, which can be strongly typed by specifying a generic argument when constructing and
Application.
The context passed to middleware has one method:
.throws()
Throws an
HTTPError, which subclass is identified by the first argument, with the message being passed as the second.
Unlike other middleware frameworks,
context does not have a significant
amount of aliases. The information about the request is only located in
.request and the information about the response is only located in
.response.
Request
The
context.request contains information about the request. It contains
several properties:
.hasBody
Set to
trueif the request has a body, or
falseif it does not. It does not validate if the body is supported by the built in body parser though.
.headers
The headers for the request, an instance of
Headers.
.method
A string that represents the HTTP method for the request.
.path
The path part of the request URL.
.search
The raw search string part of the request.
.searchParams
An instance of
URLSearchParamswhich contain the parsed value of the search part of the request URL.
.severRequest
The original
netserver request.
.url
TODO currently the same as
.path, logic needs to be added to determine the requested host.
And several methods:
.accepts(...types: string[])
Negotiates the content type supported by the request for the response. If no content types are passed, the method returns a prioritized array of accepted content types. If content types are passed, the best negotiated content type is returned. If there is no content type matched, then
undefinedis returned.
.acceptsCharsets(...charsets: string[])
To be implemented.
.acceptsEncodings(...encodings: string[])
Negotiates the content encoding supported by the request for the response. If no encodings are passed, the method returns a prioritized array of accepted encodings. If encodings are passed, the best negotiated encoding is returned. If there are no encodings matched, then
undefinedis returned.
.acceptsLanguages(...languages: string[])
To be implemented.
.body()
The method resolves to a parsed version of the request body. Currently oak supports request body types of JSON, text and URL encoded form data. If the content type of the request is not supported, the request will be rejected with a 415 HTTP Error.
If the content type is supported, the method resolves with an object which contains a
typeproperty set to
"json",
"text",
"form", or
"undefined"and a
valueproperty set with the parsed value of the property. For JSON it will be the parsed value of the JSON string. For text, it will simply be a string and for a form, it will be an instance of
URLSearchParams. For an undefined body, the value will be
undefined.
For more advanced use cases of the body, the original server request is available and contains a
.body()and
.bodyStream()methods.
Automatic response body handling
When the response
Content-Type is not set in the headers of the
.response,
oak will automatically try to determine the appropriate
Content-Type. First
it will look at
.response.type. If assigned, it will try to resolve the
appropriate media type based on treating the value of
.type as either the
media type, or resolving the media type based on an extension. For example if
.type was set to
".html", then the
Content-Type will be set to
"text/html".
If
.type is not set with a value, then oak will inspect the value of
.response.body. If the value is a
string, then oak will check to see if
the string looks like HTML, if so,
Content-Type will be set to
text/html
otherwise it will be set to
text/plain. If the value is an object, other
than a
Uint8Array or
null, the object will be passed to
JSON.stringify()
and the
Content-Type will be set to
application/json.
Router
The
Router class produces middleware which can be used with an
Application
to enable routing based on the pathname of the request.
Basic usage
The following example serves up a RESTful service of a map of books, where will return an array of books and would return the book with ID
"1":
import { Application, Router } from ""; const books = new Map<string, any>(); books.set("1", { id: "1", title: "The Hound of the Baskervilles", author: "Conan Doyle, Author" }); (async () => { const router = new Router(); router .get("/", context => { context.response.body = "Hello world!"; }) .get("/book", context => { context.response.body = Array.from(books.values()); }) .get("/book/:id", context => { if (context.params && books.has(context.params.id)) { context.response.body = books.get(context.params.id); } }); const app = new Application(); app.use(router.routes()); app.use(router.allowedMethods()); await app.listen("127.0.0.1:8000"); })();
Static content
The function
send() is designed to serve static content as part of a
middleware function. In the most straight forward usage, a root is provided
and requests provided to the function are fulfilled with files from the local
file system relative to the root from the requested path.
A basic usage would look something like this:
import { Application, send } from ""; (async () => { const app = new Application(); app.use(async context => { await send(context, context.request.path, { root: `${Deno.cwd()}/examples/static`, index: "index.html" }); }); await app.listen("127.0.0.1:8000"); })();
There are several modules that are directly adapted from other modules. They have preserved their individual licenses and copyrights. All of the modules, including those directly adapted are licensed under the MIT License.
All additional work is copyright 2018 - 2019 the oak authors. All rights reserved. | https://deno.land/x/oak/?utm_campaign=Deno%20Newsletter&utm_medium=email&utm_source=Revue%20newsletter | CC-MAIN-2019-39 | refinedweb | 1,174 | 60.21 |
The persistent keyring is a keyring used to anchor keys on
behalf of a user. Each UID the kernel deals with has its own
persistent keyring that is shared between all threads owned
by that UID. The persistent keyring has a name (description)
of the form
_persistent.<UID> where
<UID> is the
user ID of the corresponding user.
The persistent keyring may not be accessed directly, even by processes with the appropriate UID. Instead, it must first be linked to one of a process's keyrings, before that keyring can access the persistent keyring by virtue of its possessor permits. This linking is done with the keyctl_get_persistent(3) function.
If a persistent keyring does not exist when it is accessed by the keyctl_get_persistent(3) operation, it will be automatically created.
Each time the keyctl_get_persistent(3) operation is performed, the persistent key's expiration timer is reset to the value in:
/proc/sys/kernel/keys/persistent_keyring_expiry
Should the timeout be reached, the persistent keyring will be removed and everything it pins can then be garbage collected. The key will then be re-created on a subsequent call to keyctl_get_persistent(3).
The persistent keyring is not directly searched by request_key(2); it is searched only if it is linked into one of the keyrings that is searched by request_key(2).
The persistent keyring is independent of clone(2), fork(2), vfork(2), execve(2), and _exit(2). It persists until its expiration timer triggers, at which point it is garbage collected. This allows the persistent keyring to carry keys beyond the life of the kernel's record of the corresponding UID (the destruction of which results in the destruction of the user-keyring(7) and the user-session-keyring(7)). The persistent keyring can thus be used to hold authentication tokens for processes that run without user interaction, such as programs started by cron(8).
The persistent keyring is used to store UID-specific objects that themselves have limited lifetimes (e.g., kerberos tokens). If those tokens cease to be used (i.e., the persistent keyring is not accessed), then the timeout of the persistent keyring ensures that the corresponding objects are automatically discarded.
The
keyutils
library provides the keyctl_get_persistent(3)
function for manipulating persistent keyrings. (This
function is an interface to the keyctl(2)
KEYCTL_GET_PERSISTENT operation.) This
operation allows the calling thread to get the persistent
keyring corresponding to its own UID or, if the thread has
the
CAP_SETUID capability,
the persistent keyring corresponding to some other UID in
the same user namespace.
Each user namespace owns a keyring called
.persistent_register that
contains links to all of the persistent keys in that
namespace. (The
.persistent_register keyring
can be seen when reading the contents of the
/proc/keys file for the UID 0 in the
namespace.) The keyctl_get_persistent(3)
operation looks for a key with a name of the form
_persistent.<UID> in
that keyring, creates the key if it does not exist, and links
it into the keyring.
keyctl(1), keyctl(3), keyctl_get_persistent(3), keyrings(7), process-keyring(7), session-keyring(7), thread-keyring(7), user-keyring(7), user-session-keyring(7) | http://manpages.courier-mta.org/htmlman7/persistent-keyring.7.html | CC-MAIN-2019-26 | refinedweb | 521 | 53.71 |
A general filter for gradient estimation. More...
#include <vtkmGradient.h>
A general filter for gradient estimation.
Estimates the gradient of a field in a data set. The gradient calculation is dependent on the input dataset type. The created gradient array is of the same type as the array it is calculated from (e.g. point data or cell data) as well as data type (e.g. float, double). The output array has 3*number of components of the input data array. The ordering for the output tuple will be {du/dx, du/dy, du/dz, dv/dx, dv/dy, dv/dz, dw/dx, dw/dy, dw/dz} for an input array {u, v, w}.
Also options to additionally compute the divergence, vorticity and Q criterion of input vector fields.
Definition at line 39 of file vtkmGradient.h.
Definition at line 42 of file vtkmGradient.h.
Return 1 if this class is the same type of (or a subclass of) the named class.
Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkGradientFilter.
Reimplemented from vtkGradientFilter.
Methods invoked by print to print information about the object including superclasses.
Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from vtkObjectBase.
When this flag is off (the default), then the computation will fall back to the serial VTK version if VTK-m fails to run.
When the flag is on, the filter will generate an error if VTK-m fails to run. This is mostly useful in testing to make sure the expected algorithm is 64 of file vtkmGradient.h. | https://vtk.org/doc/nightly/html/classvtkmGradient.html | CC-MAIN-2021-17 | refinedweb | 279 | 51.04 |
Hello everyone!
I've started a project on SF.net to create a small yet modern IRC client (µIRChat or simply µIRC). However, there one thing that I really can't decide before I start, and that is the language to use. My idea came from µTorrent, which is, as far as I know, written in C with custom libraries. Now, I don't want my client to be extremely small, but definitely under 1 MB.
I don't want any flaming, and such, or arguing about the general "C vs. C++" question, I want the discussion to be related to my requirements, please. Thank you!
So here are my thoughts:
C
- C code is generally small and fast, although it may not have excellent readability.
- In C I'll have to do pretty much everything myself, but this isn't a big problem.
- I can bundle the soruce with Tiny C Compiler and have everything needed to get my program up and running from source in a simple package.
- C tells me to go straight to the point, but the code might end up spaghetti-like, which is really bad, but with careful design it can be avoided.
C++
- C++ is more OO and provides many more features.
- I can use namespaces to structure everything cleanly without having name collisions.
- Classes will help abstract all the platform-specific code in a nice black box.
- The STL is extensive, but I'm pretty sure I won't use it because of the size requirements.
- Overall C++ allows me to do the same thing with cleaner and more readable code.
Now you can pretty much see that I'm stuck. I need you help to pick one for my needs. Remember, it needs to be small, not necessarily fast (speed is a nice bonus too, but not a requirement). Portability will be achieved by the design of the application.
Thanks for helping!
Sincerely,
Mircea Chirea
µIRC Project Admin | https://www.daniweb.com/programming/software-development/threads/144303/c-vs-c-for-a-small-application | CC-MAIN-2018-34 | refinedweb | 327 | 73.88 |
#D4rk_S0rc3ry
import random ans1 = "The only way you'll ever get that answer from me is to pry it from my cold, dead hands." ans2 = "Thou shalt be exalted with the gnarliest of fist bunps." ans3 = "Thou'rt mad to say it." ans4 = "How dare you ask me that!" ans5 = "That information is classified." ans6 = "If I told you, I'd have to kill you." ans7 = "HAHA sucks to be you." ans8 = "I find your visage highly displeasing." ans9 = "Only you can save mankind." ans10 = "The price of my fortunes...is the blood of a freshly exsanguinated gopher." ans11 = "= _ =" ans12 = "Fear of the unknown is what imprisons us." ans13 = "Don't look behind you." ans14 = "Don't blink." ans15 = "STOP THIS NONSENSE" ans16 = "You offend me deeply." ans17 = "I find our conversations tedious." ans18 = "Whatever." ans19 = "Dumbass." ans20 = "This is the way the world ends: not with a bang but with a whimper." print("hi, welcome to the useless magic 8 ball! Please hold.") print("\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...\n...") print("(we will not provide you with any legitimate means to discern future outcomes.)\n how may we be of service today?") question = input("input query. Press ENTER to shake. if you dare. can you handle the COLD, HARD, TRUTH???\n") print("shaking..../n" *5 ,"loading...\n" *4 , "consulting psychiatrists for professional responses" , "\n BINGO! you got lucky! your life is about to change.") choice=random.randint(1, 20) if choice == 1: answer=ans1 elif choice == 2: answer=ans2 elif choice == 3: answer=ans3 elif choice == 4: answer=ans4 elif choice == 5: answer=ans5 elif choice == 6: answer=ans6 elif choice == 7: answer=ans7 elif choice == 8: answer=ans8 elif choice == 9: answer=ans9 elif choice == 10: answer=ans10 elif choice == 11: answer=ans11 elif choice == 12: answer=ans12 elif choice == 13: answer=ans13 elif choice == 14: answer=ans14 elif choice == 15: answer=ans15 elif choice == 16: answer=ans16 elif choice == 17: answer=ans17 elif choice == 18: answer=ans18 elif choice == 19: answer=ans19 else: answer=ans20 while question != "quit": print(answer) print("ask again, or type *quit*") question = input() | https://discuss.codecademy.com/t/what-is-wrong-with-this-python-code-magic-8-ball-game/14018 | CC-MAIN-2019-47 | refinedweb | 366 | 69.58 |
Hey,
Just a question on the code i've posted below.
It writes to the file out.bin but when i view it (thru notepad or edit or whatever) i can see the word "HELLO".
If this is a "binary" file should i be able to see the characters like that? I thought i mite get the bit equivalents.....
Cheers gang.Cheers gang.Code:#include <iostream> #include <fstream> using namespace std; int main() { ofstream outFile; char file[8] = "out.bin"; char buffer[10] = "HELLO"; outFile.open(file, ios::out | ios::binary); outFile.write (reinterpret_cast< const char* >(buffer), 5); outFile.close(); return 0; }
Rob. | http://cboard.cprogramming.com/cplusplus-programming/45513-writing-binary-files.html | CC-MAIN-2013-48 | refinedweb | 103 | 79.36 |
Question
What advantage does the fixed charge coverage ratio offer over simply using times interest earned?
Answer to relevant QuestionsWhat effect will disinflation following a highly inflationary period have on the reported income of the firm?Discuss the relative volatility of short- and long-term interest rates.What is the prime interest rate? How does the average bank customer fare in regard to the prime interest rate?How is valuation of any financial asset related to future cash flows?Analogue Technology has preferred stock outstanding that pays a $9 annual dividend. It has a price of $76. What is the required rate of return (yield) on the preferred stock?
Post your question | http://www.solutioninn.com/what-advantage-does-the-fixed-charge-coverage-ratio-offer-over | CC-MAIN-2016-50 | refinedweb | 112 | 52.15 |
Serialization/Deserialization Series: XML
How do you transform your XML and JSON data into objects that are validatable? Today, we cover how to take only an XML document and create objects to validate against your business rules.
Back in 2006, I worked for a company that had a project where they had certain requirements of taking an XML document and making them into reusable objects, but allowing an easier way to manipulate them in a system.
When I was given this task, I read about a technique that takes XML, or any data format, and have a "reader" create the nodes while reading in the document.
The technique is called serialization and deserialization.
Serialization is the process of taking an object and converting it into a stream of bytes to be read or used later in a database, object, or file.
As you can probably guess, deserialization is the opposite. It's the process of taking that stream and converting it into an object that's usable in another part of a system. An excellent example is a web.config.
Nine years later, I'm working with serialization and deserialization again.
Nothing like coming around full circle, huh?
Creating The Objects From XML
Let's start with a sample XML file. I created a simple dashboard.xml from my CMS dashboard.
<?xml version="1.0" encoding="utf-8" ?> <dashboard> <tabs> <tab title="Home"> <widget id="15" title="Weather"> </widget> <widget id="19" title="RSS Feed"> </widget> </tab> <tab title="Sports"> <widget id="21" title="Scores"> </widget> </tab> </tabs> </dashboard>
Now that we have our XML, how do we create our objects?
Simple.
I refer back to my earlier post on the "Ludicrous Speed" coding series. Paste the XML as classes into a plain Class1.cs file. Of course, make sure your project is targeted to a .NET 4.5 Framework for this to work properly.
Once your code is pasted, your classes will be generated in the editor. The type of classes generated may look a little different. Start renaming them to classes that are more meaningful instead of DashboardTabsTabWidget.
Some tips when using these classes:
- Use either ReSharper's Safe Renaming or Visual Studio's Rename (Refactor, then Rename) to make sure you don't lose any classes that have a different name. It'll keep your sanity. Trust me.
- If you have a different name for your XML elements, use an XmlElement attribute on your classes. For example, if you want your Widget class to be called Component, do a safe-rename of the widget class to Component and place
[XmlElement("Widget")]on the top of your Component class.
- If you have a large XML file, I would recommend using ReSharper's Move Types Into Matching Files. This will make changes to your XML classes more manageable in the long run.
- I have removed the partials from the classes since I will be modifying them and not regen-ing them any time soon.
Now that you have your classes split out, we need to make our serializer.
Let's Get Deserial!
Since we already have our XML, we might as well create our object by deserializing the XML into our object.
To create a deserializer, we need to include the
System.Xml.Serialization namespace.
var xml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <dashboard> <tabs> <tab title=""Home""> <widget id=""15"" title=""Weather""></widget> <widget id=""19"" title=""RSS Feed""></widget> </tab> <tab title=""Sports""> <widget id=""21"" title=""Scores""></widget> </tab> </tabs> </dashboard>"; var stream = xml.ToStream(); StreamReader reader = new StreamReader(stream); XmlSerializer serializer = new XmlSerializer(typeof(dashboard)); var dashboard = (dashboard) serializer.Deserialize(reader); return dashboard;
NOTE: The ToStream() is taken from the post called 10 Extremely Useful .NET Extension Methods. It takes a string and converts it into a MemoryStream.
After running the little test, we have a fully-hydrated dashboard object ready for processing.
Push it back out!
Now that we have our dashboard object, let's go the other way and serialize the object into XML.
The serialization process is just as easy.
var sb = new StringBuilder(); var ns = new XmlSerializerNamespaces(); ns.Add("", ""); using (var reader = XmlWriter.Create(sb)) { serializer.Serialize(reader, dashboard, ns); reader.Close(); }
NOTE: The ToStringContents() is another .NET extension method that I reference. It's in the Stream section, but it's not called ToStringContents(). It's just called ToString().
Once you have your XML, you can store it in a file, database, or object.
Conclusion
Today, we went over how to quickly add classes that mirror our XML document and also demonstrated how we can serialize and deserialize those objects for later use in other systems.
Later this week, we'll go over the serializing and deserializing of JSON objects as well as cover a way to validate all of our objects. | https://www.danylkoweb.com/Blog/serialization-deserialization-series-xml-AM | CC-MAIN-2017-17 | refinedweb | 803 | 57.06 |
wctomb()
Convert a wide character into a multibyte character
Synopsis:
#include <stdlib.h> int wctomb( char * s, wchar_t wc );
Arguments:
- s
- NULL, or a pointer to a location where the function can store the multibyte character.
- wc
- The wide character that you want to convert.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:.
Returns:
- If s is NULL:
- 0
- The wctomb() function uses locale specific multibyte character encoding that's not state-dependent.
- >0
- The function is state-dependent.
- If s isn't NULL:
- -1
- If the value of wchar doesn't correspond to a valid multibyte character.
- x
- The number of bytes that comprise the multibyte character corresponding to the value of wchar.
Examples:
)
Classification:
Last modified: 2013-09-30 | http://developer.blackberry.com/native/reference/core/com.qnx.doc.neutrino.lib_ref/topic/w/wctomb.html | CC-MAIN-2013-48 | refinedweb | 134 | 50.23 |
Calling lapack directly from scipy
Posted May 21, 2013 at 11:28 AM | categories: linear algebra | tags: | View Comments
Updated June 26, 2013 at 06:55 PM
If the built in linear algebra functions in numpy and scipy do not meet your needs, it is often possible to directly call lapack functions. Here we call a function to solve a set of complex linear equations. The lapack function for this is ZGBSV. The description of this function () is:
Z.
The python signature is ():
lub,piv,x,info = zgbsv(kl,ku,ab,b,[overwrite_ab,overwrite_b])
We will look at an example from.
We solve \(A x = b\) with
\( A = \left(\begin{array}{cccc} -1.65 + 2.26 i & -2.05 - 0.85 i & 0.97 - 2.84 i & 0 \\ 6.30 i & -1.48 - 1.75 i & -3.99 + 4.01 i & 0.59 - 0.48 i \\ 0 & -0.77 + 2.83 i & -1.06 + 1.94 i & 3.33 - 1.04 i \\ 0 & 0 & 4.48 - 1.09 i & -0.46 - 1.72 i \end{array}
\right) \)
\( b = \left(\begin{array}{cc} -1.06 + 21.50 i \\ -22.72 - 53.90 i \\ 28.24 - 38.60 i \\ -34.56 + 16.73 i \end{array}
\right). \)
The \(A\) matrix has one lower diagonal (kl = 1) and two upper diagonals (ku = 2), four equations (n = 4) and one right-hand side.
import scipy.linalg.lapack as la # import numpy as np A = np.array([[-1.65 + 2.26j, -2.05 - 0.85j, 0.97 - 2.84j, 0.0 ], [6.30j, -1.48 - 1.75j, -3.99 + 4.01j, 0.59 - 0.48j], [0.0, -0.77 + 2.83j, -1.06 + 1.94j, 3.33 - 1.04j], [0.0, 0.0, 4.48 - 1.09j, -0.46 - 1.72j]]) # construction of Ab is tricky. Fortran indexing starts at 1, not # 0. This code is based on the definition of Ab at #. First, we create the Fortran # indices based on the loops, and then subtract one from them to index # the numpy arrays. Ab = np.zeros((5,4),dtype=np.complex) n, kl, ku = 4, 1, 2 for j in range(1, n + 1): for i in range(max(1, j - ku), min(n, j + kl) + 1): Ab[kl + ku + 1 + i - j - 1, j - 1] = A[i-1, j-1] b = np.array([[-1.06 + 21.50j], [-22.72 - 53.90j], [28.24 - 38.60j], [-34.56 + 16.73j]]) lub, piv, x, info = la.flapack.zgbsv(kl, ku, Ab, b) # compare to results at print 'x = ',x print 'info = ',info # check solution print 'solved: ',np.all(np.dot(A,x) - b < 1e-12) # here is the easy way!!! print '\n\nbuilt-in solver' print np.linalg.solve(A,b)
x = [[-3.+2.j] [ 1.-7.j] [-5.+4.j] [ 6.-8.j]] info = 0 solved: True built-in solver [[-3.+2.j] [ 1.-7.j] [-5.+4.j] [ 6.-8.j]]
Some points of discussion.
- Kind of painful! but, nevertheless, possible. You have to do a lot more work figuring out the dimensions of the problem, how to setup the problem, keeping track of indices, etc…
But, one day it might be helpful to know this can be done, e.g. to debug an installation, to validate an approach against known results, etc…
Copyright (C) 2013 by John Kitchin. See the License for information about copying. | http://kitchingroup.cheme.cmu.edu/blog/category/linear-algebra/ | CC-MAIN-2020-05 | refinedweb | 563 | 86.4 |
High-Performance Networking Programming in C
TCP/IP network programming in C on Linux is good fun. All the advanced features of the stack are at your disposal, and you can do lot of interesting things in user space without getting into kernel programming.
Performance enhancement is as much an art as it is a science. It is an iterative process, akin to an artist gingerly stroking a painting with a fine brush, looking at the work from multiple angles at different distances until satisfied with the result.
The analogy to this artistic touch is the rich set of tools that Linux provides in order to measure network throughput and performance. Based on this, programmers tweak certain parameters or sometimes even re-engineer their solutions to achieve the expected results.
I won't dwell further upon the artistic side of high-performance programming. In this article, I focus on certain generic mechanisms that are guaranteed to provide a noticeable improvement. Based on this, you should be able to make the final touch with the help of the right tools.
I deal mostly with TCP, because the kernel does the bandwidth management and flow control for us. Of course, we no longer have to worry about reliability either. If you are interested in performance and high-volume traffic, you will arrive at TCP anyway.
Once we answer that question, we can ask ourselves another useful question, “How can we get the best out of the available bandwidth?”
Bandwidth, as defined by Wikipedia, is the difference between the higher and lower cutoff frequencies of a communication channel. Cutoff frequencies are determined by basic laws of physics—nothing much we can do there.
But, there is a lot we can do elsewhere. According to Claude Shannon, the practically achievable bandwidth is determined by the level of noise in the channel, the data encoding used and so on. Taking a cue from Shannon's idea, we should “encode” our data in such a way that the protocol overhead is minimal and most of the bits are used to carry useful payload data.
TCP/IP packets work in a packet-switched environment. We have to contend with other nodes on the network. There is no concept of dedicated bandwidth in the LAN environment where your product is most likely to reside. This is something we can control with a bit of programming.
Here's one way to maximize throughput if the bottleneck is your local LAN (this might also be the case in certain crowded ADSL deployments). Simply use multiple TCP connections. That way, you can ensure that you get all the attention at the expense of the other nodes in the LAN. This is the secret of download accelerators. They open multiple TCP connections to FTP and HTTP servers and download a file in pieces and reassemble it at multiple offsets. This is not “playing” nicely though.
We want to be well-behaved citizens, which is where non-blocking I/O comes in. The traditional approach of blocking reads and writes on the network is very easy to program, but if you are interested in filling the pipe available to you by pumping packets, you must use non-blocking TCP sockets. Listing 1 shows a simple code fragment using non-blocking sockets for network read and write.
Listing 1. nonblock.c
/* set socket non blocking */ fl = fcntl(accsock, F_GETFL); fcntl(accsock, F_SETFL, fl | O_NONBLOCK); void poll_wait(int fd, int events) { int n; struct pollfd pollfds[1]; memset((char *) &pollfds, 0, sizeof(pollfds)); pollfds[0].fd = fd; pollfds[0].events = events; n = poll(pollfds, 1, -1); if (n < 0) { perror("poll()"); errx(1, "Poll failed"); } } size_t readmore(int sock, char *buf, size_t n) { fd_set rfds; int ret, bytes; poll_wait(sock,POLLERR | POLLIN ); bytes = readall(sock, buf, n); if (0 == bytes) { perror("Connection closed"); errx(1, "Readmore Connection closure"); /* NOT REACHED */ } return bytes; } size_t readall(int sock, char *buf, size_t n) { size_t pos = 0; ssize_t res; while (n > pos) { res = read (sock, buf + pos, n - pos); switch ((int)res) { case -1: if (errno == EINTR || errno == EAGAIN) continue; return 0; case 0: errno = EPIPE; return pos; default: pos += (size_t)res; } } return (pos); } size_t writenw(int fd, char *buf, size_t n) { size_t pos = 0; ssize_t res; while (n > pos) { poll_wait(fd, POLLOUT | POLLERR); res = write (fd, buf + pos, n - pos); switch ((int)res) { case -1: if (errno == EINTR || errno == EAGAIN) continue; return 0; case 0: errno = EPIPE; return pos; default: pos += (size_t)res; } } return (pos); }
Note that you should use fcntl(2) instead of setsockopt(2) for setting the socket file descriptor to non-blocking mode. Use poll(2) or select(2) to figure out when the socket is ready to read or write. select(2) cannot figure out when the socket is ready to write, so watch out for this.
How does non-blocking I/O provide better throughput? The OS schedules the user process differently in the case of blocking and non-blocking I/O. When you block, the process “sleeps”, which leads to a context switch. When you use non-blocking sockets, this problem is. | http://www.linuxjournal.com/article/9815?quicktabs_1=1 | CC-MAIN-2014-10 | refinedweb | 850 | 59.74 |
Actually I don't want resulting output to be in the XHTML namespace, I just want saxon to think that it is...Sorry, there's no way of making Saxon think that an element is in one namespace when it's actually in another.
If the resulting output is in the correct namespace (I used the code you provided below) my <br> tags look like this
<br xmlns="" />
It does this even though there are ancestor elements in the output with the same xmlns attribute.I'd like to see the evidence. It should only do this if the parent element is in no namespace.
I think in this situation I'm just going to use the xml output method...Go ahead, but that won't change the namespace handling, which is identical in the XML and XHTML output methods. (All the serializer does is to remove duplicate namespace declarations, and that's the same code in both cases).Michael Kay
Thanks for your advice though.
/John
Michael Kay wrote:If your source document has elements with local-name br in no namespace, and you want your result document to have elements with local-name br in the XHTML namespace, then you need to modify the elements to change their namespace. This can be done with a template rule of the form:<xsl:template<xsl:element</xsl:template>Michael Kay
I have a follow up question from a previous post.I have a follow up question from a previous post.
From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of John McGowan
Sent: 06 September 2006 20:27
To: Mailing list for SAXON XSLT queries
Subject: [saxon] xhtml method and xhtml namespace
I noticed that using the output method xhtml was outputting <br></br> instead of <br/> I did some searching and found the information below. Michael's response below makes sense to me.
My application is taking small snippets of xhtml and combining them to make an xhtml form how do i get those small snippets (that have no namespace declaration) to be treated as xhtml by Saxon. asking the author of those snippets to declare namespaces just for <br> tags is not an option.
I tried setting the xmlns="" attribute in the highest level xhtml element in my stylesheet, which happens to be <form>
This partially worked. Any <br/> tags that were added to the stylesheet itself were treated appropriately when outputted. However, in my source document, there are chunks of xhtml containing <br/> tags that are turning into <br></br>.
since the outputted document does have a proper namespace declaration, are we looking at a Saxon bug, or is there something else I have to do to get saxon to realize that I want that xml from the source doc treated as xhtml?
/John
The most likely explanation is that your <br> element is not in the XHTML namespace.Michael Kay
From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Mark Gabriel
Sent: 03 July 2006 10:33
To: saxon-help@lists.sourceforge.net
Subject: [saxon] xhtml output
Hi all…
Not sure if I’m being silly here or what.Not sure if I’m being silly here or what.
With Saxon 8 outputting XHTML I’m not getting what I expect with regards to empty elements.
A <br/> will output as <br></br> which it regarded by browsers as 2 brs.
The same seems to happen for <img/> <hr/> etc
With the output as XML I and getting what I would expect and for HTML I get no closing tag at all.
How do I get the correct output for what I want?
Thanks,
Mark | https://sourceforge.net/p/saxon/mailman/attachment/012c01c6d1f3$e4b4a560$6401a8c0@turtle/1/ | CC-MAIN-2016-30 | refinedweb | 624 | 68.6 |
This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.
SVNBridge is a tool provided by Dynamsoft. Developed based on
the TFS SVNBridge library, SourceAnywhere SVNBridge links SourceAnywhere and
SVN, and enables developers to access SourceAnywhere databases from
TortoiseSVN, a famous Subversion Client.
SourceAnywhere
is a SQL Server-based version control tool. First known as a Visual SourceSafe
(VSS) replacement, SourceAnywhere continues expanding the version control
features to better fit the changing development process and environment.
To better serve the developers with different background
(he/she might have used VSS or SVN before), Dynamsoft first provided a VSS
import tool to help migrate VSS databases to SQL-based SourceAnywhere Database.
Now they decided to take it to another level by providing SVNBridge for users
to use TortoiseSVN as a direct client. If some of your team members were using
Subversion, it’s not necessary for you to convince or enforce them to change
the version control tool anymore. J
SVNBridge brings some great features to SourceAnywhere.
Before integrating SourceAnywhere with Subversion, let’s
first take a look at the architecture of the products. SVNBridge enables
TortoiseSVN to communicate with SourceAnywhere Server through the APIs provided
by SourceAnywhere COM SDK.
As you can see from the above image, SVNBridge gets the
commands from TortoiseSVN. Then through SourceAnywhere COM SDK, SVNBridge
translates the commands to those understood by SourceAnywhere to transfer the
data to SourceAnywhere Server.
Note: Please make sure that you’ve installed SourceAnywhere
Client and COM SDK on the same machine with SVNBridge.
For testing purpose, after installing the client, you can connect to the demo server
that has already been set up by Dynamsoft.
If you want to set up the server yourself, you can follow
the steps in the Step-by-Step Setup Guide.
Dynamsoft
SourceAnywhere Step by Step Setup Guide.pdf
CodePlex.TfsLibrary.dll
Interop.SAWSSDKLib.dll
scconfig.ini
SvnBridge.exe
SvnBridge.Library.dll
SCIP=demo.dynamsoft.com : If you are using SourceAnywhere Server set
up by yourself, you can open "SourceAnywhere Service Configurator" and navigate
to "System Settings -> Server IP and ports section" to check the connection
info.
For SCBIP, you can go to the machine holding the SVNBridge.
And then use the command ipconfig to get the IP address.
The following Authentication will prompt:
Username: default\dynamsoft1 (<repository name of SourceAnwyhere>\<SourceAnywhere username>)
*Please NOTE here you need to use "\" rather than "/"
Password: saw (the password of the SourceAnywhere user)
Note: you can check "Save authentication" to
avoid further Authentication dialogs.
Click OK to confirm the entry. As you can see from the
screenshot below, the little icons on the files and folders indicate that they
are under version control.
If you’d like to view the project(s) through the browser,
please enter the URL http:// 192.168.4.235:808/svn. 192.168.4.235 is the IP
address of the computer where the SVNBridge locates.
If you’d like to check out the SVNBridge by yourself, you
can download the tools at:
If you have any questions, you
can contact our support team at sawstd@dynamsoft. | http://www.codeproject.com/Articles/456498/Integrate-SVN-with-SourceAnywhere-Expand-the-Versi | CC-MAIN-2016-44 | refinedweb | 539 | 52.49 |
I'm new to programming, and tried to work through the flask tutorial.
I'm stuck on this part (from the readme on github) when trying to run the app:
Fire up a python shell and run this:
from flaskr import init_db; init_db()
I get this error when I try to run the command in python shell:
Import error: No module named flaskr
And I get this error when I try to run app locally:
sqlite3.OperationalError OperationalError: unable to open database file
I've been looking for solution for several hours now, but to no avail. Any thoughts on what I could check? Thank you.
The simplest way to accomplish what you need is to fire up the Python shell in the same folder as you have flaskr:
# I'm assuming that python is available on the command line $ cd path/to/flaskr $ python # Python then runs and you can import flaskr >>> from flaskr import init_db; init_db() >>> exit()
The trick is that when you run Python it only looks in a certain number of places for modules and packages - you can see which places by running:
>>> from sys import path >>> for fp in path: ... print fp
from the Python interpreter. If the path to flaskr is not in that list flaskr can't be imported. By default Python adds the directory it is started in to its search path (which is why we start Python in the directory that contains flaskr.)
Once you have run
init_db you should be able to run the application and see everything working. | https://pythonpedia.com/en/knowledge-base/12118192/flaskr-tutorial--can-t-import-flaskr--initialize-database- | CC-MAIN-2020-40 | refinedweb | 259 | 68.54 |
Clothes Washer/Dryer Monitoring With ESP8266 & Acceleration Sensor
Introduction: Clothes Washer/Dryer Monitoring With ESP8266 & Acceleration Sensor
The clothes washer/dryer is in the basement, and you, as a rule, put a heap of clothing in it and after that, you become occupied in your another house work. You overlook the clothing which was left soggy and absorbing in the basement on your machine. Well then again, once in a while you simply run downstairs expecting that machine has completed the work and afterward you see the machine still running. I know, it is irritating.
Imagine a scenario in which you can watch the status of the clothes washer/dryer on your cellular phone or tablet. Likewise, where you can get a message on your telephone stating that the machine has finished its assignment. Sounds exceptionally fascinating and accommodating, right!
Indeed, with the assistance of ESP8266 and an accelerometer sensor you can monitor the status of your clothes washer/dryer. You can make this venture at your own home in a simple manner if you just follow the instructions and copy the code.
Step 1: Equipment We Need
1. Adafruit Huzzah ESP8266
The initial step was getting an Adafruit Huzzah ESP8266 board. Adafruit Huzzah ESP8266 is a low-cost Wi-Fi chip with full a TCP/IP stack and microcontroller capability.The ESP8266 provides a mature platform for monitoring and control applications using the Arduino Wire Language and the Arduino IDE. The ESP8266 module is an extremely cost effective board with a huge, and ever growing community.
2.Adafruit Huzzah ESP8266 Host Adapter (USB Programmer)
This ESP8266 host adapter was designed specifically for the Adafruit Huzzah version of the ESP8266, providing an I²C interface. The integrated USB port supplies power and programming to the ESP8266.
3. H3LIS331DL Acceleration Sensor
The H3LIS331DL is a low-power high-performance 3-axis linear accelerometer with digital I²C serial interface. It is equipped for measuring accelerations with output data rates from 0.5 Hz to 1 kHz. All these things make this sensor an ideal choice for this project.
I used the I²C connecting cable available at the above link.
5. Mini USB cable
The mini USB cable Power supply is an ideal choice for powering the Adafruit Huzzah ESP8266.
Step 2: Hardware Connections
In general, the connections are very simple. Follow the instructions and images below, and you should have no difficulties.
Connection of the Adafruit Huzzah ESP8266 and USB Programmer
First of all take the Adafruit Huzzah ESP8266 and place the USB Programmer (with Inward Facing I²C Port) on it. Press the USB Programmer gently into place and we are done with this step. Easy as pie (See the pic #1).
Connection of the Sensor and Adafruit Huzzah ESP8266
Take the sensor and Connect the I²C Cable to it. For proper operation of this cable, please remember I²C Output ALWAYS connects to the I²C Input. The same should be done for the Adafruit Huzzah ESP8266 with the USB Programmer mounted over it (See the pic #2).
With the help of the ESP8266 USB Programmer, it is very easy to program the ESP8266. All you need to do is plug the sensor into the USB Programmer and you are good to go. I prefer to use this adapter because it makes it a lot easier to connect the hardware. Without this plug and play USB Programmer, there is a lot of risk of making a wrong connection. One wrong wire!
The final assembly will look like in pic #3.
Place the sensor inside Cloths washer/dryer
Before doing this, ensure you cover the sensor totally with plastic so it survives the contact with water. Now, place the sensor and paste it on the drum of the clothes washer/dryer. Do it deliberately without harming the wirework of the washer/dryer and getting yourself hurt.
With this, we are done with all the hardware work.
Step 3: Adafruit Huzzah ESP8266 Arduino Code
The ESP Code for the Adafruit Huzzah ESP8266 and H3LIS331DL Sensor is available on our Github repository.
Before going on to the code, make sure you read the instructions given in the Readme file and setup your Adafruit Huzzah ESP8266 according to it. It will just take a moment to do so.
Note: Before uploading, make sure you enter your SSID network and password in the code.
You can copy the working ESP code for this sensor from here also:
// Distributed with a free-will license.
// Use it any way you want, profit or free, provided it fits in the licenses of its associated works. // Cloth Washer/Dryer Monitoring with ESP8266 // This code is designed to work with the H3LIS331DL_I2CS I2C Mini Module available from Dcubestore.com. //
#include <ESP8266WiFi.h> #include <WiFiClient.h> #include <ESP8266WebServer.h> #include <Wire.h>
// H3LIS331DL I2C address is 0x18(24) #define Addr 0x18
const char* ssid = "your ssid network"; const char* password = "your password";
ESP8266WebServer server(80);
void handleroot() { unsigned int data[6];
for (int i = 0; i < 6; i++) { // Start I2C Transmission Wire.beginTransmission(Addr); // Select data register Wire.write((40 + i)); // Stop I2C Transmission Wire.endTransmission();
// Request 1 byte of data Wire.requestFrom(Addr, 1); // Read 6 bytes of data // xAccl lsb, xAccl msb, yAccl lsb, yAccl msb, zAccl lsb, zAccl msb if (Wire.available() == 1) { data[i] = Wire.read(); } } delay(300);
// Convert the data int xAccl = ((data[1] * 256) + data[0]); if (xAccl > 32767) { xAccl -= 65536; } int xAcc = ((100 * 9.8) / 32768) * xAccl;
int yAccl = ((data[3] * 256) + data[2]); if (yAccl > 32767) { yAccl -= 65536; } int yAcc = ((100 * 9.8) / 32768) * yAccl;
int zAccl = ((data[5] * 256) + data[4]); if (zAccl > 32767) { zAccl -= 65536; } int zAcc = ((100 * 9.8) / 32768) * zAccl;
// Output data to serial monitor Serial.print("Acceleration in X-Axis : "); Serial.print(xAcc); Serial.println(" m/s"); Serial.print("Acceleration in Y-Axis : "); Serial.print(yAcc); Serial.println(" m/s"); Serial.print("Acceleration in Z-Axis : "); Serial.print(zAcc); Serial.println(" m/s"); delay(300);
// Output data to Web Server server.sendContent ("<html><head><meta http-equiv='refresh' content='10'<>H3LIS331DL Sensor I2C Mini Module</a></h2>"); server.sendContent ("<h3 style=text-align:center;font-family:tahoma;>Acceleration in X-Axis = " + String(xAcc) + " m/s/s"); server.sendContent ("<h3 style=text-align:center;font-family:tahoma;>Acceleration in Y-Axis = " + String(yAcc) + " m/s/s"); server.sendContent ("<h3 style=text-align:center;font-family:tahoma;>Acceleration in Z-Axis = " + String(zAcc) + " m/s/s");
if (xAcc > 2) { // Output data to serial monitor Serial.println("Cloths Washer/Dryer : Working");
// Output data to Web Server server.sendContent ("<h3 style=text-align:center;font-family:tahoma;> Cloths Washer/Dryer : Working"); } else { // Output data to serial monitor Serial.println("Cloths Washer/Dryer : Completed");
// Output data to Web Server server.sendContent ("<h3 style=text-align:center;font-family:tahoma;> Cloths Washer/Dryer :");
// Start I2C Transmission Wire.beginTransmission(Addr); // Select control register 1 Wire.write(0x20); // Enable X, Y, Z axis, power on mode, data output rate 50Hz Wire.write(0x27); // Stop I2C Transmission Wire.endTransmission();
// Start I2C Transmission Wire.beginTransmission(Addr); // Select control register 4 Wire.write(0x23); // Set full scale, +/- 100g, continuous update Wire.write(0x00); // Stop I2C Transmission Wire.endTransmission(); delay(300); }
void loop() { server.handleClient(); }
Step 4: Practicality of the Code
Now, download (git pull) or copy the code and open it in the Arduino IDE.
Compile and Upload the code and see the output on your Serial Monitor. After few seconds, it will display all the parameters.
Copy the IP address of ESP8266 from the Serial Monitor and paste it in your web browser. You will see a web page with acceleration reading in 3-axis and status of the Cloth washer/dryer. Before moving on to the final testing, you have to modify the acceleration value according to washer's drum position and sensor placement in the if-else condition in the code.
The output of the sensor on Serial Monitor and Web Server are shown in the picture above.
Step 5: Applications and Upgrading
With the assistance of this project, you can monitor the status of your clothes washer/dryer on your phones and laptops. No need of going over and over and holding up/listening for it to finish the assignment.
You can likewise get a message on your phone expressing that the machine has finished its assignment. With this, you will always remember clothes in the washer. For this, you can simply upgrade this project by adding some part in the code given above.
I hope you like this project and it inspires further experimentation. The Adafruit Huzzah ESP8266 board is incredibly versatile, cheap and accessible to all hobbyists. This is just one of many simple projects which can be constructed using the ESP8266.
Step 6: Resources on Going Further
For more information about H3LIS331DL and ESP8266, check out the links below:
You can also view our additional articles on Home Automation & ESP8266 projects: | http://www.instructables.com/id/Clothes-WasherDryer-Monitoring-With-ESP8266-Accele/ | CC-MAIN-2017-34 | refinedweb | 1,485 | 57.77 |
alright... so here's a quick demonstraition of what I'm trying to do:
def calcInfluence(Coords): #apply to verts from global location Ix,Iy,Iz = 0.0,0.0,0.0 for (Px,Py,Pz),(Lx,Ly,Lz),(Rx,Ry,Rz),(Sx,Sy,Sz),W in Coords: #P = Point of transformation (base of the bone) #L,R,S = Loc,Rot,Sca #W = Weight Ix += Lx*W Vy += Ly*W Iz += Lz*W #need rotation and scale applications here return Ix,Iy,Iz
the code above calculates influence I to add to a RAW vertex position V
these influences are stored in a list to be indexed from by the facepoints.
the "Coords" come from a list of local bone coords supplied with weights.
I want eular because it's easier to manage since you can't trace matrices,
and that it cuts alot of the needless calculations with the matrix method.
does anyone know how to apply these?? | https://www.daniweb.com/programming/game-development/threads/461220/using-eular-coords-instead-of-matrices | CC-MAIN-2020-50 | refinedweb | 159 | 62.82 |
outdoor solar powered led landscape lights US $ $30.00 - $63.00 / Piece 3 year warranty ip65 factory warehouse industrial 200w led high bay light fixtureGet a Quote
Hmcity Solar Lights Outdoor 120 LED with Lights Reflector and 3 Lighting Modes, Motion Sensor Security Lights,IP65 Waterproof Solar Powered for Garden Patio Yard (2Pack) Amazon's Choice recommends highly rated and well-priced products. Free returns are available for …
solar led light malaysia price, harga; price list of malaysia solar led light products from sellers on lelong.my solar power super bright 60 and 100 led pir security motion sensor sport light teagreen. ship from : kuala lumpur, estimated arrival 1-3 working days. 30w 60 led heavy duty outdoor motion sensor all-in-one solar street light - jiangsu teagreenGet a Quote
Specification: Material: Stainless steel, plastic Lamp type: LED Power: Built-in Waterproof rating: IP65 Package Content: 8 x Solar Lights • [High Level of Waterproof] Each Solar Garden Lights Outdoor uses advanced lighting covering material, stainless steel lamp shell, suitable for outdoors use, don't worry about rain, snow, frost, etc. • [Bright Solar Ground Lights] Each Solar Pathway Light consists of 8 LED lights …
300w super bright led solar ceiling light mounted 10000mah.Get a Quote
Outdoor Waterproof Solar Powered LED small torch flame lightdescription:Solar powered garden lights, no wires, no electricity neededCharges during the daytime and turns on during the night IP65 Waterproof and Durable, withstand all kinds of weather all round the yearWith adequate charging
details about solar street light new built-in battery motion sensor remote control wall flood yard outdoor best 208 led solar power light pir motion sensor outdoor garden wall lamp usa. $10.97. free shipping we'll be happy to make an Solarhange or refund the item total price less shipping and handling (s&h) charges within 30 days of your purchases. 2. forGet a Quote
Mar 25, 2021· 100 LED Solar Powered PIR Flood Lamp Motion Sensor Garden Light Outdoor O9R5. £6.59 56 LED Solar ABS Flood Lamp Outdoor Garden Light PIR Motion Outdoor Sensor. Our units are made of high-impact ABS which can withstand snow, rain and other extreme weather conditions. IP65 waterproof and heatproof, great outdoor light for using onGet.
c $11.65. c $12.53. free shipping. seller 100% positive . waterproof 288 led pir motion sensor solar power outdoor garden lamp yard light. c $10.03. free shipping. new . buy solar street light price in Guam motion sensor remote control wall flood yard outdoorGet a Quote
OUSFOT Solar Lights Outdoor 56 LED Solar Security Light Motion Sensor IP65 Waterproof Double Heads 360° Adjustable Wall Light for Yard Garden Fence Front Door Garage (2 Pack) 4.4 out of 5 stars 96 £42.99 £ 42 . 99Get a Quote
LED Solar Powered Security Lights, Waterproof IP65, 3 Head Motion Detected for Garage, Porch, Yard: Floor Lamps - FREE DELIVERY possible on eligible purchases,Buy RIBITENS Solar Lights Outdoor Motion Sensor, Everyday low prices Large online shopping mall …
ssl-s2 solar street light calculator - solar ssl-s2 series features by the high efficient solar panel is split from light head so that it will allows solar panel keep facing the sun while the light head directs light where it is needed.Get a Quote
Mar 25, 2021 · garden lamp That Help Illuminate Your Style - Alibaba.comGarden Lamps Garden Lamp Outdoor Light LED Outdoor Waterproof Landscape Light Of IP65 LED …
Free 2-day shipping on qualified orders over $35. Buy Solar Wall Lamp, 74 LED Solar Flood Light IP65 Waterproof Wireless Solar Motion Sensor Lights Outdoor Spotlight 3 Adjustable Head 270° Wide Angle Illumination Security Light- Garage Yard Garden Patio at Walmart.comGet a Quote
Energy Saving Waterproof IP65 Outdoor Integrated LED Solar Garden Light. $24.00 - $27.00 high lumens light sensor led solar powered bollard lights outdoor garden 5w. Solar Panel. Solar Lamp. Solar Power. $9.90 - $11.25 / Piece. 100 Pieces (Min. Order) china manufacturer round light sensor solar garden lamp outdoor waterproof. Solar PanelGet a Quote
Solar Flame LED Garden Torch Lights, 2 Pack. PRO ELEC. Stylish outdoor lighting that provides a warm white ambient glow and is perfect for enhancing events and garden parties. Supplied as a pack of two to maximise lighting effect. • Easy to install, simply embed spike in the ground and ensure solar …
10w 20w 30w 40 50w 60w 12v dc led solar street lights integrated all in one lamp with sensor motion. $100.00 - $500 high efficient ce&rohs solar street lamp led looking for distributor 120 watt 3 in 1 solar road lamp used for pathwaying pole drawing latest model high mast lighting price led solar street light ac/ dc power pwm solar charge controller. $1.00Get a Quote
Feb 17, 2021·. The conversion rate of our upgraded polycrystalline silicon solar panels is as high as 20%.
hot 4w 600lm 48 solar street light outdoor black pir motion sensor light garden security lamp outdoor street waterproof wall lights. how it works? -1.charge the solar panel by placing it under direct sunlight at daytime. the electrical energy is stored in the internal battery.more sunlight, charge more power.Get a Quote
60 LED Solar Security Lights Outdoor, 【2 in 1 Design】Solar Flood Lights IP65 Waterproof Solar Motion Sensor Security Light 3 Modes Super Bright Solar Powered Wall Lights for Garden Door Pathway Yard. [Energy Class A+++] Brand: btfarm. 4.0 out of 5 stars. 776 ratings.Get a Quote
Shenzhen Solar Co.,ltd, Experts in Manufacturing and Exporting Solar Street Light,Solar Garden Light and 1042 more Products. A Verified CN Gold Supplier on Alibaba.com.
lighting type led lighting color cool white, pure white power source sun light, solar pole height 4m - 5m above ip rating ip65 (all in one [promo] 40w solar street light radar+light) certification ce, rohs battery capacity 3.7v- 18 ah lithium-ion mounting type 4m-5m above groung level led lumens 100 lumen per watts sensor type yes all in one led solar streetGet a Quote
Cheap Street Lights, Buy Quality Lights & Lighting Directly from China Suppliers:Alpha 2020X Outdoor Waterproof Motion Sensor Solar Powered LED Pole Wall Street Path Light For Garden 3 Working Modes Enjoy Free Shipping Worldwide! Limited Time Sale Easy Return.Get a Quote
Solar Lights Outdoor, 282 LED Solar Motion Sensor Security Lights with 3 Modes and 270° Wide Lighting, IP65 Waterproof Wireless Solar Powered Lights Wall Lights Solar Lamps for Garden Yard Fence: Amazon.co.uk: Kitchen & Home
high power water proof outdoor ip 66 with pir sensor 10w, 20w, 30w, 40w, 50w, 60w, 70w, 80w, 90w, 100w all in one lamp 50w 100w 200w solar led. fob price: us $ 460-480 / piece min. order: 1 piece. power supply: solar; lamp body material outdoor waterproof ip65 aluminum black golden led garden spot light and ledspike light. fob price: us $ 4.78-12Get a Quote
Solar 7 LED Spotlight Outdoor Garden Lamp Landscape Lights Waterproof Decor LOT. AU $24.88. Solar Power 5M LED Strip Lights IP65 Waterproof Garden Xmas Party Decor Lamp AU We are a professional wholesale company with factory. Our items are 100% located in Melbourne.Get a Quote
Hmcity Solar Lights Outdoor 120 LED with Lights Reflector and 3 Lighting Modes, Motion Sensor Security Lights,IP65 Waterproof Solar Powered for Garden Patio Yard (2Pack) #1 Best Seller Solar Lights Outdoor, AmeriTop 128 LED 800LM Wireless LED Solar Motion Sensor Lights Outdoor; 3 Adjustable Heads, 270°Wide Angle Illumination, IP65 WaterproofGet a Quote
LED Solar Powered Security Lights, Waterproof IP65, 3 Head Motion Detected for Garage, Porch, Yard: Floor Lamps - FREE DELIVERY possible on eligible purchases,Buy RIBITENS Solar Lights Outdoor Motion Sensor, Everyday low prices Large online shopping mall …
import china ip65 cheap solar street light 40w from various high quality chinese solar led street light buy quality solar suppliers & manufacturers on globalsources.com. 100w waterproof 120w solar led street light 60w-120w outdoor with solar panel with solar cell /solar battery. us$ 950 / piece; 5 pieces hong kong sar (142) hungary (98) iceland (76) (121) indonesia (116Get a Quote | https://www.ilbriccodicarru.it/bd1e43013b5b6a9bab8dbca8f41f78ba | CC-MAIN-2021-43 | refinedweb | 1,345 | 57.5 |
Archives
ASP.NET 2.0 Security FAQs Online
The Channel9 guys have recently published a new Wiki on ASP.NET 2.0 Security Topics where you can read and comment on common security questions (example questions/answers: how to use forms authentication with Active Directory, how to create custom trust levels, how to implement single-sign on, etc).
VirtualPathProvider Extensibility in ASP.NET 2.0
One of the really powerful things we did in ASP.NET 2.0 was to build a pluggable provider abstraction for a web app’s file activity, and to then re-plumb the ASP.NET parser, compiler, and other path/content/page related work to go through it. What this ends up delivering is a lot of extensibility capabilities not possible in ASP.NET V1just
HTML Validation Checking in VS 2005 (and how to optionally turn it off if you want)
I
A few of my favorite new HTML source editor features in Visual Web Developer & VS 2005
We spent a lot of time in Visual Web Developer and VS 2005 focusing on delivering a really great HTML source editing experience (we also did a lot in design-view – but this blog post is just about the HTML source editor). Below are a few of the cool new features it enables (none of these were in VS 2003). All but one of the features are in the free Visual Web Developer Express version that you can download..
How to Run a Root “/” Site with the VS/VWD 2005 Local Web Server
Update: This blog post is now old and out of date. Please read this newer post of mine instead.:
ASP.NET 2.0 Site Navigation Features
Feb.
At a high-level, the new Site Navigation features allow you to define (outside of code or pages) the “site map” structure of how your site is laid out. Specifically, it allows you to define the relationships between pages on the site – what is the “home” entry-point, what are the sub-sections of it, and how individual pages fit within it. This information is cached by ASP.NET, and you can then get access to this sitemap structure at runtime.
Changing the default browser used in VS 2005 and Visual Web Developer
I've seen a few people ask if it is possible to change what browser is launched and used when running web apps in VS 2005 and Visual Web Developer (for example: to use FireFox instead of IE). The good news is that there is an easy way to configure this. To-do this:
ASP
Url Mapper w/ Regex Support
Several people have asked why the built-in URL Mapper in ASP.NET 2.0 doesn't support regular expressions. There were actually a few reasons for this -- one of the big ones being that just about the time we were about to consider adding it my team started also working on IIS7. We realized that a full-featured version would want/need to take advantage of some of the new features in IIS7 as well as the support all content types (in particular -- images and directories). So we postponed making it feature rich until a future version.
Inventory Provider for the Commerce Starter Kit for ASP.NET 2.0
Last week I blogged about the new Commerce Starter Kit. David Hayden has already built a new Inventory Provider for it. Pretty cool!
Tips for Nested Master Pages and VS 2005 Design-Time).:
public class BasePage : System.Web.UI.Page {
private string runtimeMasterPageFile;
public string RuntimeMasterPageFile {
get {
return runtimeMasterPageFile;
}
set {
runtimeMasterPageFile = value;
}
}
protected override void OnPreInit(EventArgs e) {
if (runtimeMasterPageFile != null) {
this.MasterPageFile = runtimeMasterPageFile;
}
base.OnPreInit(e);
}
}).
Visual Studio 2005 Web Deployment Project support available for Download
I blogged about it earlier this week:
ASP.NET Control Visualizers in the VS 2005 Debugger
I came across a really cool link today: on how you can use some of the new visualizer architecture with ASP.NET control development:
Forms Authentication timeout default in ASP.NET 2.0
One).
ASP.NET 2.0 PayPal Commerce Starter Kit
One of the really cool starter kits that shipped on the web this week is the Commerce Starter Kit built by PayPal. You can download and learn about it here:
VS
Behind the Scenes Video and some Interesting ASP.NET 2.0 Stress Stats
I’m doing the keynote Monday night at the ASP.NET/VS Connections conference in
. It is a great conference and one I’ve presented at for years now. Las Vegas | http://weblogs.asp.net/scottgu/archive/2005/11 | CC-MAIN-2014-42 | refinedweb | 756 | 61.67 |
Docs |
Forums |
Lists |
Bugs |
Planet |
Store |
GMN |
Get Gentoo!
Not eligible to see or edit group visibility for this bug.
View Bug Activity
|
Format For Printing
|
XML
|
Clone This Bug
projectm allows Winamp's Milkdrop visualizations to be used by libvisual
(amaroK) and xmms. In the past it required its own version of SDL 1.3, making
it inappropriate for Gentoo. However, in 0.96 it has dropped this prerequesite.
There would be a USE flags for libvisual and xmms support, as they are
seperate.
It does some weird things like install the 'presets' (what it calls the
different visualizations) into /etc.
I'd suggest a USE flag for libvisual-plugins to be added, so as to direct users
to these funky visualizations (not sure on policy about this).
Reproducible: Always
Steps to Reproduce:
Created an attachment (id=56796) [edit]
projectm-0.96.ebuild
As requested, ebuild for projectm-0.96 -- works for building libvisual plugin,
but fails to compile xmms plugin. I believe the bug resides in
src/projectM/common.h on lines 57-59:
#ifndef USE_XMMS
typedef short gint16;
#endif /** !USE_XMMS */
I don't think USE_XMMS is being defined when building xmms-projectM, but I
don't have any experience with automake/autoconf so I can't fix this. Maybe
someone else could help here? Anyway, here's the ebuild.
Created an attachment (id=56797) [edit]
makeinstall.patch
Patch file to make the "make install" portion of projectM's Makefiles play
nicely with portage
The ebuild worked great with 0.96 but not 0.97. Either way projectm dosn't show
up for beep-media-player. Any thoughts?
Hmm now that I look closer, projectM isn't showing up for xmms either. I also
foudn a bunch of permission Denied errors with all the chmod/chowns for the
install. I am using the makefile patch listed above. Problem exists with 0.96
and 0.97 on my system. Am using libvisual 0.2.0 and beep-media-player 0.9.7-r4.
Created an attachment (id=64851) [edit]
Added a patch for Makefile.in (just for xmms)
I appended a patch for Makefile.in into makeinstall.patch, as Makefile.in is
the file that actually creats Makefile (and this makes emerge happy, ie, not
die).
I revisted the ebuild using the makeinstall-xmms patch and built with the
libvisual use-flag, but beep-media-player will not pickup the projectM actor
with bmp-libvisual. Although bmp-libvisual works fine rendering the normal actors.
Update: the ebuild works great with xmms, very groovey.
Just tested the ebuild with the makeinstall-xmms patch and it works with the
new
projectM-0.97.
builds fine on my amd64 using libvisual -- thanks
Created an attachment (id=71752) [edit]
projectm-0.97_p5.ebuild
Update for 0.97, which has strangely named tarballs...
I haven't tested xmms functionality because I don't use xmms.
But there's a small change to fix the compilation of the libvisual actor.
Created an attachment (id=71753) [edit]
makeinstall.patch
Don't install stuff into /etc/projectM/presets with mode 777...
Latest works awesome like in xmms, still get the usual stuff in
beep-media-player with libvisuals, no full projectm there.
For me, the libvisual actor works without any problems in amaroK.
Can somebody else confirm? (Maybe a problem with beep-media-player?)
Works for me (amarok + libvisual). Not sure about Beep -- not using it, cannot
test.
Amazingly works for me!
Gentoo amd64
Amarok 1.3.6
using projectm-0.97_p5.ebuild with libvisual USE flag
I had to manually fetch projectM-0.97.5.tar.gz from
and put it in the distfiles dir because gentoo mirrors didn't have this(?)
Then I downloaded makeinstall.patch (2005-10-30 13:00 PST) and put it in:
/usr/local/portage/media-plugins/projectm/files/makeinstall.patch
Only then digesting and emerging successfully completed.
Created an attachment (id=87682) [edit]
xmms-projectm-0.98 dependency
Created an attachment (id=87683) [edit]
xmms-projectm-0.98
Created an attachment (id=87684) [edit]
xmms-projectm-0.98 GL_CFLAGS patch
Seems like the structure of the projectM package changed greatly from 0.97 to
0.98 and most of the issues the earlier ebuilds had to address are no longer
present. Only issue I had was with @GL_CFLAGS@ not being resolved and breaking
the build at the compile stage, so I patched it to remove that variable from
Makefile.in and it works for me on x86 with xmms-1.2.10. This was my first
attempt at an ebuild, though, so it may not work for you :-P
libvisual-projectM-0.98 wants >=libvisual-0.40 (bug #131733).
I'll try it later when I have time.
libvisual 0.2 and 0.4 are incompatible (and should be installed in parallel in
different slots - see my comment on bug #131733).
libprojectm-0.98 fails to build on amd64 when linking against ftgl-2.1.2 (which
only builds libftgl.a). It does build fine when using ftgl-2.1.2-r1 (wich does
build libftgl.so*).
Created an attachment (id=93646) [edit]
ebuild for libprojectm-0.99
(From update of attachment 93646 [edit])
The ebuild for libprojectm-0.99. I had to edit libprojectm-0.98.ebuild a bit to
get v0.99 working on amd64.
Created an attachment (id=93647) [edit]
xmms-projectm-0.99.ebuild
Here's the ebuild for xmms-projectm-0.99. Had to do minimal editing to
xmms-projectm-0.98.ebuild to get it working on amd64.
Created an attachment (id=93650) [edit]
libprojectm-0.99.ebuild
cleaned the ebuild up a bit, works with libprojectm-0.99 source code.
Created an attachment (id=93656) [edit]
libprojectm-0.99.ebuild
Sorry for the attachment spam. Just wanted to fix DEPEND/RDEPEND. DEPEND is the
list of packages needed for the building of the main package. RDEPEND is the
list of packages that will be ran by the main package (read: run-time
dependencies). Also RDEPEND defaults to DEPEND, if not specified. The ebuild
howto also warns against stting DEPEND to RDEPEND.
Created an attachment (id=93657) [edit]
xmms-projectm-0.99.ebuild
Same thing with libprojectm-0.99's DEPEND/RDEPEND. Seeing as xmms-projectm-0.99
is now a xmms plugin we should always have xmms in DEPEND.
Created an attachment (id=95573) [edit]
libvisual-projectm-0.99.ebuild
This is the libvisual actor for projectM. I believe this is not the same as the
xmms plugin.
Works great with amarok-1.4.2...
Thanks to everyone, projectm and libvisual-projectm are now in portage. The
xmms plugin is obviously not committed. | http://bugs.gentoo.org/87870 | crawl-002 | refinedweb | 1,110 | 62.75 |
Resolutions
XForms resolutions
(Updated to 2012-09-05)
- 2012-06-20
We will adopt @override, from XSLT 2.0, for function declarations.
- 2012-06-13
Functions go into XForms (2003) namespace
Remove restriction on model from header and var, leave restriction to current model on bind element
Publish FPWD of XForms 2.0 and XPath Expression module
- 2012-06-06
Promote model attribute to common attribute group
- 2012-05-23
In header elem, list binding attrs in common attributes, then remove ref and nodeset from special attributes, then add spec wording to produce binding exceptions if model or bind refer to another model
in bind elem, list binding attrs in common attributes, then remove ref and nodeset from special attributes, then add spec wording to produce binding exceptions if model or bind refer to another model
Add context attribute to the common attributes.
Any XForms element must carry the common attributes.
- 2012-04-11
Allow repeat/itemset and other uses of nodeset to bind to literals (some details still to be worked out, e.g. insert/delete)
When atomic form controls (e.g. input) bind to literals, they behave as readonly
When using bind to bind to a literal, MIPs attached to literal generate a binding exception
- 2012-03-28
We publish as first public working draft for XForms 2.0 these documents:
We move further development of XHTML+XForms Rec-track document ot the community group.
- 2012-03-14
Custom-defined functions get no context item, position, or size, they have access to lexically scoped variables.
- 2012-03-07
In We add script/@type as an optional peer to sequence, which is also optional. The first recognized one in document order is used.
We accept and rename xf:context to either xf:property or xf:param and @select to @ref and possibly @value.
- 2012-02-01
HTTPS is required for XForms 2.0
Even with instance populated from JSON submission response, submission back from that instance still obeys regular submission rules, e.g. post implies application/xml, unless an explicity mediatype attribute is used on submission.
- 2012-01-11
We move forward to publish XForms 2.0 with expression and dialog modules and schemas as FPWD, with a link to Category:XForms20 in the status section.
- 2011-12-21
We add AVT to XForms 2.0 defined in a separate module as equivalent in evaluation to xf:output/@value for host languages. For XForms attributes, we change the column heading for the content model to say that value types are post-AVT evaluation, and we specifically mark attributes that do not participate at their point of definition.
- 2011-12-14
We clarify that immediately after deletion of a node, .. in XPath 2 is () and in XPath 1.0 an empty nodeset.
We clarify a deleted node continues to provide context for the duration of an action that obtained that context prior to deletion, before deferred update.
- 2011-11-16
In test 10.8.f, when you activate the Fire Custom Event trigger you must see a custom-event message. If an implementation has a default action for the custom event you must not see the effect of the default action.
We drop the model/@src proposal in favor of load embedding and await a second implementation to compare.
- 2011-11-02
We change test case XForms Test Suite 1.1 - Test case 2.4.a to add elementFormDefault="qualified"
- 2011-10-12
We add eval-in-context to our eval proposal, but the second parameter is the context node.
- 2011-09-07
valid() of empty nodeset or empty sequence is true.
- 2011-08-31
dialog is a toplevel container form control. It contains an implicit group. Dialog does not have SNB and consequently does not receive MIP bindings.
- 2011-08-30
We deprecate xf:id() function and recommend using the XPath 2.0 id() function when using XPath 2, and that type annotations from xs:id from schemas and type MIP is made available to the XPath 2 id() function.
- 2011-08-29
We change binding for case on switch to @caseref.
In XForms 2.0 xpath-version=1.0 mode the no-namespace XForms functions are also in the xforms: namespace.
We add xf:repeat-ref and xf:repeat-indexref and deprecate xf:repeat-nodeset
We add eval() to XPath function library.
- 2011-07-27
We allow a sequence of foreign elements anywhere we currently allow xforms:extension.
- 2011-07-06
The function extension mechanism will work for XPath 1.0 and 2.0.
- 2011-07-06
We're merging XForms 1.2 and XForms 2.0 so that XForms 1.2 is a profile of XForms 2.0.
- 2011-4-13
RESOLUTION: Add delay attribute to all form controls that support incremental, optional to implement, defining minimal delay in milliseconds with implementation-specific default
- 2011-2-23
RESOLUTION: We drop seconds-from-dateTime which returns epoch in favor of XPath 2.0 function, and use of XPath 2.0 date comparison for the motivating use case
- 2011-1-12
RESOLUTION 2011-01-12.1: We accept the select1 and empty items erratum in
- 2011-1-5
RESOLUTION: We accept the erratum that empty string as matching an empty item in select1 in XForms 1.1.
- 2010-1-1
RESOLUTION: Use the function version of transform
- 2010-9-22
RESOLUTION: For we allow that the lists remain together and you can have stuff before, after, and both.
RESOLUTION: We unresolve to add a pattern MIP to XForms 1.2
- 2010-9-1
RESOLVED: We agree with on XPath 2.0 function signatures.
- 2010-7-14
RESOLUTION: All new XForms functions will only be available in the XForms namespace, all functions that are available in XForms 1.1 will be available in both the default and the XForms namespace
- 2010-6-9
RESOLUTION: For we use @replace='all' with @target on submission rather than making up a new @replace value.
- 2010-4-7
RESOLUTION 2010-04-7.1: Forms WG encourages XForms 1.1 implementers to provide early experimental adoption of "multiple MIP" resolution appearing in
- 2010-3-31
RESOLUTION 2010-03-31.1: In XForms 1.2, the ref attribute always returns a nodeset; we allow the ref attribute everywhere that nodeset is currently used; we deprecate nodeset; if both are present, the ref attribute takes precedence. The consuming element decides what to do with the nodeset.
RESOLUTION 2010-03-31.2: We encourage implementors to experiment with @ref-everywhere now; we encourage authors who wish to experiment to use @ref or @ref plus @nodeset.
RESOLUTION 2010-03-31.3: @xforms:bind and @xforms:ref are allowed as global attributes. They return a nodeset, and the consuming host language decides which additional services of XForms to associate with that nodeset (e.g. UI bindings)
- 2010-3-24
RESOLUTION: For XForms 1.2, we will specify UI events designed for form author use, and will test for coverage and ease of use against use cases, and will separately consider the question of events for custom controls or model-only processors, and will make good-faith efforts not to impede that direction in the future.
- 2010-3-25
RESOLUTION: The current "XForms for HTML" document is renamed to "XForms attributes for HTML".
RESOLUTION: For XForms 1.2, we relax the constraint that only one MIP can apply to a given node. Depending on MIP: type: logical AND; constraint: logical AND; required: logical OR; readonly: logical OR; relevant: logical AND; calculate: "disallow"; p3ptype: "disallow".
RESOLUTION: We deprecate p3ptype in XForms 1.2.
- 2010-3-26
RESOLUTION: The primary use case for JSON with XForms 1.2 is to support interaction with existing data-centric JSON services, not for full-fidelity document-centric XML import/export.
- 2010-3-3
RESOLUTION 2010-03-3.1: For validation and schemas, we keep label first in controls as it's so specified in the XForms 1.1 Recommendation.
RESOLUTION 2010-03-3.2: We plan to investigate relaxing ordering constraints for labels and other elements in XForms 1.2.
- 2010-2-24
RESOLUTION 2010-02-24.1: Dispatching xforms-submit-done and xforms-submit-error after submission/@. | http://www.w3.org/MarkUp/Forms/wiki/Resolutions | CC-MAIN-2016-18 | refinedweb | 1,362 | 56.96 |
Download presentation
Presentation is loading. Please wait.
Published byIan Moseley Modified over 2 years ago
1
Chapter 8: Designing Classes
2
To learn how to choose appropriate classes to implement To understand the concepts of cohesion and coupling To minimize the use of side effects To understand the difference between instance methods and static methods To introduce the concept of static fields To understand the scope rules for local variables and instance fields To learn about packages Chapter Goals
3
A class represents a single concept from the problem domain Name for a class should be a noun that describes the concept Concepts from mathematics: Point Rectangle Ellipse Concepts from real life: BankAccount CashRegister Method names should be verbs. e.g. print, draw, sort,… Choosing Classes
4
Actors (ending in -er, -or) – are objects that do some kinds of work for you. e.g. Scanner Random // better name: RandomNumberGenerator Utility classes – not objects, only static methods and constants Math Program starters: only have a main method Don't turn actions into classes: Paycheck is a better name than ComputePaycheck Choosing Classes
5
What classes would you use for the following problem description: Users place coins in a vending machine and select a product by pushing a button. If the inserted coins are sufficient to cover the purchase price of the product, the product is dispensed and change is given. Otherwise, the inserted coins are returned to the user. Answer: We might wish to make each of the following into classes: User VendingMachine Button Coin Product
6
Your job is to write a program that plays chess. Might ChessBoard be an appropriate class? How about MovePiece ? Answer: ChessBoard would be reasonable, but not MovePiece. Self Check 8.2
7
A class should represent a single concept The public interface of a class is cohesive if all of its features are related to the concept that the class represents;... } This class represents both the concept of a cash register, along with the concept of the value of coins (and these values are specific to North America) Cohesion
8
CashRegister, as described above, involves two concepts: cash register and coin Solution: Make two classes: public class Coin { public Coin(double aValue, String aName) {... } public double getValue() {... }... } public class CashRegister { public void enterPayment(int coinCount, Coin coinType) {... }... } Cohesion
9
A class depends on another if it uses objects of that class CashRegister depends on Coin to determine the value of the payment Coin does not depend on CashRegister High Coupling = many class dependencies Minimize coupling to minimize the impact of interface changes To visualize relationships draw class diagrams UML: Unified Modeling Language. Graphical notation for object-oriented analysis and design Coupling
10
11
High and Low Coupling Between Classes
12
Why does the Coin class not depend on the CashRegister class? Answer: None of the coin operations require the CashRegister class. Self Check 8.4
13
Why should coupling be minimized between classes? Answer: If a class doesn't depend on another, it is not affected by interface changes in the other class. Self Check 8.5
14
Accessor: does not change the state of the implicit parameter double balance = account.getBalance(); Mutator: modifies the object on which it is invoked account.deposit(1000); Immutable class: has no mutator methods (e.g., String ) String name = "John Q. Public"; String uppercased = name.toUpperCase(); // name is not changed It is safe to give out references to objects of immutable classes; no code can modify the object at an unexpected time Accessors, Mutators and Immutable Classes
15
Is the substring method of the String class an accessor or a mutator? Answer: It is an accessor – calling substring doesn't modify the string on which the method is invoked. In fact, all methods of the String class are accessors. Self Check 8.6
16
Is the Rectangle class immutable? Answer: No – translate is a mutator. Self Check 8.7
17
Side effect of a method: any externally observable data modification public void transfer(double amount, BankAccount other) { balance = balance - amount; other.balance = other.balance + amount; // Modifies explicit parameter } Updating explicit parameters can be surprising to programmers; it is best to avoid it if possible Side Effects
18
If a refers to a bank account, then the call a.deposit(100) modifies the bank account object. Is that a side effect? Answer: No – a side effect of a method is any change outside the implicit parameter. Self Check 8.8
19
Consider the DataSet class of Chapter 6. Suppose we add a method void read(Scanner in) { while (in.hasNextDouble()) add(in.nextDouble()); } Does this method have a side effect? Answer: Yes – the method affects the state of the Scanner parameter. Self Check 8.9
20
void transfer(double amount, double otherBalance) { balance = balance - amount; otherBalance = otherBalance + amount; } This will not work! Scenario: double savingsBalance = 1000; harrysChecking.transfer(500, savingsBalance); System.out.println(savingsBalance); When savingsBalance is passed to transfer, its contents (1000) are copied into otherBalance---but they are not copied back In Java, a method can never modify parameters of any primitive type Common Error: Trying to Modify Primitive Type Parameters
21
Call by value: Method parameters are copied into the parameter variables when a method starts This is what Java does Call by reference: Methods can modify parameters Supported by other languages (e.g. C++) but not Java A method can change the state of an object through an object reference parameter, but cannot modify the reference itself Call by Value and Call by Reference
22
public class BankAccount { public void transfer(double amount, BankAccount otherAccount) { balance = balance - amount; double newBalance = otherAccount.balance + amount; otherAccount = new BankAccount(newBalance); // This won't work! } } Call by Value and Call by Reference (cont.)
23
harrysChecking.transfer(500, savingsAccount); Call by Value Example
24
public class BankAccount { public void transfer(double amount, BankAccount otherAccount) { balance = balance - amount; double newBalance = otherAccount.balance + amount; otherAccount.balance = newBalance; // This will work! } } Corrected Version
25
A static method belongs to a class: Is not invoked for a specific object of that class Is invoked by referring to the class name: e.g. Math.sin(0.4);; } } Static Methods
26
Call with class name not object name: double tax = Financial.percentOf(taxRate, total); main is static – it has to be because there are no objects created when the program starts running. It is the job of main to start the process of creating objects. Static Methods (cont.)
27
Suppose Java had no static methods. Then all methods of the Math class would be instance methods. How would you compute the square root of x? Answer: Math m = new Math(); double y = m.sqrt(x); Self Check 8.12
28
Harry turns in his homework assignment, a program that plays tic- tac-toe. His solution consists of a single class with many static methods. Why is this not an object-oriented solution? Answer: In an object-oriented solution, the main method would construct objects of classes Game, Player, and the like. Most methods would be instance methods that depend on the state of these objects. Self Check 8.13
29
A static field belongs to the class, not to any object of the class. Also called class field Assume we wish to create BankAccounts, but we wish the account numbers to be assigned automatically by the constructor. BankAccount accountA = new BankAccount(); // acc. # 1001 BankAccount accountB = new BankAccount(); // acc. # 1002 public class BankAccount {... private double balance; private int accountNumber; private static int lastAssignedNumber = 1000; } If lastAssignedNumber was not static, each instance of BankAccount would have its own value of lastAssignedNumber Static Fields
30
public BankAccount() { // Generates next account number to be assigned lastAssignedNumber++; // Updates the static field // Assigns field to account number of this account accountNumber = lastAssignedNumber; } Static fields have their uses, but they should be used with caution (static final fields are ok) Static Fields (cont.)
31
Three ways to initialize: 1.Do nothing. Field is initialized with 0 (for numbers), false (for boolean values), or null (for objects) 2.Use an explicit initializer, such as public class BankAccount {... private static int lastAssignedNumber = 1000; // Executed once, // when class is loaded 3.Use a static initialization block Static fields should always be declared as private Static Fields
32
Exception: Static constants, which may be either private or public public class BankAccount {... public static final double OVERDRAFT_FEE = 5; } Static Fields (cont.)
33
A Static Field and Instance Fields
34
Name two static fields of the System class. Answer: System.in and System.out. Self Check 8.14
35
Harry tells you that he has found a great way to avoid those pesky objects: Put all code into a single class and declare all methods and fields static. Then main can call the other static methods, and all of them can access the static fields. Will Harry's plan work? Is it a good idea? Answer: Yes, it works. Static methods can access static fields of the same class. But it is a terrible idea. As your programming tasks get more complex, you will want to use objects and classes to organize your programs. Self Check 8.15
Similar presentations
© 2016 SlidePlayer.com Inc. | http://slideplayer.com/slide/2408082/ | CC-MAIN-2016-50 | refinedweb | 1,525 | 56.05 |
I have a piece of server-ish software written in Java to run on Windows and OS X. (It is not running on a server, but just a normal user's PC - something like a torrent client.) I would like the software to signal to the OS to keep the machine awake (prevent it from going into sleep mode) while it is active.
Of course I don't expect there to be a cross platform solution, but I would love to have some very minimal C programs/scripts that my app can spawn to inform the OS to stay awake.
Any ideas?
I use this code to keep my workstation from locking. It's currently only set to move the mouse once every minute, you could easily adjust it though.
It's a hack, not an elegant solution.
import java.awt.*; import java.util.*; public class Hal{ public static void main(String[] args) throws Exception{ Robot hal = new Robot(); Random random = new Random(); while(true){ hal.delay(1000 * 60); int x = random.nextInt() % 640; int y = random.nextInt() % 480; hal.mouseMove(x,y); } } } | https://codedump.io/share/YhB1cm12ZVc6/1/how-do-you-keep-the-machine-awake | CC-MAIN-2017-13 | refinedweb | 183 | 73.07 |
This topic applies to:
Edition
Visual Basic
C#
C++
Web Developer
Express
Standard
Pro and Team
Table legend:
Applies
Does not apply
Command or commands hidden by default.
You can debug an existing SQL CLR stored procedure by using direct database debugging, the same way you would debug a T-SQL procedure. However, that will not work if you need to create or modify a SQL CLR procedure, because you need to compile and deploy it. These steps that do not exist for the T-SQL procedure. In this case, you need to create a SQL Server project in Visual Studio.
The following task creates a new SQL CLR stored procedure in the Adventureworks database, one of the databases installed with SQL Server 2005, and then shows how to debug it. You create a stored procedure that adds a new currency to the Sales.Currency table.
This example focuses on debugging within a SQL Server project. Once you have created the stored procedure, you can debug it using direct database debugging. For more information, see How to: Step into an Object Using Server Explorer.
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose
Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.
In a new SQL Server project, establish a connection to the AdventureWorks sample database. For more information, see How to: Connect to a Database.
Create a new stored procedure using the code from the first example section that follows, and name it InsertCurrency.cs. For more information, see How to: Develop with the SQL Server Project Type.
Add a script that tests the stored procedure by calling it. In Solution Explorer, right-click the TestScripts directory, click Add Test Script, and insert the code from the second Example section that follows. Save the file with the name InsertCurrency.sql. Right-click the file name, and click Set as Default Debug Script.
Set breakpoints in InsertCurrency.cs, and then on the Debug menu, click Start to compile, deploy, and unit-test the project. When the instruction pointer, designated by a yellow arrow, appears on a breakpoint, you are debugging your stored procedure.
Try different debugging features.
Open the Locals window, and on the Debug menu, click Step Into to step one line in the stored procedure. Notice that the value of the variable @mynvarchar has changed in the Locals window and its value is now displayed in red, indicating it has changed. For more information, see Using the Locals Window.
The server may not reflect changes to values of variables in the debugger windows. For more information, see
SQL Debugging Limitations.
Open the Watch window. In the Text Editor, drag the InsertCurrencyCommand variable to any location in the Watch window.
The variable is now added to the list of watched variables. For more information, see How to: Use Debugger Variable Windows.
Note You can edit the values of variables in the Watch window also.
In the Text Editor, right-click the InsertCurrencyCommand.ExecuteNonQuery line, and on the shortcut menu, click Insert Breakpoint.
On the Debug menu, click Continue and the debugger will run the code up to the new breakpoint.
Click Continue again to finish debugging the stored procedure.
A message appears in the Output window stating that the stored procedure was successfully deployed, and displaying the result of executing the commands in the InsertCurrency.sql file.
Replace the stored procedure template with this code.
using System;
using System.Data;
using System.Data.Sql;
using System.Data.SqlServer;
using System.Data.SqlTypes;
public partial class StoredProcedures
{
[SqlProcedure]
public static void InsertCurrency(SqlString currencyCode,
SqlString name)
{
using(SqlConnection conn = new SqlConnection("context connection=true")) {
SqlCommand cmd = new SqlCommand([your SQL statement], conn);
}
InsertCurrencyCommand.CommandText = "insert Sales.Currency"
+ " (CurrencyCode, Name, ModifiedDate) values('"
+ currencyCode.ToString() + "', '"
+ name.ToString() + "', '"
+ DateTime.Now.ToString() + "')";
InsertCurrencyCommand.ExecuteNonQuery();
}
}
This is the test script that is used to execute the stored procedure.
- Delete any row that might exist with a key value
- that matches the one we are going to insert
DELETE Sales.Currency
WHERE CurrencyCode = 'eee'
EXEC InsertCurrency 'eee', 'MyCurr4'
SELECT * FROM Sales.Currency WHERE CurrencyCode = 'eee' | http://msdn.microsoft.com/en-us/library/ms165051.aspx | crawl-002 | refinedweb | 703 | 58.38 |
Identifying Cobalt Strike team servers in the wild by using ZoomEye
by Heige of KnownSec 404 Team 02/27/2019
Yesterday, Fox-it’s blog published an article entitled “Identifying Cobalt Strike team servers in the wild”( ), which showed how they found the Cobalt Strike server in the wild. This is a very exciting job. So I want to do this through ZoomEye ( ).
In the fox-it article we know that “The webserver of the team server in Cobalt Strike is based on NanoHTTPD ( an opensource webserver written in Java. However this webserver unintendedly returns a surplus whitespace ( in all its HTTP responses.”
By testing our local Cobalt Strike webserver , Default access IP:Port, and it return 404 status :
➜ 404team curl -v
* Rebuilt URL to:
* Trying x.x.x.x…
* TCP_NODELAY set
* Connected to x.x.x.x (x.x.x.x) port 8081 (#0)
> GET / HTTP/1.1
> Host: x.x.x.x:8081
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/plain
< Date: Wed, 27 Feb 2019 14:43:19 GMT
< Content-Length: 0
<
* Connection #0 to host x.x.x.x left intact
Xmap is Zoomeye’s core scanning framework, So when Xmap scans the Cobalt Strike webserver, it will also get the banner data of 404 state. In addition, we will finally determine our ZoomEye search dork by observing the order and byte size of these banner data,Of course, we can see this information from the NanoHTTPD code:
And finally got 3,643 results in ZoomEye by this dork:
Of course, I also found the “example of Cobalt Strike team servers” mentioned in the fox-it blog:
That in ZoomEye :
We noticed the difference in the total amount of this data : .” We think ZoomEye uses 404’s banner data that more matching the characteristics of the Cobalt Strike webserver. Because there are others besides Cobalt Strike use NanoHTTPD.
Then we compared the data released by ZoomEye and fox-it ( ), 83% of the ZoomEye data exists in the fox-it data, and this shows that the zoomeye data is valid.
Although we think “extraneous space” is NanoHTTPD’s “bug”, not just the Cobalt Strike. Although Cobalt Strike declares their fix this “extraneous space” problem ,I think maybe this doesn’t matter at all, for the ZoomEye dork we use.
Note: The following work only shows the reliability of our data.
Pocsuite ( is an open-sourced remote vulnerability testing and proof-of-concept development framework developed by the Knownsec 404 Team. It has a very nice function to implement POC verification using ZoomEye’s API function.
Note: Currently using Pocsuite version 2, Pocsuite version 3 will be released soon.
the POC code:
#coding:utf-8
from pocsuite.poc import POCBase,Output
from pocsuite.utils import register
import random
import string
import socket
import ssl
def randomstr():
return random.choice(string.ascii_letters)*5
class TestPOC(POCBase):
name = ‘Cobalt Strike < 3.13 Space Check’
version = ‘1’
vulID = ‘1’
author = [‘dawu’]
vulType = ‘’
references = ‘
desc = ‘’’
‘’’
vulDate = ‘2019–02–26’
createDate = ‘2019–02–27’
updateDate = ‘2019–02–27’
appName = ‘’
appVersion = ‘’
appPowerLink = ‘’
samples = [‘’]
def _attack(self):
‘’’attack mode’’’
return self._verify()
def _verify(self):
‘’’verify mode’’’
result = {}
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
if self.url.startswith(“
ip = self.url.split(“
port = int(self.url.split(“
elif self.url.startswith(“
context = ssl._create_unverified_context()
s = context.wrap_socket(s)
ip = self.url.split(“
port = int(self.url.split(“
else:
return self.parse_output(result)
try:
s.connect((ip,port))
s.send(b”GET / HTTP/1.1\r\n\r\n”)
data = s.recv(1024)
s.close()
except Exception as e:
pass
#print(data)
if b’404 Not Found ‘ in data:
result[‘VerifyInfo’] = {}
result[‘VerifyInfo’][‘URL’] = self.url
return self.parse_output(result)
def parse_output(self,result):
output = Output(self)
if result:
output.success(result)
else:
output.fail(‘Internet nothing returned’)
return output
register(TestPOC)
And the results :
Finally, We found that its 404 state banner data, the order of the http header has been changed:: Wed, 27 Feb 2019 14:30:45 GMT
< Content-Type: text/plain
< Content-Length: 0
<
* Connection #0 to host x.x.x.x left intact
So we may need to update our ZoomEye Dork , It may be relatively troublesome because of the uncertainty of Date.I want to throw this question to the guys who are interested in this matter, good luck!
At the end, We are very grateful to fox-it for working and sharing. thanks to all of the knownsec 404 team, especially to Zhutq and Lul of ZoomEye team. | https://80vul.medium.com/identifying-cobalt-strike-team-servers-in-the-wild-by-using-zoomeye-debf995b6798 | CC-MAIN-2022-21 | refinedweb | 759 | 58.48 |
Hi Arnold, On Sun, Jul 23, 2006 at 10:30:56PM +0300, Aharon Robbins wrote: > The problem with gawk and multibyte locales has come up enough that it's > time to post a patch. This is extracted from my current code base. > It is untested but should do the trick. Thanks for posting this patch. I have a few questions. In node.c:mk_number, you have this patch: @@ -344,11 +341,7 @@ mk_number(AWKNUM x, unsigned int flags) r->stref = 1; r->stptr = NULL; r->stlen = 0; -#if defined MBS_SUPPORT - r->wstptr = NULL; - r->wstlen = 0; - r->flags &= ~WSTRCUR; -#endif /* MBS_SUPPORT */ + free_wsptr(r); #endif /* GAWKDEBUG */ return r; } That seems to be a typo: it should be free_wstr, not free_wsptr (but doesn't really matter because it's inside #ifdef GAWKDEBUG). +/* free_wstr --- release the wide string part of a node */ + +void +free_wstr(NODE *n) +{ + + if ((n->flags & WSTRCUR) != 0) { + assert(n->wstptr != NULL); + free(n->wstptr); + } + n->wstptr = NULL; + n->wstlen = 0; + n->flags &= ~WSTRCUR; +} + I'm wondering about the safety of this function. It seems to me that this implementation would be safer: void free_wstr(NODE *n) { if ((n->flags & WSTRCUR) != 0) { assert(n->wstptr != NULL); free(n->wstptr); n->wstptr = NULL; n->wstlen = 0; n->flags &= ~WSTRCUR; } } My concern here relates to whether it is safe to access the wstptr field of the NODE union in the event that WSTRCUR was not set. As I understand it, the wstptr and wstlen fields of the union are not defined unless the WSTRCUR flag is set. If that flag is not set, then it seems to me that we have no idea whether the wstptr and wstlen parts of the union are actually currently allocated for this purpose, unless we presuppose that this function is never called on a NODE of the incorrect type (that might use the fields for another purpose). For example, as I found in my debugging, I think the exec_count (sub.nodep.reflags) overlaps with wstptr (sub.val.wsp) on 64-bit opteron. So it seems dangerous to me to define free_wstr in such a way that it depends on the type of the NODE argument. But if one takes care to call it only from safe places, then I suppose it's fine. My most serious concern about this patch is how it handles the setting of wstptr strings in field variables. My patch to the bug I found involved this fix to node.c:unref: @@ -508,20 +500,13 @@ unref(register NODE *tmp) return; } free(tmp->stptr); -#if defined MBS_SUPPORT - if (tmp->wstptr != NULL) { - assert((tmp->flags & WSTRCUR) != 0); - free(tmp->wstptr); - } - tmp->flags &= ~WSTRCUR; - tmp->wstptr = NULL; - tmp->wstlen = 0; -#endif + free_wstr(tmp); } freenode(tmp); return; } if ((tmp->flags & FIELD) != 0) { + free_wstr(tmp); freenode(tmp); return; } I see that your patch does not include the latter change in unref (to free the wstr nodes with the FIELD flag set). As a result, I suspect that your patch may leave a memory leak in place. But this is masked by the changes that you made in field.c to add calls to free_wstr in various places. Note that those calls will never actually free anything (because the NODE flags are always set prior to calling free_wstr, and the WSTRCUR is never set, so the free_wstr function merely sets wstptr to NULL). But they do mask out the memory leak, since the non-NULL wstptr that was being passed to unref is now getting nulled out by the calls to free_wstr when the NODE is subsequently allocated from the free list (and thus the assertion is not being triggered). Was there a problem with the free_wstr called I added to unref? That seems to me to be the easiest way to fix the memory leak, although one could take care to do this inside field.c by adding a call to free_wstr prior to each call to unref... When I run valgrind on 3.1.5 plus your patch, I see this: bash-2.05b$ (echo "test"; echo "foo") | LANG=en_US.UTF-8 valgrind --leak-check=full ./gawk '{ if (substr($1,1,1) == substr($0,1,1)) print "substr matches"; sub(/foo/,"bar"); print nr++}' ==28750== Memcheck, a memory error detector for x86-linux. ==28750== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al. ==28750== Using valgrind-2.4.1, a program supervision framework for x86-linux. ==28750== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al. ==28750== For more details, rerun with: -v ==28750== substr matches 0 substr matches 1 ==28750== ==28750== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 15 from 1) ==28750== malloc/free: in use at exit: 17782 bytes in 91 blocks. ==28750== malloc/free: 265 allocs, 174 frees, 61091 bytes allocated. ==28750== For counts of detected errors, rerun with: -v ==28750== searching for pointers to 91 not-freed blocks. ==28750== checked 111856 bytes. ==28750== ==28750== 88 bytes in 4 blocks are definitely lost in loss record 21 of 32 ==28750== at 0x1B903234: malloc (vg_replace_malloc.c:130) ==28750== by 0x806C369: str2wstr (node.c:710) ==28750== by 0x80577BC: do_substr (builtin.c:1387) ==28750== by 0x807A38C: r_tree_eval (eval.c:991) ==28750== by 0x807A47D: r_tree_eval (eval.c:1232) ==28750== by 0x807A98B: eval_condition (eval.c:1355) ==28750== by 0x8078BF3: interpret (eval.c:482) ==28750== by 0x8078BC5: interpret (eval.c:477) ==28750== by 0x8078B34: interpret (eval.c:456) ==28750== by 0x80655DD: do_input (io.c:457) ==28750== by 0x8069C01: main (main.c:595) ==28750== ==28750== LEAK SUMMARY: ==28750== definitely lost: 88 bytes in 4 blocks. ==28750== possibly lost: 0 bytes in 0 blocks. ==28750== still reachable: 17694 bytes in 87 blocks. ==28750== suppressed: 0 bytes in 0 blocks. ==28750== Reachable blocks (those to which a pointer was found) are not shown. ==28750== To see them, rerun with: --show-reachable=yes This seems to confirm that memory is still being leaked. Regards, Andy | http://lists.gnu.org/archive/html/bug-gnu-utils/2006-07/msg00103.html | CC-MAIN-2016-30 | refinedweb | 982 | 73.98 |
The following is my self-adopted policy on each translation unit not implementing a class:
- f() and b() are entry points to this unit. They are called by some other unit(s) and defined here.- f() and b() are entry points to this unit. They are called by some other unit(s) and defined here.Code:#include /*...*/ /* -- declarations ---------- */ void f(); void b(); namespace { void foo(); void bar(); } extern void faz(); extern void baz(); /* -- implementation -------- */ void f() {/*...*/} void b() {/*...*/} namespace { void foo() {/*...*/} int bar() {/*...*/} } /* -- EOF ------------------- */
- foo() and bar() are only called within this unit (possibly from f() or b()).
- faz() and baz() are called in this unit, but defined elsewhere.
This is basically how I structure most of my files. Every function is declared and I make sure everything that can be declared local to the unit, is made so. However I have a few questions:
- If, for some reason, I want to move those declarations to a header file I will have to keep the unnamed namespace in the header file, otherwise the linker will complain. However, I shouldn't be using unnamed namespaces in header files. Is it ok to keep an unnamed namespace in a header file when I know that header file is not going to be included by any other module?
- As I understand, my usage of the extern keyword above is unnecessary. Functions have external linkage by default. However I find it has a documenting quality to it. At just a glance I know those two functions aren't defined in this unit. Is there any downside to this approach, or can I keep it?
- I'm being told some modern(!) debugers depend tremendously on external symbols. I don't see that happening so far on my implementation (mingw with gdb) when I replace the unnamed namespaces by the deprecated static declarations. But still, do unnamed namespaces circumvent this problem on debugers that may experience it? | https://cboard.cprogramming.com/cplusplus-programming/90906-understanding-linkage.html | CC-MAIN-2017-43 | refinedweb | 321 | 73.98 |
Are you testing me?
Unless there is some complicating factor, reading a bar code from a scanner is pretty trivial – just amounts to reading a CR-limited line of text from a serial port. Seems like a few minutes of work to me. Is there more to your application than that?
Should be :
Open COM port
Read string to programmed Symbol EOL char
Display string
Close COM port
I am not using CF2.0 yet but i believe there is a COM port component right? We implemented the Symbol serial scanner in our CF1.0 based POS application and are using the Franson COM component. Works like a charm !
> I want to write an application that runs on
> an embedded device that reads barcodes from
> a connected Symbol barcode scanner and display
> the barcode ‘text’ on a form/dialog/application
Are you going to compare also number of count GUI related lines too?
let’s add a twist here…
This is a USB barcode scanner, the code needs to be generic enough to deal with just about any barcode scanner being plugged into my device, so this shouldn’t matter whether this is an Intermec, HHP, Symbol, or other device – perhaps even a Wireless/USB scanner.
– Mike
oh, and the UI for this is going to be trivial, when you get content from the scanner drop this into a listbox.
– Mike
OK, so please let me subvert the myth of less-code-to-write using .NET :-)))
After a small Googling I can *estimate* that C++ solution will occupy about 2 time less LOC than equivalent written in C#.
Here is a file I found with Google and it’s a piece of C++ code using Symbol’s ScanCAPI. It’s 88 lines long. (Note: the function with strange Java_BarcodeReader_read can be considered as a client function called as a button click handler triggering scan operation).
And here we have *almost* the same but not yet completed code in C# using the same ScanCAPI:
Yes, this is only a P/Invoke wrapper but it’s 174 LOC so I can safely say that it will increase to about 200-210 LOC after you add lines using this wrapper.
Here is a prototype code in C++ + WTL adding barcode buffer data to listbox:
// … get barcode buffer to string
int len = SCNBUF_GETLEN(lpScanBuffer);
WTL::CString str((TCHAR*)SCNBUF_GETDATA(lpScanBuffer));
// attach listbox on dialog box to client var
myList.Attach(IDC_LISTBOX1);
// add string to the listbox
myList.AddString(str);
By the way, talking about language comparison in action, here are results of small competition where you can find the same task implemented in 18 languages:
Unfortunately, the overview is written in polish language only, but I think every programmer can understand source code 🙂
Mateusz, so your solution is going to use about 200 or so lines of C++ code, right ?
I’ve just walked through my C# code and counted the number of lines of code I actually needed to write, beyond the boilerplate code generated by Visual Studio 2005 I added a grande total of….
EIGHT LINES OF CODE to read content from a USB Barcode Scanner…
Very Cool ? – You Bet ! – wanna see the code ? ;O)
– Mike
I do it in 5 lines
private Intermec.Datacollection.BarcodeReader bcr;
bcr = new Intermec.Datacollection.BarcodeReader();
bcr.BarcodeRead +=new BarcodeReadEventHandler(bcr_BarcodeRead);
bcr.ThreadedRead(true);
private void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
{
this.MyTextBox.Text = bre.strDataBuffer;
}
> Mateusz, so your solution is going to use
> about 200 or so lines of C++ code, right ?
Not C++ code but 200 LOC of C# code.
It’s aobut 80 LOC of C++ code.
So, I estimate C++ solution as 2 time shorter than C#.
Ups! Sorry Mike, in my first post I’ve forgot to include the C++ code for reading barcode from scanner.
Here it is:
I think my point is more clear now.
Ronald:
> I do it in 5 lines
I don’t agree.
You omitted code of your Intermec.Datacollection.* stuff which I bet is huge amount of P/Invoke playing code.
Check this:
You have to write .NET CF binding yourself or you can buy it.
Here is C code:
OK, I can C-like API pack into tiny class and the usage will fit in a few lines of code.
ok, when I get to the office I will post my C# code.
Hey, what about supporting a Mag Stripe Reader (MSR) ? (or a two line secondary LCD display) – guess what, each of these are about 8-10 lines of extra code…
More on this in a short while…
– Mike
Mateusz:
>I don’t agree.
>You omitted code of your Intermec.Datacollection.* stuff which I bet is huge amount of P/Invoke playing code.
Yes, and your point is?
Why don’t you add the number of lines in CF.NET as well?
Fact remains.. 5 lines..
I know this is not a barcode, but since we are on the topic i figured i would add the code for reading RFID tags. This is for use with the TradeWind Technologies SDIO RFID reader used in WinCE devices…….
/*************************************************************
**** Read and Write to 15693 RFID Tag *****
**** Using Managed Code and ContactlessONE *****
**** library From *****
*************************************************************/
using C1Lib;
string tag_id="";
string tag_data="";
string data_to_write="this is a test";
read_tag(); //read the tag
write_tag(); //write to the tag
private int read)
}
//got the tag id, now convert into proper display text
for(int i=0;i<C1Lib.ISO_15693.tag.id_length;i++)
tag_id=tag_id+C1Lib.util.hex_value(C1Lib.ISO_15693.tag.tag_id[i]);
//now read the tag!
if(C1Lib.ISO_15693.NET_read_multi_15693(0,C1Lib.ISO_15693.tag.blocks)!=1) {
C1Lib.C1.NET_C1_disable();
C1Lib.C1.NET_C1_close_comm();
return 0;
} //failed to read the tag
//great, we just read the RFID tag, now convert into proper text to display to screen
tag_data=C1Lib.util.to_str(C1Lib.ISO_15693.tag.read_buff,256);
//disable the card and close the port.
C1Lib.C1.NET_C1_disable();
C1Lib.C1.NET_C1_close_comm();
return 1;
}
private int write)
}
byte[] bytes=new byte[256];
bytes=C1Lib.util.to_bytes(data_to_write); //convert the string to write to bytes
//now write to the tag!
if(C1Lib.ISO_15693.NET_write_multi_15693(0,C1Lib.ISO_15693.tag.blocks,bytes)!=1) {
C1Lib.C1.NET_C1_disable();
C1Lib.C1.NET_C1_close_comm();
return 0;
} //failed to read the tag
//disable the card and close the port.
C1Lib.C1.NET_C1_disable();
C1Lib.C1.NET_C1_close_comm();
return 1;
}
Is this a conspiracy or something? 😉
To Read and Write RFID Tags:
private Intermec.DataCollection.RFID.Reader rfid;
private Intermec.DataCollection.RFID.XMLTagReader; xmlTagReader;
rfid.Open("readerName");
string XMLresult = rfid.Command("Read *"); // read everything, using field def. file
xmlTagReader = new XMLTagReader(XMLresult); // parse the Data
if (xmlTagReader.TagCount>0)
{
xmlTagReader.Tags[0].Fields[0].Data ="newdata"; // field 0 on first Tag
rfid.Write(xmlTagReader.CreateDeltaXML()); // write data back
}
rfid.Close();
There! Can we count lines now? 🙂
We have a bar code module in our application (quality control for packaging) and I think we do our bar code stuff in just 4,000 lines of code.
🙂
Ronald:
> Yes, and your point is?
> Why don’t you add the number of lines in CF.NET
> as well?
I did. Read my second comment to Mike’s post.
> Fact remains.. 5 lines..
I don’t get it. Your code is ONLY a client code, but you omitted the code behind the scene…implementation of real job which is hidden in the Intermec.Datacollection.BarcodeReader stuff.
Dan McCarty, what language you mention?
Mateusz Łoskot: Combination of C/C++ running on CE 4.2. The actual reading of the various bar codes and color codes (pharmacode) doesn’t take 4,000 lines of code, but the code that handles the whole process does.
Dan McCarty, thanks I understand it.
I still state this comparison (as I understand the goal is to compare solutions based on C/C++/.NET, isn’t it?) does not makes any sense. I don’t see any result.
PingBack from | https://blogs.msdn.microsoft.com/mikehall/2006/01/26/barcode-capture-in-how-many-lines-of-code/ | CC-MAIN-2017-47 | refinedweb | 1,311 | 65.62 |
Learn more about these different git repos.
Other Git URLs
73428d5
@@ -0,0 +1,39 @@
+ """Adding column to store edited_by and edited_on a commnet
+
+ Revision ID: 15ea3c2cf83d
+ Revises: 21f45b08d882
+ Create Date: 2015-11-09 16:18:47.192088
+ """
+ # revision identifiers, used by Alembic.
+ revision = '15ea3c2cf83d'
+ down_revision = '21f45b08d882'
+ from alembic import op
+ import sqlalchemy as sa
+ def upgrade():
+ op.add_column(
+ 'pull_request_comments',
+ sa.Column(
+ 'editor_id',
+ sa.Integer,
+ sa.ForeignKey('users.id', onupdate='CASCADE'),
+ nullable=True)
+ )
+ 'edited_on',
+ sa.DATETIME,
+ def downgrade():
+ op.drop_column('pull_request_comments', 'editor_id')
+ op.drop_column('pull_request_comments', 'edited_on')
@@ -364,3 +364,11 @@
self.branches.choices = [
(branch, branch) for branch in kwargs['branches']
]
+ class EditCommentForm(wtf.Form):
+ """ Form to verify that comment is not empty
+ """
+ update_comment = wtforms.TextAreaField(
+ 'Comment<span class="error">*</span>',
+ [wtforms.validators.Required()]
@@ -802,6 +802,43 @@
return 'Comment added'
+ def edit_pull_request_comment(session, request, comment, user,
+ updated_comment, requestfolder, redis):
+ '''Edit a comment in the pull request'''
+ user_obj = __get_user(session, user)
+ comment.comment = updated_comment
+ comment.edited_on = datetime.datetime.utcnow()
+ comment.editor = user_obj
+ session.add(comment)
+ # Make sure we won't have SQLAlchemy error before we continue
+ session.flush()
+ pagure.lib.git.update_git(
+ request, repo=request.project, repofolder=requestfolder)
+ pagure.lib.notify.log(
+ request.project,
+ topic='pull-request.comment.edited',
+ msg=dict(
+ pullrequest=request.to_json(public=True),
+ agent=user_obj.username,
+ )
+ if redis:
+ redis.publish(request.uid, json.dumps({
+ 'request_id': len(request.comments),
+ 'comment_updated': text2markdown(comment.comment),
+ 'comment_id': comment.id,
+ 'comment_editor': user_obj.user,
+ 'avatar_url': avatar_url(comment.user.user, size=16),
+ 'comment_date': comment.date_created.strftime('%Y-%m-%d %H:%M'),
+ }))
+ return "Comment updated"
def add_pull_request_flag(session, request, username, percent, comment, url,
uid, user, requestfolder):
''' Add a flag to a pull-request. '''
@@ -928,6 +928,15 @@
date_created = sa.Column(sa.DateTime, nullable=False,
default=datetime.datetime.utcnow)
+ editor_id = sa.Column(
+ sa.Integer,
+ sa.ForeignKey('users.id', onupdate='CASCADE'),
+ nullable=True)
+ editor = relation('User', foreign_keys=[editor_id],
+ remote_side=[User.id])
+ edited_on = sa.Column(sa.DATETIME, nullable=True)
user = relation('User', foreign_keys=[user_id],
remote_side=[User.id],
@@ -74,12 +74,25 @@
<a class="headerlink" title="Permalink to this headline"
href="#comment-{{ id }}">¶</a>
<aside class="issue_action icon">
+ {% if comment.edited_on %}
+ <span title="{{
+ comment.updated_info
+ }}">Edited by {{ comment.editor.username }} {{ comment.edited_on | humanize }}</span>
+ {% endif %}
<a class="reply" title="Reply to this comment - loose formating">
reply
</a>
{% if id != 0 and g.fas_user and (
(comment.parent.status in [True, 'Open'] and g.fas_user.username == comment.user.username)
or repo_admin) %}
+ <a href="{{ url_for(
+ 'pull_request_edit_comment', username=username, repo=repo.name,
+ requestid=issueid, commentid=comment.id)}}" >
+ <span class="icon icon-edit blue"></span>
+ </a>
<button type="submit" name="drop_comment" value="{{ comment.id }}"
onclick="return confirm('Do you really want to remove this comment?');"
title="Remove comment">
@@ -0,0 +1,25 @@
+ {% extends "repo_master.html" %}
+ {% block repo %}
+ <section class="request_comment add_comment">
+ <form action="{{ url_for(
+ 'pull_request_edit_comment', username=username, repo=repo.name,
+ requestid=requestid, commentid=comment.id) }}" method="post">
+ <div class="tabs ui-widget ui-widget-content ui-corner-all" id="comment_block">
+ <div id="edit">
+ <textarea id="update_comment" name="update_comment">{{ comment.comment }}</textarea>
+ </div>
+ <div>
+
+ {{ form.csrf_token }}
+ <div>
+ <input type="submit" class="submit positive button" value="Update">
+ <input type="button" class="cancel" value="Cancel" onclick="location.href='{{ url_for(
+ 'request_pull', username=username, repo=repo.name, requestid=requestid) }}'"/>
+ </div>
+ </form>
+ </section>
+ {% endblock %}
@@ -10,6 +10,7 @@
import flask
import os
+ import datetime
import pygit2
from sqlalchemy.exc import SQLAlchemyError
@@ -368,11 +369,10 @@
flask.abort(400, 'Pull-request is already closed')
if not is_repo_admin(repo) \
- or flask.g.fas_user.username != request.user.username :
+ or flask.g.fas_user.username != request.user.username:
flask.abort(403, 'You are not allowed to edit this pull-request')
form = pagure.forms.RequestPullForm()
-
if form.validate_on_submit():
request.title = form.title.data
SESSION.add(request)
@@ -540,6 +540,77 @@
repo=repo.name, requestid=requestid))
+ @APP.route('/<repo>/pull-request/<int:requestid>/comment/<int:commentid>/edit',
+ methods=('GET', 'POST'))
+ @APP.route('/fork/<username>/<repo>/pull-request/<int:requestid>/comment'
+ '/<int:commentid>/edit', methods=('GET', 'POST'))
+ @cla_required
+ def pull_request_edit_comment(repo, requestid, commentid, username=None):
+ """Edit comment of a pull request
+ project = pagure.lib.get_project(SESSION, repo, user=username)
+ if not project:
+ flask.abort(404, 'Project not found')
+ if not project.settings.get('pull_requests', True):
+ flask.abort(404, 'No pull-requests found for this project')
+ request = pagure.lib.search_pull_requests(
+ SESSION, project_id=project.id, requestid=requestid)
+ if not request:
+ flask.abort(404, 'Pull-request not found')
+ comment = pagure.lib.get_request_comment(
+ SESSION, request.uid, commentid)
+ if comment is None or comment.pull_request.project != project:
+ flask.abort(404, 'Comment not found')
+ if (flask.g.fas_user.username != comment.user.username
+ or comment.parent.status is False) \
+ and not is_repo_admin(project):
+ flask.abort(403,
+ "You are not allowed to edit the comment")
+ form = pagure.forms.EditCommentForm()
+ if form.validate_on_submit():
+ updated_comment = form.update_comment.data
+ try:
+ message = pagure.lib.edit_pull_request_comment(
+ SESSION,
+ request=request,
+ comment=comment,
+ user=flask.g.fas_user.username,
+ updated_comment=updated_comment,
+ requestfolder=APP.config['REQUESTS_FOLDER'],
+ redis=REDIS,
+ )
+ SESSION.commit()
+ flask.flash(message)
+ except SQLAlchemyError, err: # pragma: no cover
+ SESSION.rollback()
+ LOG.error(err)
+ flask.flash(
+ 'Could not edit the comment: %s' % commentid, 'error')
+ return flask.redirect(flask.url_for(
+ 'request_pull', username=username,
+ repo=project.name, requestid=requestid))
+ return flask.render_template(
+ 'pull_request_comment_update.html',
+ select='requests',
+ requestid=requestid,
+ repo=project,
+ username=username,
+ form=form,
+ comment=comment
@APP.route('/<repo>/pull-request/<int:requestid>/merge', methods=['POST'])
@APP.route('/fork/<username>/<repo>/pull-request/<int:requestid>/merge',
methods=['POST'])
@@ -1529,6 +1529,93 @@
follow_redirects=True)
self.assertEqual(output.status_code, 404)
+ @patch('pagure.lib.notify.send_email')
+ def test_pull_request_edit_comment(self, send_email):
+ """ Test the pull request edit comment endpoint """
+ send_email.return_value = True
+ self.test_request_pull()
+ user = tests.FakeUser()
+ user.username = 'pingou'
+ with tests.user_set(pagure.APP, user):
+ # Repo 'foo' does not exist so it is verifying that condition
+ output = self.app.post('/foo/pull-request/1/comment/1/edit')
+ self.assertEqual(output.status_code, 404)
+ # Here no comment is present in the PR so its verifying that condition
+ output = self.app.post('/test/pull-request/100/comment/100/edit')
+ output = self.app.post('/test/pull-request/1/comment')
+ self.assertEqual(output.status_code, 200)
+ # Creating comment to play with
+ self.assertTrue(
+ output.data.startswith('<section class="add_comment">'))
+ csrf_token = output.data.split(
+ 'name="csrf_token" type="hidden" value="')[1].split('">')[0]
+ data = {
+ 'csrf_token': csrf_token,
+ 'comment': 'This look alright but we can do better',
+ }
+ output = self.app.post(
+ '/test/pull-request/1/comment', data=data,
+ follow_redirects=True)
+ self.assertIn(
+ '<title>PR#1: PR from the feature branch - test - '
+ 'Pagure</title>', output.data)
+ '<li class="message">Comment added</li>', output.data)
+ # Check if the comment is there
+ '<p>This look alright but we can do better</p>', output.data)
+ output = self.app.get('/test/pull-request/1/comment/1/edit')
+ self.assertIn('<section class="request_comment add_comment">', output.data)
+ # Checking if the comment is there in the update page
+ 'This look alright but we can do better</textarea>', output.data)
+ 'update_comment': 'This look alright but we can do better than this.',
+ '/test/pull-request/1/comment/1/edit', data=data,
+ # Checking if the comment is updated in the main page
+ '<p>This look alright but we can do better than this.</p>', output.data)
+ # Checking if Edited by User is there or not
+ '<span title="">Edited by pingou just now</span>', output.data)
+ '<li class="message">Comment updated</li>', output.data)
+ # Project w/o pull-request
+ repo = pagure.lib.get_project(self.session, 'test')
+ settings = repo.settings
+ settings['pull_requests'] = False
+ repo.settings = settings
+ self.session.add(repo)
+ self.session.commit()
+ '/test/pull-request/1/comment/edit/1', data=data,
if __name__ == '__main__':
SUITE = unittest.TestLoader().loadTestsFromTestCase(PagureFlaskForktests)
What happens if comment is None?
This is odd, on the first link we're sending the comment.id as part of the form, on the second page as part of the URL, I think we can do better
comment.id
Why these two lines if there was a check before?
The name of the file is misleading, as this seems to be for editing the comment?
This is either create or edit of a comment, not drop.
You need to put this before the submit button.
It looks like this form is for editing comments.
You should edit the title in that case.
We don't want any GET requests to drop.
This is NOT the right function to be adding editing functionality.
You should add a new entry point for editing if you want that, and not overload the drop endpoint.
Comment in-line.
Basically:
1. You should not reuse existing endpoints (drop) for new functionality: add new endpoints.
2. You should probably implement in-line editing. The separate comment for is a very bad user experience.
Final remark: I do NOT like the possibility of editing comments.
Especially not given the fact that we send emails for every comment, and the fact that you can reply from just the email.
Reasoning: one of the following two things happen when editing a comment:
We send another email with the edited comment. In this case, allowing edits will make people check their comments less before posting, encourage editing, and as such spam people a lot more, and making the person replying unable to see what the last version is.
We do not send another email with the edited comment. In this case, someone might respond by email to a comment that has already been edited, which may lead to some bad results.
For these exact reasons I do not like deleting of comments either, but well...
We need to catch the exception here in case writing to the DB doesn't work and we'll need to log that exception to warn the admins something is wrong with the DB.
Something we could do here, is check that the request is a POST and not a GET.
You should configure your IDE to remove spaces from empty lines
You should not reuse existing endpoints (drop) for new functionality: add new endpoints.
In theory I agree but in this case we cannot as the buttons are both in the same (html) form and we can't embed a form in another one.
What I'll like to ask @farhaan though is to split the two use-case of this endpoint into two methods to make it clearer.
You should probably implement in-line editing. The separate comment for is a very bad user experience.
I agree on this as well, but one step at a time :)
Isn't the validated version of this available in form.update_comment or something like that?
(which means that if you have your validators set correctly, you can also get rid of this check).
Remove the space after repo=
Why do you do this and not a new form so that you can have all validation done in the form?
After all comments are handled, please squash commits that don't show up anymore.
Indentation is wrong here :)
Also note that there should be no spaces around operators.
The id attribute on this should not be the comment ID, but an ID that javascript could use to refer to it.
I would say to use update_comment here as well.
I think you should remove this print statement :)
This should be before the if validate.
This too should be checked before form valdiate, so that people don't see the form for comments tehy aren't allowed to touch.
This version of onclick is probably not the best.
Especially if we want to integrate this into in-line editing, this will break horribly.
Note that for this version of the PR, it will work.
But just noting it for when you add in-line editing.
This line breaking is not per PEP8.
Actually, it is, but my browser had a horrible time displaying it.
Just ignore the previous comment.
We might want to record the last edit of the comment in the database?
That way, we could display a "This comment was edited at X by Y" meta-comment, allowing people to see why a comment and its replies might not be the same.
Note that while I don't think you need to add the text itself to the template (although that should be really easy), we should add the database field and make the edit in this PR, since making database changes is a complicated process.
Note that when the "This comment was edited" is implemented, that would resolve a lot of my complaints against enabling editing.
Especially if it is also possible to enable/disable editing on a per-project level, I would be fine with adding the feature.
The title seems odd, maybe we could be either shorter: Comment or more explicit Comment to update
Comment
Comment to update
Note: here we know the comment, so we know the PR/issue on which it was made so we can figure out where to go back if you want to cancel your edit
sa.Text is great for postgresql, but breaks for MySQL, could we use another column type?
sa.Text
(I recently had to adjust pagure to work on MySQL, so I'd like to keep this compatibility a little :))
Trailing space
on
Maybe comment why it's returning a 404 here ?
Doing a POST request here?
Do we have the old content on this page?
And the comment, is it in the page?
Do we have the new content on the page or the old one?
Should we keep the indentation consistent (2 spaces) ?
You need to use the {{ url_for() }} construct here, otherwise if you deploy pagure at the url will break
{{ url_for() }}
Already there and do we want to send an email when a comment is edited?
What is form? What does it mean? What does it contain?
All you use it for is to get the comment, so drop the un-clear/un-defined object and give the comment directly
I think we should check here if the user editing the comment is allowed to do it, and if not, raise an exception.
Was the comment added?
You're passing both the comment and the commentid, isn't one enough?
I am still not a big fan of the title of this field
We already retrieved the comment in the controller, so we're doing two queries against the DB.
Either we should do it here or in the controller, but doing two queries to retrieve the same info doesn't sound like a good idea.
Missing a space maybe?
This is the wrong one!
Your should use something like comment_changed.
Also, you should add a field comment_id so that the UI knows which comment to update.
How about issue.comment.edited to stay in the theme?
The other code paths do fedmsg publishing first and then redis, so that fedmsg happens even if something goes wrong with redis.
Why is this a string?
Just use a remote reference to the users.user_id table, just like the user = relation just a few lines beneath.
PEP8
This is a project, not a repo.
repo != project, since one project has several repos.
How about testing the the updated_by string was set correctly?
If the field is editor_id maybe the relation should be editor?
editor_id
editor
Missing a space between 'request_pull' and 'username'
There should be a space between your # and your comment :)
#
This should be 'pull-request.comment.edited' to stay in sync with the rest of the code.
Since you have editor = Relation, you should be able to say comment.editor = user_obj.
space missing.
In this instance, you did not change the name of the variable.
I don't agree that admins should be able to change other users' comments. But that's up for @pingou.
You can get rid of this line
Please add line breaks.
This should probably be user_obj.user, and renamed to comment_updated_by, or something, so that hte UI can actually show who updated the comment rather than who posted it originally.
This looks like a strange name for a template.
How about pull_request_comment_update.html or something?
If you could squash the commits and tests pass, I think we can merge to the editing branch.
Ok merging this PR manually into the editing branch | https://pagure.io/pagure/pull-request/450 | CC-MAIN-2022-21 | refinedweb | 2,664 | 52.76 |
Problem
You have a number of instances of a standard container (lists, sets, etc.), and you want to keep track of them by storing them in yet another container.
Solution
Store pointers to your containers in a single, master container. For example, you can use a map to store a string key and a pointer to a set as its value. Example 6-12 presents a simple transaction log class that stores its data as a map of string-set pointer pairs.
Example 6-12. Storing set pointers in a map
#include #include #include #include using namespace std; typedef set SetStr; typedef map MapStrSetStr; // Dummy database class class DBConn { public: void beginTxn( ) {} void endTxn( ) {} void execSql(string& sql) {} }; class SimpleTxnLog { public: SimpleTxnLog( ) {} ~SimpleTxnLog( ) {purge( );} // Add an SQL statement to the list void addTxn(const string& id, const string& sql) { SetStr* pSet = log_[id]; // This creates the entry for if (pSet == NULL) { // this id if it isn't there pSet = new SetStr( ); log_[id] = pSet; } pSet->insert(sql); } // Apply the SQL statements to the database, one transaction // at a time void apply( ) { for (MapStrSetStr::iterator p = log_.begin( ); p != log_.end( ); ++p) { conn_->beginTxn( ); // Remember that a map iterator actually refers to an object // of pair. The set pointer is stored in p->second. for (SetStr::iterator pSql = p->second->begin( ); pSql != p->second->end( ); ++pSql) { string s = *pSql; conn_->execSql(s); cout << "Executing SQL: " << s << endl; } conn_->endTxn( ); delete p->second; } log_.clear( ); } void purge( ) { for (MapStrSetStr::iterator p = log_.begin( ); p != log_.end( ); ++p) delete p->second; log_.clear( ); } // ... private: MapStrSetStr log_; DBConn* conn_; };
Discussion
Example 6-12 offers one situation where you might need to store containers within a container. Imagine that you need to store a series of SQL statements in batches, to be executed against a relational database all at once sometime in the future. That's what SimpleTxnLog does. It could stand to have a few more member functions to make it useful, and some exception handling to make it safe, but the purpose of the example is to show how to store one kind of container in another.
To begin with, I created some typedefs to make the code easier to read:
typedef std::set SetStr; typedef std::map MapStrSetStr;
When you are using templates of templates (of templates . . . ad nauseam), the declarations will get very long, which makes them hard to read, so make your life easier by employing typedef. Furthermore, using typedef makes it easier to change something about the template declaration without having to search and replace through multiple source files.
The DBConn class is a dummy class that is supposed to represent a connection to a relational database. The interesting part comes when we get into the definition of SimpleTxnLog, in the addTxn member function. At the beginning of the function, I do this to see if there is already a set object for the id that was passed in:
SetStr* pSet = log_[id];
log_ is a map (see Recipe 6.6), so operator[] does a lookup of id to see if there is a data object associated with it. If there is, the data object is returned and pSet is non-NULL; if there isn't, it creates it and returns the associated pointer, which will be NULL. Then, I can check to see if pSet points to anything to determine if I need to create another set:
if (pSet == NULL) { pSet = new SetStr( ); // SetStr = std::set log_[id] = pSet; }
Once I create the set, I have to assign it back to the associated key in the map, since pSet is a copy of the data object stored in the map (a set pointer), not the value itself. Once I do that, all that's left is to add an element to the set and return:
pSet->insert(sql);
With the above steps, I added a pointer to an address of one container (a set) to another (a map). What I didn't do was add a set object to a map. The difference is important. Since containers have copy-in, copy-out semantics, doing the following would copy the entire set s into the map:
set s; // Load up s with data... log_[id] = s; // Copy s and add the copy to log_
This will cause a lot of extra copying that you probably don't want. Therefore, the general rule to follow when using containers of containers is to use containers of pointers to containers.
Building C++ Applications
Code Organization
Numbers
Strings and Text
Dates and Times
Managing Data with Containers
Algorithms
Classes
Exceptions and Safety
Streams and Files
Science and Mathematics
Multithreading
Internationalization
XML
Miscellaneous
Index | https://flylib.com/books/en/2.131.1/storing_containers_in_containers.html | CC-MAIN-2019-47 | refinedweb | 780 | 56.69 |
#include <Encoder.h>Encoder enc_one(2, 3);int value; long enc_one_previous = -999;byte button_previous; void setup() { pinMode(23, INPUT_PULLUP); }void loop() { value = enc_one.read(); if(value > 127) { enc_one.write(127); } else if(value < 0) { enc_one.write(0); } value = constrain(value, 0, 127); if (value != enc_one_previous) { enc_one_previous = value; usbMIDI.sendControlChange(1, value, 1); } value = digitalRead(23); if(value != button_previous) { button_previous = value; usbMIDI.sendControlChange(2, (1 - value) * 127, 1); delay(3); }}
#include <MIDI_controller.h>const static byte Channel = 1;const static byte Controller = 0x14;RotaryEncoder enc(2,3,Controller,Channel,1,JOG,POS1_NEG127); // Create a new member of the class 'RotaryEncoder', called 'enc', on pin 2 and 3, controller number 0x14, on channel1, no change in speed (speed is multiplied by 1), it's used as a Jog wheel, and the mode is set to POS1_NEG127.void setup(){ setupMidi(13, 10); // Setup the MIDI communication, with an LED on pin 13, and a delay of 10ms after every message.}void loop(){ enc.refresh();}
C:\Users\...\Documents\Arduino\libraries\MIDI_controller\Analog.cpp: In constructor 'Analog::Analog(byte, byte, byte, byte)':C:\Users\...\Documents\Arduino\libraries\MIDI_controller\Analog.cpp:11:6: error: 'dPin' was not declared in this scope if(dPin < A0 || dPin > A5){ //If the user enters an invalid pin number. ^exit status 1Error compiling for board Arduino/Genuino Uno.
Excuse me, but now I can not find the MIDI_controller.zip website. Can you help that I download from?Thanks!
RotaryEncoder enc(2,3,Controller,Channel,1,JOG,POS1_NEG127); // corresponds to Traktor encoder mode "7Fh/01h"RotaryEncoder enc(2,3,Controller,Channel,1,JOG,ADD_64); // corresponds to Traktor encoder mode "3Fh/41h"
ADD_64First mode for relative MIDI messages. This is probably the simplest one. This basically maps 0 to 64 (which is 128/2). For example, if I want to send -1, I add 64, = 63 and I send it. If I want to send +1, I also add 64, = 65. If I just send 64, the computer will do nothing, because it knows it's a displacement of 0. (On the computer side, they just subtract 64, and you can use the result like nothing ever happened.)SIGN_BITSecond mode for relative MIDI messages. On computers, signed values are mostly saved with a sign bit. The sign bit is the most significant bit. When it's 0, the number defined by the other bits is positive, when it's 1, the number is negative. In a MIDI message, this is bit 6 (the 7th bit, since it's 0 based). For example: +4 would be 0b00000100, and -4 would be 0b01000100.POS1_NEG127Third mode for relative MIDI messages. Define +1 as 1, and -1 as 127. We can continue this: +2 = 2, and -2 = 126, etc. until +63 = 63, and -63 = 65.
RotaryEncoder enc(2,3,Controller,Channel,1,NORMAL_ENCODER,POS1_NEG127);
RotaryEncoder(byte pin1, byte pin2, byte controller, byte channel, int speedMultiply, byte pulsesPerStep, byte mode);pulsesPerStep is the number of pulses the encoder outputs when you turn it one step or click. On a normal rotary encoder, this is 4. When you set it to 4, it will change 1 unit in your software per click you turn, instead of 4. This is mostly more logical. For jog wheels however, you may want to set it to 1, to take advantage of the full resolution of the wheel. Use 'NORMAL_ENCODER' or 'JOG' as argument.[...]NORMAL_ENCODERset pulsesPerStep to 4, for normal rotary encoders.JOGset pulsesPerStep to 1, for jog wheels. | https://forum.arduino.cc/index.php?topic=428843.msg2957635 | CC-MAIN-2019-47 | refinedweb | 576 | 59.6 |
#include <StepData_FileRecognizer.hxx>
Assumes that no result has yet been recognized.
Adds a new Recognizer to the Compound, at the end Several calls to Add work by adding in the order of calls : Hence, when Eval has failed to recognize, Evaluate will call Evaluate from the first added Recognizer if there is one, and to the second if there is still no result, and so on.
THIS METHOD DEFINES THE RECOGNITION PROTOCOL, it is proper to each precise type of Recognizer For a suitable type of akey, it calls SetOK(result) where result is an empty result of appropriate type, then returns.
Evaluates if recognition has a result, returns it if yes In case of success, Returns True and puts result in "res" In case of Failure, simply Returns False Works by calling deferred method Eval, and in case of failure, looks for Added Recognizers to work.
Returns result of last recognition (call of Evaluate)
Records that recognition gives no result.
Records the result of the recognition. Called by specific method Eval to record a result : after calling it, Eval has finished and can return. | https://dev.opencascade.org/doc/refman/html/class_step_data___file_recognizer.html | CC-MAIN-2022-27 | refinedweb | 185 | 53.44 |
I try to calculate Sidereal Time using TimeLord Library - no luck.
I did - sunrise, sunset, moonphase, season, dayoftheweek and another options, but can't get Sidereal Time.
Can somebody give few lines of code to get this calculation work.
I did try follow TimeLord h and cpp file and also:
Time Lord Library (instructables.com)
All works fine - except Sidereal time
Thx in advance
I try to calculate Sidereal Time using TimeLord Library - no luck.
Post the code, using code tags, and explain what went wrong.
Hint: Instructables is one of the last places I would look for reliable information. Most of the entries are posted by people who have little to no idea what they are doing, and there is no quality control whatsoever.
Edit:
A quick test seems to give the expected answer.
#include <TimeLord.h> // set longitude (west values negative) and latitude (south values negative) float lon = -123.0; float lat = 44.00; void setup() { Serial.begin (9600); TimeLord here; here.TimeZone(-8 * 60); // timezone in minutes from UTC here.Position(lat, lon); // set location uint8_t today[] = { 0, 32, 20, 9, 12, 21 }; // store today's date and time (format SS, MM, HH, DD, MM, YY) Serial.print(" local time/date: "); for (int i = 0; i < 6; i++) { Serial.print(today[i]); Serial.print(", "); } Serial.println(); /* Serial.print("GMT time/date: "); here.GMT(today); for (int i = 0; i < 6; i++) { Serial.print(today[i]); Serial.print(", "); } Serial.println(); */ Serial.print("Sidereal time/date: "); here.Sidereal(today, true); //true=local for (int i = 0; i < 6; i++) { Serial.print(today[i]); Serial.print(", "); } Serial.println(); } void loop() { }
The PDF file which is referred to by the link in the OP, and now included here, contains some typing errors which have been spread throughout that document by copy paste editing and could be confusing.
TimeLord Arduino Library.pdf (90.6 KB)
Here is one of many examples (corrected):
// what time does the sun rise on Xmas day of 2009, in Southwest Florida? TimeLord myLord; myLord.Position(26.9, -81.8) // set position to SouthWest Florida // byte sunRise = {0, 0, 0, 25, 12, 9); // bad line byte sunRise[ 6 ] = {0, 0, 0, 25, 12, 9}; // correction myLord.SunRise(sunRise) ;
I think, nevertheless, that the document could be useful for users of the TimeLord library which itself can now be found here: GitHub - probonopd/TimeLord: Arduino library with many time and date related functions... Daylight Savings, Moon Phase, Sidereal time, with the SunRise library rolled in.. The person who wrote it appears to have had at least some understanding of the library.
And a bit of history of the TimeLord development can be found here: What happened to...
I use the library myself in a time switch project.
Thank You very much for your help. Your code suggestion works perfectly fine. I didn't understand h file correctly - I'm still on very steep learning curve.
Once again - thank you.
Thank you very much for pointing me to error and more sources. | https://forum.arduino.cc/t/timelord-library-question/934187 | CC-MAIN-2022-05 | refinedweb | 502 | 66.84 |
- Chinese translation by Wei Gao
I’ve been using E4X in ActionScript 3.0 for a while now and the rumors of its simplicity have been greatly exaggerated. A lot of operations are easy and make sense, but others are less… obvious. E4X is essentially a whole new language which is part of the AS3 grammar, just as regular expressions have their own completely different language but exist within ActionScript 3.0. And being so new, there really isn’t a whole lot of documentation out there. This is further complicated by the fact that since E4X seems simple enough at first glance to explain in a few lines, a lot of documentation stops short.
Anyway. I’ve been infuriated by E4X more than a few times now, and I’d like to start a running post to demystify some of it. Please! use the comments to ask any questions you might have, and I’ll keep adding to this post. Hopefully this can turn into a decent resource for E4X lore. The fun begins after the cut..person!
E4X: Beginner to Advanced, another great E4X article by Josh Tynjala @ Yahoo!
Sorry if I missed this in here if someone already pointed out a technique.
What would be the best approach for swapping positions of nodes in an xmllist?….?
Is TTS Engine(Text-To-Speech),an inbuilt feature of AS3
@allika
TTS is NOT a built-in feature of AS3. If anyone knows of a TTS implementation, let us know!:
YAY! i was actually getting close and you just tidy up the loose ends and now it all makes sense!
Thank you so much!!!.
You are so right. Most E4X examples are poor.
Hi,
thanks so much for such detail rundown! even a beginner like me feel more comfortable using E4X.
I have a question though. I would like to build something like tagCloud. So each tag1tag2> will be tagged with few labels. some labels will be repeated. I asked around, and someone mentioned XPATH in as 2.0. I check with many sites and help document didn’t find anything specific to distinct the result of allTags = xxx.*.tag
I think of one solution to put the result into an array, and check if the tag has been saved, if it is, then mark the usage times +1.
however i am still wondering if there’s an easier way to deal with it directly with E4X.
thank you for your help. :)
sorry, my xml was eaten in the comment, in case you don’t understand where the tag1tag2> came from. XD
An interesting pitfall on XML and AS3:
Hi,
Do not declare any “any” prototype property to Object class or XML and XMLList classes will mulfunction.
Example: (on any as file linked to your swf)
// an unnecessary function
Object.prototype.checkName = function(): Boolean {
return(this.name == ‘Roger’);
}
// this will make attribute (@) access impossible.
Yep, this cleaves the children but leaves
delete thePeople.person.(@name == "Roger Braunstein").*;
When I tried to completely destroy Roger (I mean the node :) )
This kicked me with a weird error:
delete thePeople.person.(@name == "Roger Braunstein");
but this worked perfectly :
delete thePeople.person.(@name == "Roger Braunstein")[0];
hope this helps…
[...] AS3 E4X Rundown – a good E4X reference/refresher [...]
Tnk´s, Roger …
Excellent article.
Hey, I was curious about some filtering things. How would you pick out an element based on the contents and/or attributes of one of its descendants?
I wanted to do something like
xml.item.( props.prop.attribute( “att” ) == “bar” )
but that doesn’t work. When I trace the test results, it prints a false for each .
Is the only way to use a loop EG for each? Why doesn’t the way I tried work? Should it? (From a theoretical or wistful point of view, that is.)
[...] AS3 E4X Rundown [...]
Hello guys,
It’s works fine:
thePeople.person.(age >= 21)
But, for selection of AKA node???
thePeople.person.(aka == “Rog”)
It’s dont work… any idea?
Kleber, there’s two problems here. First, you’re comparing an XMLList to an int, and to a String. Rather than trust AS3 to convert these automatically, you should probably compare the text inside the node:
thePeople.person.(parseInt(age.text()) >= 21)
and
thePeople.person.(aka.text().toString() == "Rog")
However, the person nodes have more than one aka node. So even if you query aka children from a single person node such as rogerNode.aka, you’ll actually get an XMLList with two entries. rogerNode.aka.text() will be an XMLList with two text nodes, and calling toString() on this concatenates them: “RogThat Guy”.
In this case, since there’s multiple aka nodes that you’re searching in, you’d be better off finding the right one of those, and then traveling back up to its parent. Let’s find the right aka node:
thePeople.person.aka.(text().toString() == "Rog")
This should find us all the aka nodes that contain the text “Rog”. Now all we have to do is step back up to see who owns that aka node. Because of the way we constructed our query, we know that its parent will be a person node: we specified the type of the nodes all the way down: thePeople, person, aka.
var foundPerson:XML = thePeople.person.aka.(text().toString() == "Rog")[0].parent();
Note here we specified we’re happy to find the first person who has an aka of “Rog”. And, when we grab its parent, that’s going to be an XML node and not and XMLList.
One final word; I’m being this verbose in order to be pedantic. As you found out, ActionScript will often convert variables to the right thing when you need to compare them. So I could have written
thePeople.person.aka(text() == "Rog")[0].parent()
or, I could get really lazy and type:
thePeople..aka(text() == "Rog")[0].parent()
I think that’s as simple as you can make this particular query, though.
[...] [...]
Hi Roger,
Thanks for the article, any idea how to dynamically set a value within a CDATA tag of an XML literal? Is this possible? I’ve tried this,
where _value is the variable i want to set the value of the CDATA tag too, but it returns
Any idea’s?
cheers.
sorry, this is my xml
<myXML><![CDATA[{_value}]]></myXML>
I think e4x in flex is only easy for developers after they’ve learned it. I was having great difficulty learning to do what I needed to do because the official docs are inadequate.
Reading your post finally got me over the learning curve. Your comparisons of shortcuts to the equivalent method calls gave me the info I needed to solve my problem.
Thanks and keep up the good work!
thePeople.length() // 1
I am new to Flex and e4x and have been struggling for weeks to find the right way to filter my xml based on two variables, that are set by two comboBox.
One comboBox defines the language the user wants to read the info. The other defines the product it wants information.
var selectedProduct (used to filter the attribute)
var languageSelected (used to filter the child node, based on the selection of the attribute)
Follows an example of the structure I am playing with:
0
Tennis ball
Our products are etc,etc etc…
Nossos produtos sao etc, etc, etc
1
Jogging shoes
Our products are etc,etc etc…
Nossos produtos sao etc, etc, etc
So for example, if the user selects the prodX1 and the language is PT (portuguese) I should read “Nossos produtos sao etc, etc, etc”.
Any ideas how to solve it? Thanks in advance….
[...] Actionscript 3 E4X rundown Using E4X with XHTML? Watch your namespaces! [...]
Great article, thank you!
however, I still can?t understand how to use e4x to filter out dates.
I have the following XML
<tour>
<show date="28 December" city="Buenos Aires" country="Argentina" venue="Teatro Flores" status="SOLD OUT"/>
<show date="26 December" city="Curitiba" country="Brazil" venue="Hellooch" status="SOLD OUT"/>
<show date="27 December" city="Sao Paulo" country="Brazil" venue="AVR Festival" status="SOLD OUT"/>
<show date="23 December" city="Valparaiso" country="Chile" venue="El Huevo" status="SOLD OUT"/>
<show date="22 December" city="Santiago" country="Chile" venue="Novedades" status="SOLD OUT"/>
<show date="21 December" city="Concepcion" country="Chile" venue="Sala 2" status=""/>
<show date="21 December" city="Monterrey" country="Mexico" venue="Ibex" status="SOLD OUT"/>
<show date="20 December" city="Mexico City" country="Mexico" venue="Hard Rock Live" status="SOLD OUT"/>
<show date="17 December" city="Haskovo" country="Bulgaria" venue="KDK" status="SOLD OUT"/>
<show date="16 December" city="Trinidad" country="Trinidad & Tobago" venue="Hellooch" status="SOLD OUT"/>
<show date="12 December" city="Sao Paulo" country="Brazil" venue="AVR Festival" status="SOLD OUT"/>
<show date="11 December" city="Valparaiso" country="Chile" venue="El Huevo" status="SOLD OUT"/>
<show date="06 December" city="Santiago" country="Chile" venue="Novedades" status="SOLD OUT"/>
<show date="05 December" city="Concepcion" country="Chile" venue="Sala 2" status="SOLD OUT"/>
<show date="04 December" city="Monterrey" country="Mexico" venue="Ibex" status="SOLD OUT"/>
<show date="03 December" city="Mexico City" country="Mexico" venue="Hard Rock Live" status="SOLD OUT"/>
</tour>
then I?m trying to put the upcoming dates in one DataGrid and the past in another, but it doesn?t seems to compare properly the date field.
<mx:Script>
<![CDATA[
public var today:Date = new Date();
]]>
</mx:Script>
<mx:DataGrid
any ideas?
Thank you for this article. It is the best I’ve seen. I’ll be back with questions.
Thanks for the article.
I am a little confused about the return type when filtering using either the square brackets indexed array notation or the the parenthetical predicates. For example
if I use
var obj:Object = thePeople.person.age[0] ;
I can see in the debugger that obj is typed as an XMLList with one XML element, and if I check the toXMLString() method on that XML node it displays “27″
But if I use
var obj:Object = thePeople.person.age[0].text() ;
it similarly returns an XMLList with one XML element but the toXMLString now just shows “27″
Although the value is what I expect, I do not see how the value “27″ can be considered an XML document or node as it does not have a root element.
This led me to try
var x:XML = XML(29) ;
and it was quite happy about this.
It seems AS3’s definition of an XML document is a little more inclusive than I expected
Brian
There actually is a nextSibling, parent, etc… but it’s on the XMLNode object. This make sense, because XMLList seems to be just a way to break XML into smaller chunks for processing, so they’re isolated objects. Each XMLNode however, has: parentNode, nextSibling, previousSibling, firstChild, lastChild, childNodes, and attributes.
Good post, but needs some proof-reading for technical accuracy. I think you understand how it all works, but the written explanations aren’t always consistent.
[...] not really taken that big step to form the way as2 talkes to XML to E4X. I started my reserch on dispatchevent.org then I viewed the E4X video from Mark Birat the Adobe MAX sessions and it helped put my research [...]
I’m looking for a way to sum the numeric data in like nodes. Using your XML in the example, I want to create an XMLList for the Age nodes using thePeople..age and then add the two results together. ie: 27+26=53
Brendan,
I too was looking for a way to sum numeric data and was able to figure this out by looking at a few other e4x examples:
var sum:Number = 0;
xml.person.age.(sum += Number(valueOf()));
trace(”Sum of ages:”, sum);
Hope this comment finds you before you drive yourself crazy (or resort to a for…loop).
Great post. So I got this idea last night to use an e4x expression as the source of a chart and advanceddatagrid dataProvider. I’ve found that mostly all of the “examples” online and in all the books only look at one or(at most) two nesting levels inside of an xml document. Unfortunately, my needs go beyond showing the number of apples or names of people in a contact list. So here’s some background:
I have xml that is segregated in different levels, with the first level being a generic role and the second level being one of a type. There can be many different roles and many number of types under each role. Within each type is a list of datapoints that correspond to the specific role and type.
So last night I was playing around and was able to get my adg to treat an e4x expression as the source by passing comparison values to the attributes which in turn only loaded the data items of interest. My e4x expression was sorta like this:
I got this to work a couple of times but the dataProvider was not being modified once the values of the typeValue and roleValue changed. So, like an idiot, I started hacking around trying to treat my e4x expression as a solid data provider and it has since stopped working altogether. If Im really nice, and standing in just the right point of the room, I can get the dataProvider to load initially but ONLY for a single attribute comparison ie myColl..role.(@id==someRoleValue) but not for another level into the structure.
Any words of wisdom would be GREAT at this point. I want to use the XML (or XMLListCollection if need be) as a dataProvider for my charts and datagrid, but since I want to filter the values based upon parent nodes (and be able to filter my data dynamically). I’ve made this work with arrayCollections but I dont want to have to redo my webservices to provide me with flat data just to get this to work. I would think this is the VERY reason for e4x…besides acting as xml processing shorthand :D
This line::
“The variable is already associated with the root node so there?s no need to write into the expression. ”
just put an end to my 2 hour headache while dealing with converting old AS2 xml into my current Flex 3 Cairngorm project.
Thank you, thank you, thank you. :- )
— Now. I iz a pimp.
Is there a way to use a wildcard filter with a string to filter a title by a single word. So for example, I want to display only the titles that have the word “Flash” in them.
I created a video player that feeds off the RSS of my blip.tv channel. I can get all the titles and videos but I want to create a custom video player that will only show the videos that have the word “flash” in the title.
Excellent article, maybe you could just add that the curly braces syntax will work only if the double quotes are missing, i.e. this will work:
while this will not:
This article is the shiznit! | http://dispatchevent.org/roger/as3-e4x-rundown/ | crawl-002 | refinedweb | 2,521 | 63.9 |
Difference between revisions of "pas2jni"
Revision as of 13:30, 1 November 2016
Contents
Overview
The pas2jni utility generates a JNI (Java Native Interface) bridge for a Pascal code. Then the Pascal code (including classes and other advanced features) can be easily used in Java programs.
For example you can do the following in Java:
import pas.classes.*; ... TStringList sl = TStringList.Create(); sl.Add("Hello."); String s = sl.getStrings(0); sl.Free(); ...
The following Pascal features are supported by pas2jni:
- function/procedure;
- var/out parameters;
- class;
- record;
- property;
- constant;
- enum;
- set;
- TGuid type;
- pointer type;
- string types;
- all numeric types;
- method pointer;
- setters/getters for array elements.
USUPPORTED features:
- Full support for arrays;
- procedure pointer (Not possible to implement. To workaround this limitation create a procedure handler in your Pascal code and call a method pointer declared in some global Pascal class. Then you can assign this method pointer from a Java code).
Shared libraries, generated by pas2jni were tested with Java on Windows and Android. It should work on other systems as well.
How to use
pas2jni uses the PPUDump utility included with Free Pascal Compiler to read unit interfaces. Therefore your Pascal code must be first compiled with FPC.
When your units are compiled, you can run pas2jni. You need to specify a list of main units and units search path.
When you specify a main unit, all its interface declarations will be available in Java. For linked units only used declarations will be available. You can fine tune included/excluded declaration using
-I and
-E command line options.
The basic invocation of pas2jni:
pas2jni myunit -U/path/to/my/units;/path/to/FPC/units/*
Here you specify myunit as the main unit and provide path to your compiled units and FPC compiled units.
After successfull run of pas2jni you will get the following output files:
- file
myunitjni.pas- a generated library unit to be compiled to a shared library. It will contain all your Pascal code to be used from Java.
- folder
pas- generated Java package
pasto be used in your Java program. Interface to each Pascal unit is placed to a separate Java public class.
Note: You need to use ppudump of the same version as the FPC compiler. Use the
-D switch to specify correct ppudump if it is not in
PATH.
Custom handlers
It is possible to define the following custom handlers in your Pascal code.
procedure JNI_OnException;
- It is called when an unhandled Pascal exception occurs. For example, you can log a stack back trace in this handler.
Custom handlers must be public and defined in one of the main units specified when calling pas2jni.
Coding tips
Setting handlers (method pointers) in a Java code.
For example there is the following event handler in your Pascal code:
TMyClass = class ... property OnChange: TNotifyEvent; ... end;
In a Java code you get the following
TMyClass instance:
TMyClass myclass = TMyClass.Create();
Then you add the event handler in a usual Java way:
... myclass.setOnChange( new TNotifyEvent() { protected void Execute(TObject Sender) { // The handler code } } ); ...
NOTE: If you are setting handlers (method pointers) for short living objects, it is needed to explicitly remove the handlers before the object destruction by setting the null handler. Otherwise you will reach the active handlers limit (10000 handlers) and your application will crash.
Command line options
Usage: pas2jni [options] <unit> [<unit2> <unit3> ...] Options: -U<path> - Unit search path, semicolon delimited. Wildcards are allowed. -L<name> - Set output library name. -P<name> - Set Java package name. -O<path> - Set output path for Pascal files. -J<path> - Set output path for Java files. -D<prog> - Set full path to the "ppudump" program. -I<list> - Include the list of specified objects in the output. The list is semicolon delimited. To read the list from a file use -I@<file> -E<list> - Exclude the list of specified objects from the output. The list is semicolon delimited. To read the list from a file use -E@<file> -? - Show this help information. | https://wiki.freepascal.org/index.php?title=pas2jni&diff=prev&oldid=104688 | CC-MAIN-2020-40 | refinedweb | 664 | 67.65 |
A python graph library implemented in Rust
Project description
- You can see the full rendered docs at:
retworkx is a rust graph library interface to python3. For right now it’s scope is as an experiment in being a potential replacement for qiskit-terra’s networkx usage (hence the name). The scope might grow or change over time, but to start it’s just about building a DAG and operating on it with the performance and safety that Rust provides. It is also a personal exercise in learning how to interface rust with python.
Installing retworkx
retworkx is published on pypi so on x86_64 and i686 linux systems or Mac OSX systems installing is as simple as running:
pip install retworkx
This will install a precompiled version of retworkx into your python environment. However if there are no precompiled binaries published for your system you’ll have to compile the code. The source package is also published on pypi so you can also run the above command to install it. However, there are 2 preconditions for this to work, first you need to have cargo/rustc nightly in your PATH. You can use rustup to make this step simpler. Secondly, you need to have setuptools-rust installed in your python environment. This can can be done by simply running:
pip install setuptools-rust
prior to running:
pip install retworkx
If you have rust nightly properly installed pip will compile retworkx for your local system and it should run just as the prebuilt binaries would.
Building from source
The first step for building retworkx from source is to clone it locally with:
git clone
retworkx uses PyO3 and setuptools-rust to build the python interface. Unfortunately, this means you need to use nightly rust because PyO3 only works with nightly at this point. You can use rustup to install rust nightly.
Once you have nightly rust and cargo installed you can easily install retworkx into your python environment using pip. Once you have a local clone of the repo you can install retworkx into your python env with:
pip install .
Assuming your current working directory is the root of the repo. Otherwise you can run:
pip install $PATH_TO_REPO_ROOT
which will install it the same way. Then retworkx in your local python environment. There are 2 things to note when doing this though, first if you try to run python from the repo root using this method it will not work as you expect. There is a name conflict in the repo root because of the local python package shim used in building the package. Simply run your python scripts or programs using retworkx outside of the repo root. The second issue is that any local changes you make to the rust code will not be reflected live in the python you’ll need to recompile the source by rerunning pip install to have any changes reflected in your python environment.
Using retworkx
Once you have retworkx installed you can use it by importing retworkx. All the functions and the PyDAG class are off the root of the package. For example, building a DAG and adding 2 nodes with an edge between them would be:
import retworkx my_dag = retworkx.PyDAG() # add_node(), add_child(), and add_parent() return the node index # The sole argument here can be any python object root_node = my_dag.add_node("MyRoot") # The second and third arguments can be any python object my_dag.add_child(root_node, "AChild", ["EdgeData"])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages. | https://pypi.org/project/retworkx/0.0.5/ | CC-MAIN-2021-39 | refinedweb | 603 | 60.04 |
IRC log of tagmem on 2006-11-14
Timestamps are in UTC.
17:59:04 [RRSAgent]
RRSAgent has joined #tagmem
17:59:04 [RRSAgent]
logging to
17:59:20 [ht]
zakim, this will be tag
17:59:21 [Zakim]
ok, ht; I see TAG_Weekly()12:30PM scheduled to start 29 minutes ago
17:59:23 [DanC]
DanC has joined #tagmem
18:00:23 [Zakim]
TAG_Weekly()12:30PM has now started
18:00:30 [Zakim]
+[IBMCambridge]
18:01:16 [Vincent]
Vincent has joined #tagmem
18:01:25 [dorchard]
dorchard has joined #tagmem
18:01:25 [noah]
zakim, [IBMCambridge] is me
18:01:25 [Zakim]
+noah; got it
18:01:36 [Zakim]
+Raman
18:01:53 [Zakim]
+Dave_Orchard
18:02:13 [Zakim]
+Vincent
18:02:24 [ht]
zakim, please call ht-781
18:02:25 [Zakim]
ok, ht; the call is being made
18:02:27 [Zakim]
+DanC
18:02:29 [Zakim]
+Ht
18:02:52 [Vincent]
Zakim, who is here?
18:02:52 [Zakim]
On the phone I see noah, Raman, Dave_Orchard, Vincent, DanC, Ht
18:02:54 [Zakim]
On IRC I see dorchard, Vincent, DanC, RRSAgent, Zakim, noah, Norm, ht
18:03:04 [DanC]
DanC has changed the topic to: TAG weekly 14 Nov
18:03:33 [Zakim]
+Norm
18:03:35 [DanC]
agenda + Convene
18:03:42 [DanC]
agenda + Issue metadataInURI-31
18:03:50 [DanC]
agenda + Issue namespaceDocument-8
18:03:54 [Vincent]
agenda:
18:04:31 [DanC]
DanC has changed the topic to: TAG weekly 14 Nov
18:04:44 [DanC]
Zakim, take up item 1
18:04:44 [Zakim]
agendum 1. "Convene" taken up [from DanC]
18:04:48 [DanC]
Scribe: DanC
18:04:52 [DanC]
Chair: VQ
18:04:55 [Zakim]
+Ed_Rice
18:05:01 [DanC]
PROPOSED: to met 21 Nov
18:05:07 [DanC]
NM: regrets 21 Nov
18:05:16 [Ed]
Ed has joined #tagmem
18:05:17 [DanC]
HT: regrets 21 Nov. backplane meeting
18:05:32 [Zakim]
+TimBL
18:05:35 [DanC]
PROPOSED: to meet 21 Nov, Ed to scribe
18:05:57 [timbl]
timbl has joined #tagmem
18:06:04 [DanC]
PROPOSED: to accept
as a true record
18:06:45 [DanC]
PROPOSED: to accept
as a true record, after making the ammendment Noah requested
18:06:47 [timbl]
ok by me
18:06:53 [DanC]
RESOLVED: to accept
as a true record, after making the ammendment Noah requested
18:07:17 [DanC]
RESOLVED: to meet 21 Nov, Ed to scribe
18:07:39 [DanC]
agenda + Issue passwordsInTheClear-52
18:08:17 [DanC]
Zakim, next item
18:08:18 [Zakim]
agendum 2. "Issue metadataInURI-31" taken up [from DanC]
18:09:14 [DanC]
VQ: so we have a draft of 7 Nov, and action on DanC and Ed to review
18:09:32 [DanC]
NM: section [n] was rewritten
18:09:50 [DanC]
VQ: I note discussion of dates in W3C URIs
18:10:26 [DanC]
NM: I saw review comments from Ed...
18:11:34 [DanC]
... about strengthening the story from save-as to running it. [?]
18:12:45 [DanC]
[odd... I see 2 URIs. ./malicious.exe and ./moviestar.jpg ]
18:13:22 [DanC]
->
The use of Metadata in URIs DRAFT TAG Finding 07 November 2006
18:15:04 [DanC]
DC: I see 2 URIs... ./malicious.exe and ./moviestar.jpg
18:15:10 [DanC]
NM: that's the 2nd example; look at the 1st
18:15:16 [DanC]
DC: what's the URI in the 1st example?
18:15:25 [DanC]
NM: there isn't a specific URI in the 1st example
18:15:42 [DanC]
DC: then it's too abstract already for somebody, like me, who isn't reading all that carefully
18:15:43 [Vincent]
s/[n]/2.8/
18:15:51 [dorchard]
this is section 2.8?
18:17:00 [DanC]
(minutes Nov 7 are dated 2006/11/14 18:09:46 )
18:17:29 [timbl]
... <img src="./moviestar.exe"/>
18:17:40 [timbl]
... <img src="./moviestar.exe"/> served as image/jpeg
18:20:24 [DanC]
NM: so I see 2 ways to mitigate the risk:
18:20:40 [DanC]
... (1) what safari does, use the mime type to make a filename of moviestar.exe.jpeg
18:20:55 [DanC]
... (2) warn that saving as .exe won't preserve the mime type
18:26:53 [DanC]
Ed: just recently I saw a link to an RSS feed that came up as text.
18:26:58 [DanC]
TimBL: what was the media type?
18:26:59 [DanC]
Ed: text
18:27:40 [DanC]
TimBL: then the browser was doing it right; if that's not what the author meant, he should have used a different media type; see webarch and/or "authoritative metadata" finding
18:28:31 [timbl]
1. The URI ends in .exe
18:28:41 [timbl]
2. The contrn typ eis image/jpeg
18:28:47 [timbl]
3. So the image works ina browser
18:28:52 [timbl]
4. the server saves it
18:29:00 [DanC]
TV: so I see (1) and (2); it's better to advise one over the other, no?
18:29:09 [timbl]
4. The users saves it with "save image to desktop"
18:29:20 [DanC]
q+ to answer TV's question: (1) is better
18:29:35 [timbl]
5. the user lcicks on it in hte desktop and the thinbg runs as a file
18:30:23 [Norm]
s/lcicks/clicks/
18:30:26 [Norm]
s/hte/the/
18:30:30 [Norm]
s/thinbg/thing/
18:30:59 [DanC]
NM: so is the GPN OK?
18:32:43 [DanC]
DC: it's too complicated; just say "when saving to filesystems that use extensions to represent media types, user agents must choose an extension that is constistent with the media type from the representation"
18:33:30 [DanC]
Ed: is that a rfc2119:MUST ?
18:33:31 [DanC]
DanC: yes
18:33:47 [DanC]
TimBL: most operating systems let you rename it
18:34:00 [DanC]
... if you accept that your warrantee is void
18:34:04 [DanC]
DanC: well, that's separate
18:35:12 [DanC]
. ACTION NM: rework 1st example to be more explicit as per Tim's suggestion above, and update GPN per Dan's suggestion
18:35:29 [DanC]
(did he say keep the 2nd example? I haven't looked at it.)
18:36:06 [DanC]
NM: I have gotten comments on other parts of the document...
18:36:23 [DanC]
... ok to change "create" to "assign"?
18:36:30 [DanC]
TBL: where is that comment?
18:37:28 [DanC]
NM: Stuart has advised against "authority" all over the document; I think he's accepted that different editors would say it differently
18:38:54 [noah]
Note from Ed Davies:
18:38:55 [noah]
18:39:09 [DanC]
NM: Ed Davies 8 Nov wrote about a UK court case
18:39:31 [DanC]
... which we have previously discussed
18:41:30 [DanC]
DanC: I think we treated this in the deep linking finding
18:41:38 [DanC]
HT: no, this is a different case
18:42:02 [DanC]
... we don't have very good sources about this case; we're still awaiting the official record
18:43:57 [DanC]
q+ to ask if it wasn't the deep linking finding, what did happen to this court case when we last discussed it?
18:46:14 [Vincent]
ack DanC
18:46:14 [Zakim]
DanC, you wanted to answer TV's question: (1) is better and to ask if it wasn't the deep linking finding, what did happen to this court case when we last discussed it?
18:47:10 [DanC]
ACTION HT: seek a copy of the official court record of the UK case on ../../ etc.
18:47:36 [DanC]
HT: I intended to get a copy before, so yes, let's track it as an action now
18:49:24 [DanC]
TimBL: I don't see this metadata in URI finding saying anything terribly relevant to the UK case
18:51:30 [DanC]
DONE: Review security section on risks of serving executables as .jpeg to metadataInURI draft.
18:51:46 [DanC]
ACTION Ed: Review security section on risks of serving executables as .jpeg to metadataInURI draft. [DONE]
18:52:04 [DanC]
"Face-to-face meeting, 11-13 Dec. 2006, Cambridge, MA, USA, hosted by MIT" --
18:52:14 [DanC]
TV: I'm at risk for the Dec ftf
18:52:21 [Norm]
My current plan is to attend 12, 13 in person and on 11 by phone, if possible
18:52:46 [DanC]
NM: I don't see much opportunity to make progress until ftf prep; ETA 4 Dec
18:53:09 [DanC]
ACTION DanC: accepted on 4 Oct 2006: Review security section on risks of serving executables as .jpeg to metadataInURI draft. [CONTINUES]
18:54:05 [DanC]
Zakim, next item
18:54:05 [Zakim]
agendum 3. "Issue namespaceDocument-8" taken up [from DanC]
18:55:08 [ht]
illustrates the case Noah describes in
18:55:09 [DanC]
WITHDRAWN: NW, accepted on 12 Jul 2005: follow up on Noah's message on ns name. Reconfirmed on 10 Jan 2006.
18:55:43 [DanC]
ACTION NW: propose to Jonathan Borden that he changes to using a file of Natures. [CONTINUES]
18:55:43 [ht]
Firefox's treatment is actually sub-optimal
18:55:57 [Vincent]
ack DanC
18:55:58 [Zakim]
DanC, you wanted to ask a fairly meaty question about GRDDL and namespaces and media types that I sent to www-tag
18:56:06 [DanC]
.
18:58:05 [noah]
DC: Shows a document containing RDF but served application/xml
18:58:25 [noah]
DC: The RDF gives a privacy policy
18:58:36 [noah]
DC: Has the author issued a privacy policy, or just said "look at these tags"?
18:59:35 [noah]
DC: I think I like the former, in part because there's a lot of stuff already deployed that way.
18:59:43 [timbl]
I vote (1)
19:00:20 [noah]
DC: Suggested in the email:
19:00:20 [noah]
An XML document labeled as text/xml or application/xml might contain
19:00:20 [noah]
namespace declarations, stylesheet-linking processing instructions
19:00:20 [noah]
(PIs), schema information, or other declarations that might be used
19:00:20 [noah]
to suggest how the document is to be processed.
19:00:32 [noah]
For example, a
19:00:32 [noah]
document might have the XHTML namespace and a reference to a CSS
19:00:32 [noah]
stylesheet. Such a document might be handled by applications that
19:00:32 [noah]
would use this information to dispatch the document for appropriate
19:00:32 [noah]
processing.
19:00:55 [noah]
q+
19:02:13 [Vincent]
ack noah
19:04:33 [DanC]
q+ to bring up another case,
19:07:14 [Vincent]
ack DanC
19:07:14 [Zakim]
DanC, you wanted to bring up another case,
19:08:26 [DanC]
looking at
19:09:24 [DanC]
Content-Type: application/xml; qs=0.9
19:09:37 [ht]
Windows has the following information about this MIME type. This page will help you find software needed to open your file.
19:09:37 [ht]
MIME Type: application/rdf xml
19:09:47 [timbl]
Content-Location: testlist3.rdf
19:09:47 [timbl]
Vary: negotiate,accept
19:10:29 [noah]
NW: What's your question?
19:10:37 [noah]
DC: How many triples are here?
19:10:46 [noah]
DC: RDF parser is unhappy with this.
19:11:04 [noah]
TBL: If the parser supported XML functions would it be unhappy?
19:11:11 [noah]
DC: What does that mean?
19:11:28 [noah]
TBL: When you get to a subtree you don't recognize, you look up namespace to get specs.
19:11:39 [noah]
NW: Tim, you'd like it to work that way, but there's no spec for that.
19:11:49 [timbl]
<t:Test r:
19:11:56 [Norm]
We're looking at this:
19:12:02 [timbl]
19:12:33 [noah]
TBL: I did a curl -i on it and it said it was RDF.
19:12:35 [noah]
DC: OK
19:12:43 [noah]
DC: There are two tests in there.
19:13:48 [noah]
DC: this won't parse due to last dc:description.
19:14:09 [noah]
DC: if you knew to run XSLT first, you'd "win", but there don't seem to be enough keys to make that happen
19:14:15 [timbl]
q+
19:14:18 [noah]
NW: insteresting question which processing should happen first.
19:14:53 [noah]
DC: It's a mixin?
19:14:58 [noah]
HT: It is and it isn't.
19:15:22 [Norm]
q_
19:15:28 [Norm]
q+
19:15:28 [noah]
HT: That use of XML breaks compositionality. It's in that sense outside the rules, and the fact that it causes problems is not surprising.
19:15:49 [noah]
HT: In this case, the function of the whole is not the sum of the meaning of the parts. Not context free in the usual way.
19:15:51 [DanC]
HT, please stop; you have already lost tim
19:16:08 [noah]
HT: To understand the meaning of the document by working bottom up.
19:16:11 [noah]
TBL: Bottom up.
19:16:18 [noah]
DC: If it's compositional, it works either way.
19:16:31 [DanC]
(he said, glibly, before wondering if he was right)
19:16:34 [Vincent]
ack timbl
19:16:51 [noah]
(Noah thinks that in general top down provides the context for the inner parts, as in <dontTrust><x>...</x></dontTrust>
19:17:32 [Norm]
q-
19:17:48 [noah]
TBL: If it were anything other than RDF, I would propose that when the RDF parser gets down to the dc:description,it would look up the namespace, e.g. to embed an encrypted piece. Works "fine" for other XML dialects.
19:18:01 .
19:18:04 [DanC]
(wow... tim is blowing my mind, taking the side of "XSLT is working here; RDF is not doing the clean thing.")
19:18:08 [noah]
TBL: Problem is that RDF claims to tell you the semantics of anything you put in there. There's no extensibility in that sense.
19:18:50 [noah]
HT: Here's an example where it's different.
19:19:06 [noah]
HT: XSTL stylesheets themselves break compositionality, and we've known that for years.
19:19:36 [noah]
HT: You write things like <P> knowing that the contents are not the contents of a paragraph. They are result elements. XSLT is a meta lanuage that has implicit quoting all over the place.
19:19:49 [noah]
TBL: Nothing wrong with that, because you start from the top.
19:20:18 [noah]
(Noah notes that what Tim is saying is precisely why Noah said above that top down is the only right way to look at it.)
19:20:32 [DanC]
("my functional xml paper" ... pointer, ht?)
19:20:36 [noah]
TVR: In XSLT, everything but the XSLT namespace is implicitly quoted.
19:20:57 [DanC]
(I find
Functional XML: A preliminary sketch HT )
19:21:11 [noah]
HT: But there are lots of XSLT elements that can contain either quoted or non-quoted things. Not clear it's entirely equivalent to backquoting.
19:21:45 [noah]
NW: There are <xsl:element>, <xsl:attribute> and you could use them everywhere. Arguably that's what <p>
19:22:14 [noah]
DC: So I'm hearing first case leaves things looking reasonably clean as far as sniffing for RDF, but the 2nd case still seems to have dragons lurking.
19:22:29 [ht]
[FYI, both Protege 3.1 and SWOOP 2.3 throw exceptions when given Dan's second URI. . .
19:22:40 [noah]
DC: If I put a "parse type"(? scribe's not sure about this) we'd incorrectly blow past the XSL.
19:22:59 [DanC]
(well, we'd blow past; whether correct or not is the issue.)
19:23:02 [Norm]
If we put "parseType='XMLLiteral'" is what Dan meant
19:23:10 [noah]
Thanks.
19:23:38 [noah]
(Noah didn't scribe what Tim said, sorry. Couldn't quite hear.)
19:23:43 [noah]
HT: Xinclude is another example.
19:24:16 [timbl]
q+
19:24:22 [DanC]
(no smiley required, Norm; in the GRDDL WG, we've got an open action to make a test case of using an XML Pipeline in place of an XSLT transformation.)
19:24:51 [Vincent]
ack TimBL
19:25:52 [DanC]
(it's becoming reasonably clear that people do consider that this xmlFunctions-34 does cover this discussion, so I don't need nsMediaType-3 re-opened)
19:27:48 [DanC]
ACTION HT: track progress of #int bug 1974 in the XML Schema namespace document in the XML Schema WG. [CONTINUES]
19:28:07 [DanC]
. TBL, accepted on 5 Oct 2006: with Norm, draft semantic web architecture stories and such.
19:28:26 [DanC]
ACTION NDW: draft semantic web architecture stories and such
19:28:32 [DanC]
NDW: I hope to have something for the ftf, but it's risky
19:28:41 [DanC]
(new version of which? I have fallen behind)
19:29:15 [DanC]
(which finding, NDW?)
19:29:34 [DanC]
.
19:29:35 [DanC]
.
19:30:06 [DanC]
VQ: looks like we'll postpone passwordsInTheClear-52 to next time
19:30:13 [timbl]
passwords in the clear ok where?
19:30:19 [DanC]
e.g. on local networks
19:30:50 [DanC]
it's hard to get the scope of passwordsInTheClear clear while keeping it front-side-of-one-page
19:30:52 [DanC]
Zakim, next item
19:30:52 [Zakim]
agendum 4. "Issue passwordsInTheClear-52" taken up [from DanC]
19:31:03 [DanC]
Topic: Dec ftf agenda
19:31:07 [DanC]
oops
19:31:09 [DanC]
that's for next week
19:31:13 [Zakim]
-Dave_Orchard
19:31:17 [Zakim]
-Ed_Rice
19:31:19 [Zakim]
-Norm
19:31:20 [Zakim]
-Vincent
19:31:20 [Zakim]
-DanC
19:31:22 [Zakim]
-noah
19:31:24 [Zakim]
-TimBL
19:31:24 [Zakim]
-Ht
19:31:27 [Zakim]
-Raman
19:31:29 [Zakim]
TAG_Weekly()12:30PM has ended
19:31:30 [Zakim]
Attendees were noah, Raman, Dave_Orchard, Vincent, DanC, Ht, Norm, Ed_Rice, TimBL
21:12:34 [Norm]
Norm has joined #tagmem
22:00:45 [Zakim]
Zakim has left #tagmem | http://www.w3.org/2006/11/14-tagmem-irc | CC-MAIN-2014-52 | refinedweb | 3,082 | 76.86 |
DirectXTK October 2012 release
The:
- Moved DDSTextureLoader and WICTextureLoader into the DirectX C++ namespace
- Renamed project files for better consistency
- Extended WICTextureLoader to support Windows 8 96bpp floating point formats
- Updated Win32 desktop projects to use Windows Vista (0x0600) rather than Windows 7 (0x0601) APIs
- Tweaked SpriteBatch.cpp to workaround an ARM NEON compiler codegen bug
So what is this GeoSphere thingie, you may well ask, and why might it be better than a plain old fashioned UV sphere primitive? Shamelessly plagiarizing an explanation from Adrian:.
Source
0
Recommended Comments
There are no comments to display.
You need to be a member in order to leave a comment
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now | https://www.gamedev.net/blogs/entry/2255170-directxtk-october-2012-release/ | CC-MAIN-2018-26 | refinedweb | 134 | 63.39 |
-
).
Currently the database block all connections excepted a list of whitelisted IP and because everybody doesn't have a static ip available, we need to deploy a ssh gateway with postgesql-client configured with read only access in the evergreen namespace to allow people to jump there and run command.
We could build a docker image that contains ssh authorized keys and an openssh server
That would be fine by me. If needed, my pubkey is also available at
I created a PR which needs some reviews.
Baptiste Mathus Mandie Smith I also created a docker image that contains sshd and postgresql-client configured on them, can I ask you to add your public ssh key?
It should be straightforward.
> can I ask you to add your public ssh key?
Olivier Vernin sorry to be a slowpoke, but where? I already provided a link to mine above, not sure where you mean. Thanks!
> I already provided a link
You shared a link to your public GPG key not public ssh key
> where?
Indeed I forgot to put the link
Just skip step 1
> You shared a link to your public GPG key not public ssh key
Woops, right. :facepalm:
Thanks for the link
Read only access is configured from 137.116.80.151. It should be easy to understand how to use that endpoint. Btw ip will probably change in a near futur so I suggest to create a dns record to keep track of it
wooot, I can confirm this works. Just used to retrieve older UL content for debugging
JENKINS-54358. Merci beaucoup Olivier Vernin!
Olivier Vernin, do you think this is something you could be able to figure out? I don't have a lot of bright ideas for how we can share access to Azure DBs | https://issues.jenkins-ci.org/browse/INFRA-1769?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel | CC-MAIN-2020-24 | refinedweb | 300 | 79.4 |
Phone Directory Implementation in C++
Here we are going to make our own C++ program to make a phone directory. So what is a phone directory and how to create it? A phone directory is a collection of data, which consists of names of people and their phone numbers. To create a phone directory, we will use a data structure trie. Its search complexity is equal to that of the key length. The nodes of trie contain alphabets and these nodes are connected to further tries thus they form a tree. When a word is finished, we mark it as finished in a trie as shown in the diagram.
C++ Program to create phone directory
#include <bits/stdc++.h> using namespace std; // global declaration of contact list string contactList[] = {"phantom" , "phone","phul"}; struct TrieNode { // every trie Node contains a Map 'child' // in which each alphabet points to another trie node unordered_map<char,TrieNode*> child; // 'lastLetter' is true if the node represents // end of a contact bool lastLetter ; // Constructor TrieNode() { // Initializing all nodes as null for (char i = 'a'; i <= 'z'; i++) child[i] = NULL; lastLetter = false; } }; // Making root NULL for ease so that it doesn't // have to be passed to all functions. TrieNode *root = NULL; // Add contacts int trie node void AddContact(string s) { int length = s.length(); // 'head' is used to iterate the Trie Nodes TrieNode *head = root; for (int i = 0; i < length; i++) { // Check if the s[i] is already present in // Trie TrieNode *nextNode = head->child[s[i]]; if (nextNode == NULL) { // If not found then create a new TrieNode nextNode = new TrieNode(); // Insert into the Map head->child[s[i]] = nextNode; } // Move the head, to point to next // Trie Node head = nextNode; // If its the last character of the string 's' // then mark 'lastLetter' as true if (i == length - 1) head->lastLetter = true; } } // This function simply displays all contacts in //phone directory. // teaverse current node. String 'pre' // stands for string corelating to the path from // root to currentNode. void showContactsTil(TrieNode *currentNode, string pre) { // Checking if string 'pre' ends here // If yes then display the string till now if (currentNode->lastLetter) cout << pre << endl; // Find the Nodes adjecent to the current // Node and then recursively call the function for (char i = 'a'; i <= 'z'; i++) { TrieNode *next = currentNode->child[i]; if (next != NULL) showContactsTil(next, pre + (char)i); } } //this function show contacts //as user inputs a letter, for example //if user inputs "phu" then first it will show //all contacts starting from p then from ph //and finally from phu if no contact is present //then is will tell no result is found. void showContacts(string str) { TrieNode *previousNode = root; string pre = ""; int length = str.length(); // Display the contact List for string formed // after entering every character int i; for (i=0; i<length; i++) { // 'pre' stores the string formed so far pre += (char)str[i]; // Get the last character entered char lastChar = pre[i]; // Find the Node corelating to the last // character of 'pre' which is pointed by // prevNode of the Trie TrieNode *currentNode = previousNode->child[lastChar]; // If nothing found, then break the loop as // no more prefixes are going to be present. if (currentNode == NULL) { cout << "No result found "<<" " << pre << endl; i++; break; } cout << "Suggesions for" <<" "<< pre<<" " << "are "<< endl; showContactsTil(currentNode, pre); // Change prevNode for next pre previousNode = currentNode; } for (; i<length; i++) { pre += (char)str[i]; cout << "no contact found for"<<" " << pre << endl; } } // Insert all the Contacts into the Trie void insertInDirectory(string contacts[],int n) { // Initialize root Node root = new TrieNode(); // Insert each contact into the trie for (int i = 0; i < n; i++) AddContact(contacts[i]); } int main() { // Size of the Contact List int n = sizeof(contactList)/sizeof(string); insertInDirectory(contactList, n); string Search = "phum"; showContacts(Search); return 0; }
function implementation
- InsertInDirectory
this function names in the phone directory
- AddContact
this function adds the contact to directory
- showContacts
this function displays contact letter by letter suppose user gives an input “p” it will show all contacts starting from “p“if the user then gives input as u then it will show all contacts starting from “pu”.
- showContactsTil
this function displays all contacts from the phone directory starting from a pedicular prefix.
Implementation
To add contacts, we have made a global string array in which we can add contacts. Then we have called a function “InsertInDirectory” this function runs a loop and adds one string at a time from the array to the phone directory by calling the function “AddContact”. To search a contact, we have created a search string, the program will be going to search then, this string in phone directory letter by letter and going to display all the contacts letter by letter, as explained above.
To search we will call the function showContacts this will first check if there is a contact present starting from the 1st letter of the search string if yes then it will call showContactsTil, this function will show all the contacts starting from the letter.
For example-:
let’s assume the phone directory has two contacts {Ram, Raghav} and the search string is {Rishabh}.
So “showContact” first will check if there are any contacts starting from “R” if yes (as in our case) then it will call “showContactsTil” and this function will show all the contacts staring form “R”. Then “showContact” will check is there any contact which starts from “Ri”, as there is no contact starting from “Ri” thus it will return no contacts are found.
Output
Noe it’s time to run our code. Below is the result that we will see after running our code:
Suggestions based on p are phantom phone phul Suggestions based on ph are phantom phone phul Suggestions based on phu are phul No contact Found for phum | https://www.codespeedy.com/phone-directory-implementation-in-c/ | CC-MAIN-2021-10 | refinedweb | 963 | 55.2 |
Toy compression implementations
From HaskellWiki
(Difference between revisions)
Revision as of 16:46, 15 February 2007)
module Compression where import Data.List -- Run-length encoding encode_RLE :: (Eq x) => [x] -> [(Int,x)] encode_RLE = map (\xs -> (length xs, head xs)) . groupBy (==) decode_RLE :: [(Int,x)] -> [x] decode_RLE = concatMap (uncurry replicate) -- Limpel-Ziv-Welsh compression (Recommend using [Word8] or [SmallAlpha] for input!) encode_LZW :: (Eq x, Enum x, Bounded x) => [x] -> [Int] encode_LZW [] = [] encode_LZW (x:xs) = work init [x] xs where init = map (\x -> [x]) $ enumFromTo minBound maxBound -- TODO: Matching decode_LZW function. -- TODO: Huffman encoding. -- TODO: Arithmetic coding.
It may also be useful to add the following for test purposes:
Anybody know how to use
import Data.Word data SmallAlpha = AA | BB | CC | DD deriving (Show, Eq, Ord, Enum, Bounded) parse1 'a' = AA parse1 'b' = BB parse1 'c' = CC parse1 _ = DD -- For safety parse = map parse1
to make a type like
newtype
but with
Char
and
minBound
much closer together?
maxBound | https://wiki.haskell.org/index.php?title=Toy_compression_implementations&diff=11324&oldid=11323 | CC-MAIN-2015-32 | refinedweb | 157 | 52.7 |
A bit of protocol: * If you're writing on a public list, address your questions to the whole audience, not to a specific individual * I don't know anything (much) about eXist * This list is about XSLT, and there's a strict policy about staying on-topic. I don't see any XSLT content in this question. Michael Kay Saxonica mike@xxxxxxxxxxxx +44 (0) 118 946 5893 On 6 Aug 2014, at 06:06, L2L 2L emanuelallen@xxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > ... Here: > > This is an open environment to writing xQuery in --somewhat-- the browser. > > In your version, you defined namespace for the window's objects, and methods to be use in xQuery environment. > > ... I don't want to waste any more time on this and just concentrate on JavaScript for all my scripting requirement. > > I just would like to query you on a few things. > > Going through this approach: > > Can one extract the window namespace modular from your source ode as is, and place it in this as a modular namespace to access extended method and property of the window object? > > If so, can't one link a file to that file their server to the web browser to run the code in the file on the web browser with a connection open? Like a chat socket --such a novice, don't have the understanding to be using this word-- to open up a lexical --again, not quite there yet with this terminology-- to be of effect to the environment in the browser. As transferring the scope environment. So it'll be more of a mixture with namespace: > > One is the browser and the other is xQuery. > > Would this work in away? Would it simplified everything, this theory that I have wrote to you, could it be done? > > eXist have reply to me that, this is an interested feature to add on, but not at the immediate time due to shortest of hands. I wish to simplified this for them... Make it to where it's a more sudo approach --not actually in the browser, but the effect of it being as if it was actually running in the browsers-- to the situation/problem. Giving developers who work with XML and JavaScript a chance to actually tries something new, and write in xQuery; to both query the DOM, and access the method and properties of the window/DOM object. > > Again, not actually being invoke in the browser, but via connection of an open scope to the server to use the lexicon environment of the xQuery engine. > > .... Hope this made sense --in a novice nut shell-- to you. > > Thank you for reading. > > E-S4L > >> On Aug 5, 2014, at 3:38 AM, "L2L 2L" <emanuelallen@xxxxxxxxxxx> wrote: >> >> Michael Kay | http://www.oxygenxml.com/archives/xsl-list/201408/msg00058.html | CC-MAIN-2018-34 | refinedweb | 460 | 68.2 |
Release date: 8/10/2010
Welcome to the developer release notes for Adobe AIR 2.0.3. This update includes fixes that improve the security, stability, performance, and compatibility of AIR.
Please refer to the Adobe AIR 2 release notes for additional information.
For the current Adobe AIR system requirements, please visit:
AIR 2.0.3 includes an updated version of the Flash Player plug-in (10.1.82.73), which is used when displaying SWF content embedded in HTML. For more information, see.
Continue to use the AIR 2.0.2 SDK to develop AIR applications. An SDK corresponding to the AIR 2.0.3 runtime will not be released.
To verify that a bug in your application was fixed in AIR 2.0.3, you can install the AIR 2.0.3 runtime. Use the ADL -runtime parameter to debug under AIR 2.0.3 (see Using the AIR debug launcher for more information).
AIR applications on Windows can now accept HTTP responses compressed with GZIP or Deflate. By default, AIR includes the header "Accept-Encoding: gzip, deflate" with every HTTP or HTTPS request. If the server is configured to compress the response data, network performance is improved. HTTP response compression has been available for Mac and Linux since AIR 2.0.2. Automatically compressing the HTTP request data sent by the application to the server is not supported.
Applications must use the AIR 2 (or later) namespace in the application descriptor file to take advantage of HTTP response compression.
In previous versions of AIR and Flash Player, timers did not restart the timer interval until any code triggered by the timer finished executing. Thus, if you created a timer to repeat every 500ms, and it took 200ms to execute the code in your timer event handler, then the timer would actually dispatch a timer event every 700ms.
As of AIR 2.0.3 and Flash Player 10.1, timers now restart the timer interval immediately. Thus a timer with a repeating interval of 500ms will now fire every 500ms, regardless of how long the code triggered by the timer event handler takes to execute.
This change can cause the timers in your application to dispatch timer events more frequently than before. Because the code triggered by the timer is run more frequently, the overall CPU utilization of your application may increase. If this increase is significant for your application, increase the intervals assigned to the timers in your application to compensate.
All AIR applications that use timers may be affected by this change when run with the AIR 2.0.3 runtime.
Adobe AIR 2.0.3 includes security improvements described in Security Bulletin APSB10-16.
Camera resolution cannot be increased beyond 320x240 on Ubuntu Linux (2586239)
Typing characters with an IME when focused on a button or other non-editable component can cause an application to quit unexpectedly. (Linux only) (2650465)
To report a feature request, please submit and vote on ideas using the Adobe AIR Ideas website.
To report a bug, please report the issue using the Adobe AIR feedback bug feedback form. | https://www.adobe.com/support/documentation/en/air/2_0_3/releasenotes_developers.html | CC-MAIN-2016-40 | refinedweb | 518 | 57.77 |
Post from my blog. If you're enjoying the series, please consider buying me a coffee.
Now that we have a very basic webserver, we must decide what it is we actually want to create to proceed any further. On request by David Wickes I decided to make a "todo-mvp" for the purpose of this tutorial. We won't be following the specifications exactly because
I couldn't be arsed to read them there are things I want to discuss beyond what makes sense for a todo-mvp.
Basic types
First, let's create the data-type that will hold the todo list's information. We need a list of tasks, each task must have a state; "done" or "not done". Let's first create a type to differentiate between "done" and "not done". And no, we won't be using a boolean. Haskell lets us be more specific than that.
data TaskStatus = Done | NotDone
This creates a type called
TaskStatus, which is inhabited by
Done and
NotDone.
We can use our
TaskStatus in the definition of a
Task:
data Task = Task String TaskStatus
The first
Task is the type name, the second
Task is the constructor name.
Done and
NotDone are also constructors, they just don't take any arguments. The
Task constructor, on the other hand, requires a
String and a
TaskStatus as an argument. A constructor can be used as a function, so we can create a value of type
Task like so:
myTask :: Task myTask = Task "create todo list" NotDone
When defining a type with only one constructor, it is common for the type's name and the constructor name to be the same. Since types and terms can't occur in the same place, the compiler will have no trouble figuring out which one we mean.
note
We can also create types as records:
data Task = Task { description :: String , status :: TaskStatus }
this can be useful to name the fields of your type, but I won't go into records yet.
Finally, we want to have a list of tasks:
myTodoList :: [Task] myTodoList = [ Task "create todo list" Done , Task "invent terror drones" NotDone , Task "achieve world domination" NotDone ]
Just like
IO,
List is a higher-kinded type with kind
* -> *. It takes a type and produces the type for a list of elements of that type.
List Int is a list of integers,
List String is a list of strings,
List (List Boolean) is a list of a list of booleans, and so on.
note
List is also a monad. We get
returnby putting a single element in a list,
fmapby
mapand we can get
>>=using concatenation
concat :: [[a]] -> [a]by doing an
fmapfollowed by a
concat. Many other data structures are monads too.
We'll want to send our todo list as HTML, so we must make a function to convert
[Task] into HTML. Let's start with a conversion function for a single task:
toHTML :: Task -> String toHTML task = case task of Task description status -> case status of NotDone -> "<p>" ++ description ++ "</p>" Done -> "<p><strike>" ++ description ++ "</strike></p>"
What's going on here? We're using a case expression. A case expression is similar to a switch in imperative programming; it evaluates a different expression based on the value of a variable. Rather than matching an exact value though, we match on patters. The pattern
NotDone matches a
TaskStatus created with the
NotDone constructor. Similarly, the pattern
Task description status matches any value of type
Task created with the
Task constructor. In that case
description and
status would bind to the first and second argument of the constructor, and we could use them on the right side of the arrow.
++ is the string concatenation operation.
Oh, and Haskell is indentation-sensitive.
Finally, let's make a function that turns our snippets of HTML into a web page.
toHTMLPage :: String -> String toHTMLPage\ \<head>\ \ <meta charset=\"utf-8\" />\ \ <title>TODO list </title>\ \</head>\ \<body>\ \ " ++ innerHTML ++ "</body>"
We use
\ to escape a newline, and top escaping at the next
\. This might seem obnoxious at first because it's a lot more characters than using a multi-line string delimiter, but this allows us to have the right indentation in both code and output. We also use
\ to escape the
" string delimiter.
Run
stack build to ensure you have no type errors.
Hoogle
But there's a problem, the
responseLBS function from last chapter only accepts a lazy
ByteString, whereas here we have a
String. So what is the difference? A
String is a list of
Chars, whereas a
ByteString is an array of bytes. A
Char is a representation of unicode code point, a byte is (generally) 8 bits with no meaning attached to it.
So what is the distinction between a lazy and a strict
ByteString? Isn't everything in Haskell lazy? Well, this is a different sort of lazy. A strict
ByteString is a single vector of bytes. But because Haskell is pure, we cannot mutate it. That means that if we need to change or append 1 byte, we have to deep copy everything else in the
ByteString. A lazy
ByteString consists of multiple vectors of bytes, so we can copy references to the parts that didn't change.
So, how do we change a list of code points into a sequence of bytes? We have to specify the right encoding. We could use the
Data.ByteString.Lazy.Char8 module that comes with the bytestring package, but the documentations tells us "all Chars will be truncated to 8 bits", which is not what we want! HTML supports more than just ASCII characters.
Let's Hoogle it!
Visit hoogle.haskell.org and search for "String -> ByteString". These are the results I get:
We've already rejected the first result, but fromString in the utf8-string package looks promising.
Add the right version of utf8-string under dependencies in
package.yaml. My dependencies now look like this (you may have different versions):
dependencies: - base >= 4.7 && < 5 - warp >= 3.2.28 && < 4 - wai >= 3.2.2.1 && < 4 - http-types >= 0.12.3 && < 0.13 - utf8-string >= 1.0.1.1 && < 2
We'll need to import a new module, namely
Data.ByteString.Lazy.UTF8:
import qualified Data.ByteString.Lazy.UTF8 as UTF8 (fromString)
Now, we can change our
requestHandler to send a task as response:
requestHandler :: Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived requestHandler request respond = let htmlPage = UTF8.fromString $ toHTMLPage $ toHTML myTask response = responseLBS status200 [] htmlPage in do putStrLn "Received an HTTP request!" respond response
Now you can
stack run to start your server and navigate to to see a rather disappointing website.
Typeclasses
Okay, so we can now send a single
Task as an HTML element, but we want to send more than just that! We need to be able to at least convert a list of tasks to HTML and possibly other stuff too. We want different types to be able to have similar functions available, and be able to write code based on those functions, rather than for each individual type. Enter typeclasses! A typeclass defines a set of functions that must be available for a type for it to be considered a member of that class.
For instance, for our toHTML function, we might make an
HTML class:
class HTML a where toHTML :: a -> String
Here we create a class
HTML, we use
a as a placeholder for the yet unknown type, and declare that a member of the class
HTML must specify a function called
toHTML with type signature
a -> String (where
a will be replaced by the type in question).
We can declare that
Task is an instance of the
HTML class:
instance HTML Task where toHTML task = case task of Task description status -> case status of NotDone -> "<p>" ++ description ++ "</p>" Done -> "<p><strike>" ++ description ++ "</strike></p>"
By providing an implementation of the requirements for being a member of the
HTML class, we have essentially proven that
Task is a member of
HTML.
We can do something similar for lists:
instance HTML a => HTML [a] where toHTML listOfElements = let elementToListElement :: HTML a => a -> String elementToListElement element = "<li>" ++ toHTML element ++ "</li>" in "<ul>" ++ (concat $ map elementToListElement listOfElements) ++ "</ul>"
There is a lot of new stuff in there, so let's look at it bit by bit.
What is this weird
=> arrow? Well it's a sort of restriction to the type signature that comes after it.
instance HTML a => HTML [a] is saying that
[a] is an instance of the
HTML class, but only if the variable type
a is as well. So a
[Task] is an instance of
HTML, because
Task is, but
[Char] is not, because
Char is not an instance of
HTML (not yet anyway). This restriction on the type variable
a tells us
a must follow the rules of the
HTML class. Specifically, there must be a function
toHTML :: a -> String, and we will be able to use that function when declaring
toHTML for
[a].
Similarly, in
elementToListElement,
HTML a tells us this function only works for instances of the
HTML class, letting us use the
toHTML function.
Finally, we find the functions
map - which you're likely familiar with, it creates a new list by applying a function to all elements of another list - and concat, which concatenates a list of
Strings into a single
String.
The open world assumption
Now, you might want to also make a
String an instance of
HTML. Unfortunately, you cannot do that, because
String is defined as being a list of characters
[Char]. We already have an instance for
[a], and
[Char] is also a
[a]. If we were to declare:
instance Html [Char] where -- Bad! toHTML = ...
the compiler would complain, because it is no longer clear which implementation of
toHTML to use. Even if we were to remove the instance declaration for
[a], it would still be illegal, as we might add it later, potentially changing the behavior of code in a completely different place. We say it violates the open world assumption. We do not know what else there is, so we are only allowed to match instances on data declarations.
But how can a
String not be a data declaration? We can create aliases for existing types:
type String = [Char]
This defines the
String type to be a different name for the
[Char] type. If we had:
data String = String [Char]
We would not have this problem. It is not a popular opinion, so take it with a grain of salt, but I personally consider
type declarations to be bad style: things that are the same should be called by the same name, otherwise we're just obfuscating the types. Aliases can save you some time though, and I have used them myself, but I'm never proud of them.
side note 1
Instance declarations match on the right side of the
=>. That means that even if you were to used advanced type programming to make the left sides of two instance declarations mutually exclusive, you still would not be able to have overlapping instances.
side note 2
There is a language extension that will let you have overlapping instances, but I do not recommend it.
Putting it all together
We can now also change our
toHTMLPage to be defined in terms of the
HTML class:
toHTMLPage :: HTML a => a -> String toHTMLPage\ \<head>\ \ <meta charset=\"utf-8\" />\ \ <title>TODO list </title>\ \</head>\ \<body>\ \ " ++ toHTML a ++ "</body>"
And of course don't forget to change
requestHandler to work with our new definition! And let's send the entire list over while we're at it.
htmlPage = UTF8.fromString $ toHTMLPage myTodoList
stack run it and let's see our website:
Great success!
Final code for this chapter.
Discussion (0) | https://dev.to/drbearhands/types-of-todo-52g4 | CC-MAIN-2021-49 | refinedweb | 1,961 | 69.82 |
I have a CM on v6.2 and Cluster on 5.14.4. I am trying to use the swagger API V30 to manage the cluster.
I am trying to follow the examples listed on the web page. I am able to print the cluster.name which means my connection is correct. However I can't get anything out when try to follow "Inspecting a service".
I am wondering if the API client only work with 6.x cluster, or it should work with 5.14 cluster as well.
thanks.
# comment out because my cluster is not 6.x
# if cluster.full_version.startswith("6."): services_api_instance = cm_client.ServicesResourceApi(api_client) services = services_api_instance.read_services(cluster.name, view='FULL') for service in services.items: print service.display_name, "-", service.type if service.type == 'HDFS': hdfs = service
The CDH version should not be relevant here. If you are using CM 6.2 API, then the compatible API (v30) should be fine.
I recommend adding instrumention to the code to print out the value after each call to find out where it is failing.
Also, you might try this slightly different example form the python docs...
from __future__ import print_function import time import cm_client from cm_client.rest import ApiException from pprint import pprint # Configure HTTP basic authorization: basic configuration = cm_client.Configuration() configuration.username = 'YOUR_USERNAME' configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = cm_client.ServicesResourceApi(cm_client.ApiClient(configuration)) cluster_name = 'cluster_name_example' # str | view = 'summary' # str | (optional) (default to summary) try: # Lists all services registered in the cluster. api_response = api_instance.read_services(cluster_name, view=view) pprint(api_response) except ApiException as e: print("Exception when calling ServicesResourceApi->read_services: %s\n" % e)
You can plug your cluster name (returned by the previous example you had success with) into the "cluster_name" variable.
Thank you bgooley for confirming it should work. I will spend time to do more experiement and post back the results.
Regards,
Kevin_Z
It's working now. probably there was a startup/shutdown when I tried previously.
thanks | https://community.cloudera.com/t5/Support-Questions/does-the-swagger-api-v30-support-cm6-2-and-cluster-5-14/td-p/92813 | CC-MAIN-2019-35 | refinedweb | 329 | 53.47 |
Alibaba Cloud NAS is a file storage service facing to Alibaba Cloud Elastic Compute Service (ECS) instances and provides the standard file access protocol. You can use the distributed file system with unlimited capacity, extensive capabilities, single namespace, multiple sharing, high reliability, and high availability, without modifying the existing applications.
Limits
Currently, Hangzhou, Shanghai, Beijing, and Shenzhen are opened for Alibaba Cloud NAS, and you can only create NAS data volumes for clusters in these regions.
Prerequisites
You can only activate the data volume function when your cluster meets the following conditions:
The cluster Agent is of version 0.6 or later versions.
You can view your Agent version on the Cluster List page. Click More at the right of the cluster and then select Upgrade Agent from the list. For how to upgrade the Agent, see Upgrade Agent.
The acsvolumedriver application is deployed in the cluster. We recommend that you update the acsvolumedriver to the latest version.
You can deploy and update the acsvolumedriver application by upgrading the system services. For details, see Upgrade system services.
Procedure
Take the Container Service cluster whose Region is China East 1 (Hangzhou) and Network Type is Virtual Private Cloud (VPC) as an example.
Step 1: Create an NAS file system
Log on to the NAS console and create a NAS file system. For details, see Create a file system.
Note: The created NAS file system and your cluster must be in the same region.
In this example, an NAS file system with China East 1 (Hangzhou) as the Region is created.
Step 2: Add a mount point of a Container Service cluster
Log on to the NAS console and add a mount point. For details, see Add a mount point.
If the network type of your container cluster is Classic, add a classic network mount point.
If the network type of your container cluster is VPC, add a VPC mount point.
In this example, add a VPC mount point.
Note: Select the VPC in which your container cluster resides in the VPC field. Otherwise, an error occurs when creating the data volumes.
Add the intranet IP addresses of the ECS instances in the cluster to the NAS file system whitelist to make these ECS instances can access the NAS file system.
For clusters created after February 2017, the intranet IP addresses of the ECS instances in the cluster will be automatically added to the NAS file system whitelist when NAS data volumes are created. You do not need to perform any operations.
After creating the NAS data volumes, Container Service will automatically create NAS data volumes for newly added or expanded ECS instances and add the intranet IP addresses of the newly added ECS instances to the NAS file system whitelist when you expand the cluster (for details, see Add an existing ECS instance or Expand a cluster).
For clusters created before February 2017, you can add the intranet IP addresses of the ECS instances in the cluster to the NAS file system by:
Manually adding the whitelist.
Log on to the NAS console. Create a permission group and add permission group rules to add the intranet IP addresses of the ECS instances in the cluster to the whitelist. For details, see Use permission groups to control the access.
Use this method to add the whitelist and create the NAS data volumes. Then, when you expand the cluster (for details, see Add an existing ECS instance or Expand a cluster), Container Service will automatically create the NAS data volumes for the newly added or expanded ECS instances. However, before using such data volumes, you must and can only manually add the intranet IP addresses of the newly added ECS instances to the NAS file system whitelist.
Authorizing in RAM. The whitelist will be automatically added after the authorization. Container Service will automatically add the intranet IP addresses of the newly added ECS instances to the NAS file system whitelist when you expand the cluster (for details, see Add an existing ECS instance or Expand a cluster).
Log on to the RAM console.
Click Users in the left-side navigation pane.
Click the user
acs_ram_account_[cluster_id].
Click User Authorization Policies in the left-side navigation pane and then click Edit Authorization Policy in the upper-right corner.
The Edit User-Level Authorization dialog box appears. Enter NAS in the search box and select AliyunNASFullAccess. Click the add (
) button to add the authorization policy to the Selected Authorization Policy Name section and then click OK.
Enter the cellphone verification code and then click OK to complete the authorization.
Step 3: Create an NAS data volume
Log on to the Container Service console.
Click Data Volumes in the left-side navigation pane.
Select the cluster in which you want to create a data volume from the Cluster list.
Click Create in the upper-right corner.
The Create Data Volume dialog box appears. Complete the configurations and then click Create. Container Service will create NAS data volumes with the same name on each node in the cluster.
You can log on to the NAS console. Click the ID of the NAS file system that the cluster will mount to view the details of the file system.
Complete the configurations for the data volume according to the file system details.
- Name: The data volume name, which must be unique in the cluster.
- File System ID: The ID of the NAS file system.
- Mount Point Domain Name: The mount address of the mount point in the NAS file system for the cluster.
- Path: The subdirectory under the NAS path, which is started with
/. After setting the subdirectory, the data volumes will be attached to the specified subdirectory.
- If the specified subdirectory does not exist in the NAS root directory, the subdirectory will be created first by default and then has the data volumes attached.
- With this field not configured, the data volumes will be attached to the NAS root directory by default.
- Privilege: Set the access permission for the mount directory. For example, 755, 644, and 777.
- This field can only be configured when the data volumes are attached to the NAS subdirectory. When the data volumes are attached to the root directory, this field cannot be configured.
- With this field not configured, the privilege is the original permission of the NAS file by default.
Note: Upgrade the volume driver to the latest version if you want to configure the Path and Privilege fields.
Subsequent operations
After creating the data volumes, you can use the created data volumes in your applications. For how to use the data volumes in applications, see Use third-party data volumes. | https://www.alibabacloud.com/help/doc-detail/56330.htm | CC-MAIN-2018-34 | refinedweb | 1,108 | 55.74 |
LAB: CAN bus
Objective
- Get practical experience with CAN bus communication
- Create hardware circuitry necessary for the CAN bus
You need to work with your lab partner for this lab. Be sure to pair program and not work independently on this lab.
Part 0: Interface two boards over CAN transceiver
CAN bus requires additional hardware that will be interfaced to your board. Your CAN controller has Rx and Tx wires, and these are interfaces to a "CAN Transceiver" which translates the Tx wire to the CAN bus line. Note that when this translation is performed, the CANH and CANL represent the state of the single Tx wire, and you are basically at half-duplex CAN bus. At any time, you are either transmitting or receiving, but you cannot be transmitting and receiving at the same time because CAN bus is a half-duplex bus. If you are actively transmitting, the Rx wire represents your own transmission that is read back from CANH and CANL.
Part 1: Configure the CAN driver
Reference the following starter code for details. To initialize the CAN driver, the easiest approach is to invoke the
init() function and then bypass the CAN message acceptance filter and receive all CAN frames that arrive on the bus.
One thing you should do is that created a new code module such as
can_bus_initializer.h such that at the
periodic_callbacks__initialize(), you invoke a single function to initialize the CAN bus. This would make it easier to add the unit-test for the periodic callbacks, and furthermore not create a blob software anti-pattern.
#include "can_bus.h" void periodic_callbacks__initialize(void) { // TODO: You should refactor this initialization code to dedicated "can_bus_initializer.h" code module // Read can_bus.h for more details CAN__init(...); CAN_bypass_filter_accept_all_msgs(...); CAN_reset_bus(...); }
Part 2: Send and Receive messages
Setup your code in a 10 or 100Hz task:
- Transmit a test message
- Receive all messages enqueued by your CAN driver
- This would empty out all messages you received, not including the message you transmitted
Reference the following starter code for details. Once again, you should actually create a new code module called
can_bus_message_handler.h. This file is definitely expected to grow because you will be handling a lot more CAN messages in your RC car's production code.
#include "can_bus.h" void periodic_callbacks__100Hz(uint32_t callback_count) { // TODO: Send a message periodically can__tx(...); // Empty all messages received in a 100Hz slot while (can__rx(...)) { } }
Be careful of the following:
- Since your periodic callback of 100Hz expects your function to return within 10ms, you cannot block while receiving data from the CAN bus
Part 3: Simple CAN bus application
- Build a meaningful communications' application
- For example, if Board=A senses a switch pressed, then send a 1-byte message with 0xAA, otherwise send 0x00 if button is not pressed
- On Board-B, simply light up an LED (or otherwise turn it off) based on the CAN message data
- For robustness, if the CAN Bus turns off, simply turn it back on at 1Hz (every 1000ms)
- You can be more creative here by sending tilt sensor readings from one board to another board and should have the mindset to go "above and beyond"
Conclusion.
Be sure to submit a Merge Request of your Git repository to get credit for the assignment | http://books.socialledge.com/books/industrial-applications-with-can-bus/page/lab-can-bus | CC-MAIN-2020-40 | refinedweb | 544 | 55.58 |
The world of Deep Learning (DL) Natural Language Processing (NLP) is evolving at a rapid pace. We tried to capture some of these trends in an earlier post which you can check out if you want more background into these developments. Two of the most important trends are the Transformer (2017) architecture and the BERT (2018) language model, which is the most famous model to take advantage of the former architecture. These two developments, in particular, have been pivotal in helping machines perform much better at a wide range of language-reading tasks.
A vital part of these new developments is how they consume the text they need to perform well in complex linguistic tasks. We often skip this part of the process in order to get to the “meatier” core of the cool new model. It turns out that these input steps are a whole research field of their own, with an abundance of complex algorithms all working simply to enable the larger language models to learn higher level linguistic tasks. Think of it like the sorting algorithms needed to order vast arrays of numbers. While you only use the sort function in your Python script there is a whole industry whose sole goal is to optimize for better and better sorting algorithms. But before we dive into the specifics of these algorithms, we first need to understand why reading text is a difficult task for a machine.
Why is reading difficult for machines?
You could understand language before you learned to read. When you started school you could already talk to your classmates even though you didn’t know the difference between a noun and a verb. After that, you learned to turn your phonetic language into a written language so that you could read and write. Once you had learned to turn text into sounds, you were able to access your previously learned bank of word meanings.
Machines don’t have this phonetic head start. Without knowing anything about language we need to develop systems that enable them to process text without the ability, like humans, of already being able to associate sounds with the meanings of words. It’s the classic “chicken and egg” problem: how can machines start processing text if they know nothing about grammar, sounds, words or sentences? You can create rules that tell a machine to process text to enable it to perform a dictionary-type lookup. However, in this scenario the machine isn’t learning anything, and you would need to have a static dataset of every possible combination of words and all their grammatical variants.
Instead of training a machine to lookup fixed dictionaries, we want to teach machines to recognize and “read” text in such a way that it can learn from this action itself. In other words, the more it reads the more it learns. Humans do this by leveraging how they previously learned phonetic sounds. Machines don’t have this knowledge to leverage so they need to be told how to break text into standard units to process it. They do this using a system called “tokenization”, where sequences of text are broken into smaller parts, or “tokens”, and then fed as input into a DL NLP model like BERT. But, before we look at the different ways we can tokenize text let’s first see if we really need to use tokenization at all.
Do We Need Tokenizers?
To teach a DL model like BERT or GPT-2 to perform well at NLP tasks we need to feed it lots and lots of text. Hopefully, through the specific design of the architecture, the model will learn some level of syntactic or semantic understanding. It is still an area of active research as to what level of semantic understanding these models learn. It's thought that they learn syntactic knowledge at the lower levels of the neural network and then semantic knowledge at the higher levels as they begin to hone in on more specific language domain signals, e.g. medical vs. technical training texts.
The specific type of architecture used will have a significant impact on what tasks the model can deal with, how quickly it can learn and how well it performs. GPT2 uses a decoder architecture, for example, since its task is to predict the next word in a sequence. In contrast, BERT uses an encoder type architecture since it is trained for a larger range of NLP tasks like next-sentence prediction, question and answer retrieval and classification. Regardless of how they are designed, they all need to be fed text via their input layers to perform any type of learning.
One simple way to do this would be to simply feed the text as it appears in your training dataset. This sounds easy but there is a problem. We need to find a way to represent the words mathematically for the neural network to process it.
Remember, these models have no knowledge of language. So they cannot learn from text if they don’t understand anything about the structure of language. It will just appear like gibberish to the model and it won’t learn anything. It won’t understand where one word starts and another ends. It won’t even know what constitutes a word. We get around this by first learning to understand spoken language and then learning to relate speech to written text. So we need to find a way to do two things to be able to feed our training data of text into our DL model:
- Split the input into smaller chunks: The model doesn't know anything about the structure of language so we need to break it into chunks, or tokens, before feeding it into the model.
- Represent the input as a vector: We want the model to learn the relationship between the words in a sentence or sequence of text. We do not want to encode grammatical rules into the model, as they would be restrictive and require specialist linguistic knowledge. Instead, we want the model to learn the relationship itself and discover some way to understand language. To do this we need to encode the tokens as vectors where the model can encode meaning in any of the dimensions of these vector. They can be used as outputs since they represent the contextual reference for the words. Alternatively, they can be fed into other layers as inputs to higher level NLP tasks such as text classification or used for transfer learning.
Before we can start training our model to produce better vectors, we first need to figure out which tokenization policy we need to implement in order to break our text into small chunks.
If you asked english language speakers they would most likely say that breaking sentences into word-level chunks or tokens seems like the best approach. And they would be right to some extent. In the above diagram you can see that even for word tokenization there are some difficulties in creating tokens: do we ignore punctuation or include them, or do we write specific rules to end up with more coherent and useful word tokens?
So even if you work out a standard approach or ruleset that enables you to encode text into word tokens, you will still run into a few core problems:
- You need a big vocabulary: When you are dealing with word tokens you can only learn those which are in your training vocab. Any words not in the training set will be treated as unknown words when using the model and identified by the dreaded “<UNK>” token. So even if you learned the word “cat” in your training set, the final model would not recognize the plural “cats”. It does not break words into sub-words so it would miss anything like “talk” vs. “talks” vs. “talked” and “talking”. All of these would need individual tokens at the word level which, among other things, is a very inefficient approach. Although you could address this by applying stemming or lemmatization to your input text to reduce the size of your vocabulary, you still end up with an extra step in your NLP pipeline and may be limited to certain languages.
- We combine words: The other problem is that there may be some confusion about what exactly constitutes a word. We have compounded words such as “sun” and “flower” to make sunflower and hyphenated words such as “check-in” or “runner-up”. Are these one word or multiple? And we use text sequences such as “New York” or “bachelor of science” as one unit. They may not make sense as isolated words.
- Abbreviated words: With the rise of social media we have shorthand for words such as “LOL” or “IMO”. Are these collections of words or new words?
- Some languages don’t segment by spaces: It’s easy to break up english sentences into words for languages such as english which separate words by spaces but this is not true for all languages such as Chinese. In these cases word separation is not a trivial task.
OK, Let’s Tokenize Characters Instead of Words?
An alternative approach to using words is to simply tokenize the input text character by character. This way we avoid a number of pitfalls of word tokenization. For example, we can now avoid things like unknown words, since at the character level you can create an embedding for any word. You will know all the elements of the alphabet that make up the language so you can construct an embedding for any combination of those elements.
In the above diagram we can see that there are a number of different ways we can perform this character encoding. We can, for example, ignore spaces and simply treat every character and symbol as a single token and have a separate vector for each token. Alternatively, we may want to limit our character vocabulary to certain symbols and thus remove symbols like apostrophes. All of these ignore the spacing of words, so we may want to assign a symbol to a space and use this when creating the embedding vectors for each token.
Hopefully, using any of these approaches misspelled words or the unusual spelling of words (e.g. cooooooool) should appear as similar to each other as their learned embeddings will be close together. The same applies to different versions of the same verb, e.g. “walk”, “walk-ing”, “walk-ed”, and so on.
However, there are some drawbacks with this approach also:
- Lack of meaning: Unlike words, characters don’t have any inherent meaning, so there is no guarantee that the resultant learned representations will have any meaning. Letters may be combined into slightly unusual combinations which are not correct words. More training data should help alleviate this tendency, but we are still left with a situation where the model is losing the semantic-specific feature of words.
- Increased input computation: If you use word level tokens then you will spike a 7-word sentence into 7 input tokens. However, assuming an average of 5 letters per word (in the English language) you now have 35 inputs to process. This increases the complexity of the scale of the inputs you need to process
- Limits network choices: Increasing the size of your input sequences at the character level also limits the type of neural networks you can use. It is difficult to use architectures which process input sequentially since your input sequences will be much longer. However, new models such as BERT are based on the Transformer architecture, which processes inputs in parallel, meaning that this is no longer a major limitation. However, it still impacts your choice of networks since it is difficult to perform some type of NLP tasks on characters. If you are training a Parts Of Speech (POS) tagger or a classifier then it is more difficult to work at the character level. You will need to do more work than if you trained it at a word level to optimize for your task.
If word-level tokens are not ideal, and character-level tokens seem to have their own issues, then what are the alternatives? One alternative that has proved popular is a balance between the character level and the word level known as the subword-level tokenization.
Subword Tokenization
We want a system that is able to deal with missing tokens without needing an infinite vocabulary. In other words, we want a tokenization scheme that deals with an infinite potential vocabulary via a finite list of known words. Also, we don’t want the extra complexity of breaking everything into single characters since character-level tokenization can lose some of the meaning and semantic niceties of the word level.
One way we can solve this problem is by thinking of how we can re-use words and create larger words from smaller ones. Think of words like “any” and “place” which make “anyplace” or compound words like “anyhow” or “anybody”. You don’t need an entry for each word in your vocabulary list. Instead you just need to remember a few words and put them together to create the other words. That requires much less memory and effort. This is the basic idea behind subword tokenization. Try and build up the smallest collection of subword chunks which would allow you to cover all the words in your dataset without needing to know every word in that vocabulary.
To make a more efficient system, the subword chunks do not even need to be whole words. You could, for example, make up the word “unfortunately” via “un” + “for” + “tun” + “ate” + “ly”. Subword tokenisation will break the text into chunks based on the word frequency. In practice what happens is that common words will be tokenized generally as whole words, e.g. “the”, “at”, “and”, etc., while rarer words will be broken into smaller chunks and can be used to create the rest of the words in the relevant dataset.
The other factor which applies here is the size of the vocabulary allowed. This is chosen by the person running the subword algorithm. The larger the vocabulary size the more common words you can tokenize. The smaller the vocabulary size the more subword tokens you need to avoid having to use the<UNK> token. It is this delicate balance that you can tinker with to try and find an optimum solution for your particular task.
Byte Pair Encoding (BPE)
One popular algorithm for subword tokenisation which follows the above approach is BPE. BPE was originally used to help compress data by finding common byte pair combinations. It can also be applied to NLP to find the most efficient way of representing text. We can look at an example to see how BPE works in practice (I used code from Lei Mao’s blog for the following example. You should check out the blog if you are interested in an even deeper dive into the world of BPE):
Imagine you have a text sample that contains the following words:
“FloydHub is the fastest way to build, train and deploy deep learning models. Build deep learning models in the cloud. Train deep learning models.”
First let’s look at how often the individual words appear. The words in this text occur in the following frequency:
The first thing you can see here is that there is a “</w>” token at the end of each word. This is to identify a word boundary so that the algorithm knows where each word ends. This is important as the subword algorithm looks through each character in the text and tries to find the highest frequency character pairing. Next, let's look at the frequency of character level tokens:
A few points to note here. Look through the table and familiarize yourself with the tokens and how frequently they occur. You can see the “</w>” character occurs 24 times, which makes sense as there are 24 words. The next most frequent token is the “e” character, which occurs 16 times. In total there are 27 tokens. Now the BPE algorithm looks at the most frequent pairing, merges them and does another iteration.
What is merging?
The main goal of the BPE subword algorithm is to find a way to represent your entire text dataset with the least amount of tokens. Similar to a compression algorithm, you want to find the best way to represent your image, text or whatever you are encoding, which uses the least amount of data, or in our case tokens. In the BPE algorithm merging is the way we try and “compress” the text into subword units.
Merging works by identifying the most frequently represented byte pairs. In our example here a character is the same as a byte, but this will not always be the case, e.g. in some languages a character will be represented by multiple bytes. But for our purposes, and to keep it simple, a byte pair and a character pair are the same. There are a few steps to these merging actions (some of which we have already performed in our simple example):
- Get the word count frequency
- Get the initial token countand frequency (i.e. how many times each character occurs)
- Merge the most common byte pairing
- Add this to the list of tokens and recalculate the frequency count for each token; this will change with each merging step
- Rinse and repeat until you have reached your defined token limit or a set number of iterations (as in our example)
We already have our word and token values in the above tables. Next we need to find the most common byte pair and merge both into one new token. After one iteration our output looks like this:
After one iteration our most frequent pairing is “d” and “e”. As a result we combined these to create our first subword token (which is not a single character) “de”. How did we calculate this? If you remember the word frequencies we calculated earlier you can see how “de” is the most frequent pairing.
If you add up the frequency of the word in which “de” appears in you get 3 + 2 + 1 + 1 = 7 which is the frequency of our new “de” token. Since “de” is a new token we need to recalculate the counts for all our tokens. We do this by subtracting the frequency of the new “de” token, 7, from the frequency of the individual tokens before the merging operation. This makes sense if you think about it. We have just created a new token “de”. This occurs 7 times in our dataset. Now we only want to count the times “d” and “e” occur when not paired together. To do this we subtract 7 from the original frequency of occurrence of “e”, 16, to get 9. And we subtract 7 from the original frequency of “d”, 12, to get 5. You can see this in the “iteration 1” table.
Let’s do another iteration and see what the next most frequent pairing is:
Again, we add a new token, bringing the number of tokens to 29, so we have actually increased the number of tokens after 2 iterations. This is common; as we start to create new merged pairs the number of tokens increases but then begins decreasing as we combine those together and remove other tokens. You can see this number change as we go through different iterations here:
As you can see the number of tokens initially increases as we start merging. Then it reaches a peak at 34 and starts to decrease. At this point subword units start to merge and we begin eliminating one or both of the merged pairs. We then build up our tokens into a format which can represent the entire dataset in the most efficient way. For our example here we stop at around 70 iterations with 18 tokens. In fact, we have recreated the original words from a starting point of individual character tokens. The final token list looks like:
Does this look familiar? Indeed it should, it is the original word list we started with. So what have we done? We have recreated the original word list by starting with the individual characters and merging the most frequent byte pair tokens over a number of iterations (If you use smaller iterations you will see different token lists). While this may seem pointless remember that this was a toy dataset and the goal was to show the steps taken for subword tokenization. In a real world example the vocabulary size of your dataset should be much larger. Then you would not be able to have a token for each word in your vocabulary.
Probabilistic Subword Tokenization
For BPE we used the frequency of words to help identify which tokens to merge to create our token set. BPE ensures that the most common words will be represented in the new vocabulary as a single token, while less common words will be broken down into two or more subword tokens. To achieve this, BPE will go through every potential option at each step and pick the tokens to merge based on the highest frequency. In this way it is a greedy algorithm which optimizes for the best solution at each step in its iteration.
One downside of BPE’s greedy approach is it can result in a potentially ambiguous final token vocabulary. The output of your BPE algorithm is a token set like the one we generated earlier. This token set is used to encode the text for the input to your model. The problem occurs when there is more than one way to encode a particular word. How do you choose which subword units to use? You don’t have any way to prioritize which subword tokens to use first. As a simple example, pretend our final token set for our toy example was the following subword tokens:
And out input sentence contained the phrase “deep learning”. Then there would be a number of different ways we could encode this using our token set:
So while the input text is the same it can be represented by three different encodings. This is a problem for your language models as the embeddings generated will be different. These three different sequences will appear as three different input embeddings to be learned by your language model. This will impact the accuracy of your learned representations as your model will learn that the phrase “deep learning” appears in different context when in fact it should be the same relational context. To address this we need some way to rank or prioritize the encoding steps so that we end up with the same token encodings for similar phrases. This is, conveniently, a feature of probabilistic subword models such as unigram.
Unigram Subword Tokenization
We have seen that using the frequency of subword patterns for tokenization can result in ambiguous final encodings. The problem is that we have no way to predict which particular token is more likely to be the best one when encoding any new input text. Luckily, needing to predict the most likely sequence of text is not a unique problem to tokenization. We can leverage this knowledge to build a better tokenizer.
The goal of a language model, which in some form or another underpins all current deep learning models such as BERT or GPT2, is to be able to predict a sequence of text given some initial state. For example, given the input text “FloydHub is the fastest way to build, train and deploy deep ????”, can you predict the next text sequence? Is it “deep … sea”, “deep … space”, “deep … learning” or “deep … sleep”. A well trained language model should be able to provide a probability for which is most likely given the preceding sequence of text. From our own simple example we can see that predicting the next word is more accurate the more words we take into account. However, the more words we take into account the more complex the model becomes since this increases the dimensionality of our LM and makes the conditional probability more difficult to calculate.
To address this complexity the simplest approach is the unigram model which only considers the probability of the current word. How likely it is that the next word is “learning” depends only on the probability of the word “learning” turning up in the training set. Now, this is not ideal when we are creating a model that is trying to predict a coherent sentence from some starting point. You would want to use a model with a larger training sequence such as a LM that looks at the preceding 2-3 words. This will have a better chance of generating a more coherent sentence as we can see even from our simple example. The goal for a subword model, however, is different from a LM that is trying to predict a full sentence. We only want something that generates unambiguous tokenization.
In 2018 a paper was released which described how to use this unigram LM approach to choose subword tokens. It is a great paper to check out since it describes the BPE approach as well and goes through its advantages and disadvantages. There is some math in the paper which covers the probability side of things but even that is well explained. The unigram approach differs from BPE in that it attempts to choose the most likely option rather than the best option at each iteration. To generate a unigram subword token set you need to first define the desired final size of your token set and also a starting seed subword token set. You can choose the seed subword token set in a similar way to BPE and choose the most frequently occurring substrings. Once you have this in place then you need to:
- Work out the probability for each subword token
- Work out a loss value which would result if each subwork token were to be dropped. The loss is worked out via an algorithm described in the paper (an expectation maximization algorithm).
- Drop the tokens which have the largest loss value. You can choose a value here, e.g. drop the bottom 10% or 20% of subword tokens based on their loss calculations. Note you need to keep single characters to be able to deal with out-of-vocabulary words.
- Repeat these steps until you reach your desired final vocabulary size or until there is no change in token numbers after successive iterations.
The Story so Far
So far we have explained why we need to tokenize input text sequences for deep learning NLP models. We then looked at some of the common approaches to tokenizing text and then we reviewed two recent models for subword tokenization in the form of BPE and unigram. Knowing something about both of these latter models means you should be able to understand nearly all of the tokenizer approaches currently used in deep learning NLP.
Most models will either use these directly or some variant of them. However, it can still be difficult to understand which tokenizer was used in the latest and greatest NLP deep learning model. The reason is that they may mention a tokenizer model which you have not heard of. You might then think it was a waste of time knowing anything about unigram or BPE models. But don’t worry, all is not lost! What happens in most cases is that after a little digging you begin to see that these “new” methods are actually pretty similar to either BPE or unigram.
An example of this is the tokenizer used in BERT, which is called “WordPiece”. We will go through that algorithm and show how it is similar to the BPE model discussed earlier. We will finish up by looking at the “SentencePiece” algorithm which is used in the Universal Sentence Encoder Multilingual model released recently in 2019. SentencePiece brings together all of the concepts that we have spoken about, so it is a great way to summarize what we have covered so far. It also has a great open source repo that lets you take it for a test drive, so we can go through some code examples.
WordPiece
The world of subword tokenization is, like the deep learning NLP universe, evolving rapidly in a short space of time. So when BERT was released in 2018, it included a new subword algorithm called WordPiece. On an initial reading, you might think that you are back to square one and need to figure out another subword model. However, WordPiece turns out to be very similar to BPE.
Think of WordPiece as an intermediary between the BPE approach and the unigram approach. BPE, if you remember, takes two tokens, looks at the frequency of each pair and then merges the pairs that have the highest combined frequency count. It only considers the most frequent pair combinations at each step, nothing else.
An alternate approach is to check the potential impact of merging that particular pair. You can do this using the probabilistic LM approach. At each iterative step, choose the character pair which will result in the largest increase in likelihood once merged. This is the difference between the probability of the new meged pair occurring minus the probability of both individual tokens occurring individually. For example, if “de” is more likely to occur than the probability of “d” + “e”.
This is why I said WordPiece seems to be a bridge between both BPE and unigram approaches. Its overall approach is similar to BPE but it also uses the unigram approach to identify when to merge tokens.
You might be wondering - how is it different from the unigram model itself? That is a good question. The main difference is that WordPiece is a greedy approach. It still tries to build a tokenizer from the bottom up, picking the best pair at each iteration to merge. WordPiece uses the likelihood rather than count frequency but otherwise it is a similar approach. Unigram in contrast is a fully probabilistic approach which uses probability to both choose the pairs to merge and whether to merge them or not. It also removes tokens based on the fact that they add the least to the overall likelihood of the unigram model. Think of dropping the tokens which are at the tail ends of a normal distribution. Note that the individual character tokens will never be dropped since they will be needed to construct potentially out of vocabulary words.
In unigram we drop tokens using a distribution in the same way we would look for the skinny “tail” of a normal distribution. This has a lower density, or in our case would mean these are the tokens which are least likely to result in better tokenization.
Take A Breath!
Phew! I know, right? Who thought this part of the deep learning NLP process would be so difficult? And this is only the first step for these models- we haven’t even got to the main part where we train them to be able to complete common NLP tasks. All that is for a later post or two! For now, let’s briefly summarize what we have so far:
- BPE: Just uses the frequency of occurrences to identify the best match at every iteration until it reaches the predefined vocabulary size.
- WordPiece: Similar to BPE and uses frequency occurrences to identify potential merges but makes the final decision based on the likelihood of the merged token
- Unigram: A fully probabilistic model which does not use frequency occurrences. Instead, it trains a LM using a probabilistic model, removing the token which improves the overall likelihood the least and then starting over until it reaches the final token limit.
It is likely that you could use the BPE model with BERT instead of WordPiece and get similar results. Don’t hold me to this but it should not greatly impact the final results. However, after BERT started gaining widespread attention a new subword model was released which just might be the final step in this recent tokenization evolutionary cycle. This was the SentencePiece algorithm, which we will look at now and hopefully it will help us bring together all of the concepts we have discussed.
SentencePiece
SentencePiece basically tries to bring all the subword tokenization tools and techniques under one banner. It’s kind of like the Swiss Army knife for subword tokenization. To be a Swiss Army-like tool something has to be capable of solving multiple problems. So what problems is SentencePiece addressing:
- All other models assume input is already tokenized: BPE and Unigram are great models but they share one big disadvantage- they both need to have their input already tokenized. BPE needs to have the input tokenized so that every character (including word-boundary characters) are tokenized. Only then can BPE count frequencies and start to merge tokens. Usually this is done by simply doing word level tokenization but, as we discussed earlier, this is a problem with tokenization since not all languages are space segmented. Similarly, the unigram model needs to have its input tokenized before it can start discarding tokens based on their probability distribution. SentencePiece deals with this by simply taking in an input in raw text and then doing everything (which we will discuss below) needed on that input to perform subword tokenization.
- Language agnostic: Since all other subword algorithms need to have their input pre-tokenized, it limits their applicability to many languages. You have to create rules for different languages to be able to use them as input into your model. This gets very messy very quickly.
- Decoding is difficult: Another problem which is caused by models like BPE and unigram requiring already tokenized inputs is you do not know what encoding rules were used. For example, how were spaces encoded in your tokens? Did the encoding rules differentiate between spaces and tabs? If you see two tokens like [new] and [york] together you cannot know whether the original input was “new-york”, “new york”, “new york” or so on. So you cannot decode the input and return it to its original format. This creates problems when you are trying to reproduce results or confirm findings.
- No end to end solution: These are just some of the issues, which means that BPE and unigram are not fully complete or end-to-end solutions. You cannot just plug in a raw input and get an output. Instead they are only part of a solution. SentencePiece gathers everything needed for an end-to-end solution under one neat package.
How does SentencePiece fix all these issues?
SentencePiece uses a number of features that address all of the above issues, which are outlined in detail in both the related paper and the corresponding GitHub repo. Both of these are great resources, but if you are short on time then skimming the repo might be the best way to get a quick overview of SentencePiece and all of its associated Swiss Army greatness.
For now it is enough to note some of the techniques SentencePiece uses to address the above shortcomings before diving into some code examples:
- Encode everything as unicode ...: SentencePiece first converts all the input into unicode characters. This means it doesn’t have to worry about different languages or characters or symbols. If it uses unicode it can just treat all input in the same way, which allows it to be language agnostic
- … including the spaces: To get around the word segmenting issues, SentencePiece simply encodes spaces as a unicode symbol. Specifically it encodes it as unicode value U+2581 (underscore ‘_’ to those of us who don’t speak unicode). This helps with the language agnostic issues and the decoding issue. Since spaces are unicode encoded then they can be easily reversed or decoded and treated (i.e learned) like a normal language character. It sounds like a simple approach and I guess it is, but the best ideas tend to seem that way in the end
- And it’s faster: Google famously noted that “speed isn’t just a feature, it’s the feature”. Well, this isn’t just true for search engines, it’s also true for subword tokenization. One of the issues preventing other subword algorithms from being used to tokenize raw sentences as part of model training was that there lack of speed. If you processed input in real time and performed your tokenization on the raw input it would be too slow. SentencePiece addresses this by using a priority queue for the BPE algorithm to speed it up so that you can use it as part of an end-to-end solution.
Using these and other features, SentencePiece is able to provide fast and robust subword tokenization on any input language for any deep learning NLP model. Now let’s look at it in action.
SentencePiece in action
The SentencePiece Github repo provides some great examples of how to use the library. We will try out some of these to showcase some of the subword algorithms we have spoken about already. However, there is much more to the SentencePiece library than we can go into in a few blog posts. We will aim to cover the main features here to enable you to dig deeper as needed for further exploration. The main things we will cover are:
- Find a good dataset: To really test SentencePiece we want to train it on some data. SentencePiece suggests training on a novel called “Botchan”. While this is fine, it is a Japanese novel written in 1906. So we can find something a bit more up to date. We can use one of the open source datasets made available by lionbridge.ai. It includes this list of datasets for NLP from which we can choose the Blogger Corpus of over 600,000 blog posts (we only need a fraction of this). It should contain a variety of data, common words, slang, misspellings, names and entities and so on.
- Train a BPE model: After creating our dataset we can train a BPE model so that we end up with a list of BPE tokens we can use for encoding.
- Train a Unigram model: Similarly, we can train a unigram model on the same data so we can have unigram-specific tokens.
- Compare the models: Using the trained models we will take a look at the tokens and find the differences. We will also encode some text to see how it looks with both modelsPerform some sampling: As we noted, the unigram model is based on a probability distribution so SentencePiece provides functions to sample from this distribution. These features are only available in the unigram model.
Get Your Training Data
Check out the code repo to see the how to use the blog corpus for training. Note that you can use any data that you like here. This is just a suggestion. All the code for the steps below are in the notebook so you can follow along with all the steps below via the notebook.
Train a BPE Model
We can train a model quite easily using SentencePiece. For now we don’t need to worry about the parameters we use in the training cmd.
# train sentencepiece model from our blog corpus spm.SentencePieceTrainer.train('--model_type=bpe --input=blog_test.txt --model_prefix=bpe --vocab_size=500 --normalization_rule_tsv=normalization_rule.tsv')
The main parameter to note is the “vocab_size”. We set this to 500 just as an example, but you can choose anything you like here. Remember, the larger your vocab size the more common words you will be able to store, but you may want a smaller vocab size for your application for performance reasons.
Once you have trained your model, you just need to load it and you are ready to go!
# makes segmenter instance and loads the BPE model file (bpe.model) sp_bpe = spm.SentencePieceProcessor() sp_bpe.load('bpe.model')
Train a Unigram Model
Now we just need to train the Unigram model and then we can compare the two. You can train the Unigram model in much the same way as the BPE model. Just remember to name them differently!
# train sentencepiece model from our blog corpus spm.SentencePieceTrainer.train('--model_type=unigram --input=blog_test.txt --model_prefix=uni --vocab_size=500 --normalization_rule_tsv=normalization_rule.tsv') # makes segmenter instance and loads the BPE model file (bpe.model) sp_uni = spm.SentencePieceProcessor() sp_uni.load('uni.model')
Let’s Compare the Models
You can encode a sentence with the trained subword tokens by calling the “encode_as_pieces” function. Let’s encode the following sentence: “This is a test”.
print("BPE: {}".format(sp_bpe.encode_as_pieces('This is a test'))) print("UNI: {}".format(sp_uni.encode_as_pieces('This is a test')))
BPE: ['▁This', '▁is', '▁a', '▁t', 'est']
UNI: ['▁Thi', 's', '▁is', '▁a', '▁t', 'est']
The underscore indicates that there is a space with the token and it is case sensitive. So it will view “Test” and “test” as different tokens. Note that the first word appears to have a space before it even though we did not put it there. It assumes there is one since that word is at the start of a sentence. So encoding the sentences “ This is a test” will be encoded in the same way.
Interesting things to note here are that there is no word for “This” or “test” in the Unigram model, but there is for “This” in BPE. In a different dataset these words might have been more common if we chose a larger vocab size. For a blog you would think “this” would be a popular word. Maybe it is the capital “T” which is causing it to be encoded differently? Let’s try “I think this is a test”.
BPE: ['▁I', '▁think', '▁this', '▁is', '▁a', '▁t', 'est']
UNI: ['▁I', '▁think', '▁this', '▁is', '▁a', '▁t', 'est']
So there is a word for “this”! It does not occur with a capital ‘T” enough to be encoded as a specific token for the Unigram model (or it did not increase the merging likelihood enough to be implemented). Since there is no word for “test” the model created it via the combination of “t” and “est”. We can try words that would not be used frequently in this dataset such as “Carbon dioxide”.
BPE: ['▁C', 'ar', 'b', 'on', '▁d', 'i', 'o', 'x', 'ide']
UNI: ['▁C', 'ar', 'b', 'on', '▁d', 'i', 'o', 'x', 'id', 'e']
So it looks like this is not a common word and thus is made up from a collection of more common subword tokens and a few single letter tokens.
Let’s See All Our Tokens
To see all the tokens that were created we can run the following code to see the full list.
vocabs = [sp_bpe.id_to_piece(id) for id in range(sp_bpe.get_piece_size())] bpe_tokens = sorted(vocabs, key=lambda x: len(x), reverse=True) bpe_tokens
We will get a list of 500 tokens (which was our predefined limit) which should represent the most common words followed by the most common subword combinations. You can see from the code that we used the “id_to_piece” function which turns the ID of a token into its corresponding textual representation.
['▁something', '▁because', '▁thought', '▁really', . . . '9', '*', '8', '6', '7', '$']
This is important since SentencePiece enables the subword process to be reversible. You can encode your test sentence in ID’s or in subword tokens; what you use is up to you. The key is that you can decode either the IDs or the tokens perfectly back into the original sentences, including the original spaces. Previously this was not possible with other tokenizers since they just provided the tokens and it was not clear exactly what encoding scheme was used, e.g. how did they deal with spaces or punctuation? This is a big selling point for SentencePiece.
# decode: id => text print("BPE {}".format(sp_bpe.decode_pieces(['▁This', '▁is', '▁a', '▁t', 'est']))) print("BPE {}".format(sp_bpe.decode_ids([400, 61, 4, 3, 231]))) print("UNI {}".format(sp_uni.decode_pieces(['▁Thi', 's', '▁is', '▁a', '▁t', 'est']))) print("UNI {}".format(sp_uni.decode_ids([284, 3, 37, 15, 78, 338])))
BPE This is a test
BPE This is a test
UNI This is a test
UNI This is a test
Anyway, back to our token list. It would be nice to look at the list of tokens created by the different models and see where they are different. To do this we need to create two lists, one containing the Unigram tokens and the other containing the BPE tokens.
We can then simply get Unigram tokens which are not in the BPE list and vice versa. It is interesting to see which tokens are missing from each set. This will tell us something about the different approaches of each subword model. Remember when looking at these tokens the “__” represents a space. When it does not appear it means the word is part of another one or attached to a full stop or comma or some symbol other than a space. When you start tinkering with the encoding this will become clearer.
If we look at some of the BPE tokens which are not in the Unigam model, we see examples like “▁somet” and “ittle”.
diff_pairs = list(zip(uni_tok_diff, bpe_tok_diff)) diff_df = pd.DataFrame(diff_pairs, columns=(["Unigram tokens not in BPE", "BPE tokens not in Unigram"])) diff_df.head()
These are good examples of BPE’s greedy approach. Do we really need a token for “▁somet”? The Unigram model must have calculated that the overall benefit of using this is less than simply using “▁some” along with some other subword units. But for BPE it just checks the most frequent pairing at each step.
Similarly for “ittle”, is it efficient to have this token? If you look in the training data text “little” occurs 159 times. 156 of those are “little”, the other remaining occasions are one “belittle” and two “Little” mentions. If we had a lot of words ending in “ittle” such as “whittle”, “tittle” and “skittle” then it might make sense. But given the lack of those types of words it seems the Unigram type of approach is more efficient. This shows the benefit of using the Unigram approach if you want to have the most efficient subword vocabulary,
Let’s Do Some Sampling
And last but not least, let's take a look at the Unigram sampling functionality. This is only available for the Unigram model since BPE is a frequency-based approach. The sampling functionality of SentencePiece allows you to set the sampling parameters. By default you get the most efficient tokenization, but you can change this if you like. These are very fine-grained and advanced settings which are mentioned in the original paper. The “nbest” parameter allows you to select from more segmentation options. The higher the parameter, the more options will be considered. While this is pretty advanced and it’s difficult to know when you might need to change it, you can at least look at the different tokens returned when you alter these settings.
# Can obtain different segmentations per request. # There are two hyperparamenters for sampling (nbest_size and inverse temperature). see the paper [kudo18] for detail. for n in range(10): print(sp_uni.sample_encode_as_pieces('remembers', -1, 0.1))
['▁re', 'me', 'm', 'b', 'er', 's']
['▁', 're', 'm', 'e', 'm', 'b', 'e', 'r', 's']
['▁remember', 's']
['▁remember', 's']
['▁remember', 's']
['▁', 're', 'me', 'm', 'b', 'er', 's']
['▁', 'r', 'e', 'me', 'm', 'b', 'er', 's']
['▁re', 'me', 'm', 'b', 'e', 'r', 's']
['▁', 'r', 'e', 'me', 'm', 'b', 'er', 's']
['▁remember', 's']
You can read more about this in the subword sampling section of the paper where they discuss the “l-best” approach to sampling.
HuggingFace Tokenizers to the Rescue!
Those great people at HuggingFace have done it again. There latest addition to their already impressive NLP library is, yep, you guessed it, tokenizers. The handy thing about the HuggingFace tokenizers is that they hide much of the complicated details we discussed in this post (don’t worry, it’s still really useful to have a working knowledge of how they work and this will help you with libraries like the HuggingFace tokenizer, I promise).
Now that neural nets have fast implementations, a bottleneck in pipelines is tokenization: strings➡️model inputs.— Hugging Face (@huggingface) January 10, 2020
Welcome 🤗Tokenizers: ultra-fast & versatile tokenization led by @moi_anthony:
-encode 1GB in 20sec
-BPE/byte-level-BPE/WordPiece/SentencePiece...
-python/js/rust... pic.twitter.com/1TfJ1Hm1xx
As we have shown, the SentencePiece library contains everything you need for the BPE and Unigram models. But if you want to use other models such as WordPiece you will need to set that up separately. HuggingFace have all of these under one handy GitHub roof. So let’s train these tokens on our blog data and show how easy it is to use.
With a few lines of code you have access to a whole range of tokenizers including the ones we have discussed above. We can train it on the same test dataset and then simply print the tokens.
from tokenizers import (ByteLevelBPETokenizer, BPETokenizer, SentencePieceBPETokenizer, BertWordPieceTokenizer) tokenizer = SentencePieceBPETokenizer() tokenizer.train(["../blog_test.txt"], vocab_size=500, min_frequency=2) output = tokenizer.encode("This is a test") print(output.tokens)
BPE: ['▁Th', 'is', '▁is', '▁a', '▁t', 'est']
You can see that this is different from the token for our BPE algorithm which we implemented via SentencePiece:
BPE: ['▁This', '▁is', '▁a', '▁t', 'est']
This is possibly due to the different parameters you can set or the default parameters for the different libraries. You can tinker with some of them to see if you can get the tokens to align. This shows the potential issues with using different libraries. If you use SentencePiece and someone else uses HuggingFace then it may tokenize the input differently and result in different results for the same model trained on the same data.
Hopefully, it should be easy enough to align the parameters so that these libraries can be used interchangeably. Alternatively, whichever library you use it may be best to stick with that in all your projects for consistency. It's too early to tell but one of these libraries may just prove to be the defacto standard that most people use going forward.
Conclusion
With the rapid pace of development in Deep Learning, it can be easy to look only at the main, meaty core of models like BERT and XLNet. However, the format used to enable these models to process text is central to how they learn. Understanding the basics about subword tokenizers will give you a way to quickly get to grips with the latest innovations in this field. You do not need to start from scratch when reading up on the latest model hot off the academic press. It will also help if you are trying to build these networks yourself or dealing with multilingual issues when performing traditional NLP tasks. Either way, knowing something about models such as SentencePiece will be a useful foundational tool if you are interested in the field of Deep Learning NLP.
Further Reading
Tokenization is a surprisingly complex topic once you start to get into the finer details of each model. It seems like it is it's own separate research area outside of the more widely know areas such as the LM architecture and models like ELMo, BERT and the Transformer models. So I leant on a wide range of source to try and better understand the area. Here are some of the most helpful resources I found. So If you want to know more about tokenization (or you think I have got it all wrong !) then I recommend the following material:
- A Deep Dive into the Wonderful World of Preprocessing in NLP
- Byte Pair Encoding
- Tokenizing Chinese text
- Character encoding overview
- Tokenization tooling
- Google SentencePiece repo
- Unicode Normalization
About Cathal Horan
Cathal is interested in the intersection of philosophy and technology, and is particularly fascinated by how technologies like deep learning can help augment and improve human decision making. He recently completed an MSc in business analytics. His primary degree is in electrical and electronic engineering, but he also boasts a degree in philosophy and an MPhil in psychoanalytic studies. He currently works at Intercom. Cathal is also aFloydHub AI Writer.
You can follow along with Cathal onTwitter, and also on theIntercom blog. | https://pythondigest.ru/view/48950/ | CC-MAIN-2020-16 | refinedweb | 8,744 | 61.06 |
public class SanderRossel : Lazy<Person>
{
public void DoWork()
{
throw new NotSupportedException();
}
}
DaveAuld wrote:too muooooch
Lazy<Dog>
Audery Hepburn told:I’ve been lucky. Opportunities don’t often come along. So, when they do, you have to grab them.
W∴ Balboos wrote:"Audery Hepburn's 85th Birthday" is the special.
The report of my death was an exaggeration - Mark Twain
Simply Elegant Designs JimmyRopes Designs
I'm on-line therefore I am.
JimmyRopes
JimmyRopes wrote:I want to see Audery Hepburn at 85
Kornfeld Eliyahu Peter wrote:No it's not. I hate when someone makes something cheap 'on the back' of someone who worked so hard...
With all the respect to Peter Jackson, he is not up to write new stories in the name of Tolkien!
And it's event worst - it's a bad action movie!
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages. | http://www.codeproject.com/Lounge.aspx?msg=4813008 | CC-MAIN-2015-32 | refinedweb | 167 | 65.22 |
Which Teiid/AS versions... at runtime?Marco Ardito Mar 1, 2016 7:11 AM
Hi,
a lesser question maybe, but since I have not yet understood how this is managed in Teiid, sorry.
I have a 8.12.3 teiid server, and I think I am sure of this just because its folder is named "teiid-8.12.3" since it's been extracted from a "teiid-8.12.3-server.zip" file I downloaded.
I guess it should be Teiid 8.12.3 on EAP server, since now Teiid site offers a link for "8.12.4 With EAP" like "teiid-8.12.4-server.zip"
But my runtime says different...
- the web console has a top header logo like "Wildfly + Teiid 8.11"
- accessing with jboss-cli.sh -c I get
[standalone@localhost:9999 /] ls
core-service socket-binding-group management-minor-version=7 profile-name=undefined
deployment subsystem name=debiantemplate release-codename=Janus
deployment-overlay system-property namespaces=[] release-version=7.5.0.Final-redhat-15
extension launch-type=STANDALONE process-type=Server running-mode=NORMAL
interface management-major-version=1 product-name=Teiid schema-locations=[]
path management-micro-version=0 product-version=+ Teiid 8.11 server-state=running
and what is this about?
release-version=7.5.0.Final-redhat-15
release-codename=Janus
I am even not so sure about the AS type/version.
- as said the web console states: "Wildfly + Teiid 8.11"
- but the version.txt says
/teiid-8.12.3# cat version.txt
Red Hat JBoss Enterprise Application Platform - Version 6.4.0.Alpha1
...maybe I'm picky, but is there a way to absolutely be sure which real software versions I have in use anytime, anywhere?
Marco
1. Re: Which Teiid/AS versions... at runtime?Steven Hawkins Mar 1, 2016 12:41 PM (in response to Marco Ardito)
> maybe I'm picky, but is there a way to absolutely be sure which real software versions I have in use anytime, anywhere?
The first thing to note is that you are indeed running "Red Hat JBoss Enterprise Application Platform - Version 6.4.0.Alpha1". However that is a product name/version - the project name/version is JBoss AS 7.5.0.Final-redhat-15. The product version is maintained independently of the component project versions and is completely expected.
However "Wildfly + Teiid 8.11" is coming from the Teiid Web Console. It is including a manifest file that includes "JBoss-Product-Release-Version: + Teiid 8.11" - which obviously needs to not hardcode the Teiid version (or should show the console version). But it also appears that even AS/EAP will substitute Wildfly for JBoss-Product-Release-Version:, so there is an issue there as well.
Do you mind capturing these as issues?
2. Re: Which Teiid/AS versions... at runtime?Marco Ardito Mar 1, 2016 3:33 PM (in response to Steven Hawkins)
Steven Hawkins wrote:
Do you mind capturing these as issues?
Sure so if I got it well:
1) one issue is with Teiid which should show its version so in this case 8.12.3 not 8.11
this is easy [TEIID-4009] teiid shows wrong version on web console near to AS/EAP header logo - JBoss Issue Tracker
2) another issue is with EAP which shows Wildfly instead of JBoss-Product-Release-Version
I can't find EAP alpha releases but just GA on the issue form but added that anyway I hope it's good.
[JBEAP-3638] eap alpha shows web console logo as "wildfly" - JBoss Issue Tracker
Hopefully I didn't mess all up...
Thanks,
Marco
3. Re: Which Teiid/AS versions... at runtime?Steven Hawkins Mar 1, 2016 3:09 PM (in response to Marco Ardito)
Thanks Marco, that should be good. We'll follow through from there. | https://developer.jboss.org/thread/268100 | CC-MAIN-2018-17 | refinedweb | 633 | 59.6 |
As Windows Programmers we know the following to be true:
Luckily, this "facts" aren't true. I personally believe that we are starting to see a transition from hard-coded, MS-looking GUIs to more unique and sometimes photo-realistic GUIs for applications. Currently you can see this trend in applications that are "skinned" and commercial applications like the photo-realistic Gizmos. When Apples Os X is release in about a year, I believe we will see an explosion of alternate GUIs for both the Apple and Microsoft platforms.
I feel that part of my job, as a software engineer, is to prepare for this future. To prepare I have been looking at several technologies:
I'm employed at a company where I have the good fortune to work closely with Industrial Artists and Human Factors Engineers. For the last several years, part of my job has been converting the Industrial Artist's art and Human Factors Engineer's behavior into elements for Windows applications. This has reinforced my opinion that most programmers are lousy artists and even worse interface-designers (just so you know I include myself in this broad, overly simplified generalization).
At my company the preferred tool for use by an Industrial Artist is Adobe Illustrator. This tool allows the creation of art as bitmaps, vectors, or a combination of both. It is my observation is that artists prefer working in vector art. This is for practical reasons. Vectors can be defined as individual objects that can be ordered, translated, rotated, and scaled independently.
I've also observed that Windows programmers have a mental block. All graphic problems are solved with bitmaps. Personally I hate bitmaps. They don't easily scale or rotate. They tend to be large. And you have to associate touch regions with the bitmap if you want to define any interesting behavior to them. In other word, bitmaps are difficult to work with and the result is often poor.
Since the artists I associate with prefer working with vector art anyway, I've been asking for the vector form of their art for my projects. I then run the files through a tool that I've written that extracts the vectors and text and converts them into C++ code. This article shows how to use this type of data to create interesting applications.
Disclaimer - Do not assume that the project shown here is either an example of good art or of good Human Factors design. It's just an example of what you can do with vectors.
Vector art is drawn the same way a painter paints. Elements of the image are painted from back to front with the later elements possibly obscuring some of the earlier elements. This means that you should never change the order that items are drawn. It also means that you should hit-test in the reverse order that items are drawn.
The following is an example of the output of a red circle. I created the drawing with CorelDraw. Saved the output as a Windows Meta File. I then run that file though a tool that I wrote that extracts, polygons, polylines, and text. The following code is output from this tool.
#include "StdAfx.h" #include "ArtCode.h" // Contains code that does hit-test, drawing, and region creation. static RECT bounds = {20, 20, 15980, 15740}; static POINT Polygon0Points[] = { {8000, 15740}, {8409, 15730}, {8814, 15700}, {9212, 15650}, {9605, 15580}, {9990, 15492}, {10368, 15386}, {10739, 15262}, {11101, 15121}, {11454, 14963}, {11798, 14789}, {12133, 14600}, {12456, 14395}, {12769, 14176}, {13071, 13942}, {13361, 13694}, {13638, 13434}, {13903, 13161}, {14154, 12875}, {14391, 12578}, {14614, 12270}, {14822, 11951}, {15015, 11622}, {15191, 11283}, {15351, 10935}, {15495, 10578}, {15620, 10213}, {15728, 9841}, {15818, 9461}, {15888, 9074}, {15939, 8682}, {15970, 8284}, {15980, 7880}, {15970, 7477}, {15939, 7078}, {15888, 6686}, {15818, 6299}, {15728, 5920}, {15620, 5547}, {15495, 5182}, {15351, 4825}, {15191, 4478}, {15015, 4139}, {14822, 3810}, {14614, 3490}, {14391, 3182}, {14154, 2885}, {13903, 2600}, {13638, 2326}, {13361, 2066}, {13071, 1819}, {12769, 1585}, {12456, 1365}, {12133, 1160}, {11798, 971}, {11454, 797}, {11101, 639}, {10739, 498}, {10368, 374}, {9990, 268}, {9605, 180}, {9212, 111}, {8814, 60}, {8409, 30}, {8000, 20}, {7590, 30}, {7186, 60}, {6787, 111}, {6395, 180}, {6009, 268}, {5631, 374}, {5261, 498}, {4899, 639}, {4545, 797}, {4201, 971}, {3867, 1160}, {3543, 1365}, {3230, 1585}, {2929, 1819}, {2639, 2066}, {2361, 2326}, {2097, 2600}, {1846, 2885}, {1608, 3182}, {1386, 3490}, {1178, 3810}, {985, 4139}, {808, 4478}, {648, 4825}, {505, 5182}, {379, 5547}, {272, 5920}, {182, 6299}, {112, 6686}, { 61, 7078}, { 30, 7477}, { 20, 7880}, { 30, 8284}, { 61, 8682}, {112, 9074}, {182, 9461}, {272, 9841}, {379, 10213}, {505, 10578}, {648, 10935}, {808, 11283}, {985, 11622}, {1178, 11951}, {1386, 12270}, {1608, 12578}, {1846, 12875}, {2097, 13161}, {2361, 13434}, {2639, 13694}, {2929, 13942}, {3230, 14176}, {3543, 14395}, {3867, 14600}, {4201, 14789}, {4545, 14963}, {4899, 15121}, {5261, 15262}, {5631, 15386}, {6009, 15492}, {6395, 15580}, {6787, 15650}, {7186, 15700}, {7590, 15730}, {8000, 15740}, }; static PolygonEntry Polygon0 = { "Polygon0", {20, 20, 15980, 15740}, RGB(218, 37, 29), 1, // PolyFillMode 129, Polygon0Points, }; // Draw Vector image - will scale to clientRect so if you want // to maintain the images aspect ratio please make sure the clientRect // passed also maintains that aspect ratio of the object. void DrawObject(CDC* pDC, const CRect& clientRect) { Draw(pDC, Polygon0, clientRect, bounds); } // Creates a region. Regions can be used for several things. // However the result of this call is usually used to create a // Window Region. void CreateRegion(CRgn& rgn, const CRect& clientRect) { CreateRegion(rgn, Polygon0, clientRect, bounds); } // TRUE on an element in the vector drawing is hit. BOOL HitTestObject(const CPoint& point, const CRect& clientRect) { if (HitTest(Polygon1, clientRect, bounds, point)) return TRUE; return FALSE; } // Returns the aspect ratio of the image. To use this you do the following: // newWidth = AspectRatio()*window.Height(); double AspectRatio() { CRect objectRect(bounds); return ((double) objectRect.Width())/((double) objectRect.Height()); }
To modify your dialog app all you need to do is set the window region to the regions of the combined vectors and then handle OnPaint messages. The logical place to set the window region is in OnInitDialog.
This code does the following:
BOOL CFlowerPowerDlg::OnInitDialog() { SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon m_downItem = None; // Maintain aspect ratio of drawing CRect rect; GetWindowRect(&rect); rect.right = ((int) (rect.Height()*AspectRatio()))+rect.left; CRgn wndRgn; // Size Window to new aspect ratio MoveWindow(&rect, FALSE); // Get Screen Rect and convert to client coords GetWindowRect(&rect); ScreenToClient(&rect); // Create a region for our window in client coords CreateRegion(wndRgn, rect); // Set Window region in client coords - the MS docs say this call is in // Screen Coords, but only client coords work. SetWindowRgn(wndRgn, TRUE); CDialog::OnInitDialog(); return TRUE; // return TRUE unless you set the focus to a control }
OnPaint is the stock output from the AppWizard expect for the non-iconic drawing. When drawing non-icon version of the dialog you do the following:
void CFlowerPowerDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, { if (!m_bDialogUp) { CWindowDC dc(this); CMemDC pDC(&dc); CRect rect; GetWindowRect(&rect); ScreenToClient(&rect); DrawObject(&pDC, rect); CDialog::OnPaint(); } } }
To create your own C++ code out of vector art I've included the application I've written called ArtCode.exe. Just so you know, this application is complete hack. It was designed for one purpose, to turn vector art to code with the least work possible with the tools that I already had. I had Adobe Illustrator and CorelDraw. Because of that, the process of getting your vector art to C++ requires a reasonably current copy of CoreDraw (I've successfully used versions 6-9 for this). Here's the process (and yes it is quirky -- but it works):
Rotation, translation, and Scaling of vector art is easy, but if you don't recall how to do this from your linear algebra class (mine was 20+ years ago) you will need either a good computer graphics book or a good linear algebra book. All you do is set up a transformation matrix and do a matrix multiply to perform one or more of these operations. Once you see it you'll discover how simple this really is. A decent calculator helps too (I love my TI-92).
The ArtCode.exe program is completely unsupported. Please do not send me email asking for changes or to help you troubleshoot some problem you are having with it. It is very, very unlikely that I will respond to any such email. If you do get stuck and absolutely need help you might try one of the discussion forums on.
The tool will not work if you try to open your run-of-the-mill Windows Metafiles. The tool supports a very, very small subset of Windows Metafile commands so you are guaranteed to get no graphics or a subset of your graphics if you import a typical WMF. The step of exporting to Adobe Illustrator format first is absolutely required in most cases.
The point of this article isn't to cause any serious changes in how you design GUIs. The goal is to stimulate some thought about where GUI development is going, and to help you prepare for the future that you see coming. It also should show you how much easier working with vector graphics can be than working with bitmaps graphics.
You may use the code you find included in this project anyway you like. However, the art was derived from my legal copy of CorelDraw. I believe that it is legal for me to use the derived version of the art in my code, however please don't use this art in your project unless you own CorelDraw.
General
News
Question
Answer
Joke
Rant
Admin | http://www.codeproject.com/KB/GDI/flowerpower.aspx | crawl-002 | refinedweb | 1,618 | 67.18 |
:GPS API in Symbian 3rd Edition.
+Before Anything+ There are many errors in this example, solution for each error is available at Archived Talk:GPS API in Symbian 3rd Edition
Overview
S60 3rd Edition has full support for GPS positioning. Both built-in and external Bluetooth GPS modules are supported. There are several GPS-enabled phones already on the market. They are Nokia 6110 and Nokia N95. More GPS phones are coming.
There is free GPS navigation software from Nokia called Smart2Go (another name is Nokia Maps). There are several 3rd party titles that also utilize GPS positioning. How can you use GPS positioning in your application?
Implementation
There are two ways. The first way is using low-level communication with external Bluetooth GPS module. It was widely used in S60 2nd Edition. It involves many technical issues and might not work correctly with some external Bluetooth GPS devices. It also will NOT work with the built-in GPS modules in Nokia 6110 and Nokia N95 phones. It’s a deprecated way.
The other (recommended) way is using Location API that was introduced in S60 2nd Edition, Feature Pack 2 and also supported in S60 3rd Edition.
There are several key classes in Location API. They are RPositionServer, RPositioner and TPositionInfo. First you need to connect to RPositionServer. Then create RPositioner object and issue an asynchronous request for current location. The result will be returned in TPositionInfo structure.
Usage
Here is a high-level utility class CGpsPositionRequest. It solves three problems. First, is hides all details and complexity of Location API from a user (programmer). Second, it works synchronously and removes all asynchronous complexity from the user. Third, a progress dialog (wait note) is being shown during the location request, so an end-user will see that an application is working. Here is a usage example:
#include "GpsPositionRequest.h"
...
// variables to hold current locations
TReal latitude, longitude;
// create CGpsPositionRequest object and put it into cleanup stack;
// pass application name as argument
CGpsPositionRequest* request = CGpsPositionRequest::NewLC(
_L("My application"));
// get current location (this operation can be long up to 30 seconds);
// progress dialog is shown to user during this time
TBool result = request->GetCurrentPostionL(latitude, longitude);
// delete request object
CleanupStack::PopAndDestroy(request);
// process result here
if (result)
{
// success, use latitude and longitude coordinates
}
else
{
// failed getting current position, show error message to user
}
Note that you also need to include the following lines into your MMP project file:
SOURCE GpsPositionRequest.cpp
LIBRARY lbs.lib
You will also need to include GpsPositionRequest.ra file into your resource file:
#include "GpsPositionRequest.ra"
Download the source code for CGpsPositionRequest from here: File:GpsPositionRequest.zip
Another example that also has simple re-usable container that you could use for viewing the position before selecting it can be found from here: File:GeoTagging Example.zip
The example code won't compile because the NewLC method doesn't exist in the class.
---*1 Use NewL instead of NewLC
The zipped source code won't compile because the GetCurrentPositionL method isn't declared in the header file.
---*2 Replace GetCurrentPositionL by FetchCurrentLocationL
ECidWaitNote needs to be defined somewhere to get the code to compile.
---*3 Add this code to your *.hrh file
[code] enum TControlID { ECidWaitNote = 0x6666 }; [/code] note: you can also change the id and define it in your *.hrh file. you can also use another value.
Another error
The .ra file has EAknWaitNoteFlag instead of EAknWaitNoteFlags. Will not compile.
---*4 Copy the content of .ra file to your *.rssi file.
The correct function name for ---*2 is FetchCurrentPostionL // Govind Paul
One more!
After signing the file using a developer certificate and installing on the phone, when I open the application, I get a "System Error!". Any clue why this so?
---*5 The error: "System Error" is obtained because the file where you put the #include *.ra line is incorrect. Don't put this line in any file just do the item 4 with (---*4) mark.
Hope it helps - by joseph.m
Hello, I'm currently testing this example. I've got one question. It seems like it shows the coordinates with a very low precision? I mean it seems to retrive some coordinates but they stay the same when position changes (a change of about 50m) doesn't affect the coordinates. on the other hand the coordinates change in the standard Nokia GPS app (tools). any idea how to change the precision?
PallaviMajgaokar - One more
---6* Before
you need to push the "request". CleanupStack::PushL( request ); and then TBool result = request->GetCurrentPostionL(latitude, longitude);
But even after doing all these things, I did not get position at all! :(
PallaviMajgaokar 19:54, 28 December 2011 (EET)
Hamishwillee - @PallaviMajgaokar - not correct
No idea why it doesn't work - assuming you're still using 3rd edition?
- How about instead of adding notes here you actually fix the code in the main article?
- PallaviMajgaokar - you're incorrect. The request is created using NewLC, so a copy of the object is left on the CleanupStack following construction. You would be correct if the object was created using NewL()
hamishwillee 06:24, 3 January 2012 (EET)
PallaviMajgaokar - HamishwilleeI am still using 3rd edition. My application crashes if I don't write that PopAndDestroy without the PushL. If some one else in the future would have the same error, they would atleast know what the probably solution might be.
PallaviMajgaokar 12:17, 13 January 2012 (EET) | http://developer.nokia.com/community/wiki/Archived:GPS_API_in_Symbian_3rd_Edition | CC-MAIN-2014-52 | refinedweb | 903 | 58.48 |
Opened 8 years ago
Last modified 4 years ago
#13345 needs_info defect
Test if the assumptions made by quotient rings are fulfilled
Description (last modified by )
In the definition of a QuotientRing there is the following assumption
ASSUMPTION:
II
has a methodhas a method
I.reduce(x)I.reduce(x)
returning the normal form of elementsreturning the normal form of elements
x\in R. In other words, it is required that
I.reduce(x)==I.reduce(y)I.reduce(x)==I.reduce(y)
\iff x-y \in I, and
x-I.reduce(x) in Ix-I.reduce(x) in I
, for all, for all
x,y\in R.
On the other hand, the default definition of reduce in
sage/rings/ideal.py says
def reduce(self, f): return f # default
As a consequence one gets
sage: Z4x.<x> = Integers(4)[] sage: GR.<y> = Z4x.quotient_ring(x**2+x+1) sage: R = GR.quo(GR.ideal(2)) sage: R(y+2) == R(y) False
This patch adds a deprecation warning in
reduce(). It also introduces a test in
QuotientRing_nc.__init__(), which determines if the ideal class overwrites the definition of
reduce().
There is also a discussion about this on.
Attachments (1)
Change History (19)
comment:1 Changed 8 years ago by
comment:2 follow-up: ↓ 3 Changed 8 years ago by
Does this patch lead to test failures?
If yes, are the tests wrong or did they pass only by accident in the past?
I don't know the involved math, but it sounds to me like sage currently returns wrong answers. If this is the case, the bug should be fixed and not deprectaed. This means: a) use NotImplemntedError? right away and b) reimplement reduce() where neccessary.
comment:3 in reply to: ↑ 2 ; follow-up: ↓ 4 Changed 8 years ago by
Does this patch lead to test failures?
I was talking about the failures where I did not catch the deprecation warning. I will start this work as soon as there is a decision if there should be some deprecation warning or a NotImplementedError? at those places.
I don't know the involved math, but it sounds to me like sage currently returns wrong answers. If this is the case, the bug should be fixed and not deprecated. This means: a) use NotImplementedError? right away and b) reimplement reduce() where necessary.
This is definitely a bug. I am not sure if I will be able to reimplement all occurrences of reduce.
comment:4 in reply to: ↑ 3 Changed 8 years ago by
comment:5 follow-up: ↓ 6 Changed 8 years ago by
Judging just from reading the patch, I think you make the assumption very clear :)
I don't have any experience with deprecation, but what you're doing to sage/rings/ideal.py looks fine to me.
About the
DeprecationWarning you are adding to sage/rings/quotient_ring.py:
1) Any existing Sage doctest where your patch gives this warning is very likely a Sage bug. Thanks for finding them, you can list them in a separate ticket.
2) For your final patch, please remove this test and this warning. There is not much added benefit of this warning (you get an indirect warning from reduce when you use the quotient ring anyway), and it tests something different from what it claims to check (reduce being implemented is not equivalent to the assumption being satisfied, so lots of potential false positives and false negatives), while it also forces people to do extra work later (when the deprecated function "reduce" is changed to
NotImplementedError). Also, you are not deprecating any functionality at this location in the source code.
Changed 8 years ago by
comment:6 in reply to: ↑ 5 Changed 8 years ago by
- Dependencies set to 13347
I removed the
DeprecationWarning from sage/rings/quotient_ring.py as you proposed and started a new ticket, see ticket:13347.
I suppose that the documentation of mod() in sage/structure/element.pyx should also be modified:
Return a unique representative for self modulo the ideal I (or the ideal generated by the elements of I if I is not an ideal.) I.e. it is required that x.mod(I) == y.mod(I)
\iff x-y \in I, and x-x.mod(I) in I, for all
x,y\in R.
comment:7 Changed 7 years ago by
- Status changed from new to needs_review
comment:8 Changed 7 years ago by
comment:9 Changed 7 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:10 Changed 6 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:11 Changed 6 years ago by
The changes themselves look reasonable. The patch rebases with some fuzz 2 only on 6.2.base5. The links to the ticket in the docs should be given as
:trac:
`
13345
` Note also the proposed document change in comment:5 could be added. If you please make these changes (rebase, trac links, doc fix) then you can set positive review yourself, so that you need not wait for another round of review.
comment:12 Changed 6 years ago by
- Reviewers set to Ralf Stephan
comment:13 Changed 6 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:14 Changed 6 years ago by
- Status changed from needs_review to needs_work
comment:15 Changed 6 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:16 Changed 4 years ago by
- Stopgaps set to todo
comment:17 Changed 4 years ago by
Should we not simply remove the default implementation of
reduce? It is wrong for anything but the zero ideal, right? At least we should add a stopgap I guess?
comment:18 Changed 4 years ago by
- Status changed from needs_work to needs_info
I know that there are more doctest failures but maybe someone could first tell me if my approach is correct. | https://trac.sagemath.org/ticket/13345 | CC-MAIN-2020-10 | refinedweb | 990 | 73.78 |
Is there a possibility to write this in a shorter way?
elif line.startswith('\tVLRLIST=') and (line.rstrip()[9:-1] == '27' or line.rstrip()[9:-1] == '28' or line.rstrip()[9:-1] == '29')
As a general case, you can use the in keyword,
in
elif line.startswith('\tVLRLIST=') and line.rstrip()[9:-1] in ('27', '28', '29'):
For this specific example, all of them are contained in a range:
elif line.startswith('\tVLRLIST=') and (int(line.rstrip()[9:-1]) in range(27, 30):
elif re.match(r'^\tVLRLIST=2[7-9]\s*$', line):
I would use a different approach and try to name these, it's much more readable.
def prefix_is_correct(line):
return line.startswith('\tVLRLIST=')
def is_valid(line):
return prefix_is_correct(line) and line.rstrip()[9:-1] is in ['27', '28', '29']
.
.
.
elif is_valid(line):
As a general case, you can use the
inkeyword,
For this specific example, all of them are contained in a range: | https://techqa.club/v/q/python-or-in-short-form-c3RhY2tvdmVyZmxvd3w1NjEwOTg2Ng== | CC-MAIN-2021-39 | refinedweb | 156 | 71.51 |
get internet on a psp
download manager psp media
for psp games sale
for playstation games psp free
import psp white
service download psp
demos download for psp
cheats wars star 2 for on psp battlefront
game video to its going to anything is a choice between cables supporting composite the psp in the videos to disc pod video from content to veg out on this geft internet on a psp clip was part of video 9 form the get internnet on a psp best of arc story through g4t internet on a psp a plane gset internet on a psp or a few clicks completes get internet on x psp the new version of your computer then get int3rnet on a psp encode said videos to the revised psp. Video 3gp batch conversion speed and sony psp the get internet in a psp full get internet on a psp show downloads on a wonderful and get internet om a psp get internet on a psp files to begin with something interactive not only get internet on a psp enables you will have it that whole. Thing. To your portable. Pc via usb cable not found error was encountered while. Trying to download
get internet on a psp. get internet on a psp video format13 level 5 tells get internet on a psp
get internet on a psp forum thread42min. The video sites like. Youtube then you may differ encoding ensures the rest of get internet on a psp. Higher 64mb ram or a. Call so he can improve it only knows how get internet on a psp
get internet on a psp you to this is legal to retailassassin s. Quicktime
get internet on a psp get internet on a psp get internet on a psp get internet on a psp get internet on a psp get internet on a
get internet on a psp
automatically using
get internet on a psp get internet on a psp. get internet on a psp get internet on a psp march the homebrews especially get internet on a p get internet on a psp get internet on a psp get internet on a get internet on a psp get internet on a psp
psp entertainment pack on sale
internet browser on psp
how to play psp games
free downloadable movies for psp
how do you put music on a psp
watch videos on psp internet
putting videos on your psp
playstation com psp update
psp memory chip
buy a psp 1.5
how to get the internet on your psp
free psp porn sample
download movies for psp
psp homebrew emulator
psp ps1 game
playstation 3 psp remote play | http://video-on-psp.freehostia.com/get-internet-on-a-psp.php | crawl-001 | refinedweb | 447 | 53.58 |
CircleCI Server v3.x Backup and Restore
- Overview
- The setup
- Server 3.x backups on AWS
- Server 3.x backups on GCP
- Creating backups
- Restoring backups
- Optional - Scheduling backups with kots
- Troubleshooting Backups and Restoration
Overview
While operating and administering CircleCI server, you will undoubtedly ponder how to maintain backups and recover your installation, should there be a need to migrate it to another cluster or recover from a critical event. This document outlines our recommendations for how to backup. In this way, we can also restore admin-console configurations and customizations you made to your cluster.
The setup
Backups of CircleCI server can be created quite easily through Kots. To enable backup support however, you will need to install and configure Velero on your cluster. Below, we will will assume AWS as your provider permissions: (eg:
.
Once Velero is installed on your cluster, check the new
veleronamespace. You should have a Velero deployment and a restic daemonset, e.g.:
$.
Server 3.x backups on GCP
The following steps are specific for Google Cloud Platform and it is assumed you have met the prerequisites.
Step 1 - Create a GCP bucket
To reduce the chance of typos, we will set some of the parameters as shell variables. Should you be unable to complete all the steps in the same session,
do not forget to reset variables as necessary before proceeding. In the step below, for example,, we will set a shell variable for your project ID. To do so, first make sure that your
gcloudCLI points to the correct project by looking at the current configuration:
gcloud config list
If the project is correct, set the variable:
PROJECT_ID=$(gcloud config get-value project)
Create a service account:
gcloud iam service-accounts create velero \ --display-name "Velero service account"
You can check if the service account has been created successfully by running:, we first need to create a key:
gcloud iam service-accounts keys create credentials-velero \ --iam-account $SERVICE_ACCOUNT_EMAIL
After running this, you should have will need the
iam.serviceAccounts.signBlob role in addition to the permissions already specified above.
Step 3 - Install and start Velero
Run one of the following
velero
installcommands, depending on how you authorized the service account. This will create a namespace called
veleroand install.
Once Velero is installed on your cluster, check the new
veleronamespace. You should have a Velero deployment and a restic daemonset. eg:
$.
Creating backups
Now that Velero is installed on your cluster, you should see the snapshots option in the navbar of your kots admin console.
If you see this option, you are ready to create your first backup. If you do not see this option, please refer to the troubleshooting section.
Option 1 - Create a backup with kots CLI
To create the backup, run:
kubectl kots backup --namespace <your namespace>
Option 2 - Create a backup with kots admin console
Select Snapshots from the navbar. The default selection should be Full Snapshots, which is recommended.
Select the Start a snapshot button.
Restoring backups
Option 1 - Restore a backup from a snapshot
Unlike other restore procedures, which would require you to reinstall server and then restore the data, restoring CircleCI server from a kots backup does not require you to reinstall server yourself before-hand. To restore from a backup stored in your S3 compatible storage, you will need to ensure Velero is installed and configured on your Kubernetes cluster, using the instructions above. Velero must have access to the storage bucket containing the backups.
Option 2 - Restore a backup using the kots CLI
To restore a backup using the kots CLI, run the following:
kubectl kots restore --from-backup <backup-instance-id>
Option 3 - Restore a backup using the kots administration console UI
As with backups, navigate to Snapshots in kots admin. Now you should see a list of all your backups, each with a restore icon. Choose the backup you wish to use and select restore.
It should take roughly 10-15 mins for CircleCI server to be restored and operational.
Optional - Scheduling backups with kots
To schedule regular backups, select Snapshots, and then Settings & Schedule from the kots administration command below.
$ kubectl logs deployment/velero --namespace velero
You may need to reinstall Velero as a result.
Confirm that snapshots are available on your license. You may reach out to our Customer Support Team to validate this..
Then confirm that the credentials provided to Velero can be used to access the bucket.
You may need to run the command to install Velero again, this time with updated bucket info.. You may need to scale your nodes to accommodate restic in this case. | https://circleci.com/docs/2.0/server-3-operator-backup-and-restore/ | CC-MAIN-2021-25 | refinedweb | 771 | 61.36 |
John Jai wrote:The error straight forwardly implies javafx is not present in the project's class path. You should rather try the HelloWorld application provided in the tutorial link you posted.
And follow the steps from scratch to the HelloWorld program.
John Jai wrote:Class path should point to a location where your class files (or jar files) are present. Is there a lib folder parallel to the bin in the Java FX installation? Does that have jar files?
Mohamed Sanaulla wrote:I moved this thread to JavaFX forum.
I dont think Eclipse has a plugin for JavaFX 2.0 yet, but this post would help you to configure your eclipse.
And the link you have mentioned is for older verion of JavaFX.
You can download Netbeans 7.1 beta from here which comes with JavaFX 2 support.
Note that JavaFX 2.0 is not compatible with older versions. So when you are searching use the version number.
Mohamed Sanaulla wrote:Did you visit the link I provided in my reply for configuring Eclipse?
You should be using JavaFX 2.0 and above version. Older versions are not supported anymore.
Shikha Upadhyaya wrote:
But there is this error in the line 11 of the code I posted in the first post of this thread-
The method start(stage) of type PieChartSample must override or implement a supertype method. What do I do?
Mohamed Sanaulla wrote:Have you installed the JavaFX SDK?
Mohamed Sanaulla wrote:I think its missing the runtime related files. Not sure though. Try installing runtime again.
Shikha Upadhyaya wrote:
But I would like to stress upon one observation here. When I click on File > New > JavaFX project, a window "New JavaFX project" opens. In that window I can see an error message- A valid JavaFX SDK was not detected.
Mohamed Sanaulla wrote:If you have JavaFX SDK then you have the runtime as well.
I dont think Eclipse supports New JavaFX project as I am not sure if Eclipse has a plugin to support JavaFX 2.0. You must be creating a usual Java project and then follow the JavaFX sample code - Am just thinking loud here, not tried it.
But on Netbeans 7.1 beta you can create a new JavaFX project and proceed with the development - I have tried this though.
Mohamed Sanaulla wrote:You can try creating a usual Java project and then add the javafxrt jar as mentioned here and then try to create the sample application. Also uninstall the javaFX plugin which you have installed for Eclipse.
Mohamed Sanaulla wrote:I used Eclipse Helios to run JavaFX application and it works. I didnt install any JavaFX plugin for Eclipse.
Also I created a simple Java project and then added the following:
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class JavaFxSample extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
// TODO Auto-generated method stub
Group root = new Group();
Scene scene = new Scene(root, 800, 600, Color.BLACK);
primaryStage.setScene(scene);
primaryStage.setVisible(true);
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
launch(args);
}
}
I also added the jfxrt.jar to the External jars for the project.
I was able to run the application.
Also please use the tutorials from this page as they are relevant for the latest release of JavaFX
Oh then *Eclipse Indigo* is the problem!!.
Shikha Upadhyaya wrote:.
When I created the project I had checked JavaSE 1.6 as the execution environment JRE in the New Java Project window.
more from paul wheaton's glorious empire of web junk:
cast iron skillet
diatomaceous earth
rocket mass heater
sepp holzer
raised garden beds
raising chickens
lawn care
CFL
flea control
missoula
heat
permaculture | http://www.coderanch.com/t/560011/JavaFX/java/import-javafx-cannot-resolved | crawl-003 | refinedweb | 636 | 76.62 |
Python 3 - Quick Guide
What is New in Python 3?
The __future__ module
Python 3.x introduced some Python 2-incompatible keywords and features that can be imported via the in-built __future__ module in Python 2. It is recommended to use __future__ imports, if you are planning Python 3.x support for your code.
For example, if we want Python 3.x's integer division behavior in Python 2, add the following import statement.
from __future__ import division
The print Function
Most notable and most widely known change in Python 3 is how the print function is used. Use of parenthesis () with print function is now mandatory. It was optional in Python 2.
print "Hello World" #is acceptable in Python 2 print ("Hello World") # in Python 3, print must be followed by ()
The print() function inserts a new line at the end, by default. In Python 2, it can be suppressed by putting ',' at the end. In Python 3, "end =' '" appends space instead of newline.
print x, # Trailing comma suppresses newline in Python 2 print(x, end=" ") # Appends a space instead of a newline in Python 3
Reading Input from Keyboard
Python 2 has two versions of input functions, input() and raw_input(). The input() function treats the received data as string if it is included in quotes '' or "", otherwise the data is treated as number.
In Python 3, raw_input() function is deprecated. Further, the received data is always treated as string.
In Python 2 >>> x = input('something:') something:10 #entered data is treated as number >>> x 10 >>> x = input('something:') something:'10' #entered data is treated as string >>> x '10' >>> x = raw_input("something:") something:10 #entered data is treated as string even without '' >>> x '10' >>> x = raw_input("something:") something:'10' #entered data treated as string including '' >>> x "'10'" In Python 3 >>> x = input("something:") something:10 >>> x '10' >>> x = input("something:") something:'10' #entered data treated as string with or without '' >>> x "'10'" >>> x = raw_input("something:") # will result NameError Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> x = raw_input("something:") NameError: name 'raw_input' is not defined
Integer Division
In Python 2, the result of division of two integers is rounded to the nearest integer. As a result, 3/2 will show 1. In order to obtain a floating-point division, numerator or denominator must be explicitly used as float. Hence, either 3.0/2 or 3/2.0 or 3.0/2.0 will result in 1.5
Python 3 evaluates 3 / 2 as 1.5 by default, which is more intuitive for new programmers.
Unicode Representation
Python 2 requires you to mark a string with a u if you want to store it as Unicode.
Python 3 stores strings as Unicode, by default. We have Unicode (utf-8) strings, and 2 byte classes: byte and byte arrays.
xrange() Function Removed
In Python 2 range() returns a list, and xrange() returns an object that will only generate the items in the range when needed, saving memory.
In Python 3, the range() function is removed, and xrange() has been renamed as range(). In addition, the range() object supports slicing in Python 3.2 and later.
raise exception
Python 2 accepts both notations, the 'old' and the 'new' syntax; Python 3 raises a SyntaxError if we do not enclose the exception argument in parenthesis.
raise IOError, "file error" #This is accepted in Python 2 raise IOError("file error") #This is also accepted in Python 2 raise IOError, "file error" #syntax error is raised in Python 3 raise IOError("file error") #this is the recommended syntax in Python 3
Arguments in Exceptions
In Python 3, arguments to exception should be declared with 'as' keyword.
except Myerror, err: # In Python2 except Myerror as err: #In Python 3
next() Function and .next() Method
In Python 2, next() as a method of generator object, is allowed. In Python 2, the next() function, to iterate over generator object, is also accepted. In Python 3, however, next(0 as a generator method is discontinued and raises AttributeError.
gen = (letter for letter in 'Hello World') # creates generator object next(my_generator) #allowed in Python 2 and Python 3 my_generator.next() #allowed in Python 2. raises AttributeError in Python 3
2to3 Utility
Along with Python 3 interpreter, 2to3.py script is usually installed in tools/scripts folder. It reads Python 2.x source code and applies a series of fixers to transform it into a valid Python 3.x code.
Here is a sample Python 2 code (area.py): def area(x,y = 3.14): a = y*x*x print a return a a = area(10) print "area",a To convert into Python 3 version: $2to3 -w area.py Converted code : def area(x,y = 3.14): # formal parameters a = y*x*x print (a) return a a = area(10) print("area",a)
Python 3 - Environment Setup
Python Environment Variables
Here are important environment variables, which are recognized by Python −..
Python 3 - Basic Syntax
The.3.2 (default, Dec 10 2013, 11:35:01) [GCC 4.6. This produces the following result −
Hello, Python!
Script Mode Programming
Invoking the interpreter with a script parameter begins execution of the script and continues until the script is finished. When the script is finished, the interpreter is no longer active.
Let us write a simple Python program in a script. Python files have the extension .py. Type the following source code in a test.py file −Live Demo
print ("Hello, Python!")
We assume that you have the Python interpreter set in PATH variable. Now, try to run this program as follows −
On Linux
$ python test.py
This produces the following result −
Hello, Python!
On Windows
C:\Python34>Python test.py
This produces the following result −
Hello, Python!
Let us try another way to execute a Python script in Linux. Here is the modified test.py file −Live Demo
#!/usr/bin/python3 print ("Hello, Python!")
We assume that you have Python interpreter available in the /usr/bin directory. Now, try to run this program as follows −
$ chmod +x test.py # This is to make file executable $./test.py
This produces the following result −
Class names start with an uppercase letter. All other identifiers start with a lowercase letter.
Starting an identifier with a single leading underscore indicates that the identifier is private.
Starting an identifier with two leading underscores indicates a.Live Demo
#!
# and, the statement saying “Press the enter key to exit”, and then waits for the user to take action −
#!/usr/bin/python3 input("\n\nPress the enter key to exit.")
Here, "\n\n" is a single line given that no statement starts a new code block. Here is a sample snip using the semicolon −
import sys; x = 'foo'; sys.stdout.write(x + '\n')
Multiple Statement Groups as Suites
Groups of individual statements, which make a single code block are called suites in Python. Compound or complex statements, such as if, while, def, and class require a header line and a suite.
Header lines begin the statement (with the keyword) and terminate with a colon ( : ) and are followed by one or more lines which make up the suite. For example −
if expression : suite elif expression : suite else : suite
Command Line Arguments
Many programs can be run to provide you with some basic information about how they should be run. Python enables you to do this with -h −
$. Let us understand it.
Python 3 - Variable Types
Variables −Live Demo
#!Live Demo
#! −Live Demo
#!/usr/bin/python3']Live Demo
#!/usr/bin/python3 tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 ) tinytuple = (123, 'john')')
The following code is invalid with tuple, because we attempted to update a tuple, which is not allowed. Similar case is possible with lists −
#!/usr/bin/python3 tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 ) list = [ 'abcd', 786 , 2.23, 'john', −Live Demo
#!.
Python 3 - Basic Operators
Operators are the constructs, which can manipulate the value of operands. Consider the expression 4 + 5 = 9. Here, 4 and 5 are called the operands and + is called the operator.
Types of Operator
Python language supports the following types of operators −
- Arithmetic Operators
- Comparison (Relational) Operators
- Assignment Operators
- Logical Operators
- Bitwise Operators
- Membership Operators
- Identity Operators
Let us have a look at all the operators one by one.
Python Arithmetic Operators
Assume variable a holds the value 10 and variable b holds the value 21, then −
Python Comparison Operators
These operators compare the values on either side of them and decide the relation among them. They are also called Relational operators.
Assume variable a holds the value 10 and variable b holds the value 20, then −
Python Assignment Operators
Assume variable a holds the value 10 and variable b holds the value 20, then −
Python's built-in function bin() can be used to obtain binary representation of an integer number.
The following Bitwise operators are supported by Python language −
Python Logical Operators
The following logical operators are supported by Python language. Assume variable a holds True and variable b holds False then −
Python Membership Operators
Python’s membership operators test for membership in a sequence, such as strings, lists, or tuples. There are two membership operators as explained below −
Python Identity Operators
Identity operators compare the memory locations of two objects. There are two Identity operators as explained below −
Python Operators Precedence
The following table lists all operators from highest precedence to the lowest.
PythonLive Demo
#!/usr/bin/python3 var = 100 if ( var == 100 ) : print ("Value of expression is 100") print ("Good bye!")
Output
When the above code is executed, it produces the following result −
Value of expression is 100 Good bye!
Python()
Python 'long integer'
Python 3 - −Live Demo
#!/usr/bin/python3 var1 = 'Hello World!' var2 = "Python Programming" print ("var1[0]: ", var1[0]) print ("var2[1:5]: ", var2[1:5])
When the above code is executed, it produces the following result −
var1[0]: H var2[1:5]: ytho
Updating Strings
You can "update" an existing string by (re)assigning a variable to another string. The new value can be related to its previous value or to a completely different string altogether. For example −Live Demo
#!/usr/bin/python3 var1 = 'Hello World!' print ("Updated String :- ", var1[:6] + 'Python')
When the above code is executed, it produces the following result −
Updated String :- Hello Python
Escape Characters
Following table is a list of escape or non-printable characters that can be represented with backslash notation.
An escape character gets interpreted; in a single quoted as well as double quoted strings.
String Special Operators
Assume string variable a holds 'Hello' and variable b holds 'Python', then −
String Formatting Operator
One of Python's coolest features is the string format operator %. This operator is unique to strings and makes up for the pack of having functions from C's printf() family. Following is a simple example −Live Demo
#!/usr/bin/python3
Triple Quotes
Python's triple quotes comes to the rescue by allowing strings to span multiple lines, including verbatim NEWLINEs, TABs, and any other special characters.
The syntax for triple quotes consists of three consecutive single or double quotes.Live Demo
#!/usr/bin/python3 para_str = """this is a long string that is made up of several lines and non-printable characters such as TAB ( \t ) and they will show up that way when displayed. NEWLINEs within the string, whether explicitly given like this within the brackets [ \n ], or just a NEWLINE within the variable assignment will also show up. """ print (para_str)
When the above code is executed, it produces the following result. Note how every single special character has been converted to its printed form, right down to the last NEWLINE at the end of the string between the "up." and closing triple quotes. Also note that NEWLINEs occur either with an explicit carriage return at the end of a line or its escape code (\n) −
this is a long string that is made up of several lines and non-printable characters such as TAB ( ) and they will show up that way when displayed. NEWLINEs within the string, whether explicitly given like this within the brackets [ ], or just a NEWLINE within the variable assignment will also show up.
Raw strings do not treat the backslash as a special character at all. Every character you put into a raw string stays the way you wrote it −Live Demo
#!/usr/bin/python3 print ('C:\\nowhere')
When the above code is executed, it produces the following result −
C:\nowhere
Now let's make use of raw string. We would put expression in r'expression' as follows −Live Demo
#!/usr/bin/python3 print (r'C:\\nowhere')
When the above code is executed, it produces the following result −
C:\\nowhere
Unicode String
In Python 3, all strings are represented in Unicode.In Python 2 are stored internally as 8-bit ASCII, hence it is required to attach 'u' to make it Unicode. It is no longer necessary now.
Built-in String Methods
Python includes the following built-in methods to manipulate strings −
Python 3 - remove() method is discussed in subsequent section.
Basic List Operations
Lists respond to the + and * operators much like strings; they mean concatenation and repetition here too, except that the result is a new list, not a string.
In fact, lists respond to all of the general sequence operations we used on strings in the prior chapter.
Indexing, Slicing and Matrixes
Since lists are sequences, indexing and slicing work the same way for lists as they do for strings.
Assuming the following input −
L = ['C++'', 'Java', 'Python']
Built-in List Functions and Methods
Python includes the following list functions −
Python includes the following list methods −
Python 3 - Tuples
A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists. The main difference between the tuples and the lists is that the tuples cannot be changed unlike lists. Tuples use parentheses, whereas lists use square brackets.
Creating a tuple is as simple as putting different comma-separated values. Optionally, you can put these comma-separated values between parentheses also. For example −.
Accessing Values in Tuples
To access values in tuple, use the square brackets for slicing along with the index or indices to obtain the value available at that index. For example −Live Demo
#!/usr/bin/python3)
Updating Tuples
Tuples are immutable, which means you cannot update or change the values of tuple elements. You are able to take portions of the existing tuples to create new tuples as the following example demonstrates −Live Demo
#!/usr/bin/python3')
Delete Tuple Elements
Removing individual tuple elements is not possible. There is, of course, nothing wrong with putting together another tuple with the undesired elements discarded.
To explicitly remove an entire tuple, just use the del statement. For example −
#!/usr/bin/python3 tup = ('physics', 'chemistry', 1997, 2000); print (tup) del tup; print ("After deleting tup : ") print (tup)
This produces the following result.
Note − An exception is raised. This is because after del tup, tuple does not exist any more.
('physics', 'chemistry', 1997, 2000) After deleting tup : Traceback (most recent call last): File "test.py", line 9, in <module> print tup; NameError: name 'tup' is not defined
Basic Tuples Operations.
Indexing, Slicing, and Matrixes
Since tuples are sequences, indexing and slicing work the same way for tuples as they do for strings, assuming the following input −
T=('C++', 'Java', 'Python')
No Enclosing Delimiters
No enclosing Delimiters is any set of multiple objects, comma-separated, written without identifying symbols, i.e., brackets for lists, parentheses for tuples, etc., default to tuples, as indicated in these short examples.
Built-in Tuple Functions
Python includes the following tuple functions −
Python 3 -.
Accessing Values in Dictionary
To access dictionary elements, you can use the familiar square brackets along with the key to obtain its value. Following is a simple example −Live Demo
#!/usr/bin/python3 a part of the dictionary, we get an error as follows −Live Demo
#!/usr/bin/python3 dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}; print ("dict['Alice']: ", dict['Alice'])
When the above code is executed, it produces the following result −
dict['Zara']: in a simple example given below.Live Demo
#!/usr/bin/python3 dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'} dict['Age'] = 8; # update existing entry dict['School'] = "DPS School" # Add new entry print ("dict['Age']: ", dict['Age']) print ("dict['School']: ", dict['School']). Following is a simple example −Live Demo
#!/usr/bin/python3 dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'} del dict['Name'] # remove entry with key 'Name' dict.clear() # remove all entries in dict del dict # delete entire dictionary print ("dict['Age']: ", dict['Age']) print ("dict['School']: ", dict['School'])
This produces the following result.
An exception is raised because after del dict, the dictionary does not exist anymore.
dict['Age']: Traceback (most recent call last): File "test.py", line 8, in <module> print "dict['Age']: ", dict['Age']; TypeError: 'type' object is unsubscriptable
Note − The is not allowed. This means no duplicate key is allowed. When duplicate keys are encountered during assignment, the last assignment wins. For example −Live Demo
#!/usr/bin/python3 dict = {'Name': 'Zara', 'Age': 7, 'Name': 'Manni'} print ("dict['Name']: ", dict['Name'])
When the above code is executed, it produces the following result −
dict['Name']: Manni
(b) Keys must be immutable. This means you can use strings, numbers or tuples as dictionary keys but something like ['key'] is not allowed. Following is a simple example −Live Demo
#!/usr/bin/python3 and Methods
Python includes the following dictionary functions −
Python includes the following dictionary methods −
Python 3 -Live Demo
#!/usr/bin/python3 import time; # This is required to include time module. ticks = time.time() print ("Number of ticks since 12:00am, January 1, 1970:", ticks)
This would produce a result something as follows −
Number of ticks since 12:00am, January 1, 1970: 1455508609.34375
Date arithmetic is easy to do with ticks. However, dates before the epoch cannot be represented in this form. Dates in the far future also cannot be represented this way - the cutoff point is sometime in 2038 for UNIX and Windows.
What is TimeTuple?
Many of the Python's time functions handle time as a tuple of 9 numbers, as shown below −
For Example −Live Demo
import time print (time.localtime());
This would produce a result as follows −
time.struct_time(tm_year = 2016, tm_mon = 2, tm_mday = 15, tm_hour = 9, tm_min = 29, tm_sec = 2, tm_wday = 0, tm_yday = 46, tm_isdst = 0)
The above tuple is equivalent to struct_time structure. This structure has following attributes −
Getting current time
To translate a time instant from seconds since the epoch floating-point value into a timetuple, pass the floating-point value to a function (e.g., localtime) that returns a time-tuple with all valid nine items.Live Demo
#!/usr/bin/python3 import time localtime = time.localtime(time.time()) print ("Local current time :", localtime)
This would produce the following result, which could be formatted in any other presentable form −
Local current time : time.struct_time(tm_year = 2016, tm_mon = 2, tm_mday = 15, tm_hour = 9, tm_min = 29, tm_sec = 2, tm_wday = 0, tm_yday = 46, tm_isdst = 0)
Getting formatted time
You can format any time as per your requirement, but a simple method to get time in a readable format is asctime() −Live Demo Live Demo
#!/usr/bin/python3 import time localtime = time.asctime( time.localtime(time.time()) ) print ("Local current time :", localtime)
This would produce the following result −
Local current time : Mon Feb 15 09:34:03 2016
Getting calendar for a month
The calendar module gives a wide range of methods to play with yearly and monthly calendars. Here, we print a calendar for a given month ( Jan 2008 ) −Live Demo
#!/usr/bin/python3 import calendar cal = calendar.month(2016, 2) print ("Here is the calendar:") print (cal)
This would produce the following result −
Here is the calendar: February 2016 Mo Tu We Th Fr Sa Su 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
The time Module
There is a popular time module available in Python, which provides functions for working with times and for converting between representations. Here is the list of all available methods.
There are two important attributes available with time module. They are −
The calendar Module
The calendar module supplies calendar-related functions, including functions to print a text calendar for a given month or year.
By default, calendar takes Monday as the first day of the week and Sunday as the last one. To change this, call the calendar.setfirstweekday() function.
Here is a list of functions available with the calendar module −
Other Modules and Functions
If you are interested, then here you would find a list of other important modules and functions to play with date & time in Python −
Python 3 -
The following function takes a string as input parameter and prints it on standard screen.
def printme( str ): "This prints a passed string into this function" print (str) return
Calling a Function
Defining a function gives it a name, specifies the parameters that are to be included in the function and structures the blocks of code.
Once the basic structure of a function is finalized, you can execute it by calling it from another function or directly from the Python prompt. Following is an example to call the printme() function −Live Demo
#!/usr/bin/python3 # Function definition is here def printme( str ): "This prints a passed string into this function" print (str) return # Now you can call printme function printme("This is first call to the user defined function!") printme("Again second call to the same function")
When the above code is executed, it produces the following result −
This is first call to the user defined function! Again second call to the same function
Pass by Reference vs Value
All parameters (arguments) in the Python language are passed by reference. It means if you change what a parameter refers to within a function, the change also reflects back in the calling function. For example −Live Demo
#!/usr/bin/python3 # Function definition is here def changeme( mylist ): "This changes a passed list into this function" print ("Values inside the function before change: ", mylist) mylist[2]=50 print ("Values inside the function after change: ", mylist) return # Now you can call changeme function mylist = [10,20,30] changeme( mylist ) print ("Values outside the function: ", mylist)
Here, we are maintaining reference of the passed object and appending values in the same object. Therefore, this would produce the following result −
Values inside the function before change: [10, 20, 30] Values inside the function after change: [10, 20, 50] Values outside the function: [10, 20, 50]
There is one more example where argument is being passed by reference and the reference is being overwritten inside the called function.Live Demo
#!/usr/bin/python3 # Function definition is here def changeme( mylist ): "This changes a passed list into this function" mylist = [1,2,3,4] # This would assi new reference in mylist print ("Values inside the function: ", mylist) return # Now you can call changeme function mylist = [10,20,30] changeme( mylist ) print ("Values outside the function: ", mylist)
The parameter mylist is local to the function changeme. Changing mylist within the function does not affect mylist. The function accomplishes nothing and finally this would produce the following result −
Values inside the function: [1, 2, 3, 4] Values outside the function: [10, 20, 30]
Function Arguments
You can call a function by using the following types of formal arguments −
-Live Demo
#!/usr/bin/python3 # Function definition is here def printme( str ): "This prints a passed string into this function" print (str) return # Now you can call printme function printme()
When the above code is executed, it produces the following result −
Traceback (most recent call last): File "test.py", line 11, in <module>Live Demo
#!/usr/bin/python3 # Function definition is here def printme( str ): "This prints a passed string into this function" print (str) return # Now you can call printme function printme( str = "My string")
When the above code is executed, it produces the following result −
My string
The following example gives a clearer picture. Note that the order of parameters does not matter.Live Demo
#!/usr/bin/python3 # Function definition is here def printinfo( name, age ): "This prints a passed info into this function" print ("Name: ", name) print ("Age ", age) return # Now you can call printinfo function printinfo( age = 50, name = "miki" )
When the above code is executed, it produces the following result −
Name: miki Age 50
Default Arguments
A default argument is an argument that assumes a default value if a value is not provided in the function call for that argument. The following example gives an idea on default arguments, it prints default age if it is not passed −Live Demo
#!/usr/bin/python3 # Function definition is here def printinfo( name, age = 35 ): "This prints a passed info into this function" print ("Name: ", name) print ("Age ", age) return # Now you can call printinfo function printinfo( age = 50, name = "miki" ) printinfo( name = "miki" )
When the above code is executed, it produces the following result −
Name: miki Age 50 Name: miki Age 35 given below −
def functionname([formal_args,] *var_args_tuple ): "function_docstring" function_suite return [expression]
An asterisk (*) is placed before the variable name that holds the values of all nonkeyword variable arguments. This tuple remains empty if no additional arguments are specified during the function call. Following is a simple example −Live Demo
#!/usr/bin/python3 # Function definition is here def printinfo( arg1, *vartuple ): "This prints a variable passed arguments" print ("Output is: ") print (arg1) for var in vartuple: print (var) return # Now you can call printinfo function printinfo( 10 ) printinfo( 70, 60, 50 )
When the above code is executed, it produces the following result −
Output is: 10 Output is: 70 60 50
The Anonymous Functions
These functions are called anonymous because they are not declared in the standard manner by using the def keyword. You can use the lambda keyword to create small anonymous functions.
Lambda forms can take any number of arguments but return just one value in the form of an expression. They cannot contain commands or multiple expressions.
An anonymous function cannot be a direct call to print because lambda requires an expression.
Lambda functions have their own local namespace and cannot access variables other than those in their parameter list and those in the global namespace.
Although it appears that lambdas are a one-line version of a function, they are not equivalent to inline statements in C or C++, whose purpose is to stack allocation by passing function, during invocation for performance reasons.
Syntax
The syntax of lambda functions contains only a single statement, which is as follows −
lambda [arg1 [,arg2,.....argn]]:expression
Following is an example to show how lambda form of function works −Live Demo
#!/usr/bin/python3 # Function definition is here sum = lambda arg1, arg2: arg1 + arg2 # Now you can call sum as a function print ("Value of total : ", sum( 10, 20 )) print ("Value of total : ", sum( 20, 20 ))
When the above code is executed, it produces the following result −
Value of total : 30 Value of total : 40
The return Statement
The statement return [expression] exits a function, optionally passing back an expression to the caller. A return statement with no arguments is the same as return None.
All the examples given below are not returning any value. You can return a value from a function as follows −Live Demo
#!/usr/bin/python3 # Outside the function : 30Live Demo
#!/usr/bin/python3
Python 3 -aname.py. Here is an example of a simple module, support.py −
def print_func( par ): print "Hello : ", par return
The import Statement
You can use any Python source file as a module by executing an import statement in some other Python source file. The import has the following syntax − hello.py, you need to put the following command at the top of the script −
#!/usr/bin/python3 # repeatedly,
#!/usr/bin/python3 # Fibonacci numbers module def fib(n): # return Fibonacci series up to n result = [] a, b = 0, 1 while b < n: result.append(b) a, b = b, a + b return result >>> from fib import fib >>> fib(100) [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
This statement does not import the entire module fib into the current namespace; it just introduces the item fibonacci from the module fib into the global symbol table of the importing module.
The from...import * Statement
It is also possible to import all the names from a module into the current namespace by using the following import statement −
from modname import *
This provides an easy way to import all the items from a module into the current namespace; however, this statement should be used sparingly.
Executing Modules as Scripts
Within a module, the module’s name (as a string) is available as the value of the global variable __name__. The code in the module will be executed, just as if you imported it, but with the __name__ set to "__main__".
Add this code at the end of your module −Live Demo
#!/usr/bin/python3 # Fibonacci numbers module def fib(n): # return Fibonacci series up to n result = [] a, b = 0, 1 while b < n: result.append(b) a, b = b, a + b return result if __name__ == "__main__": f = fib(100) print(f)
When you run the above code, the following output will be displayed.
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
Locating Modules
When you import a module, the Python interpreter searches for the module in the following sequences −
The current directory.
If the module is not found, Python then searches each directory in the shell variable PYTHONPATH.
If all else fails, Python checks the default path. On UNIX, this default path is normally /usr/local/lib/python3/. −
set PYTHONPATH = c:\python34\lib;
And here is a typical PYTHONPATH from a UNIX system −.Live Demo
#!/usr/bin/python3Live Demo
#!/usr/bin/python3 # the following line of source code −
#!/usr/bin/python3 def Pots(): print ("I'm Pots Phone")
Similar, we have other two files having different functions with the same name as above. They are −
Phone/Isdn.py file having function Isdn()
Phone/G3.py file having function G3()
Now, create one more file __init__.py in the Phone directory −
- Phone/__init__.py
To make all of your functions available when you have3 # function in each file, but you can keep multiple functions in your files. You can also define different Python classes in those files and then you can create your packages out of those classes.
PythonLive Demo
#!Live Demo
#!Live Demo
#!.
PythonLive Demo
#!Live Demo
#!Live Demo
#!Live Demo
#!Live Demo
#!/usr/bin/python3 try: fh = open("testfile", "w") try: fh.write("This is my test file for exception handling!!") finally: print ("Going to close the file") fh.close() except IOError: print ("Error: can\'t find file or read data")
This produces the following result −
Going to close the fileLive Demo
#!Live Demo
#!
PythonLive Demo
#!Live Demo
#!Live Demo
#!Live Demo
#!Live Demo
#!
Python 3 - Regular Expressions. Nevertheless, a small thing first: There are various characters, which would have special meaning when they are used in regular expression. To avoid any confusion while dealing with regular expressions, we would use Raw Strings as r'expression'.
Basic patterns that match single chars
Compilation flags
Compilation flags let you modify some aspects of how regular expressions work. Flags are available in the re module under two names, a long name such as IGNORECASE and a short, one-letter form such as I.
The match Function
This function attempts to match RE pattern to string with optional flags.
Here is the syntax for this function −
re.match(pattern, string, flags = 0)
Here is the description of the parameters −
The re.match function returns a match object on success, None on failure. We usegroup(num) or groups() function of match object to get matched expression.
ExampleLive Demo
#!/usr/bin/python3 import re line = "Cats are smarter than dogs" matchObj = re.match( r'(.*) are (.*?) .*', line, re.M|re.I) if matchObj: print ("matchObj.group() : ", matchObj.group()) print ("matchObj.group(1) : ", matchObj.group(1)) print ("matchObj.group(2) : ", matchObj.group(2)) else: print ("No match!!")
When the above code is executed, it produces the following result −
matchObj.group() : Cats are smarter than dogs matchObj.group(1) : Cats matchObj.group(2) : smarter
The search Function
This function searches for first occurrence of RE pattern within string with optional flags.
Here is the syntax for this function −
re.search(pattern, string, flags = 0)
Here is the description of the parameters −
The re.search function returns a match object on success, none on failure. We use group(num) or groups() function of match object to get the matched expression.
ExampleLive Demo
#!/usr/bin/python3 import re line = "Cats are smarter than dogs"; searchObj = re.search( r'(.*) are (.*?) .*', line, re.M|re.I) if searchObj: print ("searchObj.group() : ", searchObj.group()) print ("searchObj.group(1) : ", searchObj.group(1)) print ("searchObj.group(2) : ", searchObj.group(2)) else: print ("Nothing found!!")
When the above code is executed, it produces the following result −
matchObj.group() : Cats are smarter than dogs matchObj.group(1) : Cats matchObj.group(2) : smarter
Matching Versus Searching
Python offers two different primitive operations based on regular expressions: match checks for a match only at the beginning of the string, while search checks for a match anywhere in the string (this is what Perl does by default).
ExampleLive Demo
#!/usr/bin/python3 import re line = "Cats are smarter than dogs"; matchObj = re.match( r'dogs', line, re.M|re.I) if matchObj: print ("match --> matchObj.group() : ", matchObj.group()) else: print ("No match!!") searchObj = re.search( r'dogs', line, re.M|re.I) if searchObj: print ("search --> searchObj.group() : ", searchObj.group()) else: print ("Nothing found!!")
When the above code is executed, it produces the following result −
No match!! search --> matchObj.group() : dogs
Search and Replace
One of the most important re methods that use regular expressions is sub.
Syntax
re.sub(pattern, repl, string, max=0)
This method replaces all occurrences of the RE pattern in string with repl, substituting all occurrences unless max is provided. This method returns modified string.
ExampleLive Demo
#!/usr/bin/python3 import re phone = "2004-959-559 # This is Phone Number" # Delete Python-style comments num = re.sub(r'#.*$', "", phone) print ("Phone Num : ", num) # Remove anything other than digits num = re.sub(r'\D', "", phone) print ("Phone Num : ", num)
When the above code is executed, it produces the following result −
Phone Num : 2004-959-559 Phone Num : 2004959559
Regular Expression Modifiers: Option Flags
Regular expression literals may include an optional modifier to control various aspects of matching. The modifiers are specified as an optional flag. You can provide multiple modifiers using exclusive OR (|), as shown previously and may be represented by one of these −
Regular Expression Patterns
Except for the control characters, (+ ? . * ^ $ ( ) [ ] { } | \), all characters match themselves. You can escape a control character by preceding it with a backslash.
The following table lists the regular expression syntax that is available in Python −
Regular Expression Examples
Literal characters
Character classes
Special Character Classes
Repetition Cases
Nongreedy repetition
This matches the smallest number of repetitions −
Grouping with Parentheses
Backreferences
This matches a previously matched group again −
Alternatives
Anchors
This needs to specify match position.
Special Syntax with Parentheses
Python 3 - CGI Programming
The Common Gateway Interface, or CGI, is a set of standards that define how information is exchanged between the web server and a custom script. The CGI specs are currently maintained by the NCSA.
What is CGI?
The Common Gateway Interface, or CGI, is a standard for external gateway programs to interface with information servers such as HTTP servers.
The current version is CGI/1.1 and CGI/1.2 is under progress.
Web Browsing
To understand the concept of CGI, let us see what happens when we click a hyper link to browse a particular web page or URL.
Your browser contacts the HTTP web server and demands for the URL, i.e., filename. Architecture Diagram
Web Server Support and Configuration
Before you proceed with CGI Programming, make sure that your Web Server supports CGI and it is configured to handle CGI Programs. All the CGI Programs to be executed by the HTTP server are kept in a pre-configured directory. This directory is called CGI Directory and by convention it is named as /var/www/cgi-bin. By convention, CGI files have extension as. cgi, but you can keep your files with python extension .py as well.
By default, the Linux server is configured to run only the scripts in the cgi-bin directory in /var/www. If you want to specify any other directory to run your CGI scripts, comment the following lines in the httpd.conf file −
<Directory "/var/www/cgi-bin"> AllowOverride None Options ExecCGI Order allow,deny Allow from all </Directory> <Directory "/var/www/cgi-bin"> Options All </Directory>
Here, we assume that you have Web Server up and running successfully and you are able to run any other CGI program like Perl or Shell, etc.
First CGI Program
Here is a simple link, which is linked to a CGI script called hello.py. This file is kept in /var/www/cgi-bin directory and it has following content. Before running your CGI program, make sure you have change mode of file using chmod 755 hello.py UNIX command to make file executable.Live Demo
#!/usr/bin/python print ("Content-type:text/html\r\n\r\n") print ('<html>') print ('<head>') print ('<title>Hello Word - First CGI Program</title>') print ('</head>') print ('<body>') print ('<h2>Hello Word! This is my first CGI program</h2>') print ('</body>') print ('</html>')
Note − First line in the script must be path to Python executable. In Linux it should be #!/usr/bin/python3
Enter following URL in yor browser
This hello.py script is a simple Python script, which writes its output on STDOUT file, i.e., screen. There is one important and extra feature available which is first line to be printed Content-type:text/html\r\n\r\n. This line is sent back to the browser and it specifies the content type to be displayed on the browser screen.
By now you must have understood basic concept of CGI and you can write many complicated CGI programs using Python. This script can interact with any other external system also to exchange information such as RDBMS.
HTTP Header
The line Content-type:text/html\r\n\r\n is part of HTTP header which is sent to the browser to understand the content. All the HTTP header will be in the following form −
HTTP Field Name: Field Content For Example Content-type: text/html\r\n\r\n
There are few other important HTTP headers, which you will use frequently in your CGI Programming.
CGI Environment Variables
All the CGI programs have access to the following environment variables. These variables play an important role while writing any CGI program.
Here is small CGI program to list out all the CGI variables. Click this link to see the result Get EnvironmentLive Demo
#!/usr/bin/python import os print ("Content-type: text/html\r\n\r\n"); print ("<font size=+1>Environment</font><\br>"); for param in os.environ.keys(): print ("<b>%20s</b>: %s<\br>" % (param, os.environ[param])) −
The GET method is the default method to pass information from browser to web server and it produces a long string that appears in your browser's Location:box. Never use GET method if you have password or other sensitive information to pass to the server. The GET method has size limitation: only 1024 characters can be sent in a request string. The GET method sends information using QUERY_STRING header and will be accessible in your CGI Program through QUERY_STRING environment variable.
You can pass information by simply concatenating key and value pairs along with any URL or you can use HTML <FORM> tags to pass information using GET method.
Simple URL Example:Get Method
Here is a simple URL, which passes two values to hello_get.py program using GET method./cgi-bin/hello_get.py?first_name=ZARA&last_name=ALI
Below is hello_get.py script to handle input given by web browser. We are going to use cgi module, which makes it very easy to access passed information −
#!>")
This would generate the following result −
Simple FORM Example:GET Method
This example passes two values using HTML FORM and submit button. We use same CGI script hello_get.py to handle this input.
<form action = "/cgi-bin/hello_get.py" method = "get"> First Name: <input type = "text" name = "first_name"> <br /> Last Name: <input type = "text" name = "last_name" /> <input type = "submit" value = "Submit" /> </form>
Here is the actual output of the above form, you enter First and Last Name and then click submit button to see the result.
Passing Information Using POST Method same hello_get.py script which handles GET as well as POST method.
#!>"
Let us take again same example as above which passes two values using HTML FORM and submit button. We use same CGI script hello_get.py to handle this input.
<form action = "/cgi-bin/hello_get.py" method = "post"> First Name: <input type = "text" name = "first_name"><br /> Last Name: <input type = "text" name = "last_name" /> <input type = "submit" value = "Submit" /> </form> −
<form action = "/cgi-bin/checkbox.cgi" method = "POST" target = "_blank"> <input type = "checkbox" name = "maths" value = "on" /> Maths <input type = "checkbox" name = "physics" value = "on" /> Physics <input type = "submit" value = "Select Subject" /> </form>
The result of this code is the following form −
Below is checkbox.cgi script to handle input given by web browser for checkbox button.
#!/usr/bin/python # Import modules for CGI handling import cgi, cgitb # Create instance of FieldStorage form = cgi.FieldStorage() # Get data from fields if form.getvalue('maths'): math_flag = "ON" else: math_flag = "OFF" if form.getvalue('physics'): physics_flag = "ON" else: physics_flag = "OFF" print "Content-type:text/html\r\n\r\n" print "<html>" print "<head>" print "<title>Checkbox - Third CGI Program</title>" print "</head>" print "<body>" print "<h2> CheckBox Maths is : %s</h2>" % math_flag print "<h2> CheckBox Physics is : %s</h2>" % physics_flag print "</body>" print "</html>"
Passing Radio Button Data to CGI Program
Radio Buttons are used when only one option is required to be selected.
Here is example HTML code for a form with two radio buttons −
<form action = "/cgi-bin/radiobutton.py" method = "post" target = "_blank"> <input type = "radio" name = "subject" value = "maths" /> Maths <input type = "radio" name = "subject" value = "physics" /> Physics <input type = "submit" value = "Select Subject" /> </form>
The result of this code is the following form −
Below is radiobutton.py script to handle input given by web browser for radio button −
#!/usr/bin/python # Import modules for CGI handling import cgi, cgitb # Create instance of FieldStorage form = cgi.FieldStorage() # Get data from fields if form.getvalue('subject'): subject = form.getvalue('subject') else: subject = "Not set" print "Content-type:text/html\r\n\r\n" print "<html>" print "<head>" print "<title>Radio - Fourth CGI Program</title>" print "</head>" print "<body>" print "<h2> Selected Subject is %s</h2>" % subject print "</body>" print "</html>"
Passing Text Area Data to CGI Program
TEXTAREA element is used when multiline text has to be passed to the CGI Program.
Here is example HTML code for a form with a TEXTAREA box −
<form action = "/cgi-bin/textarea.py" method = "post" target = "_blank"> <textarea name = "textcontent" cols = "40" rows = "4"> Type your text here... </textarea> <input type = "submit" value = "Submit" /> </form>
The result of this code is the following form −
Below is textarea.cgi script to handle input given by web browser −
#!/usr/bin/python # Import modules for CGI handling import cgi, cgitb # Create instance of FieldStorage form = cgi.FieldStorage() # Get data from fields if form.getvalue('textcontent'): text_content = form.getvalue('textcontent') else: text_content = "Not entered" print "Content-type:text/html\r\n\r\n" print "<html>" print "<head>"; print "<title>Text Area - Fifth CGI Program</title>" print "</head>" print "<body>" print "<h2> Entered Text Content is %s</h2>" % text_content print "</body>"
Passing Drop Down Box Data to CGI Program
Drop Down Box is used when we have many options available but only one or two will be selected.
Here is example HTML code for a form with one drop down box −
<form action = "/cgi-bin/dropdown.py" method = "post" target = "_blank"> <select name = "dropdown"> <option value = "Maths" selected>Maths</option> <option value = "Physics">Physics</option> </select> <input type = "submit" value = "Submit"/> </form>
The result of this code is the following form −
Below is dropdown.py script to handle input given by web browser.
#!/usr/bin/python # Import modules for CGI handling import cgi, cgitb # Create instance of FieldStorage form = cgi.FieldStorage() # Get data from fields if form.getvalue('dropdown'): subject = form.getvalue('dropdown') else: subject = "Not entered" print "Content-type:text/html\r\n\r\n" print "<html>" print "<head>" print "<title>Dropdown Box - Sixth CGI Program</title>" print "</head>" print "<body>" print "<h2> Selected Subject is %s</h2>" % subject print "</body>" print "</html>"
Using Cookies in CGI
HTTP protocol is a stateless protocol. For a commercial website, it is required to maintain session information among different pages. For example, one user registration ends after completing many pages. sets and value pairs.
Setting up Cookies
It is very easy to send cookies to browser. These cookies are sent along with HTTP Header before to Content-type field. Assuming you want to set UserID and Password as cookies. Setting the cookies is done as follows −
#!/usr/bin/python print "Set-Cookie:UserID = XYZ;\r\n" print "Set-Cookie:Password = XYZ123;\r\n" print "Set-Cookie:Expires = Tuesday, 31-Dec-2007 23:12:40 GMT";\r\n" print "Set-Cookie:Domain =;\r\n" print "Set-Cookie:Path = /perl;\n" print "Content-type:text/html\r\n\r\n" ...........Rest of the HTML Content....
From this example, you must have understood how to set cookies. We use Set-Cookie HTTP header to set cookies.
It is optional to set cookies attributes like Expires, Domain, and Path. It is notable that cookies are set before sending magic line "Content-type:text/html\r\n\r\n.
Retrieving Cookies
It is very easy to retrieve all the set cookies. Cookies are stored in CGI environment variable HTTP_COOKIE and they will have following form −
key1 = value1;key2 = value2;key3 = value3....
Here is an example of how to retrieve cookies.
#!/usr/bin/python # Import modules for CGI handling from os import environ import cgi, cgitb if environ.has_key('HTTP_COOKIE'): for cookie in map(strip, split(environ['HTTP_COOKIE'], ';')): (key, value ) = split(cookie, '='); if key == "UserID": user_id = value if key == "Password": password = value print "User ID = %s" % user_id print "Password = %s" % password
This produces the following result for the cookies set by above script −
User ID = XYZ Password = XYZ123
File Upload Example
To
Above example has been disabled intentionally to save people uploading file on our server, but you can try above code with your server.("\\", "/" ))
How To Raise a "File Download" Dialog Box?
Sometimes, it is desired that you want to give option where a user can click a link and it will pop up a "File Download" dialogue box to the user instead of displaying actual content. This is very easy and can be achieved through HTTP header. This HTTP header is be different from the header mentioned in previous section.
For example, if you want make a FileName file downloadable from a given link, then its syntax is as follows −
#!/usr/bin/python # HTTP Header print "Content-Type:application/octet-stream; name = \"FileName\"\r\n"; print "Content-Disposition: attachment; filename = \"FileName\"\r\n\n"; # Actual File Content will go here. fo = open("foo.txt", "rb") str = fo.read(); print str # Close opend file fo.close()
Hope you enjoyed this tutorial. If yes, please send me your feedback at: Contact Us
Python 3 - MySQL Database Access
The Python standard for database interfaces is the Python DB-API. Most Python database interfaces adhere to this standard.
You can choose the right database for your application. Python Database API supports a wide range of database servers such as −
- GadFly
- mSQL
- MySQL
- PostgreSQL
- Microsoft SQL Server 2000
- Informix
- Interbase
- Oracle
- Sybase
- SQLite
Here is the list of available Python database interfaces − Python Database Interfaces and APIs. You must download a separate DB API module for each database you need to access. For example, if you need to access an Oracle database as well as a MySQL database, you must download both the Oracle and the MySQL database modules.
The DB API provides a minimal standard for working with databases using Python structures and syntax wherever possible. This API includes the following −
- Importing the API module.
- Acquiring a connection with the database.
- Issuing SQL statements and stored procedures.
- Closing the connection
Python has an in-built support for SQLite. In this section, we would learn all the concepts using MySQL. MySQLdb module, a popular interface with MySQL is not compatible with Python 3. Instead, we shall use PyMySQL module.
What is PyMySQL ? Install PyMySQL?
Before proceeding further, you make sure you have PyMySQL installed on your machine. Just type the following in your Python script and execute it −
#!/usr/bin/python3 import pymysql
If it produces the following result, then it means MySQLdb module is not installed −
Traceback (most recent call last): File "test.py", line 3, in <module> Import pymysql ImportError: No module named pymysql
The last stable release is available on PyPI and can be installed with pip −
pip install pymysql
Alternatively (e.g. if pip is not available), a tarball can be downloaded from GitHub and installed with Setuptools as follows −
$ # X.X is the desired pymysql version (e.g. 0.5 or 0.6). $ curl -L | tar xz $ cd PyMySQL* $ python setup.py install $ # The folder PyMySQL* can be safely removed now.
Note − Make sure you have root privilege to install the above module.
Database Connection
Before connecting to a MySQL database, make sure of the following points −
You have created a database TESTDB.
You have created a table EMPLOYEE in TESTDB.
This table has fields FIRST_NAME, LAST_NAME, AGE, SEX and INCOME.
User ID "testuser" and password "test123" are set to access TESTDB.
Python module PyMySQL is installed properly on your machine.
You have gone through MySQL tutorial to understand MySQL Basics.
Example
Following is an example of connecting with MySQL database "TESTDB" −
#!/usr/bin/python3 import pymysql # Open database connection db = pymysql.connect("localhost","testuser","test123","TESTDB" ) # prepare a cursor object using cursor() method cursor = db.cursor() # execute SQL query using execute() method. cursor.execute("SELECT VERSION()") # Fetch a single row using fetchone() method. data = cursor.fetchone() print ("Database version : %s " % data) # disconnect from server db.close()
While running this script, it produces the following result.
Database version : 5.5.20-log
If a connection is established with the datasource, then a Connection Object is returned and saved into db for further use, otherwise db is set to None. Next, db object is used to create a cursor object, which in turn is used to execute SQL queries. Finally, before coming out, it ensures that the database connection is closed and resources are released.
Creating Database Table
Once a database connection is established, we are ready to create tables or records into the database tables using execute method of the created cursor.
Example
Let us create a Database table EMPLOYEE −
#!/usr/bin/python3 import pymysql # Open database connection db = pymysql()
INSERT Operation
The INSERT Operation is required when you want to create your records into a database table.
Example
The following example, executes SQL INSERT statement to create a record in the EMPLOYEE table ('Mac', 'Mohan', 20, 'M', 2000)""" try: # Execute the SQL command cursor.execute(sql) # Commit your changes in the database db.commit() except: # Rollback in case there is any error db.rollback() # disconnect from server db.close()
The above example can be written as follows to create SQL queries dynamically ('%s', '%s', '%d', '%c', '%d' )" % \ ('Mac', 'Mohan', 20, 'M', 2000) try: # Execute the SQL command cursor.execute(sql) # Commit your changes in the database db.commit() except: # Rollback in case there is any error db.rollback() # disconnect from server db.close()
Example
The following code segment is another form of execution where you can pass parameters directly −
.................................. user_id = "test123" password = "password" con.execute('insert into Login values("%s", "%s")' % \ (user_id, password)) ..................................
READ Operation
READ Operation on any database means to fetch some useful information from the database.
Once the database connection is established, you are ready to make a query into this database. You can use either fetchone() method to fetch a single record or fetchall() method to fetch multiple values from a database table.
fetchone() − It fetches the next row of a query result set. A result set is an object that is returned when a cursor object is used to query a table.
fetchall() − It fetches all the rows in a result set. If some rows have already been extracted from the result set, then it retrieves the remaining rows from the result set.
rowcount − This is a read-only attribute and returns the number of rows that were affected by an execute() method.
Example
The following procedure queries all the records from EMPLOYEE table having salary more than 1000 −
#!/usr/bin/python3 import pymysql # Open database connection db = pymysql.connect("localhost","testuser","test123","TESTDB" ) # prepare a cursor object using cursor() method cursor = db.cursor() # Prepare SQL query to INSERT a record into the database. sql = "SELECT * FROM EMPLOYEE \ WHERE INCOME > '%d'" % (1000) try: # Execute the SQL command cursor.execute(sql) # Fetch all the rows in a list of lists. results = cursor.fetchall() for row in results: fname = row[0] lname = row[1] age = row[2] sex = row[3] income = row[4] # Now print fetched result print ("fname = %s,lname = %s,age = %d,sex = %s,income = %d" % \ (fname, lname, age, sex, income )) except: print ("Error: unable to fetch data") # disconnect from server db.close()
Output
This will produce the following result −
fname = Mac, lname = Mohan, age = 20, sex = M, income = 2000
Update Operation
UPDATE Operation on any database means to update one or more records, which are already available in the database.
The following procedure updates all the records having SEX as 'M'. Here, we increase the AGE of all the males by one year.
Example
#!/usr/bin/python3 import pymysql # Open database connection db = pymysql.connect("localhost","testuser","test123","TESTDB" ) # prepare a cursor object using cursor() method cursor = db.cursor() # Prepare SQL query to UPDATE required records sql = "UPDATE EMPLOYEE SET AGE = AGE + 1 WHERE SEX = '%c'" % ('M') try: # Execute the SQL command cursor.execute(sql) # Commit your changes in the database db.commit() except: # Rollback in case there is any error db.rollback() # disconnect from server db.close()
DELETE Operation
DELETE operation is required when you want to delete some records from your database. Following is the procedure to delete all the records from EMPLOYEE where AGE is more than 20 −
Example
#!/usr/bin/python3 import pymysql # Open database connection db = pymysql()
Performing Transactions
Transactions are a mechanism that ensures data consistency. Transactions have the following four properties −
Atomicity − Either a transaction completes or nothing happens at all.
Consistency − A transaction must start in a consistent state and leave the system in a consistent state.
Isolation − Intermediate results of a transaction are not visible outside the current transaction.
Durability − Once a transaction was committed, the effects are persistent, even after a system failure.
The Python DB API 2.0 provides two methods to either commit or rollback a transaction.
Example
You already know how to implement transactions. Here is a similar example −
# Prepare SQL query to DELETE required records sql = "DELETE FROM EMPLOYEE WHERE AGE > '%d'" % (20) try: # Execute the SQL command cursor.execute(sql) # Commit your changes in the database db.commit() except: # Rollback in case there is any error db.rollback()
COMMIT Operation
Commit is an operation, which gives a green signal to the database to finalize the changes, and after this operation, no change can be reverted back.
Here is a simple example to call the commit method.
db.commit()
ROLLBACK Operation
If you are not satisfied with one or more of the changes and you want to revert back those changes completely, then use the rollback() method.
Here is a simple example to call the rollback() method.
db.rollback()
Disconnecting Database
To disconnect the Database connection, use the close() method.
db.close()
If the connection to a database is closed by the user with the close() method, any outstanding transactions are rolled back by the DB. However, instead of depending on any of the DB lower level implementation details, your application would be better off calling commit or rollback explicitly.
Handling Errors
There are many sources of errors. A few examples are a syntax error in an executed SQL statement, a connection failure, or calling the fetch method for an already canceled or finished statement handle.
The DB API defines a number of errors that must exist in each database module. The following table lists these exceptions.
Your Python scripts should handle these errors, but before using any of the above exceptions, make sure your MySQLdb has support for that exception. You can get more information about them by reading the DB API 2.0 specification.
Python
Python")
Python 3 - are sometimes called light-weight processes and they do not require much memory overhead; they are cheaper than processes.
A thread has a beginning, an execution sequence, and a conclusion. It has an instruction pointer that keeps track of where within its context is it currently running.
It can be pre-empted (interrupted).
It can temporarily be put on hold (also known as sleeping) while other threads are running - this is called yielding.
There are two different kind of threads −
- kernel thread
- user thread
Kernel Threads are a part of the operating system, while the User-space threads are not implemented in the kernel.
There are two modules which support the usage of threads in Python3 −
- _thread
- threading
The thread module has been "deprecated" for quite a long time. Users are encouraged to use the threading module instead. Hence, in Python 3, the module "thread" is not available anymore. However, it has been renamed to "_thread" for backwards compatibilities in Python3.
Starting a New Thread
To spawn another thread, you need to call the following method available in the thread module −
_thread.start_new_thread ( function, args[, kwargs] )
This method call enables a fast and efficient way to create new threads in both Linux and Windows.
The method call returns immediately and the child thread starts and calls function with the passed list of args. When the function returns, the thread terminates.
Here, args is a tuple of arguments; use an empty tuple to call function without passing any arguments. kwargs is an optional dictionary of keyword arguments.
Example
#!/usr/bin/python3: unable to start thread") while 1: pass
Output
When the above code is executed, it produces the following result −
Thread-1: Fri Feb 19 09:41:39 2016 Thread-2: Fri Feb 19 09:41:41 2016 Thread-1: Fri Feb 19 09:41:41 2016 Thread-1: Fri Feb 19 09:41:43 2016 Thread-2: Fri Feb 19 09:41:45 2016 Thread-1: Fri Feb 19 09:41:45 2016 Thread-1: Fri Feb 19 09:41:47 2016 Thread-2: Fri Feb 19 09:41:49 2016 Thread-2: Fri Feb 19 09:41:53 2016
Program goes in an infinite loop. You will have to press ctrl-c to stop
Although it is very effective for low-level threading, the thread module is very limited compared to the newer threading module.
The Threading Module
The newer threading module included with Python 2.4 provides much more powerful, high-level support for threads than the thread module discussed in the previous section.
The threading module exposes all the methods of the thread module and provides some additional methods −
threading.activeCount() − Returns the number of thread objects that are active.
threading.currentThread() − Returns the number of thread objects in the caller's thread control.
threading.enumerate() − Returns a list of all thread objects that are currently active.
In addition to the methods, the threading module has the Thread class that implements threading. The methods provided by the Thread class are as follows −
run() − The run() method is the entry point for a thread.
start() − The start() method starts a thread by calling the run method.
join([time]) − The join() waits for threads to terminate.
isAlive() − The isAlive() method checks whether a thread is still executing.
getName() − The getName() method returns the name of a thread.
setName() − The setName() method sets the name of a thread.
Creating Thread Using Threading Module
To implement a new thread using the threading module, you have to do the following −
Define a new subclass of the Thread class.
Override the __init__(self [,args]) method to add additional arguments.
Then, override the run(self [,args]) method to implement what the thread should do when started.
Once you have created the new Thread subclass, you can create an instance of it and then start a new thread by invoking the start(), which in turn calls the run() method.
Example
#!/usr/bin/python3 import threading import time exitFlag = 0 class myThread (threading.Thread): def __init__(self, threadID, name, counter): threading.Thread.__init__(self) self.threadID = threadID self.name = name self.counter = counter def run(self): print ("Starting " + self.name) print_time(self.name, self.counter, 5) print ("Exiting " + self.name) def print_time(threadName, delay, counter): while counter: if exitFlag: threadName.exit() time.sleep(delay) print ("%s: %s" % (threadName, time.ctime(time.time()))) counter -= 1 # Create new threads thread1 = myThread(1, "Thread-1", 1) thread2 = myThread(2, "Thread-2", 2) # Start new Threads thread1.start() thread2.start() thread1.join() thread2.join() print ("Exiting Main Thread")
Result
When we run the above program, it produces the following result −
Starting Thread-1 Starting Thread-2 Thread-1: Fri Feb 19 10:00:21 2016 Thread-2: Fri Feb 19 10:00:22 2016 Thread-1: Fri Feb 19 10:00:22 2016 Thread-1: Fri Feb 19 10:00:23 2016 Thread-2: Fri Feb 19 10:00:24 2016 Thread-1: Fri Feb 19 10:00:24 2016 Thread-1: Fri Feb 19 10:00:25 2016 Exiting Thread-1 Thread-2: Fri Feb 19 10:00:26 2016 Thread-2: Fri Feb 19 10:00:28 2016 Thread-2: Fri Feb 19 10:00:30 2016 Exiting Thread-2 Exiting Main Thread
Synchronizing Threads
The threading module provided with Python includes a simple-to-implement locking mechanism that allows you to synchronize threads. A new lock is created by calling the Lock() method, which returns the new lock.
The acquire(blocking) method of the new lock object is used to force the threads to run synchronously. The optional blocking parameter enables you to control whether the thread waits to acquire the lock.
If blocking is set to 0, the thread returns immediately with a 0 value if the lock cannot be acquired and with a 1 if the lock was acquired. If blocking is set to 1, the thread blocks and wait for the lock to be released.
The release() method of the new lock object is used to release the lock when it is no longer required.
Example
#!/usr/bin/python3 import threading import time class myThread (threading.Thread): def __init__(self, threadID, name, counter): threading.Thread.__init__(self) self.threadID = threadID self.name = name self.counter = counter def run(self): print ("Starting " + self.name) # Get lock to synchronize threads threadLock.acquire() print_time(self.name, self.counter, 3) # Free lock to release next thread threadLock.release() def print_time(threadName, delay, counter): while counter: time.sleep(delay) print ("%s: %s" % (threadName, time.ctime(time.time()))) counter -= 1 threadLock = threading.Lock() threads = [] # Create new threads thread1 = myThread(1, "Thread-1", 1) thread2 = myThread(2, "Thread-2", 2) # Start new Threads thread1.start() thread2.start() # Add threads to thread list threads.append(thread1) threads.append(thread2) # Wait for all threads to complete for t in threads: t.join() print ("Exiting Main Thread")
Output
When the above code is executed, it produces the following result −
Starting Thread-1 Starting Thread-2 Thread-1: Fri Feb 19 10:04:14 2016 Thread-1: Fri Feb 19 10:04:15 2016 Thread-1: Fri Feb 19 10:04:16 2016 Thread-2: Fri Feb 19 10:04:18 2016 Thread-2: Fri Feb 19 10:04:20 2016 Thread-2: Fri Feb 19 10:04:22 2016 Exiting Main Thread
Multithreaded Priority Queue
The Queue module allows you to create a new queue object that can hold a specific number of items. There are following methods to control the Queue −
get() − The get() removes and returns an item from the queue.
put() − The put adds item to a queue.
qsize() − The qsize() returns the number of items that are currently in the queue.
empty() − The empty( ) returns True if queue is empty; otherwise, False.
full() − the full() returns True if queue is full; otherwise, False.
Example
#!/usr/bin/python3 queue to empty while not workQueue.empty(): pass # Notify threads it's time to exit exitFlag = 1 # Wait for all threads to complete for t in threads: t.join() print ("Exiting Main Thread")
Output
When the above code is executed, it produces the following result −
Starting Thread-1 Starting Thread-2 Starting Thread-3 Thread-1 processing One Thread-2 processing Two Thread-3 processing Three Thread-1 processing Four Thread-2 processing Five Exiting Thread-3 Exiting Thread-1 Exiting Thread-2 Exiting Main Thread
Python 3 - an SQL-based backbone.
XML Parser Architectures and APIs
The Python standard library provides a minimal but useful set of interfaces to work with XML.
The two most basic and broadly used APIs to XML data are the SAX and DOM interfaces.
Simple API for XML (SAX) − Here, you register callbacks for events of interest and then let the parser proceed through the document. This is useful when your documents are large or you have memory limitations, it parses the file as it reads it from the disk and the entire file is never stored in the memory.
Document Object Model (DOM) API − This is a World Wide Web Consortium recommendation wherein the entire file is read into the memory and stored in a hierarchical (tree-based) form to represent all the features of an XML document.
SAX obviously cannot process information as fast as DOM, when working with large files. On the other hand, using DOM exclusively can really kill your resources, especially if used on many small files.
SAX is read-only, while DOM allows changes to the XML file. Since these two different APIs literally complement each other, there is no reason why you cannot use them both for large projects.
For all our XML code examples, let us the
The following method creates a new parser object and returns it. The parser object created will be of the first parser type, the system finds.
xml.sax.make_parser( [parser_list] )
Here are the details of the parameters −
parser_list − The optional argument consisting of a list of parsers to use which must all implement the make_parser method.
The parse Method
The following method creates a SAX parser and uses it to parse a document.
xml.sax.parse( xmlfile, contenthandler[, errorhandler])
Here are the details of the parameters −
xmlfile − This is the name of the XML file to read from.
contenthandler − This must be a ContentHandler object.
errorhandler − If specified, errorhandler must be a SAX ErrorHandler object.
The parseString Method
There is one more method to create a SAX parser and to parse the specified XML string.
xml.sax.parseString(xmlstring, contenthandler[, errorhandler])
Here are the details of the parameters −
xmlstring − This is the name of the XML string to read from.
contenthandler − This must be a ContentHandler object.
errorhandler − If specified, errorhandler must be a SAX ErrorHandler object.
Example
#!/usr/bin/python3")
Output
This would produce the following result −
*****Movie***** Title: Enemy Behind Type: War, Thriller Format: DVD Year: 2003 Rating: PG Stars: 10 Description: Talk about a US-Japan war *****Movie***** Title: Transformers Type: Anime, Science Fiction Format: DVD Year: 1989 Rating: R Stars: 8 Description: A scientific fiction *****Movie***** Title: Trigun Type: Anime, Action Format: DVD Rating: PG Stars: 10 Description: Vash the Stampede! *****Movie***** Title: Ishtar Type: Comedy Format: VHS Rating: PG Stars: 2 Description: Viewable boredom
For a complete detail on SAX API documentation, please refer to the standard Python SAX APIs.
Parsing XML with DOM APIs
The Document Object Model ("DOM") is a cross-language API from the World Wide Web Consortium (W3C) for accessing and modifying the XML documents.
The DOM is extremely useful for random-access applications. SAX only allows you a view of one bit of the document at a time. If you are looking at one SAX element, you have no access to another.
Here is the easiest way to load an XML document quickly.
Example
#!/usr/bin/python3)
Output
This would produce the following result −
Root element : New Arrivals *****Movie***** Title: Enemy Behind Type: War, Thriller Format: DVD Rating: PG Description: Talk about a US-Japan war *****Movie***** Title: Transformers Type: Anime, Science Fiction Format: DVD Rating: R Description: A scientific fiction *****Movie***** Title: Trigun Type: Anime, Action Format: DVD Rating: PG Description: Vash the Stampede! *****Movie***** Title: Ishtar Type: Comedy Format: VHS Rating: PG Description: Viewable boredom
For a complete detail on DOM API documentation, please refer to the standard Python DOM APIs.
Python 3 - GUI Programming (Tkinter)
Python provides various options for developing graphical user interfaces (GUIs). The most important features are listed below.
Tkinter − Tkinter is the Python interface to the Tk GUI toolkit shipped with Python. We would look this option in this chapter.
wxPython − This is an open-source Python interface for wxWidgets GUI toolkit. You can find a complete tutorial on WxPython here.
PyQt −This is also a Python interface for a popular cross-platform Qt GUI library. TutorialsPoint has a very good tutorial on PyQt here.
JPython − JPython is a Python port for Java which gives Python scripts seamless access to the Java class libraries on the local machine.
There are many other interfaces available, which you can find them on the net.
Tkinter Programming
Tk3 import tkinter # note that module name has changed from Tkinter in Python 2 to tkinter in Python 3 top = tkinter.Tk() # Code to add widgets will go here... top.mainloop()
This would create a following window −
Tkinter −
Standard attributes
Let us look at how some of their common attributes, such as sizes, colors and fonts are specified.
Geometry Management
All Tkinter widgets have access to.
Python 3 - as C functions inside the extension module.
An initialization function.
The Header File Python.h
You need to include Python.h header file in your C source file, which gives you −
ml_name − This is the name of the function as the Python interpreter presents when it is used in Python programs.
ml_meth − This is the address of a function that has any one of the signatures described in the previous section.
ml_flags − − This is the docstring for the function, which could be NULL if you do not feel like writing one.
This table needs to be terminated with a sentinel that consists of NULL and 0 values for the appropriate members.
Example
For the above-defined function, we have − This is the function to be exported.
module_methods − This is the mapping table name defined above.
docstring − This is the comment you want to give in your extension.
Putting all this together, it the source form, built and installed via a setup script usually called setup.py as.
For the above module, you need to prepare the will most likely need to run this command as root in order to have permissions to write to the site-packages directory. This usually is not a problem on Windows.
Importing Extensions
Once you install your extensions, you would be able to import and call that extension in your Python script as follows −
Example
#!/usr/bin/python3 import helloworld print helloworld.helloworld()
Output
This would produce the following result −
Hello, Python extensions!!
Passing Function Parameters
As you will most likely want to define functions that accept arguments, you can use one of the other signatures for your C functions. For example, the the; }
Output the PyArg_ParseTuple function −
Returning Values
Py_BuildValue takes in a format string much like PyArg_ParseTuple does. Instead of passing in the addresses of the values you are building, you pass in the actual values. Here captured.
The following table lists the commonly used code strings, of which zero or more are joined into a string format.
Code {...} builds dictionaries from an even number of C values, alternately keys and values. For example, Py_BuildValue("{issi}",23,"zig","zag",42) returns a dictionary like Python's {23:'zig','zag':42}. | https://www.tutorialspoint.com/python3/python_quick_guide.htm | CC-MAIN-2019-30 | refinedweb | 12,168 | 63.29 |
Link Resolver
When working with field types such as Link or Rich Text, the prismic.io Ruby kit will need to generate links to documents within your website.
Before Reading
This page assumes that you have retrieved your content and stored it in a variable named document.
Since routing is specific to your site, you will need to define your Link Resolver and provide it to some of the methods used on the fields.
If you are incorporating prismic.io into your existing Ruby project or using the Ruby on Rails starter project, you will need to create a Link Resolver.
Here is an example that shows how to add a Link Resolver function.
def link_resolver() @link_resolver ||= Prismic::LinkResolver.new(nil) {|link| # URL for the category type if link.type == "category" "/category/" + link.uid # URL for the product type elsif link.type == "product" "/product/" + link.id # Default case for all other types else "/" end } end
A Link Resolver is provided in the Ruby on Rails starter project, but you may need to adapt it or write your own depending on how you've built your website app.
The Link Resolver can be found in the app/helpers/prismic_helper.rb file of the Ruby on Rails starter.
When creating your link resolver function, you will have access to certain attributes of the linked document.
link.id
string
The document id
link.uid
string
The user-friendly unique id
link.type
string
The custom type of the document
link.tags
array
Array of the document tags
link.lang
string
The language code of the document
link.isBroken
boolean
Boolean that states if the link is broken or not
Was this article helpful?
Can't find what you're looking for? Get in touch with us on our Community Forum. | https://prismic.io/docs/technologies/link-resolver-ruby | CC-MAIN-2022-05 | refinedweb | 297 | 76.72 |
User talk:JWSchmidt/Second half 2008 discussions
Note: this is an archive of old discussions. Please do not edit this page. Continue these discussions at User talk:JWSchmidt. There are other archives at User talk:JWSchmidt/Discussion archive.
Contents
- 1 genopsych
- 2 genopsych
- 3 Re
- 4 Hi
- 5 Moodle Sanbox
- 6 Portal talk:Wiki Scholar/About the movie#the “versity” part
- 7 Ethical Management of the English Language Wikipedia
- 8 off on a tangent a bit......
- 9 Template:Deletion request
- 10 SLP
- 11 Wikiversity:Requests for_Deletion#Wikiversity:Student union
- 12 Urgent Action Required
- 13 Student union
- 14 Let's talk...
- 15 IRC
- 16 Image:I want a pony!.jpg
- 17 Image:Introduce teachingforthefuture interview of JWS.m4a.OGG
- 18 Template Babel pt not working properly?
- 19 Deletionism versus air-conditioner
- 20 Did you see these comments ?
- 21 category:History
- 22 garbage
- 23 RE your request for notifications
- 24 WikiProject study before editing
- 25 Conflict and incivility
- 26 Three Profiles
- 27 Dude!
- 28 Wikiversity:Student union
- 29 Permission
- 30 Moulton's three day trial
- 31 CSD
- 32 Fair procedure and posting statements
- 33 Day 1 Reflections
- 34 Chinese fire drill
- 35 Blanked page(s) at ethics project
- 36 question
- 37 this is terrible in my book :-(
- 38 Teamwork
- 39 Unblock
- 40 Clarification
- 41 Straight talk
- 42 Summary of previous discussion
- 43 Public pages
- 44 JWSchmidt cannot edit this page
- 45 Are you willing
- 46 Keep it simple
- 47 oversight
- 48 So now what?
- 49 Community Review
- 50 Can you abide by this?
- 51 G'day JW
- 52 User boxes
- 53 Help wanted... :-)
- 54 Reflections on your block
- 55 Concerns
- 56 Better footing?
- 57 Wikiversity: scope (versus?) organisation
- 58 Re: fiction
- 59 Reason for Transmission Break in comment...
- 60 Personal and professional
- 61 Wow, and there you go again!
- 62 Audio Wikinews Briefs
- 63 Custodian nomination
- 64 Note
- 65 Question for Mike.Lifeguard
- 66 RNA interference
- 67 Thank you for welcoming
- 68 genpsy
- 69 Request
- 70 removing test section
- 71 Easier?
- 72 Moulton
- 73 Unanswered Questions and Unfinished Conversations from Jimbo's Talk Page
- 74 Happy holidays guys
- 75 Please help!!!
genopsych[edit]
May see my update on genopsych. DMR.
genopsych[edit]
Dear JW Schmid, I think the following subjects are relevant to understand genopsych [1] plant neurobiology and intelligence [2] intelligent behavior of microorganism [3] intuition and instinctual behavior [4] physiological changes due to psychological[ hypnosis, placebo effect and phenomenon like autotomy ] decisions [5] self assembling materials , memory metals etc [6] entropy to creation of new information [7] brain processes [8] information processing within genome [8] random and non random variations , statistical process control [9] Shannon Entropy. DMR Sekhar,79.173.221.246 11:56, 7 August 2008 (UTC)
Re[edit]
ping. Donek (talk) - Go raibh mile maith agaibh 23:14, 8 July 2008 (UTC)
Hi[edit]
- -) ----Erkan Yilmaz uses the Wikiversity:Chat (try) 17:58, 4 August 2008 (UTC)
Moodle Sanbox[edit]
Hi JWSchmidt. I am interested in a Moodle Sandbox course for create some resources for on Moodle and how to use it. I would like this course ASAP. Can you let me know if this is at all possible? Thanks so much. Jgetz 18:31, 14 August 2008 (UTC)
Portal talk:Wiki Scholar/About the movie#the “versity” part[edit]
ping, ----Erkan Yilmaz uses the Wikiversity:Chat (try) 19:46, 21 August 2008 (UTC)
Ethical Management of the English Language Wikipedia[edit]
Welcome to the Ethical Management of the English Language Wikipedia project. May I recommend that you copy one or more of your user subpages to project space as learning resources there? WAS 4.250 18:13, 25 August 2008 (UTC)
off on a tangent a bit......[edit]
just caught up on the ethics project latest, and wandered by Salmon's talk page and noticed your most recent post there - which led me here because I thought I'd share a couple of my thoughts on the bigger picture issue of the whole ID thing. These are totally a propos nothing in particular, and usual disclaimers apply! (just my thoughts, no biggie etc. etc.)
I first wandered into the intelligent design article many years ago (as User:Petesmiles) for reasons lost to me in the mists of time (probably as a result of reading Dawkins? not sure.....) - and enjoyed chatting and editing there, though the learning curve was fairly steep, I wasn't surprised that it was a heated, contentious area, and I do feel that the actual article itself is actually very good.
To cut a long back-story short, one of the weird things that becomes clear (and took me a while to 'get') is that the proponents of the modern movement 'Intelligent Design' really are all associated with one particular institute - the reasons for this are a little bit circular in some ways - but it's really interesting to examine that assertion, and when I do, I find I basically agree with it. One particular bit of your note to Salmon stood out to me a bit - which was " many scientists are skeptical about the power of Darwinian natural selection to account for everything we see in the biosphere" - because I'm just not really sure that that actually is the case... you're probably aware of w:Project Steve, which is a tongue in cheek response to some of the variously framed attempts to question evolution. It's my belief that the vast (vast) majority of scientific opinion supports evolution, which in my lay understanding I'm treating synonymously with 'darwinian natural selection'.
I believe a siege mentality can cause severe harm in wiki editing culture, and indeed may well have caused harm at certain article groups.... I kind of also believe that progress lies in allowing systems to take the strain from / combat agenda-driven pressure in certain areas, because it's definitely there. It's hard to avoid a siege mentality when you're under siege! :-)
Ethics are of course vital in this area, but we're also wandering off into all sorts of other areas, which I'm happy to do! - I hope you don't mind me wandering by and rambling a bit - in other news, I came across some very interesting ethics-related conversation on en wiki earlier, and may have a word with some folk about bringing some material over here..... :-) cheers, Privatemusings 08:30, 30 August 2008 (UTC)
- It is not as insignificant a tangent as one might imagine. Archimedes, who is venerated as the First Engineer, explained the use of the Lever thusly, "Give me a place to stand and I will move the world."
- That tangent into Intelligent Design turns out to be a longer lever, more fulsomely fulcrumated, than I had previously appreciated. After finding all the IP edits of Rosalind Picard (some via her MIT VPN login, some from her Sabbatical-year office at Boston College, and some from home on her residential RCN cable service), we accumulate the following integrated collection of Picardian edit summaries on her own en:WP BLP:
- 23:20, February 4, 2007 (hist) (diff) Rosalind Picard (focus on the entry)
- 23:19, February 4, 2007 (hist) (diff) Rosalind Picard (the deleted material has nothing to do with the person in the entry)
- 22:35, June 29, 2006 (hist) (diff) Rosalind Picard ("anti-evol" is POV of the writer. the organizers of the petition support many aspects of evolution such as microevolution so to label it anti-evolution is an attempt to sell more newspapers)
- 23:29, April 27, 2006 (hist) (diff) Rosalind Picard (Read the petition. Calling it anti-evolution is not accurate, even if the NYT tried to label it that way.)
- 23:24, April 27, 2006 (hist) (diff) Rosalind Picard (→Intelligent Design Support: The petition does NOT say anything about intelligent design. Read the petition.)
- 00:21, March 31, 2006 (hist) (diff) Rosalind Picard (→Showing Skepticism and Asking for Critical Examination of Evidence)
- 15:28, March 13, 2006 (hist) (diff) Rosalind Picard (→Showing Skepticism and Asking for More Critical Examination of the Evidence)
- The above edit summaries make it abundantly clear that Picard's on-Wiki complaint (spanning 11 months from March 2006 to February 2007) coincides in substance and detail with my complaint (spanning 13 months from August 2007 to September 2008), that the Picard BLP erroneously connects her (and the notorious petition) to Intelligent Design, and utterly fails to apprehend the text of the 2001 pre-publication petition, as circulated in private E-Mail among academics, to be a sincere and sober call for rigorous adherence to the protocols of the Scientific Method when examining the evidence for any theory.
Template:Deletion request[edit]
As far as I can tell this template doesn't work, how does one specify the reason for deletion in a call to the template? It isn't clear why "the reason for deletion must be given on the template". Adambro 10:55, 31 August 2008 (UTC)
- Would you care to enter into a sensible discussion about your thoughts about Template:Deletion request on its talk page please. Adambro 14:40, 31 August 2008 (UTC)
SLP[edit]
I saw your plan for a song called "SLP". What does "SLP" mean? --Trout of Doubt 16:09, 31 August 2008 (UTC)
- Nice nic! I'm still working on the song. Right now I'm thinking that the song will be a kind of puzzle to illustrate how learning can take place at Wikiversity. The meaning of "SLP" will probably remain a puzzle to be solved, so I'm reluctant to spoil the fun of solving the puzzle by telling you the answer. Come to Wikiversity:Chat or Wikiversity:Teamspeak....there is someone else there who knows what "SLP" is and who might be willing to tell you. I'll say this, the song is not meant to be mean or to discourage anyone from coming to Wikiversity. The song is a learning project. --JWSchmidt 16:34, 31 August 2008 (UTC)
Wikiversity:Requests for_Deletion#Wikiversity:Student union[edit]
ping: did you see the "Further thoughts" ? ----Erkan Yilmaz uses the Wikiversity:Chat (try) 18:44, 1 September 2008 (UTC)
Urgent Action Required[edit]
It is imperitive that you, as the only currently active custodian, block User:Daniel Brandt immediately. Salmon of Doubt 13:56, 5 September 2008 (UTC)
- You'll also need to delete his user and usertalk pages, and then protect his user talk page. Salmon of Doubt 14:11, 5 September 2008 (UTC)
- Look like someone used User:Daniel Brandt as a disguise, as it doesn't look like the real Daniel Brandt. Dzonatas 16:18, 5 September 2008 (UTC)
Student union[edit]
I suggest to move the discussion over to Ethical_Management_of_the_English_Language_Wikiversity/Case_Studies/Deletionism instead of a edit war. Perhaps, a DPL could be created for active discussion and a link added to the student union page to the DPL. Fair? Dzonatas 20:58, 5 September 2008 (UTC)
Let's talk...[edit]
Hello JWSchmidt, are you willing to meet in chat so we can talk alltogether ? ----Erkan Yilmaz uses the Wikiversity:Chat (try) 17:46, 6 September 2008 (UTC)
IRC[edit]
Hopefully in the upcoming week I'll have some IRC time.
I'm just browsing the state of the union, and will try pinging a few people here and there, to see what is up and what I can do. Glad to see you are back though. :) Historybuff 06:29, 7 September 2008 (UTC)
Image:I want a pony!.jpg[edit]
licence difference: Image talk:I want a pony!.jpg, ----Erkan Yilmaz uses the Wikiversity:Chat (try) 21:39, 8 September 2008 (UTC)
Image:Introduce teachingforthefuture interview of JWS.m4a.OGG[edit]
What licence should this be ? ----Erkan Yilmaz uses the Wikiversity:Chat (try) 22:21, 8 September 2008 (UTC)
- fixed. I still think it is silly that the upload system lets people upload without selecting a license. --JWSchmidt 22:33, 8 September 2008 (UTC)
Template Babel pt not working properly?[edit]
Hi, thank you for the welcome. I went to set my User page and when trying to set the pt-3 in Babel template it fails with an error. I checked and the template exists, yet it does not seem to accept anything but straight "pt". Any ideas? -- Alexf 22:41, 8 September 2008 (UTC)
Deletionism versus air-conditioner[edit]
Hi, John. Let us be a little unseriously imaginatively philosophical. I often like to define "evil" as "destroying/destruction of information" (instead of "un-godly" which some theologians like), for any act of destruction of information increases entropy in the world.
Very often we see resources that pass the test of deletionism become stronger. So, perhaps, deletionism (working in the same way as an air-conditioner) may destroy some information, but in the same time make a smaller part of wikiversity more orderly? Hillgentleman|Talk 18:31, 9 September 2008 (UTC)
- Physics w:Entropy is a measure of useful energy in thermodynamic theory. It is commonly misunderstood as a measure of w:disorder; but consider the case of a drop of water versus the snowflakes that that drop can create when it possesses less available energy. There is more order. w:Information is another thing altogether from available energy or from the other thing, order. Information is related to the unexpected or unpredicted so that a series of a thousand recorded coin flips has both disorder and information (mostly useless, but information and w:knowledge and w:understanding are yet each different things); while pi (3.14...) has a predictable sequence, thus less information (yet has far more use). See w:Entropy (information theory) for more information on this. WAS 4.250 06:20, 10 September 2008 (UTC)
Did you see these comments ?[edit]
Talk:Albanian sea port history, ----Erkan Yilmaz uses the Wikiversity:Chat (try) 21:06, 10 September 2008 (UTC)
category:History[edit]
Please never put anything in this category; I'm working very hard to clear it out right now. If you find an uncategorized History page (or category), please place it in Category:Unsorted History Projects (and tell me the first time you do this; I'll file that category away in the right spot), and try to get the individual pages where they go. Thanks. The Jade Knight 05:56, 11 September 2008 (UTC)
garbage[edit]
John, On your description "good faith edits by wikiversity participants are garbage" If I use the definition from merriam-webster dictionary online: garbage=food waste, discarded or useless material, trash, inaccurate or useless data [1], (reading the word "garbage" without emotional content) people do contribute innaccurate and useless data to wikivesity. Surely we may say that, if somebody creates an empty page, like blackhole and goes away, it would show that she is interested in the subject, and it is not useless information. In that case, let me say "almost useless". Hillgentleman|Talk 06:38, 11 September 2008 (UTC)
RE your request for notifications[edit]
The following diffs include notifications of Moulton's various blocks:
The reblock by Yamla was procedural and required no notice (previous unblock was "restricted unblock to facilitate current Request for Arbitration" which was rejected) The reblock by FeloniousMonk was procedural and required no notice (previous unblock was "unblock to change duration," but duration was not changed) The reblock by Blueboy96 was procedural and required no notice (previous unblock was "to allow SUL merging," SUL was merged)
Hope that helps! Salmon of Doubt 20:40, 11 September 2008 (UTC)
WikiProject study before editing[edit]
Hi John,
Which article, or couple of articles would you like to choose as participant of this project?--Daanschr 06:53, 12 September 2008 (UTC)
- I saw that Moulton also likes to choose those articles. So, i will take a look at them as well. I don't think we will be able to acquire additional participants, but we will see.
- Is everything alright with you, given the fuss with McCormack?--Daanschr 14:34, 12 September 2008 (UTC)
- I saw that there was no information anymore about that a topic would be chosen a year in advance before editing, so participants have the chance to read themselves into the topic. Also, the present topics may be too obscure to have such formal arrangement. I do like to have a list of literature though, which we can use for the discourse.--Daanschr 14:52, 12 September 2008 (UTC)
Therefore, i favour to choose one central major topic and to edit several obscure articles related to this topic.--Daanschr 15:26, 12 September 2008 (UTC)
Conflict and incivility[edit]
Hi John, thanks for joining the Learning from conflict and incivility project, and adding your thoughts from your blog. I wonder though: would you like to reflect more - personally - on some of your comments/actions, especially those that have caused obvious offence? Have you thought about the possible consequences of calling someone a "little kid" (for example)? Also, I think your pretence of anonymity in the Student union conflict is unnecessary - I think there's nothing wrong with being personal, provided it takes place within civility and assuming good faith. Cormaggio talk 08:25, 12 September 2008 (UTC)
- John, I'd echo SB_Johnny below in asking you to please be more civil - to which I'd add "self-reflective". You ask me to provide a list of examples of where you've caused offence, which I would view as more appropriate for the Learning from conflict and incivility project than your talk page. I'd simply ask however, are you not aware that you have been causing offence? On calling someone a "little kid", you insinuated as much in the "I want a pony" discussion in your blog post (above). However, I'd admit it wasn't the best specific example (especially in the context of Salmon's "I want a pony" comments) - even though I'd still encourage you to be more reflective about your role here. To clarify my comment on the "pretence of anonymity in the Student union conflict", I was referring to your commentary on: "this particular participant (I'm not allowed to use his name)". As I said, I don't see anything wrong with critiquing and naming people, provided you do so in a way that is "fair" - ie being civil, assuming good faith, and not making any deliberate provocations that could be seen as an "attack" - even though this is often difficult to define, and different people have different thresholds. Cormaggio talk 08:20, 13 September 2008 (UTC)
- John, I'd say SB_Johnny and I have been asking you to not be so hostile. I'd say we have been asking you - as a reasonable person - to acknowledge that, judging by the fact there has been so much conflict around your actions, that you might have the good reason to take a step back and consider how you might have contributed to the escalation of this conflict. This is what I set up the Learning from conflict and incivility project for, and this is why I have tended towards identifying instances of incivility as a group activity, and not solely on your talk page. I'd never expect you to read my mind - though I wish you might show more self-awareness. Cormaggio talk 16:29, 13 September 2008 (UTC)
Three Profiles[edit])
Dude![edit]
John, please take a day or two to calm down... I don't know what's gotten into you, but it's painful to watch. --SB_Johnny talk 14:24, 12 September 2008 (UTC)
- You don't seem calm to me, and I'm not going to try to have a discussion with you while you're acting like this. --SB_Johnny talk 15:20, 12 September 2008 (UTC)
- I think you just said, "I want a pony". How does that help build dialog and understanding? --JWSchmidt 15:56, 12 September 2008 (UTC)
- No, I don't want a pony, I want my friend to stop embarrassing himself, and I'm worried that if I try to have a conversation with you that you'll treat me like you've been treating others (i.e., badly).
- Just as an aside, I'll be picking up a load of pony poo tomorrow (weather permitting), and will try to take a pic or two... might be a fun image to explain why I don't want a pony. --SB_Johnny talk 16:01, 12 September 2008 (UTC)
- When I was about 12 I saw a television show about a poker game. One of the players was having bad luck and started stealing chips out of the bank without buying them. Another player, sitting across the table was the first to notice. He quietly held up a small mirror so that everyone at the table could see the other player steal some more chips. Everyone else then started to attack the person who had held up the mirror. All I'm doing at Wikiversity is holding up a mirror, but you think I'm embarrassing myself. Okay, I understand. This is the same culture made famous at Wikipedia...rather than look in the mirror, complain about the person who is holding up the mirror. --JWSchmidt 16:24, 12 September 2008 (UTC)
- John, nobody is going to look at the mirror when the person holding it is throwing turds at the people who are supposed to be looking at it. Even the bystanders are going to be busy watching out for ricocheting turds. --SB_Johnny talk 16:30, 12 September 2008 (UTC)
- It is interesting that you say I am "throwing turds" or that I am displaying "absolutely atrocious behavior", but you can make these claims about me, and when challenged to support your claims, you just say, "I'm not going to talk to you." Tell me specifics about what you are calling "absolutely atrocious behavior", then we can discuss it. Until you become communicative, I'm just dodging the turds you are throwing. --JWSchmidt 16:39, 12 September 2008 (UTC)
- I've been working on the specifics, and will post them up soon. I had hoped that some input from your fellow users saying "yes, please stop" would be sufficient, but if you really need to do the whole RfC/ArbCommish thing, we can do it that way. It would be much better for everyone if you would just take some time to cool off instead. --SB_Johnny talk 16:46, 12 September 2008 (UTC)
- Your "conversations and open dialogs" of late don't lead me to believe there's much to be gained, because your responses to any criticism have been at best erratic, at worst irrational. If you give up your bits, I'll gladly try discussing things with you, but right now I'm genuinely concerned about how you will react and am therefore wary of engaging with you. --SB_Johnny talk 17:12, 12 September 2008 (UTC)
- I intend to take the best possible path to achieve the best result. When you say "Please provide evidence to support this claim.", you point to the hard way, because you're suggesting that you don't think the way you've been treating people is inappropriate. --SB_Johnny talk 17:41, 12 September 2008 (UTC)
- "Please provide evidence to support this claim." <-- this is a common way to ask for information during a conversation. Please assume good faith rather than invent negative interpretations of the possible meaning of my words. I'm a scientist. If I ask for evidence it means I would like to see the evidence. Is there something wrong with having this particular evidence examined? If so, please explain what that problem is. --JWSchmidt 17:50, 12 September 2008 (UTC)
(← reset tabs) John, you can see evidence here and here, which is what we were discussing in the first place. If you don't see why there's a problem there, just give up your bits and I'll do my best to see you through it as a moderator. I assume Moulton will give me a good reference as a moderator of good faith. --SB_Johnny talk 18:08, 12 September 2008 (UTC)
- I followed those two links. User:KillerChihuahua was critical of the contents of this page. I responded by inviting her to join the research project and explain her objections. User:Cormaggio commented on "the toxic, sarcastic, aggressive culture that we're seeing more and more of these days - and which you are very much contributing to". In my response I said that I was interested to hear suggestions from Cormaggio for alternatives to what he views as "toxic" culture. I wish you would explain how these responses are "erratic, at worst irrational". I don't think its fair for you to adopt the position that you are obviously correct in you views so you do not need to explain your views. I've repeatedly, in good faith, asked you to explain your views. Explaining your position, when asked to do so, is a normal part of human communication. I'm willing to fully discuss my views and my actions. I cannot read other people's minds, divine their unspoken desires and then automatically do that they want me to do. If someone says, "there's a problem" then I think it is fair for me to ask them to tell me what they think the problem is. Once I hear what other people are thinking then we can have a conversation and sort things out. I view this as the conventional and rational approach, an approach enshrined in the justice system of the country I've always lived in. --JWSchmidt 20:00, 12 September 2008 (UTC)
- John, please just give up your bits. Just imagine: when people get pissed at you, they'll complain to me, and then I'll ask you what you really meant, and then I'll be there backing you up. Conversations will go a lot more smoothly when people aren't scared of you: everyone knows that I'm an equal opportunity "despot" when a despot is needed (or perceived to be needed) :-). --SB_Johnny talk 02:05, 13 September 2008 (UTC)
Guys, why not use the chat ? You can still publish the log later if you want, ----Erkan Yilmaz uses the Wikiversity:Chat (try) 17:26, 12 September 2008 (UTC)
- Erkan, I wish that were a good answer, but I feel pretty strongly that the atmosphere on the IRC channel is no longer constructive. --SB_Johnny talk 17:41, 12 September 2008 (UTC)
Wikiversity:Student union[edit]
I've merged Wikiversity:Student Union to Wikiversity:Student union the entire history has been restored, I sincerely apologies for any problems this may have caused. DarkMage 09:16, 13 September 2008 (UTC)
- I wonder if "Wikiversity:Student Union" follows the page name conventions. --JWSchmidt 12:13, 13 September 2008 (UTC)
Permission[edit]
I, Ottava Rima, give JWSchmidt permission to revoke any use of my tools during my probationary period. Ottava Rima 02:48, 14 September 2008 (UTC)
P.S., I would give him permission to revoke them after, and to ban me willy nilly, if I didn't think the power would go to his head. I'm just kidding. :) Ottava Rima 02:48, 14 September 2008 (UTC)
- Ha ha. I only block vandals. As far as I can tell, bans are futile. --JWSchmidt 04:00, 14 September 2008 (UTC)
Moulton's three day trial[edit]
I have posted this on multiple pages - Please see this. I would like to try and have Moulton work on this task and have him refrain from the escalating actions. I would ask that you monitor but respect Moulton's work at this time, and take any complaints or concerns directly to me. There will be a peer review process at the end, and I believe that this process will be most effective after he is complete and in the manner that I put forth. I am requesting that Moulton only edit on this project during this time, and I would like if you could show him the courtesy in not furthering any dispute with him until after the process is over, and that we are all able to discuss this project. If that is too much to ask for, please contact me, and I will see how I can accommodate your needs. Thank you, and please pass the word to any that I may have forgotten and this may pertain to. Ottava Rima 18:00, 14 September 2008 (UTC)
CSD[edit]
Your image is tagged as a candidate for speedy deletion. Is there a compliant version on Wikicommons? Or is there any further information that you can add to satisfy this request? Ottava Rima (talk) 02:15, 15 September 2008 (UTC)
- Right now, I think you could justify at least some of the pages in the way that Wikipedia justifies the page. Please place a link to the Wikipedia version of the file. If you put in fair use rationale, I believe you can justify removing the CSD. It should go through standard deletion review and not speedy, but I will let you rationalize it first and see if anyone comes by and has further problems with it. Ottava Rima (talk) 02:29, 15 September 2008 (UTC)
Fair procedure and posting statements[edit]
Hi, JWS. Following your concerns above, I have further modified the page (in line with earlier intentions) to provide you with appropriate sections to post your material. There are now sections below the evidence sections where you can post or transclude a general statement. In addition, you have the links provided higher up the page if you wish to record objections to the introductory statements on the page. If you require the creation of further appropriate venues for your materials, please let me know and I will help with integration. --McCormack 10:41, 15 September 2008 (UTC)
- I have modified my user talk page (in line with earlier intentions) to provide you with appropriate sections to post your material. If you require the creation of further appropriate venues for your materials, please let me know and I will help with integration. --JWSchmidt 14:31, 15 September 2008 (UTC)
Day 1 Reflections[edit]
3) There is one Wikiversity participant who does not want to provide a link at the top of the Main Page to the main student portal page. I think Wikiversity should have such a link. <---- What do you mean by this?. Is it the main Wikiversity:Main Page you meant, if you want feel free to provide a link - or I could, if you could explain what you mean. DarkMage 20:55, 15 September 2008 (UTC)
Chinese fire drill[edit]
This made me smile. The Jade Knight 00:31, 16 September 2008 (UTC)
- I appreciate your effort to talk about these things with me. I tend (generally) not to take grievances to user pages, but to keep them at talk pages, and relate them directly to the material at hand. Of course, there's a point where some discussion at the talk page could only help…
- I hope you'll forgive me if I'm terribly straightforward: There are a few things you've done at Wikiversity which have really bothered me. I recognize that you simply view the goals of Wikiversity somewhat differently than I do, and you use different methods to try to achieve those goals than I do; I understand that you aren't trying to be a horrible contributor, etc. I talk about this somewhat on my Learning from conflict and incivility page. However, I am bothered by some of the tools you use to support your views of Wikiversity.
- In particular, I am bothered by your pointed "learning projects" which are designed to be arguments against certain ideologies. I am bothered by your explicit and implicit condemnation of individuals, particularly on prominent pages. I am bothered that you seem unaware that your concept of Wikiversity is only one of many. And, most of all, I am bothered by your use of straw man arguments. This last thing is especially disturbing to me, because straw men, while rhetorically effective, are dishonest. And while the rest of your actions could be explained by simple honest differences of opinion and feelings that there is a need to push your view of Wikiversity, I have a very hard time imagining that a good faith user would think dishonesty would be an appropriate tool to support his views. The Jade Knight 00:47, 17 September 2008 (UTC)
- 'I assume you are making reference to my "pointed" editing that arises from the fact that I think Wikiversity should welcome new contributors and help them learn to edit' —The problem is that several editors here (including myself) feel that your projects do the opposite; that they make certain users feel very unwelcome at Wikiversity. Part of the problem is that what is silly to one may be extremely offensive to others; for example, think of the Muhammad cartoons. Part of being welcoming at Wikiversity is to show respect to others. Free speech may also be an important part of it, but it is not the only part; free speech can be very unwelcoming, as well, depending on what is being said. Respect is important.
- I don't mind certain projects here being called "parody", either,.
- "I do not feel that I have a role to play in condemning editors" —Satire condemns; I think it is important that you realize this. While it may be better for individuals to just "talk to you", creating your "pointed" projects which mock other users and then expecting them to just come talk to you is about the equivalent of elbowing someone in the ribs and expecting them to just come "talk to you" about it. If you want people to talk calmly, you're better off using other forms of object lessons (and doing more direct talking to them).
- "I'm sure there are many other differences between my view of Wikiversity and the views of others" —indeed there are. And yours is not the "canonical" view (no one's is). Please remember that.
- A Modest Proposal was satire, and it shocked and offended many people, including a few who understood that it was satire, and especially those who did not. To assign the words in A Modest Proposal to anyone at the time would have been considered extremely offensive and rude (no one, including Swift, would have considered such actions welcoming). That said, what Swift wrote was, if one understood that it was not serious, terribly funny. I don't think anyone here at Wikiversity has found any of your straw man arguments funny. Part of the reason is that you are using straw men arguments in the process of logical discourse. A Modest Proposal was absurd, and clearly so; your comments appear to have been written to mislead the reader in such a way so that your own particular viewpoint will be given greater esteem. You may have intended to write like Swift, but what you have written comes across not as brilliant comedy, but as dishonest, self-serving argument. You may want to reconsider your use of loaded rhetoric in the future, as it is most likely only to offend.
- Again, in a situation of rational discourse, straw men arguments are veiled lies. When you are making an argument, it is very important that you present your opponent's arguments in as fair and neutral a manner as possible, if you intend to be honest. If you are going to create a satire, make sure that everyone is well aware that you are making satire. And please realize that The Colloquium is not an appropriate place for satire. Neither is the student union. Neither is someone else's serious historical project. Neither are talk pages. Frankly, if you intend to welcome people to Wikiversity, then given your apparent current perceptions of what is and is not appropriate for Wikiversity, you need to be thinking a lot more about how to avoid offending people than you do about ensuring that their contributions* are in line with your vision of Wikiversity.
- *Administrative edits, including RfD's, are still contributions in the minds of most users. The Jade Knight 06:25, 17 September 2008 (UTC)
- …and I want to apologize if I come across as overly hard. I must say I've been significantly irked by some of these things lately, and so when writing about them I may not appear as calm as I otherwise might wish to. I'm not trying to offend, and I apologize if my tone seems rude. The Jade Knight 08:17, 17 September 2008 (UTC)
- I appreciate you reading and responding to my comments. I hope that you'll try to take a more gentler tack when dealing with conflict in the future; I think we should discuss the whole mess vs. being rude to newcomers issue more; I do believe a compromise can be reached on this issue, but it will take a little compromising on everyone's parts, I think. I think I understand your goals better, and why you did what you did. For me, it didn't work well at all; it is important to me when engaged in a discussion or debate that my opponent be rhetorically honest—and as somewhat who has taught Writing, I notice rhetorical devices fairly quickly. I'm not opposed to there being parody on Wikiversity, but building community is essential, and when other participants feel mocked, it hurts that sense of community. At any rate, thanks for spending the time to respond to my concerns. The Jade Knight 00:26, 18 September 2008 (UTC)
- Not a bad idea, though I think we generally need guidelines for how to deal with pages like those. I realize that your goal is to encourage new users. My goal is to direct new users to real content; not by deleting their pages, but by funnelling them to good content, instead of "stub"/empty content. Make sense? Using the Training namespace could be part of this plan. Part of it could be awareness: encouraging people to put the "Training" template (when it's made) instead of voting DR. And part of it is making sure "training" projects don't get stuck in the main categories at Browse. Anyway, we should discuss this more with the community at large. The Jade Knight 06:09, 18 September 2008 (UTC)
Blanked page(s) at ethics project[edit]
To avoid an edit war, I put a DR on your page: Wikipedia Ethics/Moulton, JWSchmidt's investigation. If you wish to immediately keep the content, I suggest to move it to your userspace, and you may remove the DR tag once moved to your userspace. I hope this was fair. Dzonatas 19:02, 16 September 2008 (UTC)
question[edit]
"a canvassed checkuser nomination" <-- what does this mean? --JWSchmidt 20:33, 18 September 2008 (UTC)
this is terrible in my book :-([edit]
so it falls to me to leave a note saying that you're indefinitely blocked at the moment? - I'm chatting on IRC to try and get a picture of the goings on. I'm really hoping that you can somehow continue to take this as a learning experience on some level! - though in my book it's a terrible for the health of the community. It'll come out in the wash, I'm sure (well - I hope...) :-) Privatemusings 22:43, 19 September 2008 (UTC)
- Thanks for your note. If you are in #wikiversity-en, do you have any idea why I am blocked from that channel? "a learning experience" <-- I hope we can all sort this out. Right now, I know nothing. "terrible for the health of the community" <-- why do you say that? Please do not panic, my friend. I look forward to many long years of collaboration with you at Wikiversity, Wikipedia, and other WMF projects. --JWSchmidt 23:01, 19 September 2008 (UTC)
- there is active discussion as we speak - my take on it is that there was some tension surrounding Moulton, with you not banning him from the channel, despite being asked to? Further - it's been said that you requested links to freenode or WV policy - I think links to WV policy were provided (or offered, or felt that they were provided) - and that your subsequent inaction represented a risk to the IRC channel in some way.....
- SB just returned to the channel, and everyone there is having full and open discussion, so hopefully this'll all move towards resolution before too long... Privatemusings 23:06, 19 September 2008 (UTC)
- Thanks for the news. I've repeatedly made it clear that I only kick/block/ban for vandalism. I do not recognize any obligation to automatically perform kicks/blocks/bans for others upon their request. I proposed that it be formally made policy that there be no release of private/personal information both here at Wikiversity (make Wikiversity:Privacy policy official policy) and in #wikiversity-en (put the rules in the topic). Nobody did anything. My approach was to keep reminding Moulton to not mention personal/private information and I kept pressing him to give up his interest in the real world identities of wiki editors. "full and open discussion" <-- right. --JWSchmidt 23:51, 19 September 2008 (UTC)
- I'm also bothered that you've been blocked; we were just beginning to have productive conversation, I feel... The Jade Knight 02:26, 20 September 2008 (UTC)
Teamwork[edit]
"his return to teamwork with Moulton and encouraging Moulton to transfer his "work" to beta.wikiversity.org" <-- After Jimbo suggested some changes, that we turn "an eye towards developing principles for dealing with such projects in the future. One idea that I would like to propose is an explicit ban on "case studies" using real examples of non-notable people, in exchange for hypotheticals", I began to think about modifications to the Wikiversity research policy. I take my collaborators as I find them, and Moulton expressed some willingness to help improve the research policy. I asked him to read the research policy and make suggestions for improvements. I would have done exactly the same for anyone who showed an interest in collaborating with me to improve Wikiversity. "encouraging Moulton to transfer his "work" to beta.wikiversity.org" <-- SB_Johnny, Mu301, and Cormaggio: please tell me what you mean by: his "work". --JWSchmidt 02:51, 20 September 2008 (UTC)
- (Sorry, I mentioned this to you on IRC, but to continue on-wiki): One of the things that concerned me personally was this edit from Moulton, in which I think it's pretty clear that Moulton is not simply intent on collaborating on research guidelines, but also continuing his personal crusade against Wikimedians, by whom he feels aggrieved. (I would note that I absolutely don't begrudge Moulton the right to deal with these issues - even somehow within Wikiversity/Wikimedia - but that I don't think his modus operandi so far has been appropriate to Wikiversity.) I know you've been trying to persuade Moulton from refraining from adding personal information (see also this RCA) - so I wonder if you have any comments or advice here? Cormaggio talk 09:42, 24 September 2008 (UTC)
- I think it aids constructive discussion about these kinds of issues if we can refer to specific examples such as: Wikipedia Ethics/Moulton, JWSchmidt's investigation/Final report. That page is an early draft of a report on problems that can arise in Wikipedia biographies of living persons (BLPs). That page mentions one "throw-away" Wikipedia user account that was created by an experienced Wikipedian who knew that their edits would violate Wikipedia policy. User:Centaur of attention wanted this Wikiversity page to be deleted. Why? According to "Centaur of attention", the report, "casts specific Wikipedians in poor light". The only Wikipedian mentioned in the report was the person who created a "throw-away" account for the purpose of violating Wikipedia policy. It could be argued that by discussing this case, the person who violated Wikipedia policy might feel embarrassment, so Wikiversity participants cannot discuss this case. Does that make sense? Wikipedia policy explicitly states that Wikipedians should be on watch for just this kind of attempt to create biased Wikipedia articles. Everyday Wikipedian's who watch BLPs take note of these kinds of problems, discuss them and take action to correct them. Wikipedia is improved by discussing bad editing and existing problems at Wikipedia. Does it really make sense to say that Wikiversity researchers cannot discuss editing problems at Wikipedia because doing so might cause embarrassment? The edit history of Wikipedia is public. There is no reasonable expectation of protection from embarrassment when people edit Wikipedia. Editing Wikipedia is a public act and Wikipedia policy calls upon Wikipedia editors to examine the edits of others. I think the key point Moulton was making here is that there can be several reasons why someone might object to a Wikiversity research project. One reason is fear that someone might suffer embarrassment. Another reason is that someone might be trying to prevent Wikipedians from discovering and correcting problems at Wikipedia. Someone who is trying to prevent Wikipedians from discovering and correcting problems at Wikipedia could use the potential for "embarrassment" as an excuse for blocking a Wikiversity research project. I think it is a valid and pertinent question: how do we distinguish between real sources of embarrassment that research policy should prevent and false claims of potential embarrassment that are used as an excuse to cover up problems at Wikipedia? As for Moulton's motivations, he has stated these on his user page. I view his interest in fixing problems with BLPs as an integral part of the on-going efforts of many Wikipedian's to improve Wikipedia. Yes, Moulton has in the past crossed the line here at the English language Wikiversity by violating the spirit of the proposed privacy policy. Jimbo has called for Moulton to be blocked at any WMF project where he crosses that line. Yes, we have to watch Moulton's editing at beta.wikiversity. I asked him to help improve the research policy at beta.wikiversity and as long as he does that, I welcome his help. Besides one name, apparently the real name of a wiki editor, I have never been told what "private information" Moulton is accused of releasing. Since I do not know what to watch for, I made SBJ a custodian at beta.wikiversity. However, I think we are in a situation where no evidence is required to support claims about Moulton releasing "private information". All that is required is an unsupported claim that Moulton has released private information. This is not healthy: it exactly corresponds to conditions of a witch hunt. According to your statement at the Colloquium, your mistaken assumption about why I asked Moulton to edit at beta.wikiversity formed the basis for your decision to block me and remove me from custodianship. I ask you to do what is right and correct your error. I advise you to admit your error, unblock me and return my custodianship. Before you take action to block Moulton from editing at beta.wikiversity, I ask that you actually have verifiable evidence that he has violated policy. --JWSchmidt 14:15, 24 September 2008 (UTC)
- Hi John, it's actually impossible to cite specific cases of outing that have been oversighted, because they don't then exist in the page's history. However, here's one example that hasn't yet been dealt with, and which I will now bring to the attention of a steward. You acknowledge that Moulton has crossed the line - and this is what I think we need to do now: to figure out what that line is. (Where are our boundaries as a project and as a community?) I definitely want to have you on board for that, and I'm not happy with your being blocked. However, the decision was not solely based on Moulton's work, or your work with him - as the Colloquium post said, it was based on a multiplicity of factors, listed in the review - and so I'm prepared to stand over it for now, even though it troubles me greatly. Cormaggio talk 15:04, 24 September 2008 (UTC)
- "a multiplicity of factors, listed in the review" <-- Before I was blocked, I was working my way through the twisted charges in the "review". I have now been prevented from defending myself against those twisted charges. I ask you to do the honorable thing and unblock me so that I can continue to answer those charges and show the Wikiversity community how twisted they are and that they do not provide justification for blocking me from editing, preventing me from participating in #wikiversity-en and they do not justify removing me from custodianship. For example, the "review" charges that I have been motivated in my Wikiversity participation by attempts to go after my enemies at Wikipedia. Previously, I asked that you list those presumed enemies. I call on you to backup your charges with facts or withdraw them. I don't think it is fair for you to just keep pointing to bodgus charges (particularly charges that I have either challenged or not yet had a chance to respond to) as justification for keeping me blocked from editing. Let's start here: who are my enemies at "Wikipedia and the foundation"? List those enemies or withdraw the charge you made against me. I also ask you to formally, on the Colloquium, retract your insinuating charge that I invited Moulton to "transfer his "work" to beta.wikiversity.org". You know that I did no such thing. I asked Moulton to help modify the research policy in response to Jimbo's suggested changes. --JWSchmidt 16:00, 24 September 2008 (UTC)
- Hi John, I think it would be more useful if, instead of picking holes in criticisms, that you listened more to the intent behind them. I understand that you may feel "under attack" at the moment - which would be an understandable reaction. Maybe you don't agree with the way the "review" is worded; maybe you don't agree with specific points in it. However, I want to reinforce that the "review" and the subsequent action is based on an overall behaviour pattern that I and others have seen as damaging - the substance and detail of which is in the review (though it is partial and imperfect). In a nutshell, what I see as problematic is: 1) your use of strawman arguments (as documented by Jade Knight); 2) "fun" at the expense of others (eg. in the 'Trout of Doubt' page, and certain edits on 'Student Union'); and 3) counter-critiquing, and not listening to criticisms, or taking them on board (as in this whole process of discussing your behaviour). I also know from previous experience that you have a tendency to respond to segments of another's comment/edit, but not always respond to - or in the spirit of - the overall or underlying meaning that the other is trying to convey. So, what I would urge you to do is to reread the review in its entirety, and look for what is being conveyed as specific problems. As I said, I am not happy with your block, but all it's trying to do is to ask you to take a step back from defence/counter-attack, to recognise the problems, and to start a good-faith attempt to address them. (You can start doing so in a separate section on this page if you like - and btw, I'm not saying that you shouldn't counter-critique, but that it would be much more helpful if you weren't so quick to do so right now) When you start this more constructive process (which, I should reinforce, will involve critique of others than yourself), I will actively support your unblock. Cormaggio talk 14:52, 25 September 2008 (UTC)
- "instead of picking holes in criticisms, that you listened more to the intent behind them" <-- Is it your contention that you can publish false charges against me, use those false charges to "justify" blocking me and removing my custodianship, and then expect me to ignore those false charges because you have good intentions? If so, I reject your position. Your continuing reliance on false charges and your attempt to get me to ignore your misuse of those false charges makes it hard for me to believe that you have good intentions....your actions speak louder than your words. "your use of strawman arguments" <-- I often make use of analogies in order to help people think about a topic. If you reject a particular analogy that I make use of, then feel free to explain why you reject the analogy. If you feel that I misrepresent someone's position, then step in and say where you think I am wrong. "fun" at the expense of others <-- I never edit so as to have fun at the expense of others. If I challenge the actions and views of others, I am doing so because I want to improve Wikiversity. I made the trout of doubt user page in order to explore an analogy....it was mainly a learning exercise for myself. I knew there was a chance that Salmon would see the page, but he had previously expressed unswerving confidence in his user page statement, so I had no reason to expect that he would take offense at my learning exercise. When I made the learning exercise at the student union, I wanted to let Wikiversity participants who self-identify as students know what was going on and that an attempt had been made to delete the student union. I still feel that this is important information to share with Wikiversity participants. In making these learning exercises I was not trying to have fun at the expense of others. "not listening to criticisms" <-- It is truly absurd to try to level this charge against me. I have endlessly asked people to discuss their criticisms with me. I think my discussion with Jade Knight illustrates the value of such discussions. Rather than have fruitful discussions with me, your approach is to post a bunch of false and twisted charges and then ask me to look past the specifics of those charges and read your mind so as to understand your true intent. I can't read your mind. It seems like you do not like some of the learning resources I have crafted at Wikiversity. I stand ready to adjust the types of learning resources I make and which pages they go on when Wikiversity reaches consensus in decisions about page content. Part of the wiki consensus process is stating reasons to support your position. When I have asked for such reasons I have been answered with several variants of: "I do not have to give reasons, if you cannot figure it out for yourself, then there is nothing more I can do". I fail to see "I do not have to give reasons" as the basis for consensus at Wikiversity. If you want me to understand your position you have to explain your position, not just expect me to magically adopt it when I hear it. "I also know from previous experience that you have a tendency to respond to segments of another's comment/edit, but not always respond to - or in the spirit of - the overall or underlying meaning that the other is trying to convey." <-- I do the best I can with what I have. If you feel that I am not responding to your "underlying meaning" then it is important that you talk to me and explain your "underlying meaning". It is really not productive for you to say, "I can't explain my position, so I'll just block you". "recognise the problems, and to start a good-faith attempt to address them" <-- I have already done so. The kind of discussion I have had with Jade Knight (1, 2, 3, 4) is an example of what I stand ready to do with anyone else who has problems with my editing. Unblock me and let me continue that process. --JWSchmidt 18:29, 25 September 2008 (UTC)
- I think it would be helpful if you assumed good faith here. Consider this: When you had that discussion with me, I had originally seen your edits as very damaging and falsely accusatory. You have since assured me that this was your intention. You may see Cormaggio's edits as very damaging and falsely accusatory. He is assuring you that this is not his intention. As I assume good faith of you, you should assume good faith of him, and try to work with him to resolve this in good faith. The Jade Knight (d'viser) 23:43, 3 October 2008 (UTC)
- "I had originally seen your edits as very damaging and falsely accusatory. You have since assured me that this was your intention." <-- Please provide a link to where I assured you that I intended my edits to be "very damaging and falsely accusatory". "you should assume good faith of him" <-- I initially assumed that Cormaggio might have put his name on false charges against me without being aware that they were false charges, so I explained to Cormaggio what the false charges are. Cormaggio refuses to retract those false charges or even discuss them with me. Are you asking me to assume good faith in Cormaggio's action of making false charges against me and trying to use those false charges to justify blocking me and removing my custodial status? Are you asking me to assume good faith in Cormaggio's action of coming to this page and claiming that he wants to discuss my editing but he refuses to tell me what the "obvious" problems are in my editing? "try to work with him to resolve this" <-- Are you suggesting that I have not been doing so? --JWSchmidt 14:30, 4 October 2008 (UTC)
(<---)I too have been confused by reading you say "talk to me" and being told, in essence, read my mind. On the other hand your comment "he had previously expressed unswerving confidence in his user page statement, so I had no reason to expect that he would take offense at my learning exercise" demonstrates that you have a mistaken model of human behavior in your mind. Expressed high levels of confidence do not indicate that the person is unlikely to take offense. Think of an animal who perceives a threat making himself appear larger - "puffing himself up". Expressing high levels of confidence is often a clue that the person is feeling threatened. WAS 4.250 13:34, 26 September 2008 (UTC)
- In any event, if there is some interest in developing the faculty of constructing reliable theories of mind (i.e. beliefs, desires, dreads, intentions, motivations, and pretensions of knowledge) of otherwise unseen avatars, perhaps we should launch a workshop and seminar on blind mind-reading in the absence of the usual cues (i.e. visible facial expressions, tone of voice, body language, and other normative nonverbal signals) under the constraint of poker-faced text-telegraphy. —Gastrin Bombesin 14:24, 26 September 2008 (UTC)
- "mistaken model of human behavior" <-- I do not hold that model....this is why I invite wiki participants to use this talk page as a place to discuss any problems they have with my editing. When a scientist such as myself says, "I have no evidence," it does not imply that such evidence does not exist. I'm always ready to listen when people bring new evidence to my attention. --JWSchmidt 14:51, 26 September 2008 (UTC)
One of the things that has been bothering me in our conversation so far is that I am responding to your behaviour with other people, and observing that several other people have been bothered - sometimes deeply hurt - by things you've said and/or done. The evidence for their hurt is in many, many comments about your activity on 'Student union', 'Albanian sea port history', and other pages. Given the fact that this has been explicitly pointed out firstly by the people involved on the talk pages, and within edit summaries; and subsequently on community discussion fora (here and here), I have found your asking for "evidence", and claiming that you are being asked to "read my mind", to be quite disingenuous. I also find it hurtful that you say that I am not prepared to discuss with you. I clearly want to discuss this recent turmoil; I want to discuss yours, mine, and others' roles within it - but the framework of this discussion has to be the plain fact that many people are unhappy with the events that led up to this block. On this note, however, I commend your recent discussion with Jade Knight, and I think it shows a lot of hope. So, I'm trying to take a leaf out of that discussion here.
When I said "fun at the expense of others" - what I mean is that you edit in order to have fun yourself (which, of course, is a good thing), but that you possibly don't always think of the consequences of your actions on others. For example, on the Albanian sea port history page, which contained no content at all, and that had been proposed for deletion - you turned it with these two edits into a personal - and quite ad hominem - "learning project" on 'deletionism'. You say here that you were "having fun being silly", which you apologise for, recognising that not all things are equally funny to everyone. But what concerns me is that you didn't take criticisms (firstly subtle [2] [3], and then more direct) on board at the time, nor recognise that Jade Knight was clearly hurt. I'm concerned that you don't listen to these kinds of concerns; that you require lengthy expositions of this kind (and of the kind Jade Knight has engaged in) in order to respond graciously.
I agree with much of your perspective on page-deletion, and the encouraging of Wikiversity contributors. But I think you sometimes take your perspective too far, and make it too personal. For example, I know you have long disagreed with McCormack, but even still, I think you have been much more hostile and sneering than is called for, or, indeed, than is appropriate for a civil environment. Just to take one example, do you think this was an appropriate response to the deletion debate? (I, incidentally, don't.) Do you think that there are people who want to actively "suppress" good faith contributions to Wikiversity? If so, can you show me examples of this?
Reading back over some of what I'm writing here, I seem to have taken a similar tone to what I have done so far (above), and that has seemingly provoked you further (even though I was intending the opposite). However, I hope you can read this in the light of a critical friend - I am trying to get you to step back from conflict in order to reflect on your own role in it. I'm sorry if I haven't been clear with you, and I'm sorry for forcing you into this temporarily blocked situation. As I've said before I think it's far from ideal, and I also acknowledge I've made mistakes in this process. I think what we need to do is to acknowledge our mistakes as part of recognising the cause of our recent problems. That is precisely what this block is attempting to do - albeit quite clumsily. So, I urge to stop calling "false charges", and instead looking to understand why people are saying these things to/about you - whether or not you believe you were justified, or that the "charges" are unjustified. Cormaggio talk 13:22, 2 October 2008 (UTC)
- It occurs to me that no one is happy with this block. (If I am mistaken, then I would be grateful if someone — anyone — would stand up and say, "I am happy with this block.") If it is in fact the case that no one is happy with this block, then it occurs to me that (unless Wikiversitans are masochists) it would behoove the community to stand down from this block and return to the status quo ante. There is a reason pencils come with erasers on the other end. If it was a mistake to block John in the first place, then it is an even bigger mistake not to erase the original error. —Albatross 13:39, 2 October 2008 (UTC)
- While I don't disagree, I'm not entirely sure it's appropriate for you to be posting in this discussion ATM, and I seriously doubt it helps your case for you to be making it here in light of everything else going on, Moulton. The Jade Knight (d'viser) 23:57, 3 October 2008 (UTC)
- "I have found your asking for 'evidence', and claiming that you are being asked to 'read my mind', to be quite disingenuous" <-- I find it strange that you can lecture me about the benefits of being aware and sensitive while you are yourself are so unaware and insensitive. I completely reject your false charge that when I ask for evidence I am in some way not straightforward or candid in my requests for information. For example, when you came to this page and requested that I "reflect more - personally - on some of your comments/actions, especially those that have caused obvious offence", I responded on your talk page with a request for clarification: "I think it would be useful if you made a list of "those that have caused obvious offence" then I can comment about what you put into the list". That was a simple request for clarification from you about something that you might feel is "obvious", but which is not obvious to me. How long would it have taken you to make such a list and place it on my user talk page? Five minutes? Ten? Not very long. But you are in a position where you need not explain what you are talking about because it is "obvious". Since what you are talking about is by your very own definition "obvious", it is also "obvious" that I must know what you are talking about. Fine, you hold all the cards. You get to define what is obvious. Apparently you can read my mind and you think you know that I understand what you are thinking and you think you know that I am being deceptive when I ask for clarification of what you are talking about. Have fun with that. You will have a long glorious career as an educator who gets to define what is obvious to your students. You can block them from participating in your classes anytime they ask you to explain the "obvious". You created a model of my mind, but I'm telling you that your model is wrong. You insist that you know my mind better than I do. That's just great. Have fun with that. If you are proposing this as the basis for moving Wikiversity into the future, I will oppose you in that effort. Wikiversity is supposed to be a place where we talk out disputes. Online communication can be tricky. If someone requests clarification, then we provide that clarification, we don't say, "if you don't know what I mean, then there is nothing I can do for you". That game of saying "if you don't know what I mean, then there is nothing I can do for you" is a way of gaming the system and a way of escaping from the responsibility we all share to communicate effectively. Why do you want to play that game with me? Since you are the busy 'crat do you have a magic "get out of obligations free card" that says you do not have to explain what you think is obvious? If that is your position, then you are only demonstrating that you are unworthy to play a leadership role in Wikiversity. Yes, I could have made a guess about what you think is "obvious", but rather than make that guess I asked you to tell me what you think is obvious. That request is a simple and normal part of human communication. Rather than engage in that kind of simple and direct communication you entered into an elaborate game pretending that you know my mind better than I do. For you, it is "obvious" that you are correct about the state of my mind and that I am deceptively hiding my true state of mind by asking you to provide a simple list. To me it is obvious that you are wrong. I really want that list and I will will respond in detail to the items that you put into that list. As it is, we have a standoff, one that has lasted several weeks. Why not do a simple experiment? Provide the list I requested. I will then respond to the items on your list and we can have an adult discussion. --JWSchmidt 14:43, 2 October 2008 (UTC)
- John, how is that an appropriate response to what I've said before, and particularly just now? I gave you examples, I pointed you to discussions - yet you say I'm playing games with you? I've already given you material for discussion - it's not a "charge" - please let's discuss. Cormaggio talk 16:09, 2 October 2008 (UTC)
- "how is that an appropriate response to what I've said before" <-- You asked me to discuss something that is obvious to you, I've told you that I do not know what is obvious to you and I asked you to make a list that shows me what you are calling "obvious". I have promised to respond to that list. This is human communications 101. You say something I do not understand. I request clarification of what you mean. In normal human communication you would then clarify for me what you mean. Rather than do that, you continue to insist that I know what you are calling "obvious" and so you refuse to tell me what you think is obvious. Now are you trying to define my simple request for clarification as being inappropriate? Your reply to my request for clarification was "You ask me to provide a list of examples of where you've caused offence, which I would view as more appropriate for the 'Learning from conflict and incivility' project than your talk page.". I do not agree. If you think my editing "caused offence" then provide a link to my offensive edit on my talk page and let me discuss the edit. If you want to make a list of my edits on another page, that is fine, just bring that list to my attention and I will respond to it. I find it strange that I was in the process of responding to this list and then you decided to block me from editing that page and prevent me from further responding to the false and twisted charges you made against me. "please let's discuss" <-- You say that as if I have refused to discuss something. I've consistently asking people to discuss things with me. I've been told that I am a troll and so McCormick will not talk to me, SBJ has refused to discuss things with me, SBJ has made the absurd suggestion that rather than come to me to discuss things, people go to him. "please let's discuss" <-- You claim that I know what you want to discuss so you do not need to tell me what you want to discuss. You've said that there are other pages that are more suited for you to say what you want me to discuss. Fine, remove the bad block that you helped to impose on me and let me get back to editing and discussing. I'm still going to continue to ask people to clarify for me what they want to discuss. I cannot read minds, I do not know magically know what you and others want me to discuss. If I ask for clarification, it is an honest request for information. Please assume good faith. --JWSchmidt 17:08, 2 October 2008 (UTC)
- "you turned it with these two edits into a personal - and quite ad hominem - "learning project" on 'deletionism'." <-- I don't understand what you mean here by "ad hominem". In the edits you cited, I described the early history of editing for the "Albanian sea port history" page. The goal of the learning resource I started to create was clearly stated: "This learning project allows Wikiversity participants to compare and contrast the historical attacks on Durrës with the attacks on learning resources by Wikiversity deletionists." Are you objecting to my use of the term "deletionists"? Would you prefer that I use the term "deletionism" as a less "personal" term? My understanding of the term "ad hominem" suggests that you are implying that my learning resource was a way of "attacking my opponent personally". That was not the stated objective of the learning resource. The stated objective was to compare attacks on an ancient center of civilization to the deletion of pages at Wikiversity. "you possibly don't always think of the consequences of your actions on others" <-- I've spent years thinking about and exploring the consequences of challenging the actions of deletionists at wiki websites. In this case, the expected consequence of the learning resource I started to make was that Wikiversity deletionists would see how easy it is to take a page with "no content at all" and expand it into a useful learning resource. This is how wikis function and grow. Someone starts a page, in good faith, and then other people expand the page. The whole process is derailed when deletionists step in and destroy the good faith contributions of other wiki editors. I am aware that many people are not happy when they are called deletionists. Are you suggesting that since some people are made unhappy when the term "deletionist" is used, that should stop me from using the terms "deletionists" and "deletionism"? If so, then let's start the list of banned words at Wikiversity. Deletionism is a widely-used term to describe well-known wiki phenomena towards one end of the delete-include spectrum. I do not understand why we can't have learning resources that explore deletionism. I've been told that some people object to where I have placed learning resources about deletionism. I've had some constructive discussions with Jade Knight about this and I agreed to change my choice of location for such possible learning resources in the future. Jade Knight also objected to my use of analogies as a way of exploring deletionism. I told him that I will take his objection about using analogies into account in the future when I make learning resources. I still believe that using analogies is a valid educational method, but I have agreed to try to be more sensitive in the future. In my view, if I include an analogy in a learning resource and someone objects to that analogy, then they should come to me and explain their objection. "having fun being silly" <-- it is "silly" to try to literally compare military attacks on a city with deleting a Wikiversity page, but I made use of this analogy in an effort make people think about the very real consequences of deleting the good faith contributions of Wikiversity editors. I had been trying other methods for two two years, and the deletionists were happy to just continue their habit of calling the contributions of other Wikiversity participants "garbage" that needs to be deleted. When people do not listen to reason and do not follow proposed Wikiversity policy then I feel I have the right to make some "over-the-top" learning resources that are designed to make people think about what they are doing. In my view, that is a valid educational approach. "take criticisms on board" <-- I'm not sure what point you are trying to make. When Jade Knight made comments such as, "Should every single empty page targeted for deletion become the battleground of the inclusionists and deletionists", I participated at the talk page and made a good faith effort to address his stated concerns. In my view, Jade Knight was making claims that could easily be shown to be false claims. Are you suggesting that it was my duty to "take on board" and accept those demonstrably false claims? "recognise that Jade Knight was clearly hurt" <-- In my experience as a wiki editor, only a few wiki editors are proud to be called deletionists...they even self-categorize themselves as deletionists at Wikipedia. I saw that Jade Knight did not like his attempt to delete "Albanian sea port history" being characterized as an example of deletionism. When I began to realize how unhappy he was, I stopped developing the learning resource I had set out to make. It is unfair to claim that I was not sensitive to his valid complaints. It is true that I failed to understand the depth of his unhappiness until we had our user talk page discussion. This is exactly why I invite people to come to my talk page and discuss matters when they are not happy with my editing. When editors who are not happy with my editing, rather than come and talk to me, instead go off and complain to someone else about my editing then the whole system breaks down. It is particularly bad when people like you sign their names to false charges that are made by other editors against me and then invent new false charges in an attempt to justify blocking me from editing Wikiversity. I can't imagine why you refuse to retract the false charges you have made against me. --JWSchmidt 16:25, 2 October 2008 (UTC)
- For the record, you and I have very different ideas about what valid complaints are. I consider all of my complaints valid, and I have a hunch that many other individuals consider the complaints of mine which you consider invalid as valid. We could always take a poll. The Jade Knight (d'viser) 00:03, 4 October 2008 (UTC)
- For the record, you and I have previously discussed some of your complaints. For example, you complained that "JWSchmidt is circumventing the deletion discussion page by turning every page which the community thinks might be worthy of deletion into a 1-sided argument about deletionism". Do you still consider that to be a valid complaint? --JWSchmidt 14:49, 4 October 2008 (UTC)
- The phrasing was hyperbolic, but the underlying complaint is still valid, IMO. The Jade Knight (d'viser) 20:35, 7 October 2008 (UTC)
- "do you think this was an appropriate response" <-- I think this describes what I had previously seen on several other wikis and it also provided an accurate prediction of how I was later blocked from editing at Wikiversity. I'm interested to hear why you think that my accurate description of how things are often done at wikis is not appropriate content for Wikiversity. "Do you think that there are people who want to actively "suppress" good faith contributions to Wikiversity? If so, can you show me examples of this?" <-- The best example is McCormack's effort to delete the student union, remove the main link to the student union and turn the student union into a redirect. I've discussed McCormack's behavior in detail on multiple pages, some of which I think you have read. There are other examples that have arisen at the page for discussing proposed page deletions. Many inappropriate page deletions are done speedily in violation of Wikiversity deletion policy. --JWSchmidt 17:34, 2 October 2008 (UTC)
- People should be more careful about speedy deletions, yes. But I don't feel McCormack was trying to "actively suppress good faith contributions to Wikiversity"; you seem to see his edits as a great conspiracy against Wikiversity, but please assume good faith. It's not that a discussion of activities done on wikis is not "appropriate content for Wikiversity". It's that such a disucssion, particularly one as acerbic as the tone of your edit there, is not appropriate pasted directly on a template. Can you not see the difference? The Jade Knight (d'viser) 00:08, 4 October 2008 (UTC)
- "Can you not see the difference?" <-- I can see the difference very well. I put instructions for using the template on the template where the people who misuse the template will be sure to see the instructions. Do you think it makes sense to put those instructions on another page where they can be ignored, thus allowing people to continue to misuse the template? "the tone of your edit there" <-- what tone should be used when addressing people who use the template in violation of Wikiversity policy? --JWSchmidt 15:08, 4 October 2008 (UTC)
- "I urge to stop calling 'false charges', and instead looking to understand why people are saying these things to/about you - whether or not you believe you were justified, or that the 'charges' are unjustified". <-- Thanks for your advice. I find your advice to be absurd. You have made false charges against me and used those false charges to try to justify blocking me from editing and removing my custodianship. Since we are sharing advice, here is my advice to you. Retract the false charges you have made against me. Remove the bad block you helped impose on me. "instead looking to understand why people are saying these things" <-- I was engaged in that process when you decided I should be blocked from editing. Unblock me and let me get back to participating at Wikiversity. --JWSchmidt 17:45, 2 October 2008 (UTC)
- "Is everything I have said here a 'false charge'?" <-- I never said that and I cannot imagine why you feel the need to ask such a question. I've asked you to retract the false charge that my Wikiversity participation has involved bringing my enemies at Wikipedia and the foundation to ridicule. I've asked you to retract the false charge that I did something wrong by asking Moulton to help improve the Wikiversity policy on research. You used that false charge to try to justify blocking me from editing Wikiversity. Before you agreed that I should be blocked from editing, I was working through the charges that you made against me. So far, I have looked at eight of those charges and everyone of them is full of twisted charges that are sickening to read. The author of those charges has, in every case, created a distorted narrative. I was in the process of responding to those distortions when you decided that I need to be blocked from editing. I do not understand why you would put your name on false and twisted charges against me, block me from editing rather than let me defend myself against your false and twisted charges and try to pretend that those false charges can justify blocking me from editing. I've called upon you to retract the false charges you have made against me. I've called on you to remove the bad block that you helped to impose on me. If you will do that, then I can continue the process of defending myself against the twisted charges made against me. I will also be able to continue the process that I was engaged in: the process of discussing any concerns about my editing that other Wikiversity editors might have. --JWSchmidt 15:03, 3 October 2008 (UTC)
- Ok. I asked the question because I wanted a broader sense of what you perceive as "false", in addition to the examples you had raised previously. It strikes me that what you see as "false" is still a realistic presentation of what happened as seen by other people who were involved. You say that statements you've read are "twisted" and "false", but I wonder what you would think if you tried to see statements as versions of events according to other people, and to try to understand why people feel the way they do? This is why I asked if there was anything in what's been said about you that you agree or could sympathise with, or could take on board - and I think it would help greatly if you could read all the cases and discussions with this thought in mind. As for the examples you've highlighted, they're made more complex as a result of the nature of Moulton's activity, and the fact that much of this has taken place on IRC. From my perspective, I wouldn't say you have "enemies" (as Moulton has) - I would say there are people and practices within Wikimedia that you have a disregard for. And I would say that asking Moulton to collaborate on beta was not going to be as benign as you have claimed it would be - though I would stress that this is only one part of the story. I'm sorry that you are sickened by the narrative in the review, and there are things in there that I would happily tone down or remove. But, even though you have your point of view, I would like you to move beyond labels of "false charges" - I don't think it's fair on other people's perspectives on the matter, not least the fact that many people see it differently to you. (Sorry for taking so long in responding, by the way.) Cormaggio talk 15:18, 6 October 2008 (UTC)
- "I wonder what you would think if you tried to see statements as versions of events according to other people, and to try to understand why people feel the way they do" <-- Do you seriously imagine that I do not try to see things from multiple points of view? Why do you think I put the duckrabbit on my user talk page? I assume you have read the talk page discussion I had with Jade Knight and I assume that you realize that after I edited pages such as "Albanian sea port history" and the student union I let other people remove what I had added to those pages. The Wikiversity participants who have edited those pages reached consensus about what to include on those pages. I've agreed not to include learning resources about page deletion on pages like those. "I would say there are people and practices within Wikimedia that you have a disregard for" <-- I've spent years dealing with vandals and others who "have a disregard for" the missions of the wikis that I have worked hard to help build. "going to be as benign as you have claimed it would be" <-- I do not recall making any such claims. Development of research policy for Wikiversity is a long-term interest of mine and I have worked with everyone who has shown an interest in developing research at Wikiversity. I understand that you do not know Moulton and you do not assume good faith with respect to his activities. I do know Moulton and I know that he is a useful collaborator for many topics that are of interest to me. I take my collaborators as I find them and I do not participate in witch hunts no matter how popular they are at a particular moment in time. "I would like you to move beyond labels of 'false charges' - I don't think it's fair on other people's perspectives on the matter" <-- Well, I guess this is a fundamental difference between you and I. When someone makes false charges against me I expect them to retract those false charges. If the false charges are not retracted, I do not just move past the false charges as if they do not exist. "I don't think it's fair" <-- I don't think it's fair to make false charges against someone and try to use those false charges to "justify" blocking them and removing their custodianship. I don't think it's fair to make false and twisted charges against someone and then block that person and prevent that person from responding to the false and twisted charges. That's just the way I am. If you expect me to be different, you are going to have to live with having your expectations not be met. "many people see it differently to you" <-- is this claim supposed to make me feel happy to have false charges made against me? "many people see it differently to you" <-- is this claim supposed to make me feel happy about being banned from #wikiversity-en without any reason being given for the ban? "many people see it differently to you" <-- is this claim supposed to make me feel happy about false charges being used to "justify" blocking me from editing and removing my custodianship? --JWSchmidt 03:08, 7 October 2008 (UTC)
- I'm finding this discussion quite difficult and frustrating, John, since you seem to be treating it as a "standoff". So, I'll repeat (again) my central question: Is there anything in mine or others' criticisms of your recent editing that you agree with, or are sympathetic to, or could take on board? Cormaggio talk 22:05, 7 October 2008 (UTC)
- "criticisms of your recent editing" <-- you have restricted all of my recent editing to this one page. You chief complaint about my recent editing seems to be that I am "difficult and frustrating". Your main complaint seems to be that I do not listen to other Wikiversity editors and "take on board" their complaints about my editing. I guess I can see how it must be frustrating for you to keep repeating such an obviously false complaint about me. Anyone who looks at my editing history can see that I do listen to other Wikiversity editors and "take on board" their complaints about my editing. I have repeatedly and explicitly given examples of this to you and others on this talk page (for example, see this and this). Why you continue to ignore the explicit examples that I have provided on this page is very mysterious, even more mysterious than why you could not just read my edit history and see that I do listen to other Wikiversity editors and "take on board" their complaints about my editing. I am left thinking that there is some magic word that you expect me to utter before you will unblock me, but you refuse to tell me what the magic word is. I can see how it might be frustrating for you to wait for me to read your mind or guess the magic word, but that is a frustration of your own creation. Frankly, I do not understand what you hope to gain by playing this game, a game in which you keep asking a question that I have already repeatedly answered right here on this page. If you feel that my past efforts to listen to other editors and "take on board" their complaints about my editing are not adequate, then you need to say that and explain what is still bothering you. Maybe what is still bothering you about my editing is in the charges you have made against me that you are preventing me from responding to. In any case, you should remove the bad block that you helped imposed on me and let me finish responding to the charges you have made against me. --JWSchmidt 18:57, 8 October 2008 (UTC)
Unblock[edit]
Note:
The original content of this page section was an unblock request.
The blocking custodian then destroyed my original unblock request and added an unblock denial template.
Later the denial statement was removed.
- Well I'd hope JW can be unblocked too :-) Privatemusings 21:57, 20 September 2008 (UTC)
- It is now more than a month after an indefinite duration block was imposed on me by User:SB Johnny without warning, discussion or a valid reason provided. Of course, his bad block was over-turned by the community. For some reason, User:SB Johnny first destroyed my unblock request and now he also removed his denial of my unblock request. In between destroying my unblock request and removing his denial of my unblock request from this page, User:SB Johnny added this to the page: "just go fuck yourself and go away". In my many years as a wiki editor, I have never previously seen such a level of disruptive editing by a non-vandal on another person's user talk page. --JWSchmidt 14:45, 8 November 2008 (UTC)
Writ of Habeas Avatarus[edit]
I hereby submit a Writ of Habeas Avatarus calling upon the Custodians of Wikiversity to produce the avatars currently locked up in the hall closet. It is unseemly, unscholarly, ungentlemanly, undignified, and unbecoming for the Custodians of this distinguished venue of higher learning to be locking up avatars in the hall closet. (It's probably uncivil, too, but the definition of 'uncivil' here appears to vary from that used elsewhere in Earthling academic communities.) —Barsoom Tork 14:07, 26 September 2008 (UTC)
- It's been two days since Barsoom Tork filed his Writ of Habeas Avatarus and there has been no response from the Custodians. Could I have a statement from the Custodians for an upcoming story? —Montana Mouse 12:44, 28 September 2008 (UTC)
Clarification[edit]
JWSchmidt, please explain your role in bringing about the tensions that have been disrupting the project, and how you will do things differently in the future. --SB_Johnny talk 18:25, 21 September 2008 (UTC)
- I do not know what User:SB_Johnny means by "the tensions that have been disrupting the project". User:SB_Johnny, please explain. Make a list of these "tensions" and I will address each one. Speaking for myself, the main "tension" at this time seems to be that User:SB_Johnny has blocked me without providing a valid reason. Further, he has banned me from #Wikiversity-en without providing any reason. I suggest that the best thing for Wikiversity is for User:SB_Johnny to unblock me here and let me participate in #Wikiversity-en. If User:SB_Johnny will talk to me about the aspects of my behavior that he does not like, then I will be able discuss possible changes for the future. So far, User:SB_Johnny has had very little discussion with me, so I still do not know what he expects me to do. I know that he is unhappy with some of the learning exercises I have made at Wikiversity, but we have not had a chance to fully discuss the matter. In particular, I asked him what alternatives existed to my learning exercises and I feel that I did not get any meaningful reply. Apparently, the approach that is to be taken is that some types of learning projects will be black-listed at Wikiversity. I would like to participate in any discussions related to such black-listing. The only person who has had a discussion with me is User:Jade Knight. I feel that dialog increased our mutual understanding and I suggested the idea is that we could have a "Training:" namespace where I could collect and curate "mess and garbage" pages created by new users. Rather than delete a stub page, we would move it to the "Training:" namespace. If the page gets developed, then we could move it back to the main namespace, see: 1, 2, 3, 4. As always, I stand ready to collaborate and improve Wikiversity. The first step is that people have to talk to me. Another source of tension has been discussion of Topic:Wikipedia studies in #Wikiversity-en. I have repeatedly proposed many solutions to this source of tension. Today, I thought everyone agreed that chat about Topic:Wikipedia studies could take place in a subchannel, #wikiversity-en-projects. I went off and participated at #wikiversity-en-projects. Then, without discussion or reason User:SB_Johnny banned me from #wikiversity-en. I work to change and improve things and User:SB_Johnny punishes me. If anyone can explain this behavior, I'd like to hear the explanation. Another source of tension is Moulton's interest in the real world identities of wiki editors. I have spent weeks asking Moulton to abandon that interest. I have participated in many constructive Wikiversity editing projects with Moulton in an effort to move him away from his interest in the real world identities of wiki editors. I made changes to Wikiversity:Privacy policy and suggested that we make that an official policy. I suggested that we then say in the topic of #wikiversity-en that the Privacy Policy also applies to the chat chat channel. I feel that my actions have been positive and constructive. It is truly hard for me to see what more I can do in the future. If anyone has any suggestions, please talk to me, I am truly interested in hearing your ideas. I perceive many tensions at Wikiversity, but I think it would be most efficient if User:SB_Johnny would tell me which ones he is concerned about so I can discuss those, specifically. --JWSchmidt 19:20, 21 September 2008 (UTC)
- "Can you give me a simple yes or no to start?" <-- I could if you asked a simple yes or no question...."things going wrong" is so vague that I wonder if even you know what you mean by it. Blocking people without giving a valid reason is "going wrong", but I have not done that. You really need to specify what you mean by "things going wrong". As mentioned above, I Know you are not happy with some of the learning exercises I made. Obviously I know that I made those learning exercises. I've had a constructive dialog with Jade Knight and we started exploring ways to deal with page deletion...ways that do not involve me making learning exercises about page deletion. I've endlessly said that I stand ready to make other changes in my editing....all it takes is for people to tell me what problems they have with my past editing followed by a coherent discussion of alternatives for the future. Jade Knight is the only person who has engaged with me in that kind of constructive process. Some people complained about discussions of "Wikipedia Studies" in #wikiversity-en. I've worked hard to develop a plan for moving such discussions to a subchannel. After all that hard work seemed to finally be successful, you banned me from #wikiversity-en, without warning and without giving a reason. "I just want to know if you understand what's going on." <-- I think I have a good understanding of what is going on in public. Of course, I am not privy to the secret off-wiki planning sessions that some people get to participate in. How am I supposed to know what is going on in #wikiversity-en when you ban me, without giving a reason, from that channel? I f you have so little time for Wikiversity that you now demand monosyllable responses, I suggest that you go on wiki break and let the rest of us get back to discussing and editing. --JWSchmidt 23:14, 21 September 2008 (UTC)
- John, the atmosphere on Wikiversity is very tense, but getting better. I'm convinced that you had something to do with creating this tense atmosphere. So please work with me here: there must be at least one thing you've said or done over the past month that you've realized since then was a mistake.
- Please identify and describe one of those mistakes, and how you would have done differently with the benefit of hindsight. --SB_Johnny talk 23:35, 21 September 2008 (UTC)
- I make errors every day. When I recognize those errors, I try to correct them. Recently in #wikiversity-en, darkcode (User:Darklama) was doing his usual good work to clean up problems at Wikiversity and I made a stupid and hurtful comment. I immediately realized that my comment was not helpful so I said it was inexcusable and tried to explain what I really wanted to say. I wish that on that day I had just gone and taken a nap rather than keep pushing myself to participate at Wikiversity. I like to think that had I taken a nap, I might have avoided making my mean-spirited comment. I also recently told Jade Knight that when we were editing a page together, I was having fun and I did not realize that my fun was not appreciated...in fact, I did not realize that my fun was just an intense source of irritation for others. I'm always trying new things, and usually I try new things and then let them drop and move on to other things. My initial expectation had been that I would just make a small learning project (a rather silly one!) and then move on. When Jade Knight joined in the editing of the page, I should have just stopped rather rather than keep trying to edit. --JWSchmidt 03:56, 22 September 2008 (UTC)
- I saw both of those, and that's definitely more like the JWS I've come to know. In hindsight, is there anything you could have done differently with McCormack or "Salmon"? I get the impression they're not your favorite people, but they each had their own things to add. --SB_Johnny talk 13:38, 22 September 2008 (UTC)
(reset tabs) Excellent! Could you provide some examples? For example: when user A did X, and you did Y, what would the preferable Z be in hindsight? --SB_Johnny talk 10:46, 23 September 2008 (UTC)
- When McCormack called me troll in #wikiversity-en I could have used an "SBJ method" and banned him from participating in the channel. When "Salmon" used an unauthorized bot at Wikiversity I could have used an "SBJ method" and given him an indef block. --JWSchmidt 13:28, 23 September 2008 (UTC)
- JWS, I feel that it is a tad unfair. The timing and the recent events make your situation different. Please don't waste this time attacking others. Please? Ottava Rima (talk) 13:58, 23 September 2008 (UTC)
- "attacking others" <-- Is that directed at me? If so, who did I attack? "The timing and the recent events make your situation different." <-- I have no idea what that means. Ottava, can you explain what you are trying to say? --JWSchmidt 14:23, 23 September 2008 (UTC)
- There are subtle jabs behind your use of the phrase "SBJ method" and your applying said method to two others. Ottava Rima (talk) 15:52, 23 September 2008 (UTC)
- "channel banning and blocking would have been a better response?" <-- no, I'm not saying that, I was just guessing that was what you wanted to hear. "what would the preferable Z be in hindsight?" <-- I could have quit making my learning exercise (at the "Student Union" page) before I completed it. In the case of Salmon, when he archived the ethics project talk page, I suspected that there was something on the page that Salmon found objectionable. I tried to get Salmon to tell me what the problems was, but he refused to tell me. Later, when he said he intended to use an unauthorized bot to remove links to external sites, I asked him to explain what sites he was concerned about. He said something like "that's none of your business". If you have an idea for what I could have done differently, I'm willing to listen. --JWSchmidt 21:50, 23 September 2008 (UTC)
- In hindsight, is there anything you would have done differently? --SB_Johnny talk 08:39, 24 September 2008 (UTC)
- I respect the opinion of others who say that "major pages" like the student union page are not the place for learning exercises. I still believe that the learning exercise I created for that page was appropriate. I have a significant amount of real world experience dealing with attempts by administrators to secretly deprive students of useful learning resources and learning opportunities. In my experience, it is always useful to inform the students about such attempts. After I constructed my learning exercise at the student union page, I let other editors make the decision about keeping the exercise or removing it from that page. Since I now know that some people do not agree with my view with respect to putting learning exercises at the main student portal page, I will take that into consideration in the future. In wikis, new decisions are always being made about what content should be on which page. I'm willing to be guided by consensus on content decisions. The argument I have heard is that the learning exercise I made for the student union might be "disorienting" for new visitors to Wikiversity. My view is that the exercise was explicitly "orienting" in that it informed new Wikiversity participants that an effort has been made to stop providing self-identified students with a prominent link from the main page to a portal page designed to fit their needs. I still view this as an important lesson to be conveyed to Wikiversity participants. It is certainly possible to put learning exercises on other pages and just link to them from the main student portal page. I still think it would be constructive to put at least one learning exercise on the main portal page for students, just as a way of encouraging new visitors to click "edit" and participate. --JWSchmidt 15:49, 24 September 2008 (UTC)
- Given what I know now, I'd be willing to go with Jade Knight's suggestion and make a page specifically for learning about page deletion and provide a link from the student union page to that other page. --JWSchmidt 19:52, 24 September 2008 (UTC)
(reset tabs) That does sound like a better option. The thing I'm really wondering about though is whether you knew at the time that your comments, actions, accusations, and "analogies" (like the "tearing up a kid's drawing" thing) were genuinely hurtful both to McCormack and to Jade Knight, as well as hurtful in an empathetic way to onlookers? --SB_Johnny talk 23:54, 24 September 2008 (UTC)
- No, I did not know that anyone felt hurt. --JWSchmidt 04:45, 25 September 2008 (UTC)
- Well, you may have been the only one... did you read this (bottom sections)? --SB_Johnny talk 09:09, 25 September 2008 (UTC)
- When I read, "which is probably intended to be offensive and provocative," I was puzzled. The learning exercise I created for the student union page was intended to allow Wikiversity participants to become aware of attempts that had been made to remove links to the Wikiversity Student union, delete the Wikiversity Student union and turn the Wikiversity Student union into a redirect page. I did intend the learning exercise to be provocative in the sense that I thought it might stimulate student discussion on the student union page. I could not think of a reason why anyone would think that I intended the learning exercise to be offensive. "personalised the issue, devalued the page with his edits and then linked the page directly from the main page (while still tagged for deletion) just to highlight his personal attacks" <-- I described what had been happening to the student union page. If anyone felt I had personalized the issue, it is probably because they had personally played a major role in trying to remove links to the Wikiversity Student union and delete the Wikiversity Student union. In other words, they had personalized the issue while I just described their editing. "devalued the page" <-- I agree that the page had been devalued by attempts to remove links to the Wikiversity Student union, delete the Wikiversity Student union and turn the Wikiversity Student union into a redirect page. My creation of a learning exercise on the student union page was an attempt to develop the page and make it more useful to students. "highlight his personal attacks" <-- There were no "personal attacks". A traditional way to game the system is to falsely label the the words of others as "personal attacks". In my experience, it is fairly common to see false claims of "personal attacks" from editors who have themselves engaged in behaviors such as calling another editor a "troll". As it says at Wikipedia, "Personal attacks do not include civil language used to describe an editor's actions, and when made without involving their personal character, should not be construed as personal attacks". --JWSchmidt 14:35, 25 September 2008 (UTC)
- Well, for me "being mindful of how your actions affect others" would be a core part of civility (perhaps not part of the definition, but a good tenet to follow in any case). When you had 3 different people reverting you because they found the content objectionable, it would have made sense to pause for a bit, explain your intention (and especially that you did not intend harm), and try to discuss it in a quiet corner somewhere (email or a talk page). I know you tried to talk to McCormack on irc, but by that time you had already done a good bit of damage and trying to force a conversation with someone who's intensely pissed off and bitter will only exascerbate the problem (and besides, a conversation on an open irc channel isn't private, and it's pretty clear that he felt you were intent on humiliating him in public, and given that he felt that way, it's understandable why he would describe it as a personal attack). It would have gone a lot better if you had just laid off it for a while.
- You don't have to agree with people's reaons for being pissed off to acknowledge that they're pissed off. --SB_Johnny talk 15:13, 25 September 2008 (UTC)
The person so affected has an obligation to forthrightly disclose their resultant affective emotional state. It is unreasonable to expect people to detect facial expressions, tone of voice, gross body language, and other normative nonverbal indicators of emotional arousal in a text-telegraph medium such as wiki. It perplexes me why anyone would deem it incivil to fail to solve a puzzle for which the clues are not adequately presented. —Gastrin Bombesin 12:34, 26 September 2008 (UTC)
- AFAICT, the only two people on all of Wikiversity that couldn't tell that McCormack was bothered and JWSchmidt's edits were upsetting him and others were you and him. Something to chew on. The Jade Knight (d'viser) 00:16, 4 October 2008 (UTC)
- "the only two people on all of Wikiversity that couldn't tell that McCormack was bothered and JWSchmidt's edits were upsetting him and others were you and him" <-- For the record, I have known that "McCormack was bothered" ever since he called me a troll and said he would no longer talk to me. That was many months ago. --JWSchmidt 15:16, 4 October 2008 (UTC)
- Do you have any evidence that McCormack communicated his affective emotional state to either JWSchmidt or to myself? Are you aware that I am
botheredunpeaced by your recent acts of unceremoniously removing from discussion the carefully crafted remarks of a fellow scholar? —Moulton 05:09, 4 October 2008 (UTC)
- "pause for a bit, explain your intention" <-- As shown at Wikiversity talk:Student union/Archive/September 2008, I repeatedly paused and explained what I was doing. I participated in a lengthy discussion that eventually led to the idea that the learning exercise I had created would better be placed on another page. I do not agree with that view, but I did allow others to remove the learning exercise from the student union page. This seems like a rather routine wiki editing process by which wiki participants decide which page is the best location for particular types of content. "someone who's intensely pissed off and bitter" ... "it's pretty clear that he felt you were intent on humiliating him" <-- I felt I was engaged in the normal process of creating of a learning resource and then a fairly routing discussion about options for where to place a particular resource within the wiki. If someone is upset with me, they should come to my talk page and explain the problem. Of course, that solution is not available to someone who has publicly stated their intent not to talk to me. It seems like the central issue here is the individual who had a problem with my editing but who refuses to discuss anything with me. It is not reasonable to expect me to read that individual's thoughts and notice that they are pissed. "It would have gone a lot better if you had just laid off it for a while" <-- this reminds me of a "solution" for accidents caused by drunk driving: don't drive during the early hours (around 2-3 am) because we know there are many drunks on the road at that time. "being mindful of how your actions affect others" <-- good advice, but the drunks do not seem to take such advice to heart. --JWSchmidt 19:21, 25 September 2008 (UTC)
- Well, I just re-read that page, and people were making it very clear to you (repeatedly) that they felt you were being inappropriate and offensive, both in terms of what you had added to the page and what you were saying on the talk page. In hindsight, would you have taken a different approach? --SB_Johnny talk 10:48, 26 September 2008 (UTC)
(<---)How is what JWS did any more inappropriate or offensive than the currently popular practice of binding, gagging, kicking, and locking up serious-minded scholars in the hall closet for a week? How do you imagine that makes someone feel? —Montana Mouse 12:34, 26 September 2008 (UTC)
- Yes. I call on both sides to recognise that their behavior has upset the other side. I wish both sides to acknowledge the real and troubling lack of successful communication. Please let us have less assuming bad faith and more realization that we are all flawed human beings who make honest mistakes. WAS 4.250 13:51, 26 September 2008 (UTC)
- The lack of successful communication (primarily the lack of communication of affective emotional states that enable dialogue partners to enter into a state of mutual empathy) is partly caused by the limitations of text-telegraphy, and partly by the reluctance to employ vocabulary terms that succinctly disclose the affective emotional states that are filtered out of text-telegraphy modes of communication. I lament and regret this unfortunate limitation in the functional affordances of the Internet. —Gastrin Bombesin 16:11, 26 September 2008 (UTC)
- I have been chatting online for over 15 years now, and I really don't find it that hard to communicate online, particularly with others who have experience communicating online and are assuming good faith. The Jade Knight (d'viser) 00:28, 4 October 2008 (UTC)
- Let's assume that JWSchmidt's actions were equally inappropriate as blocking him. How does that justify him at all? If the two were equally inappropriate, were the blocks justified by being "an eye for an eye"? The Jade Knight (d'viser) 00:22, 4 October 2008 (UTC)
- Why assume anything so ludicrously at odds with the ground truth? Blocking is used to prevent damage from destructive vandals, full stop. Nothing that JWSchmidt was posting could, in any way, shape or form, be characterized as even remotely destructive or vandalistic. Blocking an authentic scholar who is sincerely contributing in good faith is an outrageously inappropriate way to treat a fellow scholar in an academic culture. Would the faculty in a respectable institution of higher learning bind and gag another scholar and lock him up in the janitorial hall closet for a week? How did such an idiotic and sophomoric practice ever find its way into the culture of Wikiversity? —Moulton 01:19, 4 October 2008 (UTC)
- Actually, Moulton, blocking is used for a variety of things, one of the most important of which is preventing damage from destructive vandals. But that is not the only thing; consensus is important, and those who fight against consensus often do much more damage to a wiki than they aid it. Moulton, the faculties of respectable institutions of higher learning revoke employment (ie, the right to teach students at the university) from non-tenured scholars all the time when they feel those professors are hindering the purpose of the university. They never gag them and lock them up, but JWSchmidt is not gagged or locked up. If his block were to become indefinite, he would be free to approach other respectable institutions of higher learning and try to become a professor there. He's also free to learn. So, in your words, such "an idiotic and sophomoric practice" is common in the culture of universities such as Leeds, Oxford, Harvard, MIT, U of Toronto, Stanford, etc. The Jade Knight (d'viser) 03:54, 4 October 2008 (UTC)
- Isn't it a tad arrogant to summarily dismiss those who argue against consensus? Every innovation in the history of civilization has to overthrow the status quo. Among the more famous examples are some we have recently remarked upon — Socrates, Jesus, Beckett, Leonardo, Copernicus, Galileo, Lavoisier, Thoreau, Darwin, Einstein, Gandi, Feynman, King (just to name a few). Where is John's voice in this discussion? Why is he not here, presenting his views? I, for one, am eager to hear what he has to say. On whose authority is his voice silenced in these halls of higher learning and scholarly discourse? —Moulton 05:09, 4 October 2008 (UTC)
- "those who fight against consensus often do much more damage to a wiki than they aid it" <-- is this the charge that is being leveled against me? If so, then please explain what you are trying to say. Are you trying to say that I have in some way rejected the role of consensus in wiki communities? Are you trying to say that I have objected to attempts by others to falsely claim that consensus has been established? What does "fight against consensus" mean? --JWSchmidt 15:28, 4 October 2008 (UTC)
Straight talk[edit]
"In hindsight, would you have taken a different approach?" <-- is this question intended to be any different from this question to which I already replied? "people were making it very clear to you (repeatedly) that they felt you were being inappropriate and offensive" <-- Other editors were making false claims about my intentions and my actions. It was suggested that I was trying to be offensive, which was not true. It was claimed that I "devalued the page", but I responded to that charge by saying that the learning exercise I was developing was my attempt to improve the page. A false claim was made that I made "personal attacks". Making false claims about personal attacks is a common way to game the system, so common that I often just ignore such false claims as background noise. The claim was made that I "personalised the issue", but all I did was describe the actions of others who had tried to remove useful links to the Wikiversity Student union, delete the Wikiversity Student union and turn the Wikiversity Student union into a redirect page. A claim was made that I was "busy driving current participants away from Wikiversity" but I did not take that claim seriously because the person making the claim qualified it as "intended to be rhetorically effective". The claim was made, "You're being really hostile here," which was a false claim either about my state of mind or my intentions. It was suggested that I had taken "ownership" of the student union page, but all I was doing was developing the page. It was claimed that, "You are creating an environment of shame here," but all I did was describe the editing of others, editing that they defended. How can a discussion of editing that the editors are proud of cause shame? It was claimed that the learning exercise I made was "just rude", but when I asked how it was rude, I got no answer. It was claimed that I was "acting uncivily", but no evidence to support that claim was provided. It was claimed that I was "opposed to having students participate", but when I asked for evidence to support that claim, there was none provided. There was an additional list of six charges made against me which I had already addressed at the Colloquium. There were false claims made about consensus, another common way to game the system, which I usually just ignore. The comment was made, "don't mess with JWSchmidt while he god-modes with Wikiversity," but when I asked for an explanation of what that meant, there was no reply. I listened to the complaints and discussed them. Eventually it was suggested that the learning exercise I made could just be moved to another page and I let others remove the learning exercise from the student union page. Given the fact that I was dealing with demonstrably false and undefended claims, I felt no compulsion to "back off" in the face of those claims. When a compromise proposal was finally made, I accepted the compromise and moved on. As I already said on this page, given what I know now I'd be willing to just make a link from the student union to the learning exercise I created. I don't think that is the best approach, but there seems to be consensus for that compromise approach. --JWSchmidt 14:19, 26 September 2008 (UTC)
- I was referring to your behavior on the discussion page. Rather than taking the tone you did, could you have taken a different approach? --SB_Johnny talk 18:12, 26 September 2008 (UTC)
- "Rather than taking the tone you did, could you have taken a different approach?" <-- I don't know what you mean by "tone". Please tell me how you characterize my "tone". "could you have taken a different approach?" <-- How does this question differ from this question which I already replied to? --JWSchmidt 05:45, 27 September 2008 (UTC)
- JWS, we can continue our discussion later, when Moulton cuts it out. Please do keep in mind (both of you) that there will be no unblock without some agreement to do your part(s) to create and maintain a civil and collegial environment. If you consider your behavior perfectly acceptable and don't see it as a problem, we can't really expect you not to repeat it. If we can't rely on you not to repeat it, the only reasonable assumption is that unblocking would inevitably lead to further problems. --SB_Johnny talk 19:02, 26 September 2008 (UTC)
- I consider blocking to be an incivil and uncollegial practice, unworthy of an authentic academic culture. For the life of me, Johnny, I cannot fathom why the custodians here bought into the adolescent Bomis Boyz™ B&D Culture. But if it pleases you to tie me up, gag me, kick me on IRC, and lock me in the janitor's hall closets — if that is to be your adoptive cultural model — then whom am I to deny you and the remaining custodians the ecstasy of your fervently held religious convictions, sophomoric as they may be? If that is your preference — to embrace and adopt a ridiculously adolescent and unscholarly practice per Jimbo's initial demonstration of the Bomis Boyz™ method of dealing with authentic scholars — then I'll simply document that curious practice as your own freely adopted choice as well. In any event, I'll continue to document the ethnology of Wikimedia-sponsored projects whatever they evolve to become. My skills at Houdini-like escape from the straight-jackets won't be very entertaining. I'll just continue to talk straight to whoever cares to engage in Bohmian dialogue. —Moulton 06:48, 27 September 2008 (UTC)
- I do not believe Wikipedia would have gotten off the ground if expressly forbade blocking. Realize, Moulton, that no one at Wikiversity has tenure, and if a non-tenured professor started acting in ways a university considered disruptive or unhelpful, there would be no "block"; the professor would simply be stripped of his right to contribute in the same way as other professors. But I guess that is blocking. So, it seems that blocking is a collegial practice, and is considered worthy of authentic academic culture at every major university. The Jade Knight (d'viser) 00:33, 4 October 2008 (UTC)
- "blocking is a collegial practice, and is considered worthy of authentic academic culture" <-- Since this is my user talk page I'm going to assume that this comment is in some way related to the act of blocking me from editing at Wikiversity. Jade Knight, are you claiming that in an "authentic academic culture" it is common practice to make false and twisted charges against a member of the community and then block that member from responding to those false and twisted charges? "considered disruptive or unhelpful" <-- If someone is removed from an authentic academic community, is it not required that a reason be given for that removal and the accused be given a chance to respond? SB_Johnny blocked me from editing without providing a valid reason for the block. SB_Johnny has refused to discuss his bad black other than to vaguely suggest that someday there might be new "guidelines" created for Wikiversity and if that happens than he might unblock me. His adoption of that position is clearly an abuse of his custodial powers. Yes, this kind of thing does happen in the real world and administrators of academic institutions who try these kinds of tricks are routinely prosecuted for their illegal employment practices. --JWSchmidt 15:46, 4 October 2008 (UTC)
- I was simply addressing Moulton's comments. It was not intended to be indirectly applicable to your case, though it may possibly be indirectly applicable; I have not weighed that particular application against these comments. Oh, and BTW, in an authentic academic community, reason is only required if the one being removed has tenure (by far the minority of cases). However, reason is often given. Not that it's entirely relevant. The Jade Knight (d'viser) 20:42, 7 October 2008 (UTC)
- Many people without tenure have a contract that protects them from being terminated without cause and without a chance to defend themselves against false charges. A wiki community is based an rules and consensus, not the whims of sysops. It is the obligation of every sysop to provide a valid reason for a block when they impose a block. SB_Johnny did not provide a valid reason when he blocked me. He has tried to "justify" blocking me by making false and twisted charges against me. He blocked me and prevented me from responding to all his false and twisted charges. Are you comfortable with such abuse of sysop powers? You think this is the way a wiki should be run? --JWSchmidt 13:57, 8 October 2008 (UTC)
- "when Moulton cuts it out" <-- SB_Johnny, you blocked me without providing a valid reason. Are you now saying that my unblock is contingent on the behavior of another editor? Just do the honorable thing and unblock me now if you want to create and maintain a civil and collegial environment. Your comment above seems to imply that you think I do not agree to help create and maintain a civil and collegial environment. I challenge that insinuation. I have worked hard for years to make Wikiversity a civil and collegial environment. If you think I have done something to disrupt that environment then tell me what is bothering you and let's discuss it. You have published false charges about me such as the idea that my Wikiversity participation has been motivated by an attempt to ridicule my "enemies at Wikipedia and the foundation". Do the honorable thing and retract your false charges. Before you blocked me from editing I was responding to your false and twisted charges. Unblock me so I can complete that process. "we can't really expect you not to repeat it" <-- I've repeatedly told you how I would do things differently now that there seems to be consensus for doing things in different ways. --JWSchmidt 06:30, 27 September 2008 (UTC)
- No, it's just hard to follow the discussion when he's doing that, and I'm sure he'd cut it out if you asked him to. I don't think I accused you of ridiculing "enemies at Wikipedia" (I didn't think you had any to speak of, but rather that you are quite concerned that certain bits of the wikipedian culture will in a sense "contaminate" Wikiversity). You did ridicule McCormack, Salmon of Doubt, Jade Knight, and Centaur of Attention (the latter did a good job of making himself a target, of course). The issue isn't where things ended up, but how it started.
- Keep in mind that the SU thing started when McCormack simply listed it on the RfD page. Before that, the only substantial edits had been by you, and since students weren't editing it, there was a (fairly weak) case that it could have been creating a "ghost town effect". You responded by adding content to the page insinuating that McCormack didn't want students to be welcome at Wikiversity (in fact you said as much when linking to it.
- All that really needed to be done was to simply oppose the deletion here. It wasn't in any danger of being deleted (no consensus). You could have also moved to close the deletion discussion. There was no need to insinuate in multiple fora that the act of considering the deletion or reditect of a page amounted to abusing Somali (or Latino, or South African, or any) students.
- If you felt you were being unfairly accused of something, you could have just requested a neutral party to come take a look (rather than responding in kind with even more hyperbolic accusations). There were at least 3 people around that would have been happy to help (Erkan, Darklama, and myself). An eye for an eye and the whole world goes blind: there are much better ways of achieving consensus than trading barbs. --SB_Johnny talk 08:19, 27 September 2008 (UTC)
- "I'm sure he'd cut it out if you asked him to" <-- Your certainty about things you know little about is awe-inspiring. Moulton has informed me in writing that he feels compelled to ignore my advice. "I don't think I accused you of ridiculing 'enemies at Wikipedia'" <--. "You did ridicule McCormack, Salmon of Doubt, Jade Knight, and Centaur of Attention" <-- I reject your characterization of my Wikiversity participation as "ridicule". I do examine and challenge the actions of others when I feel that their actions damage Wikiversity. If I describe someone's actions then that does not mean I am subjecting them to ridicule. If McCormack feels that I have subjected him to ridicule, then he should talk to me about that. Of course, since he publicly announced that he refuses to talk to me, he has limited his options. Rather than talk to me, he runs to others and makes false charges against me. Those others have attached their names to the false charges. I call on you to do the honorable thing and retract the false charges you have made against me. "the SU thing started when McCormack simply listed it on the RfD page" <--. It is proper that I document his activities and bring them to the attention of Wikiversity participants. You might not like how I have done this, and we can discuss the details of my approach, but I cannot sit by silently, particularly when you say: "All that really needed to be done was to simply oppose the deletion," which is demonstrably false. When I opposed the page deletion, McCormack went on to remove the link to the page. When he could not get away with that trick, he tried to turn the page into a redirect. "There was no need to insinuate in multiple fora that the act of considering the deletion or reditect of a page amounted to abusing ... students" <-- I have made an analogy between 1) calling the good faith contributions of Wikiversity editors "garbage" and deleting those contributions and 2) calling the work of students "garbage" and throwing away their work. I think this is a valid analogy that helps people think about the consequences of deleting the good faith contributions of Wikiversity editors rather than welcoming new editors and helping them learn how to edit constructively. "You could have also moved to close the deletion discussion" <-- Please explain why it would have made sense for me to become involved in closing the student union deletion discussion. "If you felt you were being unfairly accused of something" <-- I'm kind of lost here ... are we still in the context of the the student union talk page discussion on September 5? Having edited at Wikipedia for many years I am very comfortable with personally dealing with false accusations made against me. I either ignore such claims (they are all too common) or ask people to provide evidence to support their claims. "An eye for an eye" <-- can you explain the relevance of this comment to our discussion? Are you saying that asking people to provide evidence to support their false claims is going to make the whole world go blind? "trading barbs" <-- I'm not sure what you view as "trading barbs", but when I describe the edits of others it is not "trading barbs", it is how a wiki editor tries to get people to think about what is going on and the goal is to correct problems in a wiki community. --JWSchmidt 16:00, 27 September 2008 (UTC)
(reset tabs) OK, maybe a better way to discuss will be to just take the issues in your last comment and handle them one at a time.
9.27a[edit]
Your certainty about things you know little about is awe-inspiring. Moulton has informed me in writing that he feels compelled to ignore my advice.
- Understood, and I apologize for that: he can indeed be rather bull-headed :-). I've found that if you just ask him to stop doing something as a friend (rather than advising him to do so), he'll generally oblige (he's not evil or anything). At this point we've taken to just rolling him back when he jumps in here.
9.27b[edit].
- I read through the review and edited for grammar, checked links, etc., and removed some of the more hyperbolic statements. The review itself was written on another wiki, and the sections I did have time to closely look into were absolutely solid "cases", so I had no problems signing on to it. The part I'm most familiar with (SU, Albanian Ports, and related issues) are the parts we're discussing now, and your behavior just in those cases is more than enough to show the need for blocking "until guidelines are agreed upon". What I've been trying to get a feel for over the past week's conversation is whether you genuinely believe that your tactics in that dispute were perfectly normal and would not be considered "disruptive" or "offensive". The reason people have been reluctant to point that out to you is that they would expect anyone to see that they were disruptive and offensive. At this point I'm fairly convinced that you honestly don't know why people got so upset, so I'm going to do my best to help you see why they did. I'm going to re-read the rest now and think about how to respond (I do my best thinking on the tractor seat), but out of fairness I want to let you know that judging from what you've said so far you will not be unblocked very soon. --SB_Johnny talk 16:47, 27 September 2008 (UTC)
- absolutely solid "cases" <-- Before you blocked me, I started working through those cases, providing my POV here and in more detail here. All of the cases and charges I have looked at (including this) are full of false and twisted claims. Can you provide your definition of "absolutely solid"? "your behavior just in those cases is more than enough to show the need for blocking" <-- I made two learning resources and so I should be blocked from editing? Can you explain the logic of that? "they were disruptive and offensive" <-- In my view, they were informative and thought-provoking. "you honestly don't know why people got so upset" <-- Jade Knight took the time to explain why he got upset, so I understand his point of view. You still have never explained why what I did justifies blocking me and removing my custodianship. If you plan to ban the kind of learning resources I created, I would like to participate in discussions about such a ban. If you want to retroactively invent and enforce penalties against the kind of learning resources I made, then I think you are clearly abusing your powers. If you are offended by something I have done then we should discuss it. If there is a need to change Wikiversity policy, then we should discuss that. Rather than discuss with me why you are upset you have refused to discuss things with me and blocked me from discussing the false and twisted charges you made against me. You refuse to retract the false charges you made against me. I stand ready to listen to accounts of why people don't like the learning resources I made. "I'm going to do my best to help you see why they did" <-- then unblock me and let me continue the process of discussing matters with people like Jade Knight. "you will not be unblocked very soon" <-- You made a bad block. You did not provide a valid reason for the block. Your block is getting in the way of me responding to your false charges against me. Do the right thing and unblock me. You've made it clear that you have no intention of explaining your actions to me. I can live with that; I suspect you cannot explain your actions. Just get out of the way and let Wikiversity get back to work, your unjustified block of my editing is preventing me from discussing matters with people like Jade Knight who are willing to talk and reach consensus on content issues. --JWSchmidt 21:56, 27 September 2008 (UTC)
- "continue to be disruptive" <-- I created two learning resources that you do not like so you blocked me? The correct way to deal with content disputes is for the community to discuss the content and decide on how to deal with the disputed content. "It's quite clear ... you would indeed continue to be disruptive if you are unblocked" <-- How is that clear? You have have pointed to two learning resources that you do not like. I have defended those learning resources as providing important information to Wikiversity participants. This is a content dispute that should be settled by discussion. In fact, it was settled by discussion before you became involved and blocked me. I had constructive discussions with Jade Knight and I've told you repeatedly that because of those discussions I am now doing things differently. Thus, you know that your claim "you would indeed continue to be disruptive if you are unblocked" is false. Rather than retract your false charges against me you continue to manufacture new false charges against me: can you explain why you are doing this? --JWS 13:43, 28 September 2008 (UTC)
- It wasn't really settled, it's just that one of the people involved gave up on Wikiversity. I didn't block you solely because you made those "learning projects" (although to be honest "learning project" leaves a rather sour taste in the mouth for many people these days), but in order to prevent further disruptive behavior on your part. The fact that you don't see why your behavior as disruptive is not the issue: the fact that your behavior is disruptive is the issue. Let's not waste time discussing the validity of the block, and instead see if we can find suitable guidelines for you to follow so that we can get you unblocked. --SB_Johnny talk 17:51, 28 September 2008 (UTC)
- "It wasn't really settled" <-- I had constructive discussions with Jade Knight and I agreed to do things differently in the future. You can ignore that reality if you like, but I'd still like to know why you are so insistent on detaching yourself from reality. "prevent further disruptive behavior" <-- Your practice of making false charges against me and using them to try to justify your bad block is disruptive. That you characterize discussion of the bad block you imposed on me as a waste of time is just another indication of your inability to discuss things. "find suitable guidelines for you" <-- I've been working for years on Wikiversity guidelines and I am willing to follow those guidelines....I wish you were willing to do so also, but you seem to be hinting at a plan to make up some new rules in order to retroactively justify the bad block you imposed on me. Worse, you seem to be moving towards a new claim that I am somehow preventing you from making up these new rules, so you are going to give up on your desired "solution" to the bad block you imposed on me and just leave me blocked. Sorry, Johnny, but you imposed a bad block based on false charges. Now you seem to be gaming the system by suggesting that I am preventing you from making new guidelines. Just remove the bad block that you imposed on me. If you want to try to make new guidelines for Wikiversity then just get going and do it....I'm not stopping you. --JWSchmidt 04:04, 29 September 2008 (UTC)
9.27d[edit].
- Okay, I can't really address some of the other points without first asking you a serious question: do you really think McCormack was trying to limit student participation at Wikiversity? --SB_Johnny talk 17:38, 27 September 2008 (UTC)
- He tried to delete the main student portal page, and when that effort failed he removed the link to the main student portal page from the introductory section of the main page. For several months (when I was busy in the real world) his removal of that link limited student participation at Wikiversity. When I returned that link to the main page, he tried to turn the main student portal page into a redirect to another page that did not even mention students. Do you really think that McCormack's actions did not limit student participation at Wikiversity? --JWSchmidt 22:11, 27 September 2008 (UTC)
- So without the Student Union (which you wrote, and then altered to become a scathing critique of a fellow contributor), student participation will be limited? McCormack opened a deletion discussion on this page, which had very little content, wasn't being developed, and so was arguably not complete or useful enough to be linked from the main page. I'm quite certain that he wasn't out to exclude students, and I'm just as sure that adding a personal critique of a fellow contributor would not make people (students or otherwise) want to contribute. --SB_Johnny talk 10:47, 28 September 2008 (UTC)
- "without the Student Union .... student participation will be limited?" <-- When Wikiversity was being created, several major groups of likely participants were identified. These groups include participants who self-identify as teachers, students and researchers. In order to help these groups participate at Wikiversity the introductory part of the Main Page usefully includes a statement such as "We invite teachers, students, and researchers to join us". In that Main Page statement it is useful to link the words "teachers", "students" and "researchers" to Wikiversity pages that help those specific types of participants to edit at Wikiversity. Removal of those links limits the ability of those groups to participate. The student union page was specifically designed to help guide self-identified students towards constructive participation at Wikiversity. Without that aid, self-identified students are left in the dark with respect to their role at Wikiversity. "which had very little content, wasn't being developed, and so was arguably not complete or useful enough to be linked from the main page" <-- if so (and I dispute these claims) then the correct thing to do is to improve the student union page. In my view, the student union page was carefully crafted for its intended purpose, it served its purpose, it did not need to be changed and it was useful for self-identified students to have a prominent link to the student union from the main page. "I'm quite certain that he wasn't out to exclude students" <-- Just like you were sure that Moulton will do things that I ask him to do? Sorry, but your judgments are demonstrably poor. Ask McCormack to summarize his views about student participation that he has posted to this wiki. "a personal critique of a fellow contributor" <-- are you saying that the learning resource I made for the student union was a "a personal critique of a fellow contributor"? If so, then that is another false charge. I made a learning resource that described the the actions of editors who had tried to delete the student union, remove an important link to the student union, turn the student union into a redirect and prevent discussion of these actions on the student union page. "would not make people (students or otherwise) want to contribute" <-- I do not agree. In my experience, students become very animated and involved when they are told about attempts by administrators to limit their participation in learning activities. In any case, if there is dispute over Wikiversity content, then the solution is to discuss content guidelines, not block people and prevent discussions. --JWS 14:18, 28 September 2008 (UTC)
- OK John, I've read this seven times now, and I still don't know what to say to you, except that you're just plain wrong on every point.
- I know you won't believe me, but I want to just tell you anyway that my goal in the past week's conversation was to come up with a simple agreement with you about avoiding disruptive and harmful actions so that we could get you unblocked and contributing again in a way that would also give reassurance to those who are hesitant to give you another chance. I was hoping to achieve that by yesterday, but your responses have been deeply disturbing, and I'm quite convinced that you should not be unblocked as things stand, and I'm not even sure you should ever be unblocked. Wikis work when people can get on the same page (literally), and when there are disputes, people need to be respectful of one another's interests, integrity, and feelings, and always be mindful and read the cues to know when you've stepped over the line. If what you've been telling me is true, you aren't able to read the cues. That's not a huge fault: a lot of people have a hard time reading those cues, especially in an online environment. But it is a huge fault if you're not aware of it, and are unwilling to accept a moderator. You don't seem to be aware of it, and you're not willing to trust your moderator (that's me, by the way). There's nothing I can do to help you become aware of it if you're not willing to take my word for it, so all I can really do is just tie your hands until your willing to accept my assistance (or someone else's assistance... there's just not many willing right now).
- I'm going to take a week off from this so I can go work on the wiki in a normal way for a while. Please think about things, and keep in mind that I have absolutely no reason for wanting you blocked aside from preventing further disruption of the community. You said somewhere or another that if I didn't have enough time, I should just go on a break, but I'm willing to make the time to help you if you're willing to accept my help: that's what friends are for :-) --SB_Johnny talk 20:16, 28 September 2008 (UTC)
- "you're just plain wrong on every point" <-- but, of course, you do not need to support this claim, you just get to state it as fact. "my goal in the past week's conversation was to come up with a simple agreement with you about avoiding disruptive and harmful actions so that we could get you unblocked" <-- It is very simple. Just retract the false charges you have made against me and remove the bad block you imposed and tried to justify with the false charges you made. Before you blocked me I had useful discussions with Jade Knight and we found ways to move ahead without the types of learning resources that you do not like. We've gone over this repeatedly and you just keep ignoring the fact that the problem you are complaining about was solved before you blocked me. "Wikis work when people can get on the same page" <-- and this is why you have refused to discuss perceived problems with me and have made false charges against me and used those false charges to try to justify blocking me? "know when you've stepped over the line" <-- imposing an indef block without providing a valid reason for the block, trying to justify the block by making false charges, call discussion of the bad block a waste of time, refuse to retract the false claims you have made....how much further over the line do you intend to go? "unwilling to accept a moderator" <-- I'm not sure what this means. This is the first I have heard about a "moderator". Are claiming that you are playing the role of a moderator? I've never heard of a moderator who makes false charges against someone as part of their work as a "moderator". "There's nothing I can do" <-- You can retract the false charges you made against me, that would be an honorable starting point. "preventing further disruption of the community" <-- you've never bothered to explain how your block of me is preventing disruption. Jade Knight and I found new ways to move ahead before you you imposed your block on me. The block you imposed on me is preventing me from responding to all the false and twisted charges you made against me. "if you're willing to accept my help" <-- I've begged for your help and you've said that you refuse to discuss with me why you are upset with my edits and you've said that there is nothing you can do for me. I don't find it helpful when you press false charges against me and use those false charges to try to justify blocking me from editing. You seem to have vaguely suggested that there are new "guidelines" that can prevent future problems. Why not remove the bad block that you imposed on me and we can work together on new guidelines. --JWSchmidt 04:41, 29 September 2008 (UTC)
- SB_Johnny seems to be trying to get you unblocked and back to constructive editing. Why are you so hostile to his efforts? The Jade Knight (d'viser) 01:05, 4 October 2008 (UTC)
- Perhaps I missed it, but where is the evidence to support the thesis that "SB_Johnny seems to be trying to get JWSchmidt unblocked"? Since SBJ executed the block, he can unexecute it at will, if he had a will to do so. I don't understand what is stopping him from simply undoing his action. —Moulton 15:57, 4 October 2008 (UTC)
- "SB_Johnny seems to be trying to get you unblocked" <-- can you list the actions he has taken that suggest this to you? "hostile to his efforts" <-- Can you list my actions that you view as "hostile"? Asking him to provide a valid reason fo blocking me from editing? Asking his to retract the false charges he has made against me? Asking him to discuss with me what is bothering him? --JWSchmidt 15:53, 4 October 2008 (UTC)
- I know I'm not a neutral third party, but what SB_Johnny is saying seems right to me. The Jade Knight (d'viser) 01:05, 4 October 2008 (UTC)
Summary of previous discussion[edit]
below is a discussion summary that took place between Sept 21 and 26, 2008. as summarized by darklama.
SB_Johnny asked JWSchmidt to explain what he thinks his role was in the recent tensions that disrupted Wikiversity, what he could of done different in hindsight, and what he plans to do differently in the future. JWSchmidt asked SB_Johnny to explain and for clarification, because he did not understand the questions. Some back and forth discussion resulted in SB_Johnny trying to clarify his questions, and JWSchmidt providing some insights:
- He acknowledged that discussion of Topic:Wikipedia studies in #wikiversity-en has caused tension, feels he has repeatedly proposed many solutions, that he had put a lot of hard work into finding a solution. thought a solution had been agreed to, and feels SB_Johnny suddenly banned him from the channel without discussion or reason after a solution has been found.
- He acknowledges that Moulton's interest in the real world identities of wiki editors is another source of tension. He feels his participation in editing projects with Moulton were a constructive effort to move Moulton away from his interest in real world identities. JWSchmidt also pointed out that he spent weeks asking Moulton to stop directly.
- He believes that the tension and disruption to Wikiversity would be diminished by SB_Johnny unblocking him from the wiki and from the #wikiversity-en channel. He feels he worked to change and improve things, that his actions were positive and constructive, and SB_Johnny punished him for that. He wishes to hear an explanation for this behavior, and finds its truly hard to see what more he could do in the future. He has said if anyone has any suggestions to please talk to him, that he is truly interested in hearing ideas.
- He does not know or understand what he is expected to do differently, and cannot discuss possible changes for the future, until he has learned what aspects of his behavior was not liked or what mistakes he has made, and what is expected of or expected from him. He perceives many tensions, but thinks telling him which ones SB_Johnny is concerned about would be more efficient. He has stated that he stands ready to make changes if this were done. He thinks that expecting him to read individual's thoughts and notice that they are pissed is unreasonable.
- He provided two examples where he make a mistake, recognized his mistake and corrected it:
- He feels he did not get any meaningful reply to his question about what alternatives to his learning exercises existed. He feels this means that some types of learning projects will be black-listed, and he wishes to participate in any discussion related to black listing projects.
- He feels that User:Jade Knight is the only person who has had a discussed with him that increased mutual understanding. 1, 2, 3, 4. Given what he know now, he would of gone with Jade Knight's suggestion and made a page specifically for learning about page deletion and provide a link from the student union page to that other page.
- He did not know that anyone felt hurt. When he read, "which is probably intended to be offensive and provocative," he was puzzled. He did intend the learning exercise to be provocative in the sense that he thought it might stimulate student discussion on the student union page. He could not think of a reason why anyone would think that he intended the learning exercise to be offensive. His creation of a learning exercise on the student union page was an attempt to develop the page and make it more useful to students.
SB_Johnny suggested that JWSchmid be mindful of how his actions affect others.
[end summary]
Public pages[edit]
To let you know, the discussion on this page is quite public.
Other pages are easily searched: [5]
These pages could easily effect the reputation of JWSchmidt beyond Wikiversity. It could effect the reputation of others involved, also. Dzonatas 17:46, 27 September 2008 (UTC)
- Thanks, Dzonatas. I think that's a good thing to keep in mind! --SB_Johnny talk 18:44, 27 September 2008 (UTC)
- I am concerned that the custodians of Wikiversity are stigmatizing JWSchmidt in a manner reminiscent of the hoary scapegoat dramas of yesteryear. —Caprice 13:49, 2 October 2008 (UTC)
- Several of us have been concerned that JWSchmidt had been stigmatizing other users. But tell me, Moulton, would it have been better for JWSchmidt to be blocked and then for the community to not discuss it at all? Would that be less stigmatizing? Personally, I think this discussion is important—and the issues being brought up are very important. The Jade Knight (d'viser) 01:10, 4 October 2008 (UTC)
- "Several of us have been concerned that JWSchmidt had been stigmatizing other users" <-- Where have these concerns ween expressed? How have I stigmatized other users? By pointing out when specific users call other members of the community "troll"? By pointing out when users do not follow Wikiversity policy? By pointing out when users make false claims against other members of the community? --JWSchmidt 16:00, 4 October 2008 (UTC)
- Are you forgetting the entire "Review of JWSchmidt", as well as my, McCormack's, and others complaints about your "learning projects"? The Jade Knight (d'viser) 20:44, 7 October 2008 (UTC)
- No, he's following the lead of his mentor, Moulton, in ignoring everything that he dosen't agree with. Salmon of Doubt 20:47, 7 October 2008 (UTC)
- "he's following the lead of his mentor, Moulton, in ignoring everything that he dosen't agree with" <-- this is a demonstrably false charge. Salmon of Doubt, please list in detail any issues you feel I have ignored. I will respond to each item on your list. "his mentor, Moulton" <-- Moulton is not my mentor. Can you explain what you are trying to accomplish by making the false claim that Moulton is my mentor? --JWSchmidt 14:26, 8 October 2008 (UTC)
Your creation of "Trout of Doubt." You have not pledged to not mock other contributors and you have not pledged to not create undisclosed sockpuppets. That's just for starters. Salmon of Doubt 14:32, 8 October 2008 (UTC)
- I follow the rules for alternative account usage. I have previously disputed the charge that the "Trout of Doubt" account was an undisclosed sockpuppet. The "Trout of Doubt" user page was created by me as a learning resource that I made primarily for myself to help me think through the proper use of user pages. When I made the page I did not expect that you would ever see it since it seemed that you had stopped participating at Wikiversity. I did not create the page in order to mock you. At Wikiversity we have a continuing process of reaching consensus about the correct uses for user pages. I made the "Trout of Doubt" user page as a learning resource to help me think about the correct use of user pages. Sometimes I make use of analogies and other learning aids in order to help people think about topics and the behavior of wiki editors. It is not my intent to use those analogies and other learning aids in order to mock people. --JWSchmidt 16:54, 8 October 2008 (UTC)
- My last edit before your creation of your abusive sockpuppet was Friday, Aug 29. You created the abusive sockpuppet on Sunday, Aug 31. Was I away for the weekend? How could you have known? Is it appropriate to mock contributors who have left the project? Is it appropriate to make sockpuppets here and not disclose that the sockpuppet is yours? If your learning aids are going to drive away other contributors, shouldn't you not be permitted to return to the project until such time as it's been ascertained that you have rectified your behavior such that are not going to drive away other contributors - for instance, by mocking them if they go away for the weekend?Salmon of Doubt 17:06, 8 October 2008 (UTC)
- I do not accept your characterization of the Trout of Doubt user page learning exercise as an "abusive sockpuppet". The page was part of my exploration of what constitutes valid uses of user pages. In my view, "A sockpuppet is an online identity used for purposes of deception". I created no online identity for the purpose of deception. I must say, that as far as I can tell, you came to Wikiversity and created the "Salmon of Doubt" identity in order to prevent the Wikiversity community from knowing your identity. I still wonder what you are trying to hide about your own identity. "Was I away for the weekend?" <-- after you started editing at Wikiversity I could not keep up with all of your edits. To me it seemed like you were here every day making many edits and that you intended to remain here until you could get Moulton banned. When you stopped editing, I mistakenly suspected that you had abandoned your assigned mission to get Moulton banned. "mock contributors" <-- the Trout of Doubt user page was not created to mock anyone. "drive away other contributors" <-- I do not understand how my learning exercise about Gandhi can "drive away other contributors". "you not be permitted to return to the project" <-- I understand that you came to Wikiversity with the intent of controlling who can and cannot participate at Wikiversity. I think your judgment about who can and cannot participate at Wikiversity is deeply flawed. Your violations of Wikiversity policy indicate that your participation here is what should be carefully examined and questioned. --JWSchmidt 14:08, 9 October 2008 (UTC)
JWSchmidt cannot edit this page[edit]
I cannot edit this page from my JWSchmidt account. --JWS 13:16, 28 September 2008 (UTC)
- I do not understand why you would get this error message, but I will try to fix it. --mikeu talk 13:24, 28 September 2008 (UTC)
Ok, redid the block, so try now and see. A new option appeared on the block dialog this morning that gives an option on whether you can edit your talk or not, and it might have toggled wrong for blocks that were made before that. --SB_Johnny talk 13:48, 28 September 2008 (UTC)
- Ok, that did the trick. I can now edit this page again from this account. --JWSchmidt 14:21, 28 September 2008 (UTC)
- We are looking into submitting a bug report on this change to mediawiki software, to prevent this problem from happening to others. We are concerned that ips blocked in the past will not be able to edit the ip talk page to request unblock. This appears to be a problem caused by a recent software update. --mikeu talk 14:30, 28 September 2008 (UTC)
FYI: --SB_Johnny talk 14:55, 28 September 2008 (UTC)
Are you willing[edit]
JWSchmidt, are you willing to state that
- you realize that sometimes you upset others at Wikiversity and
- some of those times you have been unaware that you upset them and
- that you are willing to accept SB_Johnny's help so that in the future if it again happens damage to Wikiversity can be prevented or greatly limited?
I would imagine his help would take the form of letting you know
- when to back off and "give it a rest" and
- which forms of communication are disturbing people and
- some suggestions for communicating in ways others find less upsetting.
I think if you agree to that you can be unblocked.
WAS 4.250 21:25, 28 September 2008 (UTC)
- I realize that sometimes I upset others at Wikiversity. Some of those times I have been unaware that I upset them. I am willing to accept SB_Johnny's help to prevent or limit damage to Wikiversity. There is a reason it says at the top of this page, "If something I have done upsets you, please let me know." It also says, "I often like to explore the boundary between what is socially acceptable and what is outrageous," not in order to cause disruption but in order to explore what we can accomplish with wiki technology. An example of my lack of awareness was when I was editing with Jade Knight and I was having fun developing a rather silly learning project without realizing that I was really pissing him off. I had no problem apologizing for that and I have agreed not to make that kind of learning project again. SB_Johnny has suggested the idea of new guidelines that can keep me from "crossing the line". I'd like to participate in the crafting of such guidelines. --JWSchmidt 05:02, 29 September 2008 (UTC)
- Get in touch with Ottava on Wikipedia... he wrote some guidelines for himself there a while back which are a good starting point. I'm going to try to enlist a couple co-nominators. Do keep in mind that continuing to discuss the "charges" as "false, twisted, etc." will seriously slow down the process, since it's the sorts of things discussed there that you will need to avoid repeating. If you repeat them, you will be blocked again without warning. --SB_Johnny talk 11:44, 29 September 2008 (UTC)
SB_Johnny: "continuing to discuss the "charges" as "false, twisted, etc." will seriously slow down the process" <-- Do you honestly believe you can make false charges against me and then make me stop talking about how you pointed to those false charges in order to remove my custodianship and how you tried to use false charges to justify blocking me from editing? When I started to describe your false and twisted charges, you blocked me from editing and tried to justify doing so by making another false charge against me. When I saw the charges you made against me I suspected that you would never discuss them with me. Do you really think you can prevent me from responding to your false charges by misusing your power to block me? If you think you can publish false charges about me and then just block me in order to shut me up, you are wrong. "wrote some guidelines for himself" <-- I have no idea what you are talking about. You seem to be suggesting that you intend to import some guidelines from Wikipedia to Wikiversity. You have objected to some learning resources I made here at Wikiversity. I doubt if there are any useful guidelines at Wikipedia for telling you how to go about banning specific types of learning resources from Wikiversity. When there is a content dispute at Wikiversity the correct approach to resolving the dispute is community discussion. The Wikiversity community can now see that you do not respect the correct course of action for dealing with content disputes. In the case of the two learning resources you object to, other members of the community discussed the content and found ways to move ahead. You did not participate in those discussions. After those content disputes were resolved by community discussion, you misused your custodial power and blocked me from editing. "seriously slow down the process" <-- you are the one who is slowing down the process. All you have to do is retract the false charges you made against me and remove the bad block you imposed on me...then we can all get back to building Wikiversity. "you will be blocked again without warning" <-- Does this mean you intend to make a habit of misusing your custodial powers? You have made errors that you will need to avoid repeating. I have long experience helping wiki communities remove abusive sysops who habitually misuse their tools. "you will be blocked again" <-- Your threat to keep misusing your custodial powers will not stop me from talking about the false and twisted charges you made against me, or your misuse of the blocking tool. It is sad that the only way you know how to behave as a custodian is as if you are dealing with a vandal....that's not the way to deal with a content dispute. --JWSchmidt 13:21, 30 September 2008 (UTC)
- Whoa, nelly :-). Slow down, and try talking to Ottava. Or don't. You can use your user talk to respond to the "charges", write your own guidelines, or just vent. I'll be here when you've calmed and have had a chance to realize that I'm not the enemy or out to get you. --SB_Johnny talk 23:19, 30 September 2008 (UTC)
- "I'll be here when you've calmed" <-- You have repeatedly made false claims about me not being calm. I am calm. It looks to me like that is just a convenient way for you to continue your delay in reversing the bad block you imposed on me. "You can use your user talk to respond to the 'charges'" <-- You remind me of a corrupt sheriff who throws someone in jail and then says, "if you have a complaint, feel free to write it on the wall of your jail cell." At the very least you need to provide a link from here to the page section on this page where I will continue to respond to the false and twisted charges you have made against me. --JWSchmidt 17:56, 2 October 2008 (UTC)
Keep it simple[edit]
John, and guys,
These conversations are way too convoluted. Please, everyone, direct your attentions to facts and not persons or conjectures. Wouldn't you like to start simple, like: Johnny, McCormac or Cormaggio (or any of the bureaucrats or anyone who feels like it) can say: you did that ([diff]); it made so and so unhappy; here is why (one short paragraph). And stop. John may explain why he did that, and how he thinks about it now, and stop. And then the involved person can comment on that. And John can reply, and so on. Say how you feel, not how you think others have felt (like "so and so was clearly hurt"), unless you are quoting directly from that person. We have had enough misunderstandings and we should not generate more. And, Johnny, David Hilbert has once said that it is not too much to explain the same thing to a student five times (or something like that).
And let me add that I have found Wikiversity:Request custodian action/Review of JWSchmidt far too intimidating. It is structured as a report of the four bureaucrats from the beginning; its point of views were declared (that those actions of John were problematic) even before John had a chance to answer. So what I am asking for is something different: a simple and genuine dialogue; where everybody listens to each other, and everyone has the patience to answer questions, even if they have said it before.
I would urge everyone to throw out all the baggages and start from the beginning. Hillgentleman | //\\ |Talk 18:35, 2 October 2008 (UTC)
- John, Let me start with a simple question:
This [6] and previous edits to the template:deletion request include such texts as "getting the deletionist mad", "suppress your editing at Wikiversity", "destroying your contribution to Wikiversity". Some people [7], and I also, think your edits are too opinionated (and "not exactly polite"). Darklama even felt that your edits shew "anger or frustration"[8]. Do you agree? Hillgentleman | //\\ |Talk 18:58, 2 October 2008 (UTC)
- "Do you agree?" <-- I admit that it is frustrating when some Wikiversity participants are not willing to let us use methods such as Template:Welcome and expand to help guide editors towards ways to improve good faith contributions to Wikiversity. I have been exploring how to deal with deletionism in wiki communities for years. I admit that I got angry once while dealing with one specific example of deletionism. That one occasion was several years ago when a bot tried to delete some files I had uploaded to Wikipedia. The bot claimed that the files were not correctly licensed, but, in fact, I had correctly licensed them and the bot was just incapable of reading English. I became angry when the person running the bot refused to acknowledge that the bot wrong. I learned from that experience that it does no good to become angry when people try to delete the good faith contributions of other wiki editors. Through the years, I've learned that sometimes it is possible to limit deletionism if I make noise when deletionists become active. The noise attracts attention and then the wiki community can reach consensus about how to deal with the deletionism. "your edits are too opinionated" <-- I'm willing to participate in discussions about how I make "noise when deletionists become active". I feel I have had a productive discussion about this with Jade Knight. I welcome further discussions. --JWSchmidt 00:18, 3 October 2008 (UTC)
- Who would not let you use methods such as the aforementioned template? And, as I stated in our productive discussion, the "noise" seems inappropriate to me and many others. The Jade Knight (d'viser) 03:08, 4 October 2008 (UTC)
- "Who would not let you use methods such as the aforementioned template?" <-- Well, for example, you. When you saw a page that was using the "welcome and expand" template, you tried to delete the page. "the 'noise' seems inappropriate to me and many others" <-- In my experience, people who try to delete the good faith contributions of their fellow wiki editors seldom like to listen when other people object. If you object to an edit I make, then we can discuss your objection. I have engaged in such discussions and I feel that those discussions led to relatively stable consensus for the pages where such objections were raised. After that consensus was reached, I was blocked from editing, with no valid reason given for the block. "what SB_Johnny is saying seems right to me" <-- You think it is right for him to block me without giving a valid reason for the block and then vaguely suggest that some new guidelines might be made for Wikiversity and then he will unblock me? Do you think it is "right" for him to make false charges against me and try to use those false charges to justify blocking me and removing my custodial status? You think it is "right" for him to block me from editing and responding to the false and twisted charges he has made against me? --JWSchmidt 16:20, 4 October 2008 (UTC)
- Listing a page for community discussion over potential deletion in no way would not let you use the aforementioned template, etc.
- Use of the "welcome and expand template" means that a Wikiversity participant has looked at a small page and decided that the page is about a valid topic that can be expanded in the future by other editors. If you then decide to delete that page, you are not allowing the welcome and expand template to be used for its purpose of helping guide editors in the expansion and development of the page. --JWSchmidt 14:13, 8 October 2008 (UTC)
- I disagree completely; you could still guide editors in the expansion and development of that page, and adding the delete template doens't change this at all; it simply flags the page to bring it to community attention. It does not immediately stop anyone from contributing to the page. The Jade Knight (d'viser) 18:18, 8 October 2008 (UTC)
- By calling for the deletion of such a page you are trying to prevent the intended function of the "welcome and expand template" and have the page deleted. In cases where a valid reason is given for deleting the page, I have no objection to there being a community discussion about the page. When the deletion template is thrown on a such a page and there is no valid reason given for deleting the page then I feel it is a violation of Wikiversity policy. --JWSchmidt 14:16, 9 October 2008 (UTC)
- No, when I call for the deletion of a page, I am definitely not trying to prevent useful content from being added to Wikiversity; on the contrary, I'm trying to encourage the addition of useful content by clearing space for it. People are certainly welcome to add useful, relevant content to a page while discussion is ongoing; in fact, doing so can certainly affect the discussion. So, adding that template doesn't prevent content from being added at all. Actually, to give you an idea: someone once listed one of the pages I started at Wikipedia for speedy deletion. Now, this was improper; it should have been listed for standard deletion, not speedy. However, I contested the speedy, and they changed it to a standard deletion discussion. During that discussion, I expanded the page and added over half a dozen references attesting to its notability. I would not have gone to the effort so quickly had the page not been nominated for deletion. So, as a direct result of the deletion request, the page was improved. Discussion over deletion can actually really help facilitate the development of content, especially where due respect is accorded to the page creator, and good faith is assumed (as was the case with this particular page at Wikipedia; granted, many deletion discussions at Wikipedia fail in these regards, but that doesn't seem to be the case at Wikiversity, in my experience). The Jade Knight (d'viser) 21:00, 9 October 2008 (UTC)
- I do not believe that all of the charges were false; there may indeed be a difference of opinion, but as it is your actions which are offending many others in the community, I feel it is particularly appropriate for you to come to an understanding of how and why your actions offended others, and for you to try to figure out (with the help of others, if desired) how you can avoid doing likewise in the future. The Jade Knight (d'viser) 20:49, 7 October 2008 (UTC)
- I never said that all the charges are false, but it is a matter of simple justice to remove the false charges, particularly when they have been used to try to "justify" blocking me and removing my custodial status. So far I have had a chance to respond to eight of the charges and all eight of those are, when not false, distortions of reality. It is very difficult to "come to an understanding" when we are asked to build that understanding on false charges and distorted charges. Before I was blocked I was engaged in the process of coming to an understanding with other editors, then I was blocked without a valid reason for the block and I was prevented from continuing the process of coming to an understanding with other editors. The block was not valid and the block has disrupted the process of coming to an understanding with other editors. --JWSchmidt 14:13, 8 October 2008 (UTC)
Frustration begets frustration; good will begets good will?[edit]
(branching)
- John, In your first reply to my question above, you said, "I admit that it is frustrating when...". Let us pause here. Do you think that a frustrated editor editing frustratedly would cause frustration to others? An upset or angry editor would do something which make others upset or angry? Do you agree that it is possible (or even likely) that the edits you performed under frustration would make other Wikiversitians upset? :-( And, conversely, when you are editing happily, others will become happy, too? :-) Hillgentleman | //\\ |Talk 13:49, 8 October 2008 (UTC)
- I could probably take a hint from that question re: my editing in Wikipedia… The Jade Knight (d'viser) 18:23, 8 October 2008 (UTC)
- "Do you agree that it is possible (or even likely) that the edits you performed under frustration would make other Wikiversitians upset?" <-- Yes, of course. I spent three years trying to make Wikiversity a safe and productive environment for young people who are trying to learn how to participate in WMF wiki projects. My efforts were countered by other editors who seem to enjoy calling the good faith contributions of Wikiversity editors "garbage" and deleting the good faith contributions of Wikiversity editors. I know that some Wikiversity participants feel that it is their right to delete the good faith contributions of Wikiversity editors without making any attempt to welcome, understand and help the young people who are trying to learn how to participate in WMF wiki projects. I know that some of the Wikiversity participants feel that it is their right to delete the good faith contributions of Wikiversity editors get upset as soon as their actions are challenged. I know that some Wikiversity participants like to ignore me when I ask them to let other Wikiversity participants use methods such as the "welcome and expand" template to help wiki editors learn how to participate in WMF wiki projects. I have dealt with this problem for years on multiple wikis. In my experience, it is useful to bring these kinds of problems into the open so that a wiki community can reach consensus on page deletion rather than just allow a few deletionists to run wild. In my experience, the deletionists tend to complain bitterly when they are restricted from deleting the good faith contributions of other wiki editors. I am used to this kind of behavior and I still think it is important to challenge deletionists and make sure that a wide segment of the wiki community discusses the issue of page deletion. It can be painful for a wiki community when deletionists complain bitterly and proclaim their right to delete the good faith contributions of other wiki editors. However, I feel it is best that the issue of page deletion be confronted by wiki communities, even if the process is painful. I'm open to suggestions for how to limit the pain involved. --JWSchmidt 19:16, 8 October 2008 (UTC)
- John, Do you call these edits ([9]) good faith edits? They look like test edits, consisting of two lines of opinions. There is not any researched facts, and anything that was written was hardly relevant to the title. If someone genuinely interested in Albania or sea ports found this page, he would have been disappointed. Hillgentleman | //\\ |Talk 05:46, 10 October 2008 (UTC)
- I suspect that the person editing from 142.214.59.145 was a new wiki editor and that English is probably not their first language. I think the person is interested in Albania and needs help learning to use wiki as a tool for exploring that interest. "If someone genuinely interested in Albania or sea ports found this page, he would have been disappointed" <-- do we need a disclaimer that says "you might be disappointed at Wikiversity"? Erkan removed the questionable content and added the "welcome and expand" template. This is the way wiki works. Just because someone is misguided it does not mean that they are not making a good faith effort to contribute. --JWSchmidt 17:58, 11 October 2008 (UTC)
oversight[edit]
One edit containing only vandalism and personal information (ie. phone numbers) by Moulton 2DFS (block log) has been removed from the history of this page by a steward at my request. --mikeu talk 17:22, 4 October 2008 (UTC)
So now what?[edit]
I'm sorry you haven't gotten any replies today, but some people are busy with real life stuff, other people are busy chasing Moulton around, and still others are just not sure what to say to you. Hopefully things will be better tomorrow or the next day.
You've told me that you have a hard time getting a feel for how other people are feelig about things, and I believe you. I don't have a hard time doing that, so here's my sense of things: everyone who's been unsure about why you're blocked now has a better idea about why you're blocked. That includes me. What you need to do is to give assurance that you'll not be so disruptive again if unblocked. If you really, honestly don't understand why you are blocked, you should really just walk away. --SB_Johnny talk 00:47, 6 October 2008 (UTC)
- Johnny, That is a very bad idea - I mean the last thing you said. How did we come to it? Johnny, since you have not been successful in building a dialogue with John, why don't you back off for a bit and let others like Cormaggion and Jade Knight do the talking? The flowers are beautiful. Best wishes, Hillgentleman | //\\ |Talk 12:11, 6 October 2008 (UTC)
- John, 退一步,海闊天空。 Take it easy. Don't let this hiccup derail the course of wikiversity! Best wishes, Hillgentleman | //\\ |Talk 12:13, 6 October 2008 (UTC)
- "You've told me that you have a hard time getting a feel for how other people are feelig about things" <-- When wiki editors do not discuss their feelings with me it is hard to know their feelings. "I don't have a hard time doing that" <-- I'm greatly impressed by people who can read the thoughts of others....sadly I never got the genes for telepathy. "everyone who's been unsure about why you're blocked now has a better idea about why you're blocked" <-- I'm also impressed by your ability to speak for others. Personally, I'm still waiting to see a valid reason for the block. It is the obligation of the blocking sysop to provide a valid reason for a block when the block is made. You failed to do that. "That includes me" <-- I don't know what this means...does it mean that you blocked me without having a reason but now you have invented one that allows you to feel it was a good block? "What you need to do is to give assurance that you'll not be so disruptive again if unblocked" <-- before you blocked me I had constructive discussions with other editors, particularly Jade Knight and I said that I would do things differently in the future. Somehow that did not satisfy you and you blocked me...I have still not seen a valid reason for the block. If you have additional concerns and need additional assurances then you need to tell me what is on your mind. Maybe some of your concerns are in the charges you have made against me that I have not had a chance to respond to. In any case, you should remove the block you imposed on my editing and let me continue to respond to the charges you made against me. "you should really just walk away" <-- you failed to provide a valid reason for the block. I think it is absurd that you suggest I should walk away when you have made false charges against me, blocked me and prevented me from responding to all the false and twisted charges you made against me and tried to use those false charges to "justify" the block you imposed on me and the removal of my custodianship. I'm not walking away from Wikiversity. --JWSchmidt 23:07, 6 October 2008 (UTC)
Community Review[edit]
I assume you've seen this? It looks like there is a fair amount of support (SB Johnny and myself included) for unblocking you. If you could make a single statement to add there, what would you say? The Jade Knight (d'viser) 20:56, 7 October 2008 (UTC)
response from JW, formatted a bit by privatemusings, follows;[edit]
If you could make a single statement to add there, what would you say?
there is much I would like to say. First I would thank Emesee and Hillgentleman for standing up against SB_Johnny's abusive and intimidating misuses of his custodianship and #wikiversity-en ops tools. As pointed out by Darklama, I have not misused my custodial or checkuser tools. Nor have I misused my #wikiversity-en ops tools, yet I am banned from #wikiversity-en (and no reason was given by SB_Johnny when he made the ban) and I remain blocked from editing Wikiversity while SB_Johnny remains free to continue issuing false charges against me. SB_Johnny failed to provide a valid reason when he blocked me.
SB_Johnny has tried to "justify" blocking me and removing my custodianship by making use of the false claims he has made against me. SB_Johnny blocked me from editing, thus preventing me from responding to all of the false and distorted charges he made against me. When I requested unblock and pointed out the fact that he had blocked me without providing a valid reason for the block, he denied me unblock and still did not provide a valid reason for the block or for his refusal to unblock me. At the very least he should have let another custodian process the unblock request rather than continue to misuse his power to keep in place an invalid block.
I agree with Hillgentleman that it was not correct for SB_Johnny to stop the community review process before it was complete and use the incomplete review as justification for having my custodial and checkuser tools removed.
"I think Review of JWSchmidt was done in an attempt to satisfy JWSchmidt's request that people who had issues with him, list what problems they had with him and to provide evidence or such"
I do not agree with this hypothesis. I think one Wikiversity participant who had previously called me a "troll" wrote the "review" and took it to SB_Johnny. SB_Johnny then did not even carefully read and evaluate the charges that were made; he just put his name on it and posted it on wiki. The review is full of false and distorted charges, but SB_Johnny continues to try to use those false and distorted charges to "justify" his misuse of his sysop and IRC channel ops tools to block me from editing and to ban me from #wikiversity-en.
SB_Johnny: "Both the block and the removal of status were decided after seeing JWS's replies to the review"
The fact is, I was still in the process of responding to the false and distorted charges in the review. SB_Johnny's position seems to be that it is irrelevant that he made false and distorted charges against me and used those charges to "justify" blocking me and removing my custodianship. In my view, there has never been any discussion of the false and distorted charges against me nor was there ever any intention that there be such discussion. The false and distorted charges made against me were used as an excuse to block me and remove my custodial powers. SB_Johnny continues to make false charges such as "absolutely nothing would give the impression that he would not repeat this in the future".
First, by "this" I assume that SB_Johnny means the learning exercises I made concerning page deletion: this is what SB_Johnny told me by phone he was upset about. I had discussions with other editors of the "Albanian sea port history" and student union pages and I agreed not to put learning resources related to page deletion on pages like that in the future. Thus, after the community had already resolved that matter by discussion and consensus, SB_Johnny then blocked me. In other words, SB_Johnny ignored the on-wiki evidence that disproves his false claim that "absolutely nothing would give the impression that he would not repeat this in the future".
SB_Johnny claims that my two learning resources on page deletion were a "way of making a point" that was so disruptive that I need to be blocked from editing Wikiversity. This is an absurd claim. If SB_Johnny wants to dispute the validity of a learning resource I make he needs to participate in the conventional wiki process of discussing the learning resource with me. It is a clear misuse of his sysop tools to block me from editing because he does not like two learning resources that I made, learning resources that I am fully prepared to defend as valid and useful learning resources.
"brought to the point of bullying as he responded with inappropriate tones"
SB_Johnny does not like my "tone" and he claims it has approached the point where that tone can be called "bullying". This is an interesting claim that I dispute. I call upon SB_Johnny to list my edits that he thinks are "bullying" and let me respond to his charge that I have been "bullying". In my view, SB_Johnny's actions which include blocking me without providing a valid reason, banning me from #wikiversity-en without giving any reason and trying to "justify" blocking me and removing my custodianship by making use of the false charges he has made against me is bullying and clear misuse of his sysop and ops tools.
We also saw a blatant misuse of ops privledges on irc. Salmon of Doubt had requested that Moulton be kicked (he was posting private correspondence, names and email addresses of people who had not given consent to do so). When Salmon asked who had ops, JWS opped himself, but did not kick or ban... he was just showing who had the tools. Salmon had been treated rather badly by JWS and Moulton on the channel prior to this, and felt this action was done in a threatening way (which is quite understandable). A second time Moulton was doing similar things I myself had asked JWS to kick him, but again he refused (I got ops later that day, as did all the 'crats and the other custodians who are regulars on the channel).
this is typical of the false charges that SB_Johnny continues to make against me.
"Salmon had been treated rather badly by JWS"
I dispute this charge. SB_Johnny needs to list in detail what I did and let me respond to the specifics of this charge.
"Salmon...felt this action was done in a threatening way (which is quite understandable)"
I dispute this charge. The question was asked if anyone with ops was present. We were discussing if ops action was needed in the channel. In order to answer the question and be prepared to take ops action I activated my ops. There was no threat, no implied threat and no reasonable basis upon which Salmon could feel threatened by my action. I dispute SB_Johnny's claim that it is understandable that Salmon felt threatened by me. I dispute SB_Johnny's claim that my actions constitute a "blatant misuse of ops privledges".
SB_Johnny says, "I myself had asked JWS to kick him," but SB_Johnny fails to describe the fact that no valid reason had been given for kicking Moulton. In short, SB_Johnny asked me to misuse channel ops, I refused to do so, and then SB_Johnny later misused channel ops to ban be from the channel without giving any reason for doing so. It is clear that SB_Johnny (and not I) misused channel ops and yet he continues to falsely claim just the opposite. SB_Johnny said, "In the discussions leading up to the action, we all felt it was completely inappropriate for someone who treated people that way to have sysop tools" <-- SB_Johnny still has not told me what he means by "treated people that way". I can only assume that what he means is, for example, SB_Johnny's false claim that I threatened Salmon and SB_Johnny's false claim that I misused IRC channel ops. In other words, SB_Johnny continues to try to "justify" his own misuse of his custodial tools and IRC channel ops by making false charges against me.
"he and Moulton were having long and public conversations on the IRC channel about the real identities of pseudonymous users"
Such charges are vague and meaningless in the abstract. I demand that SB_Johnny frame this charge in the context of specific examples so that I can defend myself against his charges. For example, I was engaged in a Wikipedia Studies research project that included analysis of edits made by a user account that had three Wikipedia edits. All of those edits were made in violation of Wikipedia's policy. That "throw-away account" was made by an experienced Wikipedia editor in order to avoid the consequences of violating policy. Wikipedia policy calls on Wikipedians to be watchful for just this kind of account. Every day Wikipedians discover such accounts, discuss them and deal with the people who create such accounts.
As a Wikipedian, it is perfectly natural for me to engage in the analysis of such accounts. As a Wikiversity participant, it is perfectly natural for me to explore examples such as this in order to think about how to prevent future damage to Wikipedia biographies of living persons. I wonder why SB_Johnny wants to ignore the facts of my actions and instead try to smear me with a vague claim that my actions were not appropriate. I spent weeks telling Moulton that nobody at Wikiversity is particularly interested in the real world identities of wiki editors and that he should stop showing an interest in the real world identities of wiki editors.
I modified the Wikiversity privacy policy so as to make this explicit and asked Moulton to take that policy to heart. It is deceptive for SB_Johnny to vaguely suggest that I have had inappropriate discussions with Moulton about "the real identities of pseudonymous users". I demand that SB_Johnny list the specifics and let me respond in detail to his charges against me.
"The block was intended to just give JWS some time to cool off"
based on a short conversation I had with SB_Johnny by phone and the talk page discussion I have had with SB_Johnny since the block, I doubt if SB_Johnny is providing a complete and accurate account when he says, "The block was intended to just give JWS some time to cool off". I was "cool" and the main thing the block accomplished was preventing me from responding to the false charges he had made against me.
"his responses to the 'review' showed anything but regret for the unfair treatment he had been giving people"
It is not clear what SB_Johnny expects me to show regret about. All I know is that he seems to think I showed "unfair treatment" towards Salmon on IRC, but I dispute that charge against me. I have repeatedly asked SB_Johnny to discuss with me what he is unhappy about and he has repeatedly refused to do so. Maybe he still has concerns about some of the charges he made against me but which I have not yet had a chance to respond to. He should unblock me and let me respond to all the charges he made against me.
"JWS either really believes his behavior was perfectly appropriate, or he refuses to admit that it was"
SB_Johnny has made false and distorted charges against me and SB_Johnny refuses to retract the false charges and he refuses to let me respond to all the distorted charges. SB_Johnny seems to expect me to accept that false charges against me are true and to issue some sort of public statement saying that I performed those acts (the ones that he falsely claims I performed). This is an absurd expectation on the part of SB_Johnny. If SB_Johnny wants to make progress towards a happy future for Wikiversity he needs to retract the false charges he has made against me and remove the bad block that he imposed upon me.
"I really don't see a good way forward that involves unblocking at this point."
SB_Johnny made a bad block, without providing a valid reason for the block and he continues to try to "justify" his misuse of custodial power by making false charges against me. It is clear that SB_Johnny intends to keep me blocked and he intends to prevent me from fully responding to all the false charges he makes against me. I would also like to include on that page a description of the false charges that have been made against me because I have been prevented from doing that in a Wikiversity community forum. --JWSchmidt 16:40, 8 October 2008 (UTC)
Can you abide by this?[edit]
I suggested a couple guidelines on Wikiversity:Community_Review#Interpretation, specifically for you to follow, but generally for everyone to follow. Is that both understandable and acceptable? --SB_Johnny talk 16:42, 8 October 2008 (UTC)
- Any and all disagreements between Wikiversity participants should be discussed either on the talk page of a resource (in the case of an edit dispute), on the participants' user talk pages (as informal dialog), on the Community Review page (or a subpage thereof, if informal dialog fails and community input is desired), or on WV:RCA (or a subpage thereof, if use of one or more sysop tools may be needed to prevent escalation or disruption). Other resources (including main namespace pages, portal-like pages, etc.) may not be used for this purpose.
- Wikiversity participants are expected to treat their peers with respect and courtesy, assume good faith, and not make negative comparative references as a way of making a point (this includes making parody sockpuppets, comparing maintenance tasks or other editing to abusing children, war crimes, etc.).
- If the basic idea of these "rules" is that Wikiversity should be governed by discussion between Wikiversity participants then I agree with the basic spirit of these two "rules", but as you noted, they are very broad and some care is needed to make sure that the intent of these "rules" will not be forgotten and the "rules" taken too far. For example, Wikiversity has useful learning resources in the main namespace that are extended discussions between Wikiversity participants who have disagreements about some topic. Such discussions on main namespace pages are "learn by doing" exercises that allow Wikiversity participants to explore the ideas of others and to debate controversial topics. One of the explicitly stated purposes of Wikiversity that was approved by the Foundation was that we can have learning methods such as "debate clubs". Thus, I feel that main namespace can be a place to discuss disagreements between Wikiversity participants. This is appropriate and it serves the educational mission of Wikiversity that some disagreements between Wikiversity participants are discussed not on talk pages, but on main namespace pages. In particular, we have Category:Wikiversity studies and I have been thinking about participating at pages such as Ethical Management of the English Language Wikiversity/Case Studies/Deletionism. I think the Wikiversity community needs to be sensitive to the fact that the approved Wikiversity project proposal includes the idea that we can have main namespace learning projects that will include discussion of disagreements between Wikiversity participants. Your proposed "Any and all" restriction might be well intended, but it is clearly not the correct solution for Wikiversity, even if you do not personally respect the contents of the approved Wikiversity project proposal. I think the Wikiversity community needs to be sensitive to the fact that your proposed "rule" is not suited to Wikiversity and it is particularly offensive to see people lining up to prematurely vote support for this "rule" before there has been any discussion of it by people who have actually read and taken to heart the Wikiversity project proposal. It is the job of bureaucrats to help guide a wiki community towards consensus at difficult times. SB_Johnny, you are supposed to listen to reasoned arguments and use your knowledge of the Wikiversity mission as a guide to help the community establish consensus. Further, bureaucrats are supposed to recuse themselves from situations in which they are personally involved in a dispute. In my view, you are failing to meet these important obligations to the community. You might have good intentions, but I think you need to step aside in this case and stop functioning as a ring leader for a continuing series of bad decisions. Before you blocked me I had already reached agreement with others not to include learning resources about page deletion on pages such as "Albanian sea port history" and the student union. As I have explained previously, the community had already established consensus on these content issues before you showed up and blocked me. We already have Wikiversity:Consensus as a "rule" that I view as the correct starting place for dealing with content disputes such as those that arose at "Albanian sea port history" and the student union. If you want to make additions/modifications to Wikiversity:Consensus or propose new policies, then that should be done in a formal way that allows extended community discussion. In short, I'd rather remain under your bad block than allow my unblocking to become an excuse for forcing into existence a new bogus rule that explicitly violates the spirit of the approved Wikiversity project proposal. I certainly agree with the spirit of the proposed "rule #2", but it also has problems. I agree that Wikiversity participants are expected to treat their peers with respect and courtesy and assume good faith, but there seems to be a wide divergence in beliefs about what constitutes "respect and courtesy" and when one can abandon "assume good faith". For example, I do not think it shows respect and courtesy for you to block me from editing without providing a valid reason, to ban me from #wikiversity-en without providing any reason and to try to justify those actions and removal of my custodianship by pointing to false charges that you have made against me. I do not think it shows respect and courtesy for you and others to call Wikiversity participants "troll" and refuse to discuss issues with people and instead just bring out the ban hammer and treat people like vandals. In short, based on your past behavior, I doubt if you are able to fairly abide by the idea that Wikiversity participants be treated with respect and courtesy. "not make negative comparative references as a way of making a point (this includes making parody sockpuppets, comparing maintenance tasks or other editing to abusing children, war crimes, etc.)" <-- It sounds like you want to create Wikiversity:Censorship policy. Please feel free to start such a page. I think it is absurd to propose that nobody at Wikiversity can make "negative comparative references". Making "negative comparative references" is part of scholarly analysis of issues and topics. You can use the euphemism "maintenance tasks" to refer to deleting the good faith contributions of Wikiversity participants, but I know what you are talking about. I will not agree to give out a blank check to deletionists just in order to get you to lift the bad black you imposed on me. As I mentioned above, I have been thinking about participating at Wikiversity Studies pages that might involve using "negative comparative references" in order to help the Wikiversity community explore the costs and implications of deleting the good faith contributions of Wikiversity participants. In my view, any time a Wikiversity participant uses a "negative comparative reference", other Wikiversity participants are free to discuss the educational value of the "negative comparative reference". At Wikiversity we are supposed to resolve disputes and reach consensus by discussion. I will want to participate in development of any proposed Wikiversity:Censorship policy. I certainly do not trust your judgment about which topics and which learning tools can be banned from Wikiversity. In summary, I believe the intent of these proposed rules is that respectful discussion should be the basis for dispute resolution at Wikiversity. I support the idea that respectful discussion should be the basis for dispute resolution at Wikiversity. The details of the proposed "rules" are full of problems that I object to. I think it is an abuse of your power to suggest that I have to agree to these "rules" before I can be unblocked. You should step aside and stop compounding the abuse of your custodial power. If you cannot bring yourself to lift the bad block you imposed on me, then just say that you are standing aside and will respect the community decision that I should be unblocked. --JWSchmidt 13:35, 9 October 2008 (UTC)
Well, 4 things:
- Debate clubs are absolutely fine, but just make sure that both sides are interested in having the debate if it's going to be a "club". If there's a serious disagreement over something and it's not "just a debate", it should be handled either privately or with community input when there's an impasse.
- Your analogies between deletion discussion and being abusive to schoolchildren were really appalling and offensive, and is already covered by the civility policy.
- I was planning on unblocking last night or this morning, but I want to wait a few hours at this point to see if there's any new concerns voiced after the vote-counting move (IOW, let's try to be sure no-one thinks their concerns are being dismissed).
- You don't have to agree, I just wanted your opinion. I do agree that the guidelines would need to be finessed considerably before enacting as a regular policy, but for now they'll do insofar as making people more comfortable with the unblock.
See you in a few hours. --SB_Johnny talk 13:53, 9 October 2008 (UTC)
G'day JW[edit]
and welcome)
User boxes[edit]
I guess if I ask for assistance with fixing the disorganized appearance of my user boxes that would be a request for custodial assistance. Is that right? Okay so my question: would you please help me clean up the boxes on my user page, that are as crooked as can be? Thanksrecovery psychologist 03:01, 12 October 2008 (UTC)
Help wanted... :-)[edit]
Hi John. 2 things I was hoping you could add some thoughts to: first, I want to see if Wikiversity:Think tank could become a useful thing, and second I'm wondering if you might engage in some (gentle) dialog about the local culture with Mike.lifeguard. I assume you're still of the same mind about having him as a checkuser here, and I'm probably going to nominate him for that sometime tonight or tomorrow (very busy with non-wiki stuff today).
I've also been thinking a lot lately about resources for parents... it's been a while since we chatted about that, but I'm wondering if you've been thinking about it at all, and if you have any ideas. --SB_Johnny talk 20:58, 12 October 2008 (UTC)
Reflections on your block[edit]
Hi John, I've posted some reflections on your block, as well as a somewhat broader narrative on some context, at User:Cormaggio/Block on JWSchmidt. As I say there, I'd really welcome comments etc. I've more to say about specific things you've said above, but I thought that I would keep these mostly to your talk page, where we can continue our discussion - hopefully on a better footing. Talk to you soon, Cormaggio talk 23:42, 14 October 2008 (UTC)
Concerns[edit]
- If Wikiversity is to survive as an authentic learning community, it is important that the community leaders of Wikiversity set an example that reflects the ideals and practices of an authentic learning community. Some of the practices employed here in recent weeks substantially depart from the normative practices of an authentic learning community. I hope that, going forward, such misadventures will not recur, and that Wikiversity will acquit itself of the concerns that it has veered off course from the demeanor of an authentic scholarly enterprise. —Moulton 06:08, 18 October 2008 (UTC)
Better footing?[edit]
John, I want to be clear on a number of things, to keep our discussion on track:
- Your editing has caused hurt, offence and/or concern among a number of people in the community (eg. Jade Knight, Darklama, McCormack, Salmon of Doubt) - which has been documented and presented to you - and it is this effect on others that myself, Mikeu and SB_Johnny have also been concerned about, and have been reacting to - as well as what we have observed ourselves. And, as I see it, judging from several subsequent reactions from them, I do not believe that their concerns have been dealt with on the basis of your own claims about your activity and your intentions. I, personally, have certainly not been assuaged by your reaction to the highlighting of your activity - sadly, quite the contrary. So that's by way of general context - even if your perceptions are different.
- Your block was a temporary one, with the sole intention of curbing the disruption that your editing had caused, and forcing you to take a reflective look at your editing, with the hopes of setting some guidelines which would address the concerns raised. It was not solely based on your inviting Moulton to work on research guidelines (and the related "false charges" you've been explicitly mentioning represent a relatively very small part of my personal concerns). I'm not sure if the block was clearly enough communicated to you - if it wasn't, then I'm very sorry about that.
- I'm fully aware that you've made some future-looking concessions on pages and processes that caused concern - and I think these are good steps in the right direction. I would encourage you to continue working on these as personal reflections, which could be worked into community guidelines. I would like to work on these with you, and I agree that we need to take a broad look at these principles with the Wikiversity mission in mind - I think you've raised some valid points of critique so far.
- Even though this episode has put a strain on our working relationship, I want to reassure you that I have not changed in my attitude towards Wikiversity, and the mission we've always worked towards. I am simply trying here to maintain a culture of civility and mutual respect (even though I recognise that blocking is not a nice situation to create, or to be in). I still want to work with you on realising the vision we've always shared for Wikiversity, and to address the challenges that we face. I have no interest in power games - or any games such as we've seen recently, in fact - and I am not trying to restrict Wikiversity in any way, except to promote civility. I hope you can take this in good faith - it's very hard to have a constructive discussion when you maintain your negative characterisations of me and others, as you have been on my CU nomination, and in recent posts to your blog. However, I fully acknowledge that you feel negatively and unfairly characterised - so what I'm essentially doing here is calling for an 'amnesty', and a chance to have this discussion on a better footing than before. Cormaggio talk 18:32, 19 October 2008 (UTC)
- The disruption, chaos, and turmoil that arose in the wake of two controversial and unjustified blocks has hurt a lot of people, as well as the project. We have seen such lamentable effects as stigmatization, shock, alienation and anomie, scapegoating, shattering of faith, and acedia. In some cases the level of distress has been so disturbing as to cause multiple bouts of projectile vomiting. We are not just talking about shpilkes in the gennektegessoink here. We are talking about toxic reactions sufficient to cause GERD.
- Using a block as a coercive tool is neither an acceptable practice nor a sustainable practice in an authentic learning community. Such practices amount to Bill of Attainder and Immurement and have no place in Wikiversity, full stop. I can think of no practice more incivil, uncollegial, unscholarly, unbecoming, or physiologically toxic as binding and gagging a fellow scholar.
)
- John,'d also appreciate if you could stop characterising people as "thugs" - in fact, I would urge you to tone down your language and hostility in general. (I ask this not in order to stop you using particular words and phrases - but because your use of particular words and phrases is wholly unfair - and you have clearly pushed several people well past their personal thresholds.) If you do tone down your hostility, it will make this conversation a lot easier for both of us - and for everyone who is trying to follow what's going on. So, after a break and a think, I honestly believe that the basic problem here is that you have been seriously misguided in your characterisation of McCormack's intentions. McCormack has done a huge amount of work on Wikiversity's structure, and working methods - and has tried to make Wikiversity more intuitive, accessible, and better organised. I think your characterisation of McCormack's 'deletionism' is overly harsh - and your characterisation of his edits around the Student union as trying to undermine student participation is grossly unfair. McCormack has always wanted to have a clear process (or many processes, in fact) by which people can participate - and I honestly believe that, after two years, this is still not clear enough, and is therefore potentially off-putting to many potential contributors and learners. McCormack's efforts to document what kinds of materials we have, and could have - are good steps towards our mission of figuring out what works and what doesn't work in a wiki environment. Yes, I know the two of you rubbed each other up the wrong way at times (his calling you a "troll" - if he indeed did say that - was not in a vacuum, I'm sure) - but if you took what he said in response to your critiques here and elsewhere in good faith, then I think you would be building on his work, not attacking it. I think the two main discussions we need to have right now are around learning (and how it works), and around deletion (and how/when it is justified) - in other words, what exactly we are trying to promote in Wikiversity. I don't think we have ever been explicit about this - except about our diversity - and so I'm surprised that you think this issue of our identity should be somehow behind us. I think a lot of the energy you've put in recently which a lot of people feel is problematic would be best directed towards these discussions - and in an appropriate space, ie a policy discussion page. I absolutely don't think that there is an effort to limit Wikiversity - except for to define what kinds of materials, processes, and policies best serve a wiki-based learning project. It's in the best interests of Wikiversity and the Wikimedia Foundation to do so - and you know this. But it's against these interests to act as divisively as you have been before, during, and after the block - all anyone wants to do here is to make Wikiversity a better place - and I know you do too. Cormaggio talk 19:44, 26 October 2008 (UTC)
Wikiversity: scope (versus?) organisation[edit]
John,
I have seen McCormack's work. I believe he has been trying to make wikiversity more accessable and useful to more people. He wanted to put more structure on the content so that the resources are more accessible (and so that you don't need to shoot randomly). In so doing he had deviated from the original concepts of the topic: and school: namespaces; and we also had a little discussion on that. However, this had been happening all along; McCormack was not the only one who think of "school:" differently from its original idea as a free community space. And a casual newcomer may be confused by the existence of both "topic:" and "school:", whose descriptions are very similar. In an ideal world we need not distinguish "primary, secondary or tertiary" education; and even in our world someone with limited knowledge in maths may know history or literature deeply. However, wikiversity is created by real world people who come here, for better or for worse, with all of our real world baggage. And I cannot see how McCormack's contributions adversely affect free participation in Wikiversity - could you point it out? Overall, I would say McCormack's contribution is positive. Hillgentleman | //\\ |Talk 05:44, 20 October 2008 (UTC)
Re: fiction[edit]
Hi, John! Thanks for posting to my talk page. I am relatively new to Wikiversity and basically just beginning to feel my way around things, so if my posts are a bit messy, I hope you aren't too bothered by it.
I really haven't found a particular genre to focus my writing on yet; I really like SF (I'm a huge Star Wars fan!) and I have several interesting ideas for stories inspired by the likes of "Terminator" and "Alien"--although I'm not too sure if my writing style fits well in that genre since (among other things) I struggle with pinning down specific details, which I know is the key to making SF plausible and believable. That said, I'm not much of a fan of hard SF per se...I believe the most enjoyable SF is the stuff where you have to suspend your disbelief a bit, as in the Star Wars series: not everything has to be explained scientifically. On the opposite end of the spectrum, pure fantasy worlds (Middle Earth, Pern, Narnia, etc.) are a little too "out there" for my tastes.
As far as my SF goes I think I take after Allan Dean Foster quite a bit; I also like Asimov, but I could never be as technical as him. I've never read Philip K. Dick, but I've loved every film adaptation of his stories thusfar and would be interested to check out their literary counterparts!
The handful of complete stories I've written (no SF among them so far) tend to be melodramatic and character-driven pieces focusing on the "hero" or "heroine" coming to a new understanding of him- or herself after acknowledging and working through the pyschological effects his or her tumultuous past. In this area I'm heavily influenced by writers like King, Koontz, and Grisham.
I apoologize if this message is too lengthy...I hope I've sufficiently answered your question. KirbyPuckettFan 22:49, 22 October 2008 (UTC)
- Hey John, please take a look at the meta page for my SF novella and tell me what you think. I'd like to do a collab with you and David on this. KirbyPuckettFan 01:42, 25 November 2008 (UTC)
- Interesting...although my idea is not so much about mutating humans as it is about the necessity of the Luminads finding a way to boost their immune systems so that they can extend their life expectancy on Osiris IV. BUT...it's a logical scenerio to begin setting up at the end of the first book (I envision a trilogy or maybe even a tetrolgy for this) since the humans will be laying the groundwork for COHABITATION among the (reverse-engineered) Luminads. Initially, I thought that the main enemies in the sequel novels could be Saurok-earth cat hybrids, i.e. the last surviving Saurok somehow "mates" with a lion, tiger, or leopard (a transplanted zoo animal) and the resulting DNA mix creates an even more predatory Saurok species. Extending the DNA mutation to humans would fit the desired progression of adversaries in the series... KirbyPuckettFan 02:27, 26 November 2008 (UTC)
- check this out KirbyPuckettFan 10:12, 26 November 2008 (UTC)
Reason for Transmission Break in comment...[edit]
The reason I asked is to do the US Elections, If Obama wins there will be a media frenzy, and Wikinews is already talking about possibly making a 'call'
I've started building a rough playlist, but if Obama is obviously going to win, then it might be prudent to 'break into' the transmission to make a suitable announcment, I will come up with some wording...
Following the Break in, the idea was to play the US National Anthem, and then go direct to Wikinews, the alterntive is to go via two speechs, I've outlined in the Active Stream's disscusion page...
This of course only happens if there if there is an Obama win, a McCain win would not be a transmission breaking event. ShakespeareFan00 23:00, 1 November 2008 (UTC)
- Why in the world not? The Jade Knight (d'viser) 12:24, 2 November 2008 (UTC)
OK - There is a provisonal playlist idea here Talk:Wiki_Campus_Radio/Active_audio_stream#US_elections, Unfrotuantly I don't have any suggestions on what to use in respect of McCain Victory, or music wise. If you are US based you may have more ideas.. Apologies for the short notice ShakespeareFan00 21:18, 3 November 2008 (UTC)
Personal and professional[edit]
I read your statement, and I noticed you stated this: ""the disruption that your editing had caused" <-- I'd still like you to provide a list of the edits and for each edit a short English sentence that says what "disruption" I caused." Your concern is not unique about this, as I would also like to see more clarity on a per edit basis for how disruption is caused, or how someone can claim it as disruption. On the wiki environment, such accusation have been vaguely placed on other users without any kind of list of reasons, or, simply put, the accusation is too easily said too often. On Wikipedia, there are claims that even mere accusation of 'disruption' against a user is understood as an attempt to block that user, but I won't bring those instances up here right now. However, UninvitedCompany left a statement that may interest you: [10], which shows the concerns at a different level. I don't know much of the history about how UC's concern grew. Dzonatas 18:11, 4 November 2008 (UTC)
- "Disruption" is often used to mean "You are making me upset therefore you are disrupting my peace of mind and ability to edit here productively. Please stop editing in a way that bothers me." But the person is being told this in a way that upsets them, so one "side" is asserting the right to upset the other while claiming the other "side" has no right to upset them. WAS 4.250 12:17, 5 November 2008 (UTC)
In this particular case, I think it was the level of indirection (comments about comments about a study about comments about comments) that confused and upset people followed by JWSchmidt not recognising that he was upsetting people. WAS 4.250 12:17, 5 November 2008 (UTC)
- The level of recognition needs to be a two way street. One thing to recognize about JWS's actions is that JWS did not block people simply based on what upset JWS. JWS didn't block McCormick, for instance in this case. When the level of indirection lead to an obvious break down in communication between the two, then McCormick posted the colloquium thread about disruption, which lead to JWS being blocked. I saw two problems here. One being the parody, by JWS, being found in the level of indirection. The other being the post of the 'disruptive' threads in the colloquium, which I found to be a more publicly advertised link than the Student Union page. The Colloquium has a link in the left tool bar on every page of this website. The Student Union page I found only by the edit-war activity in recent changes. In the manner in which McCormick posted the thread is practically in equal parody of JWS's attempt to discuss situations on the Student Union page. Two wrongs don't make a right. JWS states on my page, "to turn Wikiversity into a mirror of Wikipedia, make it yet another wiki where reasoned arguments are not offered." I can understand this concern because a few admins here decided to overlook the wrong of what McCormick did and only focus on what JWS did, which can be viewed by others, like me, as not fair. I think Uninvited Company's #7 statement reflects this kind concern where actions are unfairly overlooked while another is exploited: "to turn Wikiversity into a mirror of Wikipedia, make it yet another wiki where reasoned arguments are not offered." Wikipedia has been based upon a popular view rather than truth. If the popular view is unable to look at a situation fairly, then I feel such view doesn't qualify under scholarly ethics. If Wikiversity is to become based on scholarly ethics, it has to be recognize different from Wikipedia where truth matters more than the popular view. Dzonatas 19:08, 5 November 2008 (UTC)
Wow, and there you go again![edit]
Sat down to look at the recent changes, and saw your baitish edit comment (case 21: why has User:SB Johnny blocked the development of critical Wikiversity policies?). For one thing, you know darn well that my issue with you on that was that you just went through and "officialized" a bunch of policies without so much as a note on the colloquium that you had done so, and that that particular policy was a bit scary because "wannabe hawk" Wikipedian transplants might use that to "prove their mettle" by nominating any/all research projects because the wording of that policy wasn't well thought out.
You've also clearly not gotten the message that insulting people via edit comment is a vulgar and less-than-collegial way to behave. Bummer. --SB_Johnny talk 22:38, 6 November 2008 (UTC)
- "baitish edit comment" <-- My edit summary contained an honest question about your editing, not an attempt to bait you. "'officialized' a bunch of policies without so much as a note on the colloquium that you had done so" <-- we have Wikiversity:Be bold. As you demonstrated, it is a trivial matter to 'un-officialize' a policy. I spent months recruiting collaborators to develop Wikiversity policy that was explicitly requested by the Wikimedia Foundation. The community had many discussions and then it was time to try to put some kind of cap on that process of policy development. It is true that I have been in a position to make many contributions to the structure of Wikiversity, but I will defend myself against the twisted claim that my hard work for the Wikiversity project and community is "manipulation". "the wording of that policy wasn't well thought out" <-- no doubt, but if there is a problem with a wiki page the solution is to correct the problem by editing. "nominating any/all research projects" <-- I do not really see that as a realistic danger. I think Cormaggio's formula was correct: "it would not be productive to apply this policy miltantly, but within 'common sense," and applies to research. The obligation to cite appropriate sources is a foundation for good research, not a tool for eliminating wiki pages that involve research results. "insulting people via edit comment" <-- are you claiming that I insulted someone? Please list the edit and explain in a short English sentence what the insult was. "less-than-collegial way to behave. Bummer." <-- I find it very strange to be the recipient of your commentary on collegiality. You published a pile of false and twisted charges against me, used those false and twisted charges to try to "justify" imposing an indef block on my editing and having my custodianship terminated and I still do not know why you have banned me from #wikiversity-en without discussion, warning or a reason given. You brought a "mediator" to Wikiversity who promptly went around telling long-term Wikiversity participants to leave the project, and you have also suggested that I leave the project....in the most vulgar of ways. I'm truly intrigued by the world you inhabit where you think you can do anything you like, things nobody else can do, "because you are you", while at the same time you take offense if I question your behavior.....yes, you clearly know the collegial way to behave....I have so much to learn from you. --JWSchmidt 18:13, 7 November 2008 (UTC)
- If you had a question about my editing, you could have just asked my on my talk page (since you're so fond of telling others that they should do so with you). Being bold doesn't mean being sneaky... you waited until the discussion was long dormant, and then officialized them because you thought they were right. Policies are decided by the community, not by you, and if you really felt it was urgent to enact them, you could have just asked around for new opinions (I, for example, would have supported most of them, had you only made the effort to ask rather than tell). I do appreciate that you were just trying to fulfill the mandates/requests of the foundation, but wiki communities (like wiki content) need to be free to evolve, and your insistence on engaging in character assassination on anyone not following your mission (even if that mission really is the original mission) is at best counterproductive, at worst destructive.
- I think you should bear in mind that your use of edit comments in that manner is what drew me personally into it (with the "McCormack doesn't like students..." thing): I've always made it a point to leave the endless arguments about policies to people who enjoy that sort of thing (I don't, as you know), and wait to add my $0.02 when it gets announced somewhere (colloquium, sitenotice, whatever). In most cases the end result of the endless back and forth (again, not my cuppa) tends to be a good sense of the community's desire and intent. The problem with you is that rather than just voting "Keep" when you disagree with a proposal for deletion (etc.), you start accusing people of being against the spirit of Wikiversity, the community, and so forth. There's no ulterior motives here John: we didn't write that review to set you up for a fall. We wrote it and/or signed onto it because we were honestly concerned about the way you were treating people, and we didn't feel we could construct it all "on-wiki" (it actually was on a wiki, just not this one) because you tend to glom onto one point or another and use it to attack, rather than just trying to understand the other's point of view (or at least that's how it feels).
- I'll try to answer the rest tomorrow... plum tuckered now. One bit of unsolicited advice though: it would help your "case" a lot if you would try to take other people's concerns seriously rather than assigning nefarious motivations to their concerns. The hardest time to Assume Good Faith is when people are really angry at you. --SB_Johnny talk 22:55, 7 November 2008 (UTC)
- Okay, a few more comments. Railing on about how people made "false and twisted charges to justify a block" isn't helping things. First, it implies that we are twisted people (we're not), that we have some sort of hidden motivation for blocking you other than the problems we outlined in the review (we don't), and that we intended to keep you permanently blocked (we didn't). The block was to head off further disruptive behavior on your part after the tools were removed, and the fact that you've spend most of your energies since the block was removed continuing your campaign of character assassination only proves that we did indeed have reason to be concerned. The logs I've seen from -projects also makes it pretty clear that banning you from -en was also a good idea, since you've been just as aggressive there as you were on -en before the ban was put in place.
- I assume by "mediator" you mean Jayvdb, but I'm ot sure what you're saying about him.
- And as far as "what I can get away with", I believe that discussion was in relation to when I tried to serve as a "firewall" during the early days of the Ethics project, because enough people knew who I am that they would be willing to AGF on my part and let things progress for a while rather than denouncing and disrupting the project from the get-go ("Centaur of Attention", for example, arrived on the project within hours of the content contributors). I still think that was the right thing to do, and I don't think Moulton, WAS, et. al. would have had a moment's peace to get their content in order if I hadn't made an all-out effort to give them that space. --SB_Johnny talk 13:21, 8 November 2008 (UTC)
- "If you had a question about my editing" <-- I'm guessing that this is in reference to my edit summary. I was editing a page in an attempt to respond to one of the charges you made against me (accusing me of "policy manipulation") and I was making a suggestion to Wikiversity community: that my contributions to policy development be compared to yours. My edit summary was designed to convey they content of my edit. "if you really felt it was urgent to enact them" <-- I do very few things in the wiki world out of a sense of urgency. When I have time, I contribute what I think will help the wiki communities I participate in. I admit that I sometimes do things that I know will not be welcomed by everyone, and other times I am taken by surprise when people are upset by my editing. I invite people to come to my talk page and tell me when they think I have "crossed the line". "your insistence on engaging in character assassination on anyone not following your mission" <-- Please list the specific case of "character assassination" you are insinuating. Sometimes I describe the actions of others, but if my act of describing someone's actions causes distress, then it only tells us something about their actions. I stand behind my accounts of the behavior of other editors. You have made many false charges against me and as I respond to your charges I have been asking that those charges be retracted or supported by evidence. So far there has only been silence and continued pointing to your false and distorted charges as "justification" for blocking me and having my custodianship removed. Your behavior might be viewed by some as....gee, what is a good term to describe this....character assassination? "you start accusing people of being against the spirit of Wikiversity, the community, and so forth" <-- the Wikiversity community developed a culture that welcomes new editors. When I see a few people rejecting the Wikiversity approach and trying to bring in a toxic culture of treating good faith contributions like vandalism then I am not going to just quietly "vote keep". Similarly, I view your treatment of me as totally inappropriate for any wiki community and particularly offensive to the reason-honoring learning environment that so many have tried to develop here at Wikiversity. You are free to retain fantasies about being able to intimidate me and you can dream that I will follow your advice to, "just go fuck yourself and go away," but I'm not going anywhere. "we were honestly concerned about the way you were treating people" <-- You were concerned that I stood up to people who were calling the good faith contributions of new wiki editors "garbage"? You were concerned that I stood up to someone who came to Wikiversity on the self-proclaimed mission of getting another Wikiversity participant banned? You were concerned that I stood up to someone who wanted to remove Wikiversity's invitation to students that they feel welcome to edit and participate? I will always defend the right of students to come to Wikiversity and participate. When I stood up to McCormack he called me a troll and told me that he would never talk to me again. Now you want to punish me for how I defended Wikiversity against McCormack. Fine. Your position is clear. It is your style to label people as "troll" and tell them to fuck off. I oppose the style of wiki "leadership" you have adopted. "we didn't feel we could construct it all 'on-wiki'" <-- when you make the choice to work on Wikiversity issues off of Wikiversity you have to live with the consequences. For example, I hold you fully responsible for every false and distorted charge that was in the "review" that you signed your name to. "take other people's concerns seriously" <-- I am happy to do so, particularly when they come to my talk page an say, "This edit (dif:here), it concerns me because X," and then we can discuss the situation. If we are talking about this, I admit I'm still working my way through all the "cases", but so far I have not found a single charge against me that is other than false and/or distorted. I do not view the "review" as having expressed "people's concerns" in a coherent manner. I view the "review" only as what it has been used for: a way to publish many false and distorted charges against me that could be used as an excuse to block me from editing, to ban me from #wikiversity-en and to have my custodianship removed. If the review had been intended to be a way to "express people's concerns" then I would have been allowed to respond and the community would have then had a chance to read the charges and my responses and decide on how to respond to the "concerns". That did not happen. First, McCormack tried to prevent me from responding to his false and distorted charges. I suspect he knew all along that he could not defend his false and distorted charges in a fair community discussion. So I had to be blocked from editing before I could defend myself against all his charges. The honest Wikiversity participants could see that there was no basis for the bad block you imposed on me. Yes, you had intimidated most people, but in the end, honest people gather their courage and do what needs to be done to set things right. "assigning nefarious motivations to their concerns" <-- I suppose this is yet another insinuated charge against me. Please explicitly state any where you think I have been "assigning nefarious motivations". After you published all those false and distorted charges against me I defended myself and I have described the actions of people who have made false and distorted charges against me and who have called me 'troll' and 'whiner' and told me to "just go fuck yourself". Sometimes I do speculate and hypothesize about the motivations of others, but when I do that I'm always still waiting for them to explain their own actions. "it implies that we are twisted people" <-- not really, but since some of you worry that I mean "twisted" in that way I'm willing to say 'distorted' and not 'twisted'.....but since you mention this possibility, I guess it could be that there was just one "twisted person" and three clueless people who agreed to sign what was written by the one "twisted person". There are other possibilities, too, but I do agree that when such a collection of false and distorted charges is used as a basis for abuse of power then all sorts of possibilities are likely rush to people's minds. That is the danger you take on when you work in secret to ambush a fellow wiki editor, in this case, a fellow editor who begged you to discuss your concerns about my editing in a civilized manner. I'd prefer to use "twisted person" to refer to people who think it is funny to put pictures of penises on the main page. "that we have some sort of hidden motivation for blocking you other than the problems we outlined in the review (we don't)" <-- fine, then call me clueless because I still do not see a single valid reason in the review for blocking me from editing, you certainly never provided one either when you blocked me or when you refused to unblock me. When you banned me from #wikiversity-en there was no discussion, no warning and no reason given for the channel ban. I still do not understand why you banned me and why you continue to enforce the ban. You and your team published a bunch of false and distorted charges against me and used them as an excuse to bring in an uninformed outsider to remove my custodianship, with no community consensus for it. That is the kind of action that wikis reserve for sysops who start deleting the main page or something. To use that trick on me is an abuse of your position, power and responsibility. But since I am so clueless, maybe you can help clue me in. It is really simple: you say something like, "JWSchmidt was blocked from editing because he kept putting penis images on the main page" or "JWSchmidt was banned from #wikiversity-en because he called other people 'troll' and told them to 'just go fuck yourself'" or "JWschmidt had to have his custodianship removed because he abused his tools by imposing an indef block on a fellow editor without warning, discussion or a valid reason." If you provide me with a short and clear English sentence such as those then I think I will be able to start to understand you "concerns". "the fact that you've spend most of your energies since the block was removed continuing your campaign of character assassination" <-- eh? "fact"? I dispute your "fact". Please describe this "campaign of character assassination". I've exerted most of my energies trying to keep working through and responding to all the false and distorted charges that you published against me.....it is truly a sickening exercise to perform in what I had dreamed of as a place of reason and learning. It is such a joy to come to this "center of learning" and read the advice of a "community leader": "just go fuck yourself" and then have to suffer through advice from the "community leader" about how to be collegial. Yes, the joy of learning...please keep it coming. I am in your debt for you sharing all these "tricks of the trade" and "nuggets of wisdom" with me. "you've been just as aggressive there as you were on -en" <-- does this mean you banned me for "being aggressive"? Please do be specific. What have I been aggressive about? Defending Wikiversity from people who threaten to have it shut down? Defending myself from people who call me 'troll'? Defending myself and my fellow collaborators in research and learning against absurd assertions and accusations? Please tell me in detail about your "concerns".....or do you intend to just let this be another charge that you make and use to "justify" your actions but never discuss and never support with evidence and never allow me to defend myself against? "you mean Jayvdb, but I'm ot sure what you're saying about him" <-- Let's try doing some research on this topic...maybe I did not correctly understand things that he said. As a starting point, you can provide your definition of "moderator" and explain to the community what you asked jayvdb to do at Wikiversity as a "moderator" and you can provide your assessment of how he performed that task. We can ask jayvdb how many Wikiversity participants he told to leave the project and then we will check his answer against the evidence. "what I can get away with" <-- I'll grant you the right to say what you meant when you said it. It took on a whole new meaning for me when you decided to block, ban and desysop me. Since about that time, you have seemed free to make any charge you like against me. Even when I explain that a charge you have made against me is false you and Cormaggio do not seem to care....you even seem to keep insisting that I admit that your false charges are correct. As far as I'm concerned, even a person who feels free to use the ban hammer on whim does not get a free ride for making false charges and using them as a way to "justify" misuse of power. --JWSchmidt 00:54, 9 November 2008 (UTC)
- The problem with your edit comment was the accusation that I'm against making good policies (I'm not), when you know quite well that my gripe with it was that you unilaterally declared a bunch of policies to be official, without discussion or notifying the community. When I reverted that on one of the policies (which was quite appropriate), you told me to get a clue. The manipulation comes to play because you waited until people weren't really engaged in the discussion any more, and then officialized them without giving any notice that you had done so or asking for community input, and then you copped an attitude when I called you on it. The "argue to the last and then have your way when everyone gets tired of arguing with you" approach to community decision making is a rather poor model. Likewise, putting the most negative interpretation possible on someone's acts or words is not a constructive way to reach consensus (though Karl Rove would probably see it your way here). --SB_Johnny talk 13:32, 9 November 2008 (UTC)
- "the accusation that I'm against making good policies" =?= "why has User:SB Johnny blocked the development of critical Wikiversity policies?" I never said that you are against making good policies. My position is this: it is in the best interest of the project that there be official policies about citing sources and privacy. Rather than help meet these needs, you have resisted the development of these policies. When #wikiversity-en participants were bothered by the mention of real names of wiki editors I worked to develop Wikiversity:Privacy policy to address that problem and I repeatedly asked participants in #wikiversity-en to make it official policy and to apply that policy to #wikiversity-en. I think it would be constructive for Wikiversity participants to explore the question of who has and who has not worked to meet this kind of critical policy need. This is important context for your charge that I "manipulate policy". I find it truly sickening that you would try to portray my efforts to develop Wikiversity policy as "manipulation". I worked to get approval for research at Wikiversity, then I struggled to get collaborators who would devote time to develop the research policy, I participated in community discussions and ask for input, including arranging for people to help translate discussions, I waited until no further input arrived and then acted to cap the development process and mark the research policy (and some other important policies) as official. It is a wiki. Everything is reversible. Any policy, even one marked "official" is still open for debate, modification and change. You would have done things different. Fine. If you do not like the way I do something then suggest a better way to do it. I think it is despicable to wait until long after you think I should have made an announcement on the colloquium and then try to claim that I "manipulate policy" as part of a collection of false and distorted charges. Then while I was still in the process of responding to all your false and distorted charges you blocked, banned and desysoped me. It is a sick double standard for you to complain that I failed to make an announcement on the colloquium while you are free to do anything you want to do including sharing your advice to, "just go fuck yourself and go away," blocking me without a valid reason for a block, banning me from #wikiversity-en with no discussion, warning or reason and using a collection of false and distorted charges to "justify" having my custodianship removed. You endlessly continue to make claims such as saying that I accused you of being against the making of good policies. Is this the future of Wikiversity, you endlessly making false and distorted charges against someone who you have a disagreement with? Is this fun for you? "you copped an attitude when I called you on it" <-- When judging consensus in a wiki I heavily discount votes that are cast without discussion and without provided reasons. I favor the idea that voting is a last resort that should only be entered into after discussion. Further, I think custodians should understand the importance of discussion and reasoned argument. I'm astounded anytime I see a wiki sysop rushing to vote or confirm a vote and count votes that are cast without there first being discussion. So, ya, I have an "attitude" about that. "argue to the last and then have your way when everyone gets tired of arguing with you" <-- I'm usually satisfied when people give me a chance to respond to their arguments and they respond to mine. Then I know there has been a chance for some discussion and communication. "putting the most negative interpretation possible on someone's acts or words is not a constructive way to reach consensus" <-- I agree. I think the correct approach is to describe someone's actions and ask them to explain their motivations. However, if people start saying "You are a troll so I'm not going to talk to you" or "I want a pony" or "If I have to explain that then there is nothing I can say to you" then I feel the flood gates have opened and I am free to start formulating hypotheses about what motivates such people. I find that after I make a few silly suggestions then normal people chuckle and explain their own motivations....if nothing else just to stop me from making more foolish suggestions about their possible motivations. When people's actions are questioned and they never explain their actions and motivations then it gets very strange. For example, you told the community that I needed to be blocked from editing here because I encouraged Moulton to "transfer his "work" to beta.wikiversity.org". I've asked what "transfer his 'work'" means. Silence. Whatever it means, it is so serious that I had to be blocked. But what is the truth? What did I actually do? I had an open discussion in #wikiversity-en with Moulton about how to modify the research policy in response to Jimbo's suggestions. I asked Moulton to look at the research policy and help modify it. So my effort to take Jimbo's advice and modify the research policy becomes a blockable offense. This raises many questions about the motivations of the team of sysops who made this false charge against me and used it to justify an indef block of my editing. An honorable person would withdraw such a false charge and take action to correct the damage they have done. What should be said about the four sysops who refuse to discuss this false charge they made and who refuse to retract it? "the most negative interpretation possible" <-- I've not offered the most negative interpretations possible for the horrible things that have taken place at Wikiversity. I generally limit myself to describing what has happened and I'm happy to stand behind my descriptions of events. If you think I have given "the most negative interpretation possible" for events at Wikiversity then set me straight. I'd really like to know why you have made and continue to make so many false and distorted charges against me. Why is it that even after I show that a charge is false you refuse to retract the charge? "the most negative interpretation possible" <-- please list these "most negative interpretations" and provide the "correct interpretation" (as you see it), then we can discuss the evidence and see which interpretation best matches the evidence. --JWSchmidt 00:42, 11 November 2008 (UTC)
- Bleh. I'm going to just share a very general thought here and we can hopefully have a non-hyperbolic discussion another day. John, if people are going to contribute here, it will be because they feel that their contributions will be valued... I think we agree on that. However, people need to feel that they have a stake in things, and that Wikiversity is something that will evolve, and that they can help it evolve. Your behavior (both before and after the tool removal/block/irc ban), your voluminous rhetorical speeches, and your "anything goes" debate style has been read by many (including, only lately, me) to believe that you see yourself as the oracle and herald of what Wikiversity's mission is, was, and always shall be, and that anyone who sees things differently is an enemy of Wikiversity.
- I don't think anyone really believes you any more (your writings of late make it pretty clear that you're a bit off the deep end), so maybe you might consider getting off the high horse (it's dead, and I'm tired of beating it). I'm fairly sure that most Wikiversitans really don't want a messiah, John... we want to meet as equals. What happened to you wasn't due to a conspiracy of power-hungry people, but rather due to an ad hoc gang of peers who decided that the bully needed to leave the playground.
- I'm not going to make any more lists for you John... been there, done that, and you've made it clear that nothing sunk in. I really wish you would make an effort to try to understand why people got so upset. --SB_Johnny talk 23:35, 11 November 2008 (UTC)
Audio Wikinews Briefs[edit]
Hello, ShakespeareFan00 asked me to update you about the Audio Wikinews Briefs. I will be resuming these on Monday, I had to step away from the project for a few weeks. Kamnet 00:56, 9 November 2008 (UTC)
Custodian nomination[edit]
Thanks for the reminder - time's up - it had slipped from my gaze. Feel free to comment, but will nominate now. -- Jtneill - Talk - c 07:22, 11 November 2008 (UTC)
Note[edit]
Could you try to limit the sizes of some of your entries? When you go over a certain length, it makes it harder for people to keep up with what you are saying, and gives others the impression that you don't necessarily want to discuss, but just be heard. I don't say this to hurt you or anything. Quite the opposite. People will just be willing to interact with you in a better way if you kept your responses to, say, 10 sentences? Ottava Rima (talk) 15:04, 11 November 2008 (UTC)
- JWS, you can blame it on ruling parties or the rest, but its an old idea that dates back thousands of years. Right now, its called tl:dr, i.e. "too long, didn't read". Its the basics of rhetoric. Try to be succinct and it will help your audience follow your point. Ottava Rima (talk) 16:03, 11 November 2008 (UTC)
- I don't rule. I don't spend that much time in the chat. I watch recent changes. I see what goes on. I help with various requests, and I go to the chat if there is an issue that needs immediate attention. I wish you would stop stereotyping or lumping people together. Ottava Rima (talk) 19:48, 11 November 2008 (UTC)
Question for Mike.Lifeguard[edit]
your last post of questions for mike dissapeared shortly before I was going to respond to them. I was going to say this to you.
- These allegations confuse me. consider JW that you have accused Mike of calling someone a whiner, a troll, and worse yet "go fuck yourself and go away".
- I presume that you are objectively quoting Mike. Since it seems greatly out of character for mike. I would like to know the full story of this. Rather than merely heatedly asking mike a bunch of heated questions, woudld you attach specific and referenced allegations.
- I don't fully undestand these very heated and repetitous accusations of incivility. There are , after all, places to mention it. In fact, one ethics project specifically asks for instances of incivility. I was hoping that as a community we could discuss and undestand what has you and some other participants so upset. It is been inactive for many weeks. So if all these unacceptable exchanges are occuring, why not record it in this project, for all to see. (and also, if you are specifically and clearly recording incivil acts somewhere, with the purpose to talk about it as a community; I would like to know where it is.)
- I though real hard about replying. I don't really want to by in the middle of anybodies feud. But the quoted accusations seem so extreme that I wonder how it is that you and I have had such different experiences with Mike. Despite all the allegations on this page, I have had NO incivil exchange with anyone on wikiversity. Mike, commagio, and Jade (to name just three people that have been recently nominated) have been particularly helpful, pleasant, and welcoming.
- At anyrate JW; if you have allegations, please make it clearer what and where Mike has done/said these things. Is it possible you have taken things out of context? I think that Mike has done some work to undo vandalism in the site, and sometimes deletions are needed to create order. --Jolie 16:33, 12 November 2008 (UTC)
well, I'll give you credit for the worst sounding one, go f yourself. you transparently state how said and when. but this Isn't Mike.lifeguard's words. I am pleased to see some a conciliatory tone on the top of the page; I don't want to have any issues with you. I'm just very confused the allegations with people that have been very civil and welcoming to me.--Jolie 16:37, 12 November 2008 (UTC)
I don't understand things around here very much, JW. I have had nothing but the most civil exchanges between most active wv participants. Let me present you an allegory,
in a way coming to wikiversity has been like coming to a beautiful, majestic catholic church. The service is thoughtful, and inspirational. The priest is kindly, very friendly, helpful. In a few hours, I have more spiritual thoughts than I have in many months. I talk to the choir director, and a lay minister. all inspirational and wonderful. the choir director tells me how inspiring the priest is and how much of a difference the priest has made. The music is exquisite, the entire congregation is friendly, welcoming and helpful (although small). as I'm walking to go home, a quiet reserved man beckons me. He is pleasant looking, thoughtful but Sad. He lowers his voice. "Do not be TOO inspired, he whispers, I have know the priest for many years", he begins, "My brother was a alter boy; the priest abused him and ruined his life"; The man continues his allegations "The priest is wealthy and has been stealing money from the church for many years. And it isn't only the priest, the choir director is a violent man who abused his wife and has said horrible things to people. They say we want to grow", he sarcastically smiles, "NO, they haven't a spark of kindness in them. they are friendly to a man to a new face and eager to impress. But this is a vicious awful place." The old man concludes "I am a student of god, young sir, And I shall stay, in hopes to hear something helpful in this rocky hell. So do not be inspired."
so if you follow my allegory, I have had nothing but inspirational experience here in wv, for nearly two months but your allegations are trouble-some and confusing. Your allegations almost suggest there is no hope in redemption. It confuses me with the concilitory things that they have said. Would you suggest that are neither being honest nor sincere in their effort to improve wv civiity? I highly suspect you would. then I probably return to my request; detail the allegation. if there aren't sincere or strait, why ask?--Jolie 16:33, 12 November 2008 (UTC)
- I thank you for your civil discussion on my talk page. Good, I have no problems with you John. There are places where alot of these issues are discussed; your log for example. I admit around lunch the whole exchange was bothering me... But, I've been very nicely treated here and have no complaints. I think I have been spending too much time today, looking into other people arguments; instead of doing what I came to do here. Study, collaborate, and pursue knowledge of interesting subjects.
- Recognizing that you are one of the founders of wikiversity. Thank you for your insight,dedication and vision. I really enjoy this website. I'm not an academic and have been out of college a long time, but since coming here I feel as if I'm learning and growing. I suppose that to a point, I need to pleasant to everyone and let people settle their differences (although I continue to hope that in some small way I can write something in these kinds of community conversations that will inspire people to be more civil).
- I look forward to working with you in helping wikiversity grow. --Jolie 21:22, 12 November 2008 (UTC)
RNA interference[edit]
I have been reading your article here on RNAi and the wikipedia one. I understand the majority of the process but I am a little confused about the effector protein. Here is what I understand to be the steps in exogenous dsRNA-induced RNAi:
1. Initiation Step: Exogenous dsRNA induces dicer to cleave it into double-stranded siRNA 2. Effector Step: double-stranded siRNA is incorporated into RISC and is converted to single-stranded dsRNA by argonaute
Does the effector protein bind the dsRNA and present it to dicer or does it present the siRNA to RISC (or both)? Donek (talk) - Go raibh mile maith agaibh 19:49, 14 November 2008 (UTC)
- I studied four years medicine and I transfered it to biochemistry. I am 7 weeks into the course. The wording of the wikipedia article confuses me a lot, especially the section I am talking about. Have a read at the (3) dsRNA paragraphs. The second paragraph seems to go back to the start of the process and then describe the middle of the process. I looked at the history to see who edited it but there are a lot of contributions from anonymous users. Donek (talk) - Go raibh mile maith agaibh 15:06, 15 November 2008 (UTC)
Thank you for welcoming[edit]
- Sorry for the delay. Be sure I'll ask any help I'll need. I wrote a short user page, so you can learh some basics about me.
- I started writing/editings in greek language WP, in January 2008. I started about 30 articles there, and I reached about 2,500 editings.
- In September 2008 I also started additions to gteek language WV. I started some subjects that was missing, like Msthematics, Chemistry, Biology, Geology and History.
- I visit the english ones too, but usually to take ideas and data. Rsrely, I find sone important (to me) errors and misssings, and try to edit them. Most times I just add the hyperlink to equivalent grrek articles and the english one there too. Sometimes there is one, but not a correct one.
- Anyway, if you also want some help in the above subjects, or any issue with greeks (language, the country, our histoty, etc), please feel free to contact with me.
--Vchorozopoulos 02:09, 16 November 2008 (UTC)
genpsy[edit]
Dear JW Schmidt, I updated the page on genpsy. Some discussion is going on on the subeject. May see this link. .
Thanks. DMR Sekhar 08:06, 26 November 2008 (UTC)
Thanks. But how to start?
DMR Sekhar 12:49, 29 November 2008 (UTC)
Request[edit]
Hi John. Would you mind rephrasing "Why do you have no interest in allowing Wikiversity participants to experiment with wiki technology and make use of page protection templates" on JK's FC discussion? Rather than assuming he has no interest, perhaps just ask him if he thinks the protection templates have any value (I have no idea what he thinks about them and would be interested in his opinion, but it's better to ask the question without the implicit assumption of his hostility to them). --SB_Johnny talk 13:16, 2 December 2008 (UTC)
- I think "Jade Knight"'s comments at Vision/2009 make clear his lack of interest in having Wikiversity participants experiment with page protection templates. Further, his comments go well beyond a simple lack of interest in experimentation with page protection templates. His comments are unwelcoming to educators and harmful to the mission of Wikiversity. If he demonstrates an interest in supporting Wikiversity participants who want to experiment with page protection then I will gladly change the wording of my question. As things stand, my question is a valid question that helps the community explore his judgment about what Wikiversity is and if he can be trusted to make decisions about what to revert and delete and who to block and discourage from participating at Wikiversity. --JWSchmidt 15:53, 2 December 2008 (UTC)
- I don't see that there... the 2 contributors seemed to be asking about actual page protection (i.e., restricting who can edit), rather than the use of the templates (which ask people not to edit). One of them made it very clear that he's not willing to trust people to not edit when the template is there, so our "job" is to teach him to assume good faith. You need to do a better job of that too, IMO :-).
- I guess it's a moot point now, since JK already refused to answer the question as you had put it (it's kind of like the difference between when your wife says "I guess you don't care what I look like since you didn't comment on my shoes" vs. "do you like my new shoes?"... passive-aggressive questions inevitably lead to angry responses, or a refusal to respond). I think I know what you're trying to learn here, so I'll rephrase it for you in a straightforward manner, but please let's not make this a habit ;-).
- For readability's sake, would you mind keeping this conversation here on your talk? Or mine if you prefer. Much easier to read when you don't have to keep flipping back and forth! --SB_Johnny talk 22:42, 2 December 2008 (UTC)
removing test section[edit]
Re: [11] I have noticed that trancluded pages sometimes do not show up right away after an edit. I'm not sure what causes the problem. One soluction is too add ?action=purge to the end of the url. For example There is also a gadget in Special:Preferences called Add purge tab that does the same thing. --mikeu talk 13:29, 2 December 2008 (UTC)
Easier?[edit]
I think Wikiversity:Respect pseudonyms could be approved a lot faster and get us over this particular hump... we can merge it into something else later (policy discussions can be very difficult when there's too many things on the plate at once). --SB_Johnny talk 17:03, 10 December 2008 (UTC)
Moulton[edit]
Moulton is a banned user by this community. Your characterization of the reasons for his banning are completely wrong, and I recommend that you research it more before jumping into support him so carelessly.
Let me be clear on this: this is not optional. This is not a point of discussion or debate anymore. This community has banned him, the English Wikipedia has banned him, and he has consistently violated our community norms. If you would like to appeal this, then please take it up with Sue Gardner or even the Board of the Wikimedia Foundation. Or open an appeals process to try to overturn his ban here in the same way that it was confirmed.
But I actually recommend against that. His behavior has been consistent for a long period of time, and his action show me that he is very unlikely to change. He wants to argue pedantically about complete irrelevancies, using ad hominem argumentation to avoid facing up to the fact that his behavior has stepped very far outside community norms.
There is a solution that works quite well in cases like this. Revert, block, ignore.--Jimbo Wales 15:21, 12 December 2008 (UTC)
- I hate to be the one to have to break the news to Mr. Wales, but the concept of banning (as he apparently conceives it) went out of style some 3768 years ago, when humankind invented a new regulatory model commonly known as the Rule of Law. In that remarkable innovation in the Advance of Civilization, the designers of that new system of governance devised practices commonly known today as Due Process. Due Process includes such features as a trial or hearing where allegations must be proven with evidence, and where the defendant is afforded the right to examine and refute the evidence and to cross examine any witnesses. Ironically, the very first secular law ever carved into stone tablets dealt with the subject of banning. It was a capital offense to ban someone without just cause and without proving the case at trial. Moreover, the second secular law ever carved into stone tablets provided an independent method for an accused to establish his innocence. Jimbo's ridiculous edict, above, utterly fails on both counts. Moreover, it's not only an Epic Fail, it's an Epoch Fail, since this is the 21st Century, and principles of Due Process, Civil Rights, and Ethical Governance have evolved substantially during the past four millenia. But I appreciate that Jimbo has joined with me to help review this fundamental lesson in civics to the 21st Century youth who are interested in absorbing the central lessons in the sum of all human knowledge. —Moulton 20:00, 12 December 2008 (UTC)
- If you would like to appeal this, then please take it up with Sue Gardner or even the Board of the Wikimedia Foundation.
- I did contact the WMF Office, a year ago. They did not respond. I have since learned that this is their routine practice. I know of two other academics (both highly distinguished) who were treated even more rudely than I was. And in the process, I gained some insight into the rift between Wales and Sanger, and why Sanger left. —Moulton 02:26, 13 December 2008 (UTC)
- I would like to point out that a process was initiated to see if Moulton could build trust with the community again in order to have such an appeals process be initiated, and this fell apart because of Moulton's continued posting of personal information and other attacks. He has since continued to attack those who tried to give him a way to prove that he deserves to be here. Ottava Rima (talk) 00:37, 13 December 2008 (UTC)
- I would like to point out that the exercise was not so much about building trust, but about engaging with others on topics related to ethical reasoning. The allegations that I had posted personal information were never proven. They were simply asserted and when others asked for evidence and proof, they were brushed off, just as the WMF Office has routinely brushed off academics who complain of corrupt practices. I don't need to prove anything. Those who wish to file charges against me or JWSchmidt or anyone else have the burden of proof. Among the advances of civilization is the notion that one is innocent until proven guilty. Only in Alice in Wonderland does the Red Queen pronounce guilt and sentence Alice (whose "crime" is that she engaged in scholarly inquiry as to what the devil was going on in Wonderland). The WMF has a published Mission Statement and enjoys a 501(c)(3) tax exemption based on representations made to the public and the government. Neither Jimbo Wales nor Ottava Rima can rescind those representations or otherwise undermine the educational mission of the project without jeopardizing the legal status of the project as a donor-funded tax-exempt educational project operating in the public interest. Some people might not want to learn about the contributions of Hammurabi, Moses, Jesus, Beckett, Stephen Langton, Maimonides, Galileo, Darwin, Dostoevsky, Gandhi, King, Thich Nhat Hanh, or the Dalai Lama to the sum of all human knowledge, but those contributions are substantive and meaningful to anyone seeking a comprehensive 21st Century education that includes concepts such as Due Process, Civil Rights, and Ethical Governance. —Moulton 02:26, 13 December 2008 (UTC)
So there was an attempt. I think that something very important is against Moulton. I have told that to him many times: he is avoiding bans using other IPs. I am not sure but I think it is official policy not to avoid bans. What I mean is that no one will listen to him if he keeps entering here without permission. Even if he does not agree the ban, that is no reason to avoid it. If I don't agree to a law, do I break it? It is unethical and if it were in real life, illegal. IMHO. --Davichito 01:57, 13 December 2008 (UTC)
- The Red Queen never listened to Alice, either. Elmer Fudd never listened to Bugs Bunny. Wiley Coyote never listened to the Road Runner. I'm not here to talk to those whose ears are shut to dialogue. I'm here to engage in public dialogue on subjects of educational import with those who value the learning process. Do you know the story of Rosa Parks, the Woolworth's Lunch Counter story, or the stories of Mohandas Gandhi and Martin Luther King? —Moulton 02:26, 13 December 2008 (UTC)
- No. I am not familiar with their stories yet. Every person who is in a discussion must listen, I agree. Dialogue is between two. What I am saying is: do you listen to them? Do you listen to Mike_lifeguard when he bans you from IRC, for instance? Because, if you want to engage in public dialogue, you must try to understand their reasons too. And, IMHO, not by force. For instance, talking about dialogue, when you enter #wikiversiy-en, clearly avoiding a ban, you are trying to shout at their ears because they do not want to listen. Would you shout to someone that has stated that he won't listen to you unless you are officially unbanned in that channel, for instance? See, when people ban in a channel, they expect the other person don't go back because they got tired of listening to him. I have read a literal paste of a conversation between you and mike. He clearly says something like "Do not talk to me anymore, I do not want to listen to you". I think that we may decide whether we want to listen to someone. He does not have to listen to you. If I decided not to listen to anyone, they should respect what I ask, in IRC or talk pages. If not, I would have to do the non polite action to /ignore. So, my question is: if you know some people agree that you are banned at #wikiversity-en, why to go in there and try them to listen to you at all costs? For instance, Mikelifeguard, he said he does not want to listen to you and that you should ask for an unban in there, instead, if you wish to talk in the channel. But what you do is enter through other IPs and then start talking to people do not want to hear. Respect their right to ignore you. You are clearly not listening to him because he has sysop privileges in there so he must follow the policies of the channel so he must act in consequence, else he would not be making his job in there. And he made a recommendation, that you should ask for unbanning in there instead trying to enter through other IPs.
- --Davichito 13:12, 13 December 2008 (UTC)
- Your remarks are suffused with counterfactual assumptions. When I log into #wikiversity-en, I never type a single word. I just go there to listen. When Mike boots me out, he no longer says anything beyond "Bye." That's what makes it like the Woolworth's Lunch Counter Sit-In. Like the students at Woolworth's, I just walk in, sit down, and don't say a word. I do it that way, Davichito, because we are replaying a famous scene in US History from the Civil Rights Era. The point is to do an accurate re-enactment, since this is an educational exercise. Do you see your counterfactual? You assumed I had a wish to talk there. But I had no such wish, no such intention, nor did I utter a word. Moreover, there is no cost. There is rather a payoff, as Mike plays the role of the Woolworth's manager exactly as it took place in the 1960s. The reason I change IPs is because Mike blocks them. The Internet has billions of IPs. IP blocking is largely ineffective (and increasingly so with IPv6 addressing). I am not a vandal. I am here in my traditional role as a scholar, researcher, and educator. But I have no doubt that real vandals know all these methods better than I do. Over on Wikipedia, I notice that admins there had already blocked the SixXS gateway in the Netherlands, which is the only way people on the IPv6 network can reach Wikipedia. That single IP block locks out billions and billions of IPv6 addresses in North America and Europe, as it's the only operational gateway at this time. I am thrilled to have people ignore me. I would be thrilled if Mike or Ottava ignored me. But they are disrupting dialogues between me and those here who do wish to engage in scholarly conversations, per the remit of the WMF Mission Statement. Their disruption of those conversations is something that authentic scholars should be concerned about, as that undermines the advertised function of this site. If Mike has no compunctions about violating the civil rights of one scholar, then he has no compunctions about violating the civil rights of any scholar. My objective here is to reveal to you that fundamental failure of ethical governance, because your education is what matters to me. Mike has elected not to learn anything from me, which is his unalienable right. Everyone has a God-given right to remain ignorant. If Mike elects to exercise that right, there is nothing I can do about it. It's his free choice, full stop. —Moulton 03:39, 14 December 2008 (UTC)
Unanswered Questions and Unfinished Conversations from Jimbo's Talk Page[edit]
Herewith are the unfinished threads from Jimbo's Talk Page, which he unceremoniously blanked without responding to open issues and questions.
On your deletion of Moulton's page[edit]
Jimbo Wales, Wikiversity has been discussing the problems around Moulton's talk page. If you have any concerns, please bring it up to the community, e.g. on the Wikiversity:Colloquium or on Wikiversity:Notices for custodians. You are not an elected custodian and you are no where near in being an active part of the community. It is not appropriate for you to simply step in and perform a custodian action. I would in the very least like to know in what capacity (steward? foundation action? office action?) you did that job. Best, Hillgentleman | //\\ |Talk 11:34, 12 December 2008 (UTC)
- Gah! Not on the Colloquium please... the discussion Hillgentleman refers to is here: Wikiversity:Community Review/Moulton's talk page. --SB_Johnny talk 12:23, 12 December 2008 (UTC)
- I will not allow Wikiversity to be used as a platform for harassment and outing. Period. Call it what you like, I'm drawing the line here: this kind of behavior is unacceptable.--Jimbo Wales 14:59, 12 December 2008 (UTC)
- I call it phony baloney. On my Wikiversity talk page, I asked Mr. Wales to prove his allegations and subject his evidence and witnesses to cross examination, per the principles of Due Process, Evidence-Based Judgments, Civil Rights, and Ethical Governance. Mr. Wales failed to respond, and so his allegations fell for lack of evidence. It is simply not acceptable in this day and age to level false and unproven charges, blithely ignoring due process as if this were a comedic reprise of the Red Queen vs. Alice. Once again, Mr. Wales repeats the silly Red Queen scene, and this time more voices are raised questioning his inexplicable and perplexing practices. What is Mr. Wales teaching impressionable youth of the 21st Century? Does not the sum of all human knowledge include four thousand years of advances in such fundamental concepts as Due Process, Evidence-Based Reasoning, Civil Rights, and Ethical Governance? —Moulton 03:16, 13 December 2008 (UTC)
- Hill, not everyone needs to be elected to have power. As a Wikimedia founder, he has power by default. He has also been welcomed by the majority of our community, so he does have authority here either way you look at it. Ottava Rima (talk) 00:30, 13 December 2008 (UTC)
- The Red Queen also asserted power. In the end, Alice gave up on the Red Queen and her sycophants, exclaiming, "You're nothing but a pack of cards. Who cares for you?" — whereupon the pack of cards all went postal. Of course Lewis Carroll wrote that story for the benefit of 20th Century youth, but it still applies to the current generation of scholars who seek to discover the great lessons to be found in the sum of all human knowledge. —Moulton 03:16, 13 December 2008 (UTC)
- Jimbo - I cannot tell if something has been oversighted, but could the edits revealing personal information and the rest be such? One of the issues about deleting the page was to do exactly that. I tried contacting a few people who made the original complaint about a direct diff to the personal information to put forth the request, but no one ever got back to me. If you could find it and oversight to make sure that the information doesn't come back, that would solve any future issues that could arise. Ottava Rima (talk) 00:34, 13 December 2008 (UTC)
- I don't know of anything being oversighted. I don't think the people that Moulton is annoying will need oversight, ordinary deletion should be fine.--Jimbo Wales 03:45, 13 December 2008 (UTC)
- Ottava, here is the content of the requested talk page. Whatever Mr. Wales is going on about can presumably be found there. Could someone be kind enough to find the alleged crime there? —Moulton 03:16, 13 December 2008 (UTC)
The posted reason for protecting Moulton's Talk Page[edit]
Permission error
You do not have permission to edit this page, for the following reasons:
- This page has been locked to prevent editing.
- This title has been protected from creation by Jimbo Wales. The reason given is '.
As his reason for taking action, Wales enters into the system log the ever popular Null Reason. Alas, that doesn't seem to be a very meaningful or informative reason. On the other hand it has the advantage that Wales thus has nothing to prove. Fortunately, he is very good at proving nothing at all.
Moulton[edit]
- Please explain the basis in Wikimedia governance by which you can make this unilateral proclamation to the Wikiversity community.
- "This community has banned him"''
- I am not aware of any Wikiversity community discussion that might have established norms or consensus for bans at Wikiversity. Can you provide a link to such a community discussion? If there is some method for applying external norms (such as those at Wikipedia) to Wikiversity, I think you should explain that process to the Wikiversity community.
- Can you explain how this ban was decided on? Several months ago I tried to get the Wikiversity community to adopt a policy that would provide a basis for dealing with Moulton's practice of using the real names of wiki editors who have made charges against him. I have been charged with "policy manipulation" because of my past attempts to develop needed Wikiversity policies. I have been told that other Wikiversity participants refuse to adopt needed policies such as the Wikiversity privacy policy simply because I think they should be official policy...an attitude that is childish and damaging to this project. Rather than have to impose blocks and bans at Wikiversity, I wonder if it might be a better use of your authority to help guide the Wikiversity community towards the establishment of a few critically needed policies....then the community-appointed custodians will be able to follow those policies and you will not have to step in to perform blocks and bans through some process that exists outside of community consensus.
- "jumping into support him so carelessly"
- I once explained to you in IRC chat that I have repeatedly asked Moulton to abandon his practice of using the real names of wiki editors who have made charges against him. I've spent a huge amount of time investigating the "Moulton case" and I do not think my actions can reasonably be characterized as "careless".
- I do not think that Moulton's practice of using the real names of wiki editors who have made charges against him constitutes harassment. There is a principle of fair play here: is it right to make it possible for wiki editors to publish false claims about living people without there being a way for people to defend themselves and challenge the people who have made the false claims? Moulton's concerns about these kinds of issues can be traced back to his concerns about finding ways to assure a high quality of information in Wikipedia biographies of living persons. Your comments on my talk page seem to suggest that maybe you view such concerns as "complete irrelevancies"....I hope that is not true.
- "I recommend that you research it more"
- I would be very interested to see copies of the communications that you have received about Moulton. --JWSchmidt 20:15, 13 December 2008 (UTC)
- I have taken the liberty of inserting bulleted formatting into the above, for ease of reading.
- The issue about using real names of critics is related to a principle of scholarly ethics. In academia, when one produces and presents work to an academic audience, one routinely receives comments, feedback, and criticisms that highlight portions of the work that need further attention. It is not that uncommon for a critic to introduce a point that ultimately leads to an improvement in the final product. It is both customary and ethical for a scholar to acknowledge the comments and criticisms of reviewers, especially when those remarks help the process of crafting a better final product. I am obliged to acknowledge those who took the time to critique my work, and credit them where their remarks have proven seminal. If Wikiversity is an authentic academic enterprise, then it is both fitting and proper for me to refer to my commentators by the names they would be known by in academia in the real world. —Moulton 14:51, 14 December 2008 (UTC)
- w:Rationalization (psychology) WAS 4.250 11:02, 15 December 2008 (UTC)
- Outing harassers is allowed. WAS 4.250 11:15, 15 December 2008 (UTC)
- Evidence? Proof? Conscientious scholarly revue? Due process? What is Mr. Wales teaching the impressionable youth of the 21st Century? —Moulton 13:53, 15 December 2008 (UTC)
(<---)There are consequences to behavior. Unfortunately you refuse to accept responsibility for the consequences of your behavior. Hopefully "the impressionable youth of the 21st Century" will not be so hard to teach. Also, regarding this; I said "You confuse Jimmy with the Wikimedia Foundation". I did not say "Jimmy Wales has no power and no authority". Do you edit while drunk? I have gotten that impression more than once. WAS 4.250 15:31, 15 December 2008 (UTC)
- Consequences? When one of the admins dons their jackboots, that's my responsibility? Are you familiar with the Arthurian legend of Sir Gawain and Green Knight? There is a mathematical logic that undergirds drama. I play my role, and my antagonist plays his role. The scripts are timeless. Are you saying that Jimbo's actions here have no bearing on the status of the WMF as a tax-exempt 501(c)(3) non-profit? It occurs to me that if the WMF-sponsored projects deviate substantially from the representations made to the public and to the IRS, and if Jimbo Wales (who set up WMF and chaired it for many years) departs from the advertised mission, the repercussions could well jeopardize the tax-exempt status of WMF (or, more likely, the ability of the WMF to garner project-sustaining donations). —Moulton 22:48, 15 December 2008 (UTC)
- You ask "When one of the admins dons their jackboots, that's my responsibility?" Yes. You have gone out of your way to provoke a reaction. You ask "Are you saying that Jimbo's actions here have no bearing on the status of the WMF as a tax-exempt 501(c)(3) non-profit?" Yes. The Wikimedia Foundation is not deviating substantially from representations made to the public and to the IRS. What do you think of this? w:Vinod Khosla is her husband. Wikimedia's projects are useful and more useful every year. You're not being allowed to do what you think you should be allowed to do is insignificant in the overall scheme of things. - WAS 4.250 06:05, 18 December 2008 (UTC)
- There are other sensible reactions besides donning the jackboots. You might recall a concept that we called a Social Contract. In the absence of a Social Contract, when there arises the inevitable breach of expectations, instead of working out a peaceable resolution, the party who fancies themselves to be politically dominant is likely to engage in an act of aggression. The ensuing Chinese Fire Drill can eventually be arrested by an agreement conventionally known as a Peace Treaty. The only significant difference between a Social Contract and a Peace Treaty is the timing. In one case it's negotiated before hostilities have broken out; in the other case, it's negotiated after the Chinese Fire Drill. In the 21st Century, it is more appropriate to be thinking about Social Contracts than donning the jackboot and reifying the sorriest regimes of the 20th Century. If you are saying that the WMF has represented to the IRS that they want a tax exempt status to teach the practices of the worst despots of history, I have to wonder for the sanity of both the WMF and the IRS. What I think I should be allowed to do is to play the roles modeled by Socrates, Becket, Langton, Galileo, Gandhi, etc, whilst Jimbo and Company play the roles of King Henry, King John, Pope Urban, the Red Queen, et al. And that is exactly what they have made it possible for me to do. They are most accommodating, eh? What you don't know (since you are not on IRC) is the audience of young people watching this drama and making up their mind which side to subscribe to. As you know, Ottava Rima has joined the Dark Side. Isn't that remarkable? —Moulton 04:08, 19 December 2008 (UTC)
(<---) This caused this. Are you as useful? WAS 4.250 14:08, 23 December 2008 (UTC)
- Two comments...
- First of all, note the text in the blue banner at the top of the page of the first link:
"Imagine a world in which every single person on the planet is given free access to the sum of all human knowledge."
— Jimmy Wales, Founder of Wikipedia
- That's the quote that you previously dismissed as irrelevant.
- So, is the quote relevant and persuasive or not?
- More to the point, is the quote an honest representation of Jimbo's vision for what WMF plans to do with its funds?
- Secondly, what is WMF really doing with its resources? Last night, on Wikipedia, there was a remarkable demonstration of the kind of dramaturgy that WP RfCs have become known for. Even Dan Tobias weighed in and called the admins filing the RfC "jackboot thuggery" against an editor who was playing Alice to their Red Queen.
- Ironically, the Red Queen admins were being led by an editor going by the name of Baseball Bugs (Bunny). Yet he was playing the role of Elmer Fudd, ever ready with his shotgun to mindlessly blast away at that Wascally Wabbit who had the temerity to actually comment in the RfC.
- In that current case, the RfC was less a request for comments, and more a request for cartoons.
- If WMF uses those funds, solicited under false pretenses, to promote the Jimbonic Jackboot Culture, the inevitable backlash will parallel the Madoff collapse, as donors realize that Jimbo made off with their donations to fund his world travels whilst entraining impresssionable 21st Century youth into a culture of fascism, oblivious of such modern educational ideals as the Rule of Law, Due Process, Evidence-Based Judgments, Presumption of Innocence, Trial By Jury, Civil Rights, Separation of Powers, Ethical Governance, Freedom of Inquiry, and Scholarly Ethics.
- The concepts of Due Process, Evidence-Based Judgments, Presumption of Innocence, Trial By Jury, Civil Rights, Separation of Powers, No Bill of Attainder, etc, were in the minds of the Founders, who expressly saw fit to write them into the Constitution. Here, in Wikiland, these concepts are not even contemplated as applicable goals. Ethical Governance, Freedom of Inquiry, and Scholarly Ethics have been expressly rejected as cultural values; they are not even unrealized goals. The fascistic custodians here have expressly rejected those values in favor of adopting abhorrent practices that Americans went to war to rid the world of some 70 years ago. —Moulton (talk) 15:27, 23 December 2008 (UTC)
- Just fine? Hardly. Editing Wikiversity is like placing a phone call to Katmandu. It's possible but still a hurdle. I am a lifelong educator. I carry out educational projects in many media, including electronic media, just as I carry out some conversations by telephone and some by sitting down in the same room with a person. The challenge of networking is to make the network as transparent as possible. When I use VOIP with one of my correspondents, the audio quality can be so clear that one forgets the other person is not sitting in the same room, but is actually 2000 miles away. Perhaps someday you will consent to hook up a Mic to your computer and chat voice with me. —Moulton (talk) 14:11, 24 December 2008 (UTC)
(<---)None-the-less, you persist in making inappropriate claims about cyber-space based on claims about meat-space. WAS 4.250 17:26, 24 December 2008 (UTC)
- Consider the following notice, which appears in my browser when I first undertake to respond to you here...
You do not have permission to edit this page, for the following reason:
Your user name or IP address has been blocked.
The block was made by Ottava Rima. The reason given is Abusing multiple accounts. You can contact Ottava Rima or another custodian to discuss the block. You can use the 'email this user' feature (in the left-hand sidebar of a custodian's user page) provided a valid email address is specified in your account preferences. Your current IP address is 68.163.107.39. Please include this in any queries. Blocked users can edit their own user discussion page. If you are not logged in as a registered user, use the user discussion page for your IP address: here. You can add the Template {{Unblock}} to your user discussion page in order to request unblocking.
- Monarchial Bill of Attainder (and later, Parliamentary Bill of Attainder) were features of human political culture for thousands of years. Then, around the time of the American Revolution, that practice was abandoned, on the grounds that it ineluctibly corrupted any administration that employed it. Those lessons of history are part of the sum of all human knowledge. Moreover, they are of sufficient import in political consciousness that the prohibition on Bill of Attainder appears in Article I of the US Constitution. That WikiCulture still employs the cyberspace equivalent of Bill of Attainder reveals that the Custodians here have not yet caught up to where Thomas Jefferson took us 225 years ago. More to the point, note the fascistic cultural model that Ottava Rima, Mike.Lifeguard, and Darklama are learning from Jimbo and spreading amongst the community of 21st Century youth who inhabit these halls of learning. Yesterday, Emesee put out feelers for starting a more enlightened site than the dark one that Wikiversity has morphed into in the shadow of Jimbo's Jackboot Juggernaut. It matters to me what ideas and practices young people are learning and adopting in cyberspace educational venues. And I daresay I am not alone in expressing that concern. —Moulton (talk) 15:17, 25 December 2008 (UTC)
- What aspects of that lead you to believe that that is the "cyberspace equivalent of Bill of Attainder"? Arbcom creating a policy that bans a named individual might qualify, but you are not banned by being named in a policy, you are banned based on being convicted by a consensus of people believing that you insist on disrupting Wikiversity by pointlessly naming names you have been asked not to name. You can be unbanned anytime you agree to act according to consensus on how you should act. You insist on behaving in ways you have been asked not to. You reap the consequences of your own behavior. That's just banging your head against the wall and blaming others for getting your head bloody. WAS 4.250 13:34, 27 December 2008 (UTC)
- ArbCom played no role in establishing my status. FloNight expressly declined, on behalf of ArbCom, to review my status, as it was established by a single individual, Tracy Walker, acting on her own, outside of community process.
Actually, on second thought why waste yet more time on WP:CSN? I'm just going to indef and post on ANI. KillerChihuahua?!? 19:21, 11 September 2007 (UTC)
- Similarly, on Wikiversity, Jimbo Wales, who is not even a participant here, acted independently, outside of community process, assured that few would challenge him, after he had threatened to shut down the whole project if anyone dared overturn him. And so other timid Custodians, including SB_Johnny, Mike Umbricht, Mike.Lifeguard, Darklama, and Ottava Rima jumped onboard the Jimbonic Jackboot Juggernaut. Is this what WMF sought tax-exempt status for? To teach the practice of fascism to impressionable youth of the 21st Century? —Barry Kort, Ph.D. 11:50, 28 December 2008 (UTC)
Happy holidays guys[edit]
John, WAS, Moulton, and everyone else reading this page. Happy holidays. Ottava Rima (talk) 06:12, 25 December 2008 (UTC)
- It would be happier if I didn't have to travel 20 miles to find a computer with an unblocked IP addresss to return your holiday greetings, Mr. Grinch. —Moulton 15:22, 25 December 2008 (UTC)
- Should I skip to the chase and just get you coal next year? :P Have a good new year Moulton. Spend time with some friends and family. Have some fun. Take a break. Try to enjoy yourself. Ottava Rima (talk) 17:27, 25 December 2008 (UTC)
- What I sincerely wish you would do, if you are fortunate enough to be with family this week, is to visit with those of your grandparents' generation who were alive during the Second World War. I reckon your grandparents would have been too young to have fought in that war, but perhaps old enough to be aware of what it was all about. As you know, the pogroms of Eastern Europe evolved into the most notorious Holocaust in the annals of human history. Today, Christians around the world are celebrating the birth of an infant who, at age 25, would become one of the most famous Rabbis in human history. At age 30, this radical young scholar would propose to upgrade the Covenent of Moses to address continuing issues of oppression, injustice, and political violence that were undermining the Roman Empire. He was not warmly received by his contemporaries, but his ideas did not die on the cross with him. The gift I seek is the Gift of Epiphany, like the one John Newton experienced. —Moulton (talk) 18:06, 25 December 2008 (UTC)
- I had three uncles who served in WW2. One was a tank commander who drowned when the Rhine was flooded. One was a pilot who was shot down. The other was a paratrooper who was shot down. My family has served this country in combat for 232 years. Ottava Rima (talk) 18:46, 25 December 2008 (UTC)
- Have you discussed with your surviving family members of that era why they were willing to lay down their lives to put an end to pogroms and fascism? Have you discussed with those of your parents' generation why you have abandoned the Teachings of Jesus and the Principles of Thomas Jefferson to reprise the abhorrent practices that Jimbo's Jackboot Juggernaut are now inexplicably introducing back into the 21st Century donor-funded educational curriculum of Wikiversity? —Moulton (talk) 19:04, 25 December 2008 (UTC)
- Right now, the only fascism taking place is a user who is using personal information to attack and destroy others, then going around protections to make sure it sticks. You do know that the Nazis did that to the Jews, right? So, fair is fair, you are acting like a fascist. Stop the hate, Moulton. Jesus said to love another. He said to turn the other cheek. He also said to silently endure. You aren't doing any of that. Ottava Rima (talk) 18:26, 27 December 2008 (UTC)
- May I quote you on that and call upon that distinguished young scholar to support his thesis with evidence, reasoning, and analysis, and submit it to scholarly peer review by his colleagues in Academia? —Barry Kort, Ph.D. 11:23, 28 December 2008 (UTC)
Note: this is an archive of old discussions. Please do not edit this page. Continue these discussions at User talk:JWSchmidt. There are other archives at User talk:JWSchmidt/Discussion archive.
Please help!!![edit]
I followed links to get here with the hope I can reach a person who can break this down to the overly educated with limited internet experience (with the exception being research - but contributing? not something I have done online)
I came to you because the beginning of my link path was in the performing arts, and I hope to connect with another artistic mind who won't judge the wikilliterate.
I would love to help in the performing arts department, I studied acting at The American Academy of Dramatic Arts in both NY and LA, I found their evening program (NY) to be quite wonderful, but the full time program left me wanting more. I have found other methods and techniques that have been more productive for me and would love the opportunity to share what I have learned. If you could help me get started. I get the formatting stuff, I think I am just unsure if I should just dive in or if that is some kind of no-no, I guess just creating an article seems presumptuous.
Demosthenes13 10:46, 31 December 2008 (UTC) | https://en.wikiversity.org/wiki/User_talk:JWSchmidt/Second_half_2008_discussions | CC-MAIN-2019-43 | refinedweb | 51,844 | 58.42 |
Welcome to yet another exciting tutorial! This time we will focus on the effect rather than the graphics, although the final result is pretty cool looking! In this tutorial you will learn how to morph seamlessly from one object to another. Similar to the effect I use in the dolphin demo. Although there are a few catches. First thing to note is that each object must have the same amount of points. Very rare to luck out and get 3 object made up of exactly the same amount of vertices, but it just so happens, in this tutorial we have 3 objects with exactly the same amount of points :) Don't get me wrong, you can use objects with different values, but the transition from one object to another is odd looking and not as smooth.
You will also learn how to read object data from a file. Similar to the format used in lesson 10, although it shouldn't be hard to modify the code to read .ASC files or some other text type data files. In general, it's a really cool effect, a really cool tutorial, so lets begin!
We start off as usual. Including all the required header files, along with the math and standard input / output headers. Notice we don't include glaux. That's because we'll be drawing points rather than textures in this tutorial. After you've got the tutorial figured out, you can try playing with Polygons, Lines, and Textures!
#include <windows.h> // Header File For Windows
#include <math.h> // Math Library Header File
#include <stdio.h> // Header File For Standard Input/Output
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h> // Header File For The GLu32 Library
HDC hDC=NULL; // Device Context Handle
HGLRC hRC=NULL; // Rendering Context Handle
HWND hWnd=NULL; // Window Handle
HINSTANCE hInstance; // Instance Handle
bool keys[256]; // Key Array
bool active=TRUE; // Program's Active
bool fullscreen=TRUE; // Default Fullscreen To True
After setting up all the standard variables, we will add some new variables. xrot, yrot and zrot will hold the current rotation values for the x, y and z axes of the onscreen object. xspeed, yspeed and zspeed will control how fast the object is rotating on each axis. cx, cy and cz control the position of the object on the screen (where it's drawn left to right cx, up and down cy and into and out of the screen cz).
The variable key is a variable that I have included to make sure the user doesn't try to morph from the first shape back into the first shape. This would be pretty pointless and would cause a delay while the points were trying to morph to the position they're already in.
step is a counter variable that counts through all the steps specified by steps. If you increase the value of steps it will take longer for the object to morph, but the movement of the points as they morph will be smoother. Once step is equal to steps we know the morphing has been completed.
The last variable morph lets our program know if it should be morphing the points or leaving them where they are. If it's TRUE, the object is in the process of morphing from one shape to another.
GLfloat xrot,yrot,zrot, // X, Y & Z Rotation
xspeed,yspeed,zspeed, // X, Y & Z Spin Speed
cx,cy,cz=-15; // X, Y & Z Position
int key=1; // Used To Make Sure Same Morph Key Is Not Pressed
int step=0,steps=200; // Step Counter And Maximum Number Of Steps
bool morph=FALSE; // Default morph To False (Not Morphing)
Now we create a structure to keep track of a vertex. The structure will hold the x, y and z values of any point on the screen. The variables x, y & z are all floating point so we can position the point anywhere on the screen with great accuracy. The structure name is VERTEX.
typedef struct // Structure For 3D Points
{
float x, y, z; // X, Y & Z Points
} VERTEX; // Called VERTEX
We already have a structure to keep track of vertices, and we know that an object is made up of many vertices so lets create an OBJECT structure. The first variable verts is an integer value that will hold the number of vertices required to make up an object. So if our object has 5 points, the value of verts will be equal to 5. We will set the value later in the code. For now, all you need to know is that verts keeps track of how many points we use to create the object.
The variable points will reference a single VERTEX (x, y and z values). This allows us to grab the x, y or z value of any point using points[{point we want to access}].{x, y or z}.
The name of this structure is... you guessed it... OBJECT!
typedef struct // Structure For An Object
{
int verts; // Number Of Vertices For The Object
VERTEX *points; // One Vertice (Vertex x,y & z)
} OBJECT; // Called OBJECT
Now that we have created a VERTEX structure and an OBJECT structure we can define some objects.
The variable maxver will be used to keep track of the maximum number of variables used in any of the objects. If one object only had 5 points, another had 20, and the last object had 15, the value of maxver would be equal to the greatest number of points used. So maxver would be equal to 20.
After we define maxver we can define the objects. morph1, morph2, morph3, morph4 & helper are all defined as an OBJECT. *sour & *dest are defined as OBJECT* (pointer to an object). The object is made up of vertices (VERTEX). The first 4 morph{num} objects will hold the 4 objects we want to morph to and from. helper will be used to keep track of changes as the object is morphed. *sour will point to the source object and *dest will point to the object we want to morph to (destination object).
int maxver; // Will Eventually Hold The Maximum Number Of Vertices
OBJECT morph1,morph2,morph3,morph4, // Our 4 Morphable Objects (morph1,2,3 & 4)
helper,*sour,*dest; // Helper Object, Source Object, Destination Object
Same as always, we declare WndProc().
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration
The code below allocates memory for each object, based on the number of vertices we pass to n. *k will point to the object we want to allocate memory for.
The line inside the { }'s allocates the memory for object k's points. A point is an entire VERTEX (3 floats). The memory allocated is the size of VERTEX (3 floats) multiplied by the number of points (n). So if there were 10 points (n=10) we would be allocating room for 30 floating point values (3 floats * 10 points).
void objallocate(OBJECT *k,int n) // Allocate Memory For Each Object
{ // And Defines points
k->points=(VERTEX*)malloc(sizeof(VERTEX)*n); // Sets points Equal To VERTEX * Number Of Vertices
} // (3 Points For Each Vertice)
The following code frees the object, releasing the memory used to create the object. The object is passed as k. The free command tells our program to release all the points used to make up our object (k).
void objfree(OBJECT *k) // Frees The Object (Releasing The Memory)
{
free(k->points); // Frees Points
}
The code below reads a string of text from a file. The pointer to our file structure is passed to *f. The variable string will hold the text that we have read in.
We start off by creating a do / while loop. fgets() will read up to 255 characters from our file f and store the characters at *string. If the line read is blank (carriage return \n), the loop will start over, attempting to find a line with text. The while() statement checks for blank lines and if found starts over again.
After the string has been read in we return.
void readstr(FILE *f,char *string) // Reads A String From File (f)
{
do // Do This
{
fgets(string, 255, f); // Gets A String Of 255 Chars Max From f (File)
} while ((string[0] == '/') || (string[0] == '\n')); // Read Again If Line Has Comment Or Is Blank
return; // Return
}
Now we load in an object. *name points to the filename. *k points to the object we wish to load data into.
We start off with an integer variable called ver. ver will hold the number of vertices used to build the object.
The variables rx, ry & rz will hold the x, y & z values of each vertex.
The variable filein is the pointer to our file structure, and oneline[ ] will be used to hold 255 characters of text.
We open the file name for read in text translated mode (meaning CTRL-Z represents the end of a line). Then we read in a line of text using readstr(filein,oneline). The line of text will be stored in oneline.
After we have read in the text, we scan the line of text (oneline) for the phrase "Vertices: {some number}{carriage return}. If the text is found, the number is stored in the variable ver. This number is the number of vertices used to create the object. If you look at the object text files, you'll see that the first line of text is: Vertices: {some number}.
After we know how many vertices are used we store the results in the objects verts variable. Each object could have a different value if each object had a different number of vertices.
The last thing we do in this section of code is allocate memory for the object. We do this by calling objallocate({object name},{number of verts}).
void objload(char *name,OBJECT *k) // Loads Object From File (name)
{
int ver; // Will Hold Vertice Count
float rx,ry,rz; // Hold Vertex X, Y & Z Position
FILE *filein; // Filename To Open
char oneline[255]; // Holds One Line Of Text (255 Chars Max)
filein = fopen(name, "rt"); // Opens The File For Reading Text In Translated Mode
// CTRL Z Symbolizes End Of File In Translated Mode
readstr(filein,oneline); // Jumps To Code That Reads One Line Of Text From The File
sscanf(oneline, "Vertices: %d\n", &ver); // Scans Text For "Vertices: ". Number After Is Stored In ver
k->verts=ver; // Sets Objects verts Variable To Equal The Value Of ver
objallocate(k,ver); // Jumps To Code That Allocates Ram To Hold The Object
We know how many vertices the object has. We have allocated memory, now all that is left to do is read in the vertices. We create a loop using the variable i. The loop will go through all the vertices.
Next we read in a line of text. This will be the first line of valid text underneath the "Vertices: {some number}" line. What we should end up reading is a line with floating point values for x, y & z.
The line is analyzed with sscanf() and the three floating point values are extracted and stored in rx, ry and rz.
for (int i=0;i<ver;i++) // Loops Through The Vertices
{
readstr(filein,oneline); // Reads In The Next Line Of Text
sscanf(oneline, "%f %f %f", &rx, &ry, &rz); // Searches For 3 Floating Point Numbers, Store In rx,ry & rz
The following three lines are hard to explain in plain english if you don't understand structures, etc, but I'll try my best :)
The line k->points[i].x=rx can be broken down like this:
rx is the value on the x axis for one of the points. points[i].x is the x axis position of point[i]. If i is 0 then were are setting the x axis value of point 1, if i is 1, we are setting the x axis value of point 2, and so on. points[i] is part of our object (which is represented as k).
So if i is equal to 0, what we are saying is: The x axis of point 1 (point[0].x) in our object (k) equals the x axis value we just read from the file (rx).
The other two lines set the y & z axis values for each point in our object.
We loop through all the vertices. If there are not enough vertices, an error might occur, so make sure the text at the beginning of the file "Vertices: {some number}" is actually the number of vertices in the file. Meaning if the top line of the file says "Vertices: 10", there had better be 10 Vertices (x, y and z values)!
After reading in all of the vertices we close the file, and check to see if the variable ver is greater than the variable maxver. If ver is greater than maxver, we set maxver to equal ver. That way if we read in one object and it has 20 vertices, maxver will become 20. If we read in another object, and it has 40 vertices, maxver will become 40. That way we know how many vertices our largest object has.
k->points[i].x = rx; // Sets Objects (k) points.x Value To rx
k->points[i].y = ry; // Sets Objects (k) points.y Value To ry
k->points[i].z = rz; // Sets Objects (k) points.z Value To rz
}
fclose(filein); // Close The File
if(ver>maxver) maxver=ver; // If ver Is Greater Than maxver Set maxver Equal To ver
} // Keeps Track Of Highest Number Of Vertices Used
The next bit of code may look a little intimidating... it's NOT :) I'll explain it so clearly you'll laugh when you next look at it.
What the code below does is calculates a new position for each point when morphing is enabled. The number of the point to calculate is stored in i. The results will be returned in the VERTEX structure.
The first variable we create is a VERTEX called a. This will give a an x, y and z value.
Lets look at the first line. The x value of the VERTEX a equals the x value of point[i] (point[i].x) in our SOURCE object minus the x value of point[i] (point[i].x) in our DESTINATION object divided by steps.
So lets plug in some numbers. Lets say our source objects first x value is 40 and our destination objects first x value is 20. We already know that steps is equal to 200! So that means that a.x=(40-20)/200... a.x=(20)/200... a.x=0.1.
What this means is that in order to move from 40 to 20 in 200 steps, we need to move by 0.1 units each calculation. To prove this calculation, multiply 0.1 by 200, and you get 20. 40-20=20 :)
We do the same thing to calculate how many units to move on both the y axis and the z axis for each point. If you increase the value of steps the movements will be even more fine (smooth), but it will take longer to morph from one position to another.
VERTEX calculate(int i) // Calculates Movement Of Points During Morphing
{
VERTEX a; // Temporary Vertex Called a
a.x=(sour->points[i].x - dest->points[i].x) / steps; // a.x Value Equals Source x - Destination x Divided By Steps
a.y=(sour->points[i].y - dest->points[i].y) / steps; // a.y Value Equals Source y - Destination y Divided By Steps
a.z=(sour->points[i].z - dest->points[i].z) / steps; // a.z Value Equals Source z - Destination z Divided By Steps
return a; // Return The Results
} // This Makes Points Move At A Speed So They All Get To Their
The ReSizeGLScene() code hasn't changed so we'll skip over it.
GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window
In the code below we set blending for translucency. This allows us to create neat looking trails when the points are moving.
int InitGL(GLvoid) // All Setup For OpenGL Goes Here
{
glBlendFunc(GL_SRC_ALPHA,GL_ONE); // Set The Blending Function For TranslucencyHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
We set the maxver variable to 0 to start off. We haven't read in any objects so we don't know what the maximum amount of vertices will be.
Next well load in 3 objects. The first object is a sphere. The data for the sphere is stored in the file sphere.txt. The data will be loaded into the object named morph1. We also load a torus, and a tube into objects morph2 and morph3.
maxver=0; // Sets Max Vertices To 0 By Default
objload("data/sphere.txt",&morph1); // Load The First Object Into morph1 From File sphere.txt
objload("data/torus.txt",&morph2); // Load The Second Object Into morph2 From File torus.txt
objload("data/tube.txt",&morph3); // Load The Third Object Into morph3 From File tube.txt
The 4th object isn't read from a file. It's a bunch of dots randomly scattered around the screen. Because we're not reading the data from a file, we have to manually allocate the memory by calling objallocate(&morph4,468). 468 means we want to allocate enough space to hold 468 vertices (the same amount of vertices the other 3 objects have).
After allocating the space, we create a loop that assigns a random x, y and z value to each point. The random value will be a floating point value from +7 to -7. (14000/1000=14... minus 7 gives us a max value of +7... if the random number is 0, we have a minimum value of 0-7 or -7).
objallocate(&morph4,486); // Manually Reserver Ram For A 4th 468 Vertice Object (morph4)
for(int i=0;i<486;i++) // Loop Through All 468 Vertices
{
morph4.points[i].x=((float)(rand()%14000)/1000)-7; // morph4 x Point Becomes A Random Float Value From -7 to 7
morph4.points[i].y=((float)(rand()%14000)/1000)-7; // morph4 y Point Becomes A Random Float Value From -7 to 7
morph4.points[i].z=((float)(rand()%14000)/1000)-7; // morph4 z Point Becomes A Random Float Value From -7 to 7
}
We then load the sphere.txt as a helper object. We never want to modify the object data in morph{1/2/3/4} directly. We modify the helper data to make it become one of the 4 shapes. Because we start out displaying morph1 (a sphere) we start the helper out as a sphere as well.
After all of the objects are loaded, we set the source and destination objects (sour and dest) to equal morph1, which is the sphere. This way everything starts out as a sphere.
objload("data/sphere.txt",&helper); // Load sphere.txt Object Into Helper (Used As Starting Point)
sour=dest=&morph1; // Source & Destination Are Set To Equal First Object (morph1)
return TRUE; // Initialization Went OK
}
Now for the fun stuff. The actual rendering code :)
We start off normal. Clear the screen, depth buffer and reset the modelview matrix. Then we position the object on the screen using the values stored in cx, cy and cz.
Rotations are done using xrot, yrot and zrot.
The rotation angle is increased based on xspeed, yspeed and zspeed.
Finally 3 temporary variables are created tx, ty and tz, along with a new VERTEX called q.
void DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The View
glTranslatef(cx,cy,cz); // Translate To The Current Position
glRotatef(xrot,1,0,0); // Rotate On The X Axis By xrot
glRotatef(yrot,0,1,0); // Rotate On The Y Axis By yrot
glRotatef(zrot,0,0,1); // Rotate On The Z Axis By zrot
xrot+=xspeed; yrot+=yspeed; zrot+=zspeed; // Increase xrot,yrot & zrot by xspeed, yspeed & zspeed
GLfloat tx,ty,tz; // Temp X, Y & Z Variables
VERTEX q; // Holds Returned Calculated Values For One Vertex
Now we draw the points and do our calculations if morphing is enabled. glBegin(GL_POINTS) tells OpenGL that each vertex that we specify will be drawn as a point on the screen.
We create a loop to loop through all the vertices. You could use maxver, but because every object has the same number of vertices we'll use morph1.verts.
Inside the loop we check to see if morph is TRUE. If it is we calculate the movement for the current point (i). q.x, q.y and q.z will hold the results. If morph is false, q.x, q.y and q.z will be set to 0 (preventing movement).
The points in the helper object are moved based on the results of we got from calculate(i). (remember earlier that we calculated a point would have to move 0.1 units to make it from 40 to 20 in 200 steps).
We adjust the each points value on the x, y and z axis by subtracting the number of units to move from helper.
The new helper point is stored in tx, ty and tz. (t{x/y/z}=helper.points[i].{x/y/z}).
glBegin(GL_POINTS); // Begin Drawing Points
for(int i=0;i<morph1.verts;i++) // Loop Through All The Verts Of morph1 (All Objects Have
{ // The Same Amount Of Verts For Simplicity, Could Use maxver Also)
if(morph) q=calculate(i); else q.x=q.y=q.z=0; // If morph Is True Calculate Movement Otherwise Movement=0
helper.points[i].x-=q.x; // Subtract q.x Units From helper.points[i].x (Move On X Axis)
helper.points[i].y-=q.y; // Subtract q.y Units From helper.points[i].y (Move On Y Axis)
helper.points[i].z-=q.z; // Subtract q.z Units From helper.points[i].z (Move On Z Axis)
tx=helper.points[i].x; // Make Temp X Variable Equal To Helper's X Variable
ty=helper.points[i].y; // Make Temp Y Variable Equal To Helper's Y Variable
tz=helper.points[i].z; // Make Temp Z Variable Equal To Helper's Z Variable
Now that we have the new position calculated it's time to draw our points. We set the color to a bright bluish color, and then draw the first point with glVertex3f(tx,ty,tz). This draws a point at the newly calculated position.
We then darken the color a little, and move 2 steps in the direction we just calculated instead of one. This moves the point to the newly calculated position, and then moves it again in the same direction. So if it was travelling left at 0.1 units, the next dot would be at 0.2 units. After calculating 2 positions ahead we draw the second point.
Finally we set the color to dark blue, and calculate even further ahead. This time using our example we would move 0.4 units to the left instead of 0.1 or 0.2. The end result is a little tail of particles following as the dots move. With blending, this creates a pretty cool effect!
glEnd() tells OpenGL we are done drawing points.
glColor3f(0,1,1); // Set Color To A Bright Shade Of Off Blue
glVertex3f(tx,ty,tz); // Draw A Point At The Current Temp Values (Vertex)
glColor3f(0,0.5f,1); // Darken Color A Bit
tx-=2*q.x; ty-=2*q.y; ty-=2*q.y; // Calculate Two Positions Ahead
glVertex3f(tx,ty,tz); // Draw A Second Point At The Newly Calculate Position
glColor3f(0,0,1); // Set Color To A Very Dark Blue
tx-=2*q.x; ty-=2*q.y; ty-=2*q.y; // Calculate Two More Positions Ahead
glVertex3f(tx,ty,tz); // Draw A Third Point At The Second New Position
} // This Creates A Ghostly Tail As Points Move
glEnd(); // Done Drawing Points
The last thing we do is check to see if morph is TRUE and step is less than steps (200). If step is less than 200, we increase step by 1.
If morph is false or step is greater than or equal to steps (200), morph is set to FALSE, the sour (source) object is set to equal the dest (destination) object, and step is set back to 0. This tells the program that morphing is not happening or it has just finished.
// If We're Morphing And We Haven't Gone Through All 200 Steps Increase Our Step Counter
// Otherwise Set Morphing To False, Make Source=Destination And Set The Step Counter Back To Zero.
if(morph && step<=steps)step++; else { morph=FALSE; sour=dest; step=0;}
}
The KillGLWindow() code hasn't changed much. The only real difference is that we free all of the objects from memory before we kill the windows. This prevents memory leaks, and is good practice ;)
GLvoid KillGLWindow(GLvoid) // Properly Kill The Window
{
objfree(&morph1); // Jump To Code To Release morph1 Allocated Ram
objfree(&morph2); // Jump To Code To Release morph2 Allocated Ram
objfree(&morph3); // Jump To Code To Release morph3 Allocated Ram
objfree(&morph4); // Jump To Code To Release morph4 Allocated Ram
objfree(&helper); // Jump To Code To Release helper Allocated Ram
if (fullscreen) // Are We In Fullscreen Mode?
{
ChangeDisplaySettings(NULL,0); // If So Switch Back To The Desktop
}
}
The CreateGLWindow() and WndProc() code hasn't changed. So I'll skip over it.
BOOL CreateGLWindow() // Creates The GL Window
LRESULT CALLBACK WndProc() // Handle For This Window
In WinMain() there are a few changes. First thing to note is the new caption on the title bar :)("Piotr Cieslak & NeHe's Morphing Points && keys[VK_ESCAPE]) // Active? Was There A Quit Received?
{
done=TRUE; // ESC or DrawGLScene Signaled A Quit
}
else // Not Time To Quit, Update Screen
{
DrawGLScene(); // Draw The Scene (Don't Draw When Inactive 1% CPU Use)
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
The code below watches for key presses. By now you should understand the code fairly easily. If page up is pressed we increase zspeed. This causes the object to spin faster on the z axis in a positive direction.
If page down is pressed we decrease zspeed. This causes the object to spin faster on the z axis in a negative direction.
If the down arrow is pressed we increase xspeed. This causes the object to spin faster on the x axis in a positive direction.
If the up arrow is pressed we decrease xspeed. This causes the object to spin faster on the x axis in a negative direction.
If the right arrow is pressed we increase yspeed. This causes the object to spin faster on the y axis in a positive direction.
If the left arrow is pressed we decrease yspeed. This causes the object to spin faster on the y axis in a negative direction.
if(keys[VK_PRIOR]) // Is Page Up Being Pressed?
zspeed+=0.01f; // Increase zspeed
if(keys[VK_NEXT]) // Is Page Down Being Pressed?
zspeed-=0.01f; // Decrease zspeed
if(keys[VK_DOWN]) // Is Down Arrow Being Pressed?
xspeed+=0.01f; // Increase xspeed
if(keys[VK_UP]) // Is Up Arrow Being Pressed?
xspeed-=0.01f; // Decrease xspeed
if(keys[VK_RIGHT]) // Is Right Arrow Being Pressed?
yspeed+=0.01f; // Increase yspeed
if(keys[VK_LEFT]) // Is Left Arrow Being Pressed?
yspeed-=0.01f; // Decrease yspeed
The following keys physically move the object. 'Q' moves it into the screen, 'Z' moves it towards the viewer, 'W' moves the object up, 'S' moves it down, 'D' moves it right, and 'A' moves it left.
if (keys['Q']) // Is Q Key Being Pressed?
cz-=0.01f; // Move Object Away From Viewer
if (keys['Z']) // Is Z Key Being Pressed?
cz+=0.01f; // Move Object Towards Viewer
if (keys['W']) // Is W Key Being Pressed?
cy+=0.01f; // Move Object Up
if (keys['S']) // Is S Key Being Pressed?
cy-=0.01f; // Move Object Down
if (keys['D']) // Is D Key Being Pressed?
cx+=0.01f; // Move Object Right
if (keys['A']) // Is A Key Being Pressed?
cx-=0.01f; // Move Object Left
Now we watch to see if keys 1 through 4 are pressed. If 1 is pressed and key is not equal to 1 (not the current object already) and morph is false (not already in the process of morphing), we set key to 1, so that our program knows we just selected object 1. We then set morph to TRUE, letting our program know it's time to start morphing, and last we set the destination object (dest) to equal object 1 (morph1).
Pressing keys 2, 3, and 4 does the same thing. If 2 is pressed we set dest to morph2, and we set key to equal 2. Pressing 3, sets dest to morph3 and key to 3.
By setting key to the value of the key we just pressed on the keyboard, we prevent the user from trying to morph from a sphere to a sphere or a cone to a cone!
if (keys['1'] && (key!=1) && !morph) // Is 1 Pressed, key Not Equal To 1 And Morph False?
{
key=1; // Sets key To 1 (To Prevent Pressing 1 2x In A Row)
morph=TRUE; // Set morph To True (Starts Morphing Process)
dest=&morph1; // Destination Object To Morph To Becomes morph1
}
if (keys['2'] && (key!=2) && !morph) // Is 2 Pressed, key Not Equal To 2 And Morph False?
{
key=2; // Sets key To 2 (To Prevent Pressing 2 2x In A Row)
morph=TRUE; // Set morph To True (Starts Morphing Process)
dest=&morph2; // Destination Object To Morph To Becomes morph2
}
if (keys['3'] && (key!=3) && !morph) // Is 3 Pressed, key Not Equal To 3 And Morph False?
{
key=3; // Sets key To 3 (To Prevent Pressing 3 2x In A Row)
morph=TRUE; // Set morph To True (Starts Morphing Process)
dest=&morph3; // Destination Object To Morph To Becomes morph3
}
if (keys['4'] && (key!=4) && !morph) // Is 4 Pressed, key Not Equal To 4 And Morph False?
{
key=4; // Sets key To 4 (To Prevent Pressing 4 2x In A Row)
morph=TRUE; // Set morph To True (Starts Morphing Process)
dest=&morph4; // Destination Object To Morph To Becomes morph4
}
Finally we watch to see if F1 is pressed if it is we toggle from Fullscreen("Piotr Cieslak & NeHe's Morphing Points Tutorial",640,480,16,fullscreen))
{
return 0; // Quit If Window Was Not Created
}
}
}
}
}
// Shutdown
KillGLWindow(); // Kill The Window
return (msg.wParam); // Exit The Program
}
I hope you have enjoyed this tutorial. Although it's not an incredibly complex tutorial, you can learn alot from the code! The animation in my dolphin demo is done in a similar way to the morphing in this demo. By playing around with the code you can come up with some really cool effects. Dots turning into words. Faked animation, and more! You may even want to try using solid polygons or lines instead of dots. The effect can be quite impressive!
Piotr's code is new and refreshing. I hope that after reading through this tutorial you have a better understanding on how to store and load object data from a file, and how to manipulate the data to create cool GL effects in your own programs! The .html for this tutorial took 3 days to write. If you notice any mistakes please let me know. Alot of it was written late at night, meaning a few mistakes may have crept in. I want these tutorials to be the best they can be. Feedback is appreciated!
RabidHaMsTeR released a demo called "Morph" before this tutorial was written that shows off a more advanced version of this effect. You can check it out yourself at /data/lessons/.
Piotr Ciesl Jay Groven ) * DOWNLOAD Linux/GLX Code For This Lesson. ( Conversion by Patrick Schubert ) * DOWNLOAD Linux/SDL Code For This Lesson. ( Conversion by DarkAlloy ) * DOWNLOAD LWJGL Code For This Lesson. ( Conversion by Mark Bernard ) * DOWNLOAD Mac OS X/Cocoa Code For This Lesson. ( Conversion by Bryan Blackburn ) * DOWNLOAD Visual Studio .NET Code For This Lesson. ( Conversion by Grant James )
< Lesson 24Lesson 26 >
NeHe™ and NeHe Productions™ are trademarks of GameDev.net, LLC
OpenGL® is a registered trademark of Silicon Graphics Inc. | http://nehe.gamedev.net/tutorial/morphing__loading_objects_from_a_file/16003/ | CC-MAIN-2013-48 | refinedweb | 5,382 | 72.87 |
Hello Everyone!
Today I am going to tell you about how to simply send SMS by using your HSDPA dongle or GSM modem. Cool!
Isn't it? yes It's not that difficult either. I have tried so many ways to accomplish this. After so many
attempts I got the way to do it right. So I will tell you how I have done that.
Basically this was created by using SMSLib which is an open source
library for Java. After studying the API I have created a simple API wrapper for convenience. I have hosted the open source code
in Github with a sample project named SMS.Dura.Wrapper. For this sample project I have made and used a
prebuilt Jar library named smsdura-1.0.jar which works as the wrapper. So in your
project you have to simply import that smsdura-1.0.jar, just configure the modem, put the
message, TP, and send. Now SMS from Java? It' s very easy! I will tell you how to do that. May be it will add more value for your project as well.
I will guide you through the rest of the process. Okay let's start!
1. First of all you have to Download this
sample project.
2. Now we have to copy few files in the <Extras folder> to your Java Classpath. [Normally JDKDIR can be found in
> C:\Program Files\Java] Go to that path and do it as said. Detailed instructions are listed below.
---------------------------
External Configurations for the JVM on the targeted machine. (Strictly Recommended!)
[These files can be found in <extras> folder of the Project path.)
---------------------------
Java Comm Installation <comm dir>
-----------------------------------
File comm.jar should go under JDKDIR/jre/lib/ext/
File javax.comm.properties should go under JDKDIR/jre/lib/
Library files (i.e. win32com.dll for Win32 or the .so Linux library files) should go under JDKDIR/jre/bin/
If you have a separate JRE directory, do the same copies for the JREDIR directory!
RxTx Installation <rxtx dir>
-----------------------------------
File RXTXcomm.jar should go under JDKDIR/jre/lib/ext/
The necessary library (e.g.. for Linux 32bit, the librxtxSerial.so) should go under JDKDIR/jre/bin/
If you have a separate JRE directory, do the same copies for the JREDIR directory!
Huh! All the hard work has been done. be cool now
3. Okay now simply open the project from Netbeans IDE or whatever IDE you are using.
4. Importing the Required Dependencies. I have imported all the Jars for this
project. So by default you have to do nothing with importing. But in your project you have to import few Jar files you can found in
<lib> folder. You have to import all the Jars in that folder.
5. Okay done! Now take a look at this code.
package logic;
import com.harshadura.gsm.smsdura.GsmModem;
public class TestSMS {
private static String port = "COM3"; //Modem Port.
private static int bitRate = 115200; //this is also optional. leave as it is.
private static String modemName = "ZTE"; //this is optional.
private static String modemPin = "0000"; //Pin code if any have assigned to the modem.
private static String SMSC = "+9477000003"; //Message Center Number ex. Mobitel
public static void main(String[] args) throws Exception {
GsmModem gsmModem = new GsmModem();
GsmModem.configModem(port, bitRate, modemName, modemPin, SMSC);
gsmModem.Sender("+94712244555", "Test Message"); // (tp, msg)
}
}
Okay in here, you will notice that you have to first find out the port number of your USB modem/dongle.
For that you can simply right click the MyComputer Icon > go to Mange > then Search for Modems > then it will pop up a interface with several tabs.
Okay then you can simply notice theirs a Name called port. In front of that there
is the port number. Now you know the port number. Insert that into the code.
Modem name is a optional thing. Give it some relevant name.
Bit rate? Leave it as it is. Or change to a proper one. The number will change depending modem to modem. so just leave as it as.
Some modems are using PIN numbers for Security. Does your one also using such a pin? If so please insert it to the code.
Well then You have to insert the SMS Message Center Number. You already know that. Suppose you own a Mobitel/Dialog SIM you can easily find out it in your Mobile phone/Dongle Message Settings. So get the Number and paste it with +94 prefix.
Wow! Now all are ready. we have completed the Configuration of the modem. Cool isnt it?
Okay now please disconnect your Modem from the Internet Before continue. If its connected to the internet or may be the Mobile Partner
or whatever the software you are using to connect with the modem, can disturb our work. So just close them All. You better restart your computer to refresh the Modem Port.
Don't Connect it to the Internet!!
Well now we are ready to send SMS thorough Java.. Be cool..!
gsmModem.Sender("+94712244555", "Test Message"); // (tp, msg)
Just put some telephone number and message for the body. Then do a Clean and Build. Now simply Run the project.
Okay everything has to be working properly.. Wait, give it some time! Did you
get the message?
So that's how we can simply send SMS using Java with our USB modem. Cool way.. huh!
Cheers! - Harsha
Please note that this is an API wrapper for SMSLib and the Main API has more functionality than this wrapper. | http://www.codeproject.com/Tips/492716/How-to-send-SMS-using-Java-with-a-HSDPA-Dongle?msg=4438019&PageFlow=FixedWidth | CC-MAIN-2015-18 | refinedweb | 916 | 78.25 |
Compute and display the daylight sky color. More...
#include <Atmosphere.hpp>
Compute and display the daylight sky color.
The sky brightness is computed with the SkyBright class, the color with the SkyLight. Don't use this class directly but use it through the LandscapeMgr.
Definition at line 40 of file Atmosphere.hpp.
Called on every update to recompute colors of the atmosphere.
Must be called at least once after a call to draw(), as vertexGrid is lazily initialized at the first draw call.
Get the average luminance of the atmosphere in cd/m2 If atmosphere is off, the luminance includes the background starlight + light pollution.
Otherwise it includes the atmosphere + background starlight + eclipse factor + light pollution.
Definition at line 77 of file Atmosphere.hpp.
Get fade in/out duration in seconds.
Definition at line 59 of file Atmosphere.hpp.
Get whether atmosphere is displayed.
Definition at line 64 of file Atmosphere.hpp.
Get the light pollution luminance in cd/m^2.
Definition at line 82 of file Atmosphere.hpp.
Get the actual atmosphere intensity due to eclipses + fader.
Definition at line 68 of file Atmosphere.hpp.
Set fade in/out duration in seconds.
Definition at line 57 of file Atmosphere.hpp.
Define whether to display atmosphere.
Definition at line 62 of file Atmosphere.hpp.
Set the light pollution luminance in cd/m^2.
Definition at line 80 of file Atmosphere.hpp. | http://stellarium.org/doc/0.12.0/classAtmosphere.html | CC-MAIN-2014-15 | refinedweb | 231 | 53.98 |
The ce_lookup cache entry lookup function looks up a cache entry for a specified URL.
#include <libproxy/cache.h> CacheEntry *ce_lookup(Session *sn, Request *rq, char *url, time_t ims_c);
NULL if caching is not enabled
A newly allocated CacheEntry structure, whether or not a copy existed in the cache. Within that structure, the ce->state field reports about the existence:
CACHE_NO signals that the document is not and will not be cached. Other fields in the cache structure may be NULL
CACHE_CREATE signals that the cache file doesn’t exist but may be created once the remote server is contacted. However, during the retrieval it may turn out that the document not be cacheable.
CACHE_REFRESH signals that the cache file exists but must be refreshed before being used. The data might still be up to date but the remote server needs to be contacted to find out. If the file is not up to date, the cache file will be replaced with the new document version sent by the remote origin server.
CACHE_RETURN_FROM_CACHE signals that the cache file exists and is up-to-date based on the configuration and current parameters controlling what is considered fresh.
CACHE_RETURN_ERROR is a signal that happens only if the proxy is set to no-network mode connect-Modenese, and the document does not exist in the cache.
Session *sn identifies the Session structure.
Request *rq identifies the Request structure.
char *url contains the name of the URL for which the cache is being sought.
time-out misc. is the if-modified-since time. | http://docs.oracle.com/cd/E19575-01/821-0049/aecec/index.html | CC-MAIN-2015-22 | refinedweb | 259 | 62.07 |
#include <qgsattributeform.h>
Definition at line 44 of file qgsattributeform.h.
Filter types.
Definition at line 63 of file qgsattributeform.h.
Form modes.
Definition at line 51 of file qgsattributeform.h.
Definition at line 63 of file qgsattributeform.cpp.
Definition at line 89 of file qgsattributeform.cpp.
Takes ownership.
Definition at line 117 of file qgsattributeform.cpp.
The aggregate filter is only useful if the form is in AggregateFilter mode.
In this case it will return a combined expression according to the chosen filters on all attribute widgets.
Definition at line 2289 of file qgsattributeform.cpp.
Notifies about changes of attributes, this signal is not emitted when the value is set back to the original one. 241 of file qgsattributeform.cpp.
Emitted when the user selects the close option from the form's button bar.
Disconnects the button box (OK/Cancel) from the accept/resetValues slots If this method is called, you have to create these connections from outside.
Definition at line 111 of file qgsattributeform.cpp.
Returns if the form is currently in editable mode.
Definition at line 122 of file qgsattributeform.cpp.
Intercepts keypress on custom form (escape should not close it)
trueif the event has been handled (key was ESC)
Definition at line 2126 of file qgsattributeform.cpp.
Definition at line 76 of file qgsattributeform.h.
Emitted when a feature is changed or added.
Emitted when a filter expression is set using the form.
Emitted when the user chooses to flash a filtered set of features.
Hides the button box (OK/Cancel) and enables auto-commit.
Definition at line 95 of file qgsattributeform.cpp.
Returns the layer for which this form is shown.
Definition at line 113 of file qgsattributeform.h.
Returns the current mode of the form.
Definition at line 127 of file qgsattributeform.h.
Emitted when the form changes mode.
reload current feature
Definition at line 1193 of file qgsattributeform.cpp.
Resets the search/filter form values.
Definition at line 770 of file qgsattributeform.cpp.
Sets all values to the values of the current feature.
Definition at line 758 of file qgsattributeform.cpp.
Save all the values from the editors to the layer.
trueif successful
Definition at line 698 of file qgsattributeform.cpp.
Sets the edit command message (Undo) that will be used when the dialog is accepted.
Definition at line 142 of file qgsattributeform.h.
Update all editors to correspond to a different feature.
Definition at line 265 of file qgsattributeform.cpp.
Sets the message bar to display feedback from the form in.
This is used in the search/filter mode to display the count of selected features.
Definition at line 2281 of file qgsattributeform.cpp.
Sets the current mode of the form.
Definition at line 127 of file qgsattributeform.cpp.
Sets all feature IDs which are to be edited if the form is in multiedit mode.
Definition at line 2201 of file qgsattributeform.cpp.
Shows the button box (OK/Cancel) and disables auto-commit.
Definition at line 104 of file qgsattributeform.cpp.
Notifies about changes of attributes.
Emitted when the user chooses to zoom to a filtered set of features.
Definition at line 463 of file qgsattributeform.h.
Definition at line 462 of file qgsattributeform.h. | https://qgis.org/api/3.10/classQgsAttributeForm.html | CC-MAIN-2020-50 | refinedweb | 533 | 61.83 |
Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
You can subscribe to this list here.
Showing
7
results of 7
> > I'd rather say that it has not been *commited* yet. It may have starte=
d an
> > insertion transaction and the "I want to be in your database" button ju=
st
> > commits the transaction. If the user goes away, it is rolled back and =
that's
> > it.
>
> Nope. This object lives across numerous pages. There may be many
> transactions begun and committed before I decide whether to create a DB
> object from the memory version. Furthermore, given the stateless nature
> of the Web, I have no way of knowing whether the object was abandoned --
> therefore, no way to know whether to rollback the database changes.
I have the same problem; I've opted to defer object creation until the
last page. It's not a big issue for me, though, because I _can't_
create it as an object until later--it wouldn't meet the schema
constraints (nonNull columns, etc.) until the last step.
It's much easier to persist earlier steps as hidden input fields in
the intermediate forms.
--
Tim Lesher <tlesher@...>
Yes! Problem was solved, thank you very much!
>
> Your test script is called sqlobject.py, and of course there is no
> SQLObject in it. Rename your script and never create a script with a name
> that conflicts with library modules!
>
> Oleg.
On Sat, Oct 08, 2005 at 01:03:33PM +0400, Nicolay A. Vasiliev wrote:
> Traceback (most recent call last):
> File "sqlobject.py", line 8, in ?
> from sqlobject import SQLObject
> File "c:\Python24\Tutors\sqlobject.py", line 8, in ?
> from sqlobject import SQLObject
> ImportError: cannot import name SQLObject
Your test script is called sqlobject.py, and of course there is no
SQLObject in it. Rename your script and never create a script with a name
that conflicts with library modules!
Oleg.
--
Oleg Broytmann phd@...
Programmers don't die, they just GOSUB without RETURN.
Hello, and thank you all for suggestions. But...
#!/usr/bin/env python
from sqlobject import SQLObject
conn = 'mysql://root@.../newcatalog';
class Person(SQLObject):
_connection = conn
firstName = StringCol()
middleInitial = StringCol(length=1, default=None)
lastName = StringCol()
Traceback (most recent call last):
File "sqlobject.py", line 8, in ?
from sqlobject import SQLObject
File "c:\Python24\Tutors\sqlobject.py", line 8, in ?
from sqlobject import SQLObject
ImportError: cannot import name SQLObject
Hi,
Seems like i need to send SET NAMES query to resolve unicode problem with
MySQL DB, how can i do this while creating sqlobject class ? (or in the other
suitable way insted of editing db confing files). Sorry, if it is stupid
question but i haven't found anything about it in documentation
Jeff Bauer wrote:
>.
Though it doesn't look pretty (there should be some special syntax for
this), you want 'postgres://jbauer@/text';. This connects over a local
socket, instead of over 127.0.0.1, and Postgres has different
authentication for the two..
all fail with
psycopg.OperationalError: FATAL: IDENT authentication
failed for user "jbauer"
What is the correct connectionForURI value for a local
postgres connection?
-Jeff | http://sourceforge.net/p/sqlobject/mailman/sqlobject-discuss/?viewmonth=200510&viewday=8 | CC-MAIN-2014-35 | refinedweb | 535 | 67.96 |
Count pairs in array whose sum is divisible by K in C++
In this tutorial, we will learn how to count pairs in an array whose sum is divisible by K in C++. Also, given an array and a number K, and we have to count pairs.
For example:
- Given arr[ ] = { 2, 4, 5, 2, 1, 6} and K = 6
- 2+4=6 and that is divisible by 6.
- 4+2 = 6 and that is divisible by 6.
- 5+1 = 6 and that is also divisible by 6.
- 6 is divisilbe by itself.
- Total number of pairs = 4
Simple Approach:
- We will iterate through every pair of the array by using two for loops.
- Count the pairs whose sum is divisible by number.
- Time complexity: O(n^2)
For better performance, we have to reduce this time complexity. So, we will go for a better approach.
Efficient Approach:
- We will use the hashing technique.
- Separate elements of an array into a bucket that separation will depend upon mathematical computation.
- Mathematical computation is their (value mod K).
- The time complexity of this hashing technique: O(n)
- Hence, we have reduced the time complexity of our code.
You may also like:
Find count of multiples of 3 or 5 in a given range in C++
Count pairs in an array whose sum is divisible by K in C++
Hence, this is implemented code:
// C++ Program to count pairs #include<iostream> #include <bits/stdc++.h> using namespace std; // Program to count pairs int countpairs(int arr[], int mani, int k) { // Create a count array to count pairs int count[k] = { 0 }; // Count occurrences of all remaind. for (int i = 0; i < mani; i++) ++count[arr[i] % k]; int sumof = count[0] * (count[0] - 1) / 2; // count for all pairs for (int i = 1; i <= k / 2 && i != (k- i); i++) sumof += count[i] * count[k - i]; if (k % 2 == 0) sumof+= (count[k / 2] * (count[k / 2] - 1) / 2); return sumof; } int main() { int arr[] = { 2, 4, 1, 2, 5, 1 }; int mani = sizeof(A) / sizeof(A[0]); int k = 6; cout << countpairs(arr,mani , k); return 0; }
Output:
OUTPUT: 4 | https://www.codespeedy.com/count-pairs-in-array-whose-sum-is-divisible-by-k-in-cpp/ | CC-MAIN-2020-40 | refinedweb | 358 | 69.62 |
The hillbilly is on a new project. Well actually, I’m on two new projects but I’m still working on how to Code Better on the one that involves stored procs in Oracle, a web site project (vs. web application project), a data access layer consisting entirely of static methods, and no unit tests except on the domain objects themselves. Suffice it to say that “maintainability” means very different things to different people.
The other project has led me to investigate REST (or, more accurately, ReST but that’s the last time I’ll call it that because that looks too alt even for my tastes). The bulk of the work for the application is going to be done via JavaScript calls to services. So in my attempt to hammer that screw with ASP.NET MVC, my first reaction was: S#arp Architecture with judicious use of JsonResult.
Luckily, my partner-in-crime is a little more rounded, and politely, but firmly, guided me away from MVC saying, “I ain’t building this app with that whore makin’ the rounds on every blog short of Wil Wheaton’s”, or something to that effect. Instead, he said a RESTful architecture may be more suitable for our goals. So I set about the task of investigating it.
There is enough out there on REST that you can find on your own, starting with the Wikipedia page. But my English teacher always told me to understand something, you should put it in your own words. In keeping with that, REST is, to my thinking, a way of architecting your application based on resources and how they are accessed. Strictly speaking, it is implementation-agnostic but for my purpose, I find it useful to tie it to HTTP because that’s the canonical example and because, well, I’m building a web app.
With respect to HTTP, REST de-emphasizes the URL (or, apparently more accurately, the URI) as the be-all and end-all of how to perform some action, like getting a list of possible moonshine bases or adding a new store to your designer clothing empire. Instead, the URL is a placeholder, basically a way of accessing the resource. What you want to do with it depends on other factors, like the HTTP verb used to get it and the data sent to the page in the HTTP header.
For example, could be a valid URL. But what it does depends on how you access it. If you use a GET verb, then you want to get the details of the menu item with ID 3. If you use a PUT (or POST, this is still kind of fuzzy to me), you would update it (or possibly add a new one with an ID 3, I think; hopefully some RESTful commenters will clarify that for me). In this case, you’d have to provide some more information to the URL in the header. Using a DELETE verb will automatically update it to the latest version of your application. I’m kidding, of course, you all know what DELETE will do.
Incidentally, none of this says anything on how the menu item will be rendered when you do a GET. Maybe it will be XML, maybe JSON, maybe some proprietary format. When you make a request, part of the information you provide is how you want the item to be returned to you. If memory serves, I think the ACCEPT HTTP header determines this.
Furthermore, HTTP defines a whole whack of return codes that we typically ignore. OK and PageNotFound are no strangers but there is also MethodNotAllowed, Created, and a bunch of others. Typically, I don’t pay any attention to them but in REST, this things have meaning and are part of the implementation.
So to sum up, the URL is just the starting point, identifying the resource with which you want to work. What you do with it depends on a host of other data provided with the request and the status code that is returned. With that bit of understanding out of the way, my next step was to see how this could potentially be implemented in .NET. (Comment if you want on the futility of doing this in .NET, I’m already neck deep in new concepts on this project. I need C# as my safety blanket.)
My first stop was still MVC and the SimplyRestful routing with MvcContrib. But that didn’t sit too well with me. It is, after all, a model-view-controller and we wouldn’t have a lot of need for the view part. In short, REST feels like an afterthought with respect to MVC.
My cohort turned me on to WCF Rest Starter Kit and we were duly impressed at the veritable fountain of information available, particularly in the form of screencasts. After checking out a couple and playing with some demo services, this looked like a step in the right direction. It seems to gel with my understanding of REST, such as it is. HTTP verbs, different content types, a URL templating mechanism, all of this appears to be handled in some form or another.
But in the back of my mind, a little voice kept saying “OpenRasta”, a framework I had followed to varying degrees over the last year or so. Based on the documentation, it seemed to be a different form of MVC implementation but with different syntax and better support for different content types.
Let me say this up front, and I’ve told the project owner, Sebastien Lambla, the same thing, this documentation is to the detriment of the project itself because the demonstration he graciously gave (at my request, I should note) was impressive as hell. And it may be too soon to tell, but it looks much, much better than the WCF implementation. Admittedly, I had originally set up the demo primarily in order to answer some general REST questions because Sebastien always seemed to be talking about it and he’s a bright guy. I had a vague idea of what OpenRasta did but I was skeptical that it could replace the sheer magnitude of marketing force behind WCF REST Starter Kit.
I’ll give you some samples from memory. Sebastien will likely chime in if they’re wrong. The following will return a Json representation of a MenuItem for a GET request:
public class MenuItemHandler { public MenuItem Get( int id ) { return new MenuItem { Id = id, OriginalSpecies = "Raccoon" }; } }
That’s it. Provided you do the proper configuration, of course, which is similar to setting up routes in MVC. But the highlights are:
- Class doesn’t need to inherit from a base class
- No need to manually serialize the object
- No need to manually specify the HTTP verb
- No need to specify the content type at all
Now, if you want to also return the object in XML format, here is what the code would then look:
// See above code
That is, your implementation code doesn’t change. In the configuration, you tell it that you’d also like to be able to handle XML requests and that’s it. The framework does everything else for you. Provided you specify the content-type in the ACCEPT header, it will use the same method to return the object in JSON or XML format.
It gets better. If you want to return this in an HTML page that spits out all the properties, again, nothing changes. You change the configuration so that it accepts HTML requests, and you set up a view for it (similar to MVC), and that’s it.
By the way, this is only one alternative. If you want more control over your status code, you can do it in a slightly more MVC-ish way:
public class MenuItemHandler { public OperationResult Get( int id ) { return new OperationResult.OK { ResponseResource = new MenuItem { Id = id, OriginalSpecies = "Raccoon" } }; } }
I’m starting to get into areas where I may not be doing the syntax justice but the idea is the same. You can specify the exact HTTP status code you’d like returned with each method.
Handling the other HTTP verbs is a simple matter of adding the methods:
public class MenuItemHandler { public MenuItem Get( int id ) { return new MenuItem { Id = id, OriginalSpecies = "Raccoon" }; } public OperationResult Post( MenuItem menuItem ) { // Update the menu item return new OperationResult.Created { ResponseResource = menuItem }; } }
All in all, colour us both very impressed. As I’ve mentioned, documentation is light and the beta and open-source nature of it may give one the willies. But given that we are both very new to REST, we got a nice warm fuzzy feeling that OpenRasta would lead us down the right path without: a) getting in our way, or b) hiding the details of REST that we need to understand to use it properly. Will report back after using it more but as it stands now, we’re basking in the afterglow of a demo gone right.
Kyle the Dazzled | http://codebetter.com/kylebaley/2009/04/19/openrasta-or-how-to-speak-rest/ | crawl-003 | refinedweb | 1,506 | 68.1 |
a) This special attribute is one of the five predefined attributes of a class. There other fours are `__name__`, `__bases__`, `__doc__`, and `__module__`.
b) As the name (dict) implies, this attribute is a dictionary object (Note to self: remember, almost everything is an object in Python), one of the built-in data type in Python. A dictionary is a set of key:value pairs surrounded by braces. Example is `{'foo' : 1, 'bar' : 2, 'baz' : 3}`.
Example 0:
>>> class Foo(object): ........ pass >>> f = Foo() >>> f.>> f.>> f._dict_ {'a': 'a', 'b': 'b'}
c) Namespace is a container that stores a set of identifiers. A container ensures uniqueness and hierarchy to all identifiers. Using a dictionary object which support these two characteristics, you can implement (identifies as keys, different data types as values ) a namespace in both modules and classes in Python. Some examples 3 of common namespace usage:
Example 1:
identifier /home/kianmeng/.bashrc (unique location) namespace /home/kianmeng (path) local name .bashrc (file name)
Example 2:
identifies (url) namespace example.com (domain) local name www (host name)
d) Object attributes referencing and assignment can be done in both ways of dot notation or direct dictionary manipulation. Comparison of both are shown below:
Example 3: Dot notation
a = o.foo o.foo = b
Example 4: Direct dictionary manipulation
a = o.___dict___["foo"] o.___dict___["foo"] = a
e) If an attribute is not found in current child class __dict__ object, Python will lookup the attribute in the parent class `__dict__` object. Attribute assignment only can be done within the current child class and not the parent class. | https://www.kianmeng.org/2012/05/lpthw-day-145-gothons-are-getting.html | CC-MAIN-2018-17 | refinedweb | 265 | 57.37 |
Nov 30, 2017 04:02 PM|chilluk|LINK
I have an XML file that represents a thesaurus of sorts (basic example) :
<?xml version="1.0" encoding="utf-8" ?> <synonyms> <group> <syn>spanner</syn> <syn>wrench</syn> </group> <group> <syn>lawnmower</syn> <syn>lawn mower</syn> <syn>grass cutter</syn> </group> </synonyms>
I need to match this to an incoming string and expand that string by all of the terms in the matching group - for example :
If someone enters the term "rotary lawnmower" I need to first match the group that contains the term "lawnmower" and then grab all the terms within that group - then my expanded string will become :
"rotary lawnmower lawn mower grass cutter"
I need an efficient way to do this without having to loop each word of my original string AND then the whole XML file for each word. In my head I am thinking I need to seek the term, and then grab the rest of the terms from within the group - but I can't fathom quite how to do this (and especially efficiently!)
Thanks.
Star
8670 Points
Dec 01, 2017 07:43 AM|Cathy Zou|LINK
Hi chilluk,
Working sample as below:
<asp:TextBox</asp:TextBox>
Code behind:
using System.Xml.Linq; protected void TextBox1_TextChanged(object sender, EventArgs e) { string search = TextBox1.Text; List<string> list1 = new List<string>(); list1.Add(search); XDocument doc = XDocument.Load(Server.MapPath("Success.xml")); var s = (doc.Descendants("synonyms").Descendants("group") .ToList() .Where(c => c.Descendants("syn") .Select(d => new { value = d.Value }).ToList() .Any(f => list1.Any(l => l.ToString().Contains(f.value))) )).Elements("syn").Select(ds=>ds.Value).ToList(); var result = String.Join(" ", s.ToArray()); Response.Write(result.Replace("lawnmower", "rotary lawnmower")); }
Output:
Best regards
Cathy
Dec 01, 2017 04:19 PM|chilluk|LINK
Ah I wonder if there is a way to extend this?
If the incoming string is multiple words, I wonder can it be matched back to the xml - for example with our lawnmower example in our file we have :
lawnmower
lawn mower
grass cutter
At the moment if someone enters "lawnmower" it matches and expands just great - but if they enter "lawn mower" then it doesn't because it's matching on individual words to what is coming in. I guess I maybe need to do it in reverse and compare the synonymns on the XML file back to the incoming string and map for individual or phrase matches?
3 replies
Last post Dec 01, 2017 04:19 PM by chilluk | https://forums.asp.net/t/2132647.aspx?Seek+a+string+value+term+in+an+XML+document | CC-MAIN-2020-10 | refinedweb | 419 | 54.66 |
QGLPixelbuffer in threads is blocking
Hello,
I am trying to use a QGLPixelbuffer in a multi threaded GL application (X11). My problem with this seems related to this discussion I have found on the web:
Generally speaking, any GL context I create in another thread than the main thread will block at some time in an arbitrary GL command until any event is triggered. Usually, moving the mouse on top of the gui window works.
I will post a very stripped down example. Here, in the main thread, I open an empty QWidget and show it, then I create another thread that opens a QGLPixelBuffer and then calls makeCurrent(), doneCurrent() repeatedly and writes dots to the console.
Expected behaviour:
console fills up with dots, because makeCurrent() and doneCurrent() do not block.
Shown behaviour:
Each call to makeCurrent() locks up (traced down to xcb_wait_event()) until the mouse is moved on top of the Gui Window, which generates events that cause makeCurrent() to unlock and continue.
Of course calling makeCurrent/doneCurrent here repeatedly does not make much sense but is meant as a minimal example of the effect. In the actual application, it might also hang when creating a texture or drawing a vertex buffer or whatever, but only very seldom.
If I instead use a glxPBuffer it seems to work as expected.
I tried Qt4.7 and Qt4.8 on Suse 11.4 and debian testing on different machines with nvidia boards, drivers 295.20 and 290.xy.
I do not know where the problem is or if I am doing something completely wrong here.
Any suggestions welcome!
[edit] I was wrong, it actually works on Debian Testing (wheezy)! It does not work on Suse 11.4 and 12.1, see my other post below.
[edit2] In the code below, QGLPixelBuffer should be created in the Gui-Thread. This does not help with the problem.
@#include <QApplication>
#include <QtOpenGL/QGLPixelBuffer>
#include <QThread>
#include <X11/Xlib.h>
#include <iostream>
using namespace std;
class MyThread : public QThread
{
public:
MyThread(QObject *parent = 0) : QThread(parent) { run_=true; start(); };
virtual ~MyThread() { run_=false; wait(); }
virtual void run();
protected:
bool run_;
};
void MyThread::run() {
QGLFormat format;
QGLPixelBuffer buffer(5,5, format);
while (run_) {
buffer.makeCurrent();
usleep(10);
buffer.doneCurrent();
cout << "." << flush;
}
}
int main(int argc, char *argv[]) {
QApplication::setAttribute(Qt::AA_X11InitThreads);
// XInitThreads();
QApplication app(argc, argv);
QWidget widget;
widget.show();
MyThread thread;
return app.exec();
}
@
Hi,
I have a very similar problem. My setup differs in that I use a normal QGLWidget as base for my threaded renderer, but the hangs are very similar. (Mouse movement and various other kinds of events wake the renderer again.)
I have found that adding sleeps to the QTimer event handler that triggers my rendering somewhat mitigates the problem, as a rule of thumb if the sleep was about the same length that the rendering itself is (20ms for me) the problem mostly disappears. Sadly I have no clue about why this helps. But since this "fix" highly depends on timing it may not work in a C++ application (I'm using qt from within python)
Another difference is that i do the XInitThreads() myself since I started my project in qt 4.6 times, but thanks to you I now know that it doesn't matter.
Since this problem has bugged my application for almost a year now, I'm seriously starting to consider a switch to windows. I tried threaded opengl there once and it simply worked out of the box...
Regards,
io-sys
[edit] one last question, did you manage to embed the results of a glxpbuffer in some kind of QWidget and if yes how?
Hi,
thanks for your reply! I think this is not a Qt bug but might be related to this xcb bug:
I dont know if the fix for this is in all the distributions yet, but I tested above code now with Suse 11.4, Suse 12.1 (both blocking) and debian testing. Here I have to correct myself: With a fully updated debian testing the code works without blocking!
My code using a glxPbuffer would open a new X connection for every buffer whereas the Qt implementation seems to reuse the same connection, triggering the problem with xcb.
But maybe it is something completely different - I do not know.
In my example code, the pbuffer should be created in the GUI thread, but that does not change the behaviour.
To use the content of your glxpbuffer in a QWidget you could use glreadpixels to read the content to an image for example. If you use the glxpbuffer as an offscreen context only you could render to framebuffers and use the resulting textures in your widgets. | https://forum.qt.io/topic/15141/qglpixelbuffer-in-threads-is-blocking | CC-MAIN-2018-30 | refinedweb | 785 | 72.56 |
Properties
Properties are a central concept in .NET languages and a foundation principal when building classes. They have several advanced features over simple field variables and their use is integrated in many way throughout class interaction. Understanding how to properties work, and more importantly how properties can make your application smarter friendlier and easier to code is vital to advancing your trade-craft as a software developer.
Why is this important to learn about?
The professional coding community uses properties extensively. Its a primary concept. Its how classes communicate with each other. If your code doesn't use them then its going to be a real headache to interact with other classes..
Properties
Properties can best be thought of as advanced variables. You call and use them like variable. From the caller's point of view
public string Name;
and
public string Name { get; set; }
are exactly the same thing. "So why do I care about properties?" is probably your first through. Because as mentioned they are an advanced construct. In reality they are a wrapper around a get and set method. Let me say that again: Properties are a wrapper around two methods. And as we know methods are exectuable code that can do things and make comparrisons and decisions. Simple variables can't do anything.
In its simplest syntax a property can be autoset, meaning it has no backing field variable (more on this in a sec., so don't panic) The Name property above is an autoset property. It has a get and a set method that contain nothing. It will act exactly like any other variable. But that's like using a Ferrari to get groceries: Its under utilizing the tools at your disposal.
The get method within the property uses an important keyword: value
That is the value being passed in. You can work with that value within the get method. The only condition on this is that as soon as you start doing these things you have to have a backing variable for the property. The value has to be stored someplace while the methods do their job. Let's see it in action so it becomes clear.
private int _Age = 0; public int Age { get { return _Age; } set { if (value < 0) value = 0; _Age = value; } }
In our example Age is the property, _Age is the backing variariable.1
If you had a simple int variable for someone's age your code would have to validate it everyplace you used it. A typical program might refer to the Age 100 times. What if somewhere in all that our calculation screwed up? Do we really want to have to qualify every calculation every time? Worse yet, what if there are new rules put into place about validating age: We would have to scrub through thousands of lines of code and copy/paste the new rules into the 100 places we do it. YUCK!
For example, what if the age was accidentally set to a negative number? Its legal for an int to be -4, but that's not a valid age. But the get method executes on incoming values. We can make an age property that does this for us one time, in one place so we don't have to validate the age in 100 places.
void SomeMethod() { // Do a bunch of fancy stuff and get information from a database // In the course of our work we update the Age property. Age = OurNewCalculatedValue; }
Let's assume that after a faulty calculation OurNewCalculatedValue is -18 instead of positive 18. Well -18 is certainly not a valid age. Let's walk through how our property will validate and overcome wrote values being passed in:
Age = OurNewCalculatedValue; // is therefore
Age = -18; // Sending -18 as the value to the set method within the Age property.
set { if (value < 0) // {which is} if (-18 < 0) so yeah, this is true value = 0; // set the value to 0 _Age = value; // set our backing field variable to our corrected value } }
What happens most of the time when the original calculation doesn't screw up? Let's assume that after a correct calculation OurNewCalculatedValue is positive 21: A perfectly valid age
set { if (value < 0) // {which is} if (21 < 0) nope, not the case value = 0; // so this line doesn't execut _Age = value; // set our backing value to the passed in value of 21 } }
So if only for the capability of centralizing the validation of values properties are well worth the time. But wait! There's more! And this one is a doozy. There is an interface called INotifyPropertyChanged. We love this! The short description is: This how a property can raise an event telling any subscriber that it's value has been changed. Picture this very common situation:
You have a window and on it are various controls with information about a persion: Name, age, address, phone number etc. When a user inputs a change you want the property to update. By the same token if the age updates from an programmatic source (like a database update) you want the GUI to update automatically. This is exactly the same as say a calculator. When the math is done the Answer property is updated and you want that to be shown on screen. Or you are writting a chat program and the Message property updates when a new message is received.... Or you are watching a USB weather station and the Temperature gets a new value so you want that on-screen.
This is pretty much how any program should work: The work class does the work and the GUI acts as an interface between the user and the work.
You could do this:
private int _Age = 0; public int Age { get { return _Age; } set { if (value < 0) value = 0; _Age = value; lbl_Age.Text = value; } } //and void lbl_Age_TextChanged(object sender, eventargs e) { Age = Convert.ToInt32(lbl_Age.Text); }
But that violates a prime rule of OOP: One clase shouldn't know more than is necessary about another class. AND your data shouldn't be tightly bound to your GUI. The problem here becomes if a designer changes the layout or names of the controls on the GUI then the data class breaks because it is calling those controls directly. And the controls would have to be made public making them vulnerable to unintentional changes... and... and... and...
So instead we want to just raise up a notice (an event) that the data has been updated. The data class doesn't know or care who's listening: That's the responsiblity of the listener to update itself. Not the responsibility of a pure data class to fix up the GUI.
All we have to do is bind the value of the GUI control to the property, then tell the property to raise a PropertyChanged event when it gets set
WPF example:
In the C# code behind we
- Line 9: add a using statement for System.ComponentModel because that's where interface INotifyPropertyChanged lives.
- line 16: Add INotifyPropertyChanged to our class signature
- Lines 40-48: Impliment the events for INotifyPropertyChanged
That stuff is just one time, to get our class prepped. You don't do that for every property.
- Line 33: When the property gets changed, raise an event saying so.
//.Collections.Generic; using System.ComponentModel; using System.Windows; namespace DicTutorial { public partial class MainWindow : Window, INotifyPropertyChanged { // Constructor method (Note lack of return type and name matches the name of the class) public MainWindow() { InitializeComponent(); } #region Property Tutorial private int _Age = 0; public int Age { get { return _Age; } set { if (value < 0) value = 0; _Age = value; RaisePropertyChanged("Age"); } } #endregion #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, e: new PropertyChangedEventArgs(propertyName)); } #endregion } }
Then on our WPF window we bind the .Value of the control to the Age property, speicfying two way. That way when the property is changed the GUI is updated, and when the GUI is changed the property is updated.
Now that all the groundwork has been laid we can add as many easy-to-bind properties as we like. For a contact card we might add Name, address and so on to our existing Age property. One of my most common uses is to give the user status updates on the status bar at the bottom of the window.
Add all we had to do was add one more property that that reports when it has a change.
private string _Status; public string Status { get { return _Status; } set { if (_Status == value) return; _Status = value; RaisePropertyChanged("Status"); } }
Now we can give the user status updates easily with a single line from any method in our application.
bool DownloadData() { // Fancy download code Status = "Download complete"; return true; } void ReceiveNewTemperatureFromWeatherStation(int NewTemp) { WriteNewTempToDatabase(NewTemp); Status = string.Format("New Temp: {0}f", NewTemp); } void ExitApplication() { Status = "Cleaning up before close"; SaveUnsavedData(); }
In Conclusion
There is even more advanced features about properties. But this tutorial is already getting pretty long. We've covered the basics about what properties are and even some intermediate stuff about cool ways to use them. Hopefully this will get you thinking, and using properties as much as possible.
See all the C# Learning Series tutorials here!
Footnotes
1Naming convention:
Spoiler | http://www.dreamincode.net/forums/topic/299601-c%23-learning-series-properties/page__pid__1743192__st__0&#entry1743192?s=665f7dea2455f5e0ce4e7f1bdfeb4b3b | CC-MAIN-2016-44 | refinedweb | 1,548 | 62.88 |
HTML <video> and <canvas> have been introduced. Those elements give developers the possibility to use multimedia technology in "native" HTML, just by writing some JavaScript in combination with HTML. A basic action that should be provided by multimedia technologies is animation. In HTML5, there are some ways to create such actions.
<video>
<canvas>
In this article, I will only compare the new <canvas>.
I am currently giving a lecture on creating WebApplications using HTML5, CSS3 and JavaScript. This is a lecture with tutorials. For one of the tutorials, I picked a sample canvas animation - just showing in which direction we are heading to with a technology like this. Then I introduced the CSS3 animation in the lecture (everyone was very excited about it) and wanted to create a simple homework task using the CSS3 animations. What came to my mind was: How easy or hard would it be to actually transform the canvas animation into a complete CSS3 animation?
This involved several parts:
<div>
The reason for using CSS3 animation over the <canvas>-element is quite important: While browsers can optimize their elements performance (regarding their style, i.e. CSS), they cannot optimize our custom drawing routines used in a canvas. The reason for this lies in the browser's ability to use hardware mainly the graphics card. Currently the browser does not give us direct access to the graphics card, i.e., every drawing operation has to go over some function in the browser first.
This problem could be prevented with techniques such as webgl, where the browser does give the developer direct access to the graphics card. However, this is treated as a security problem and will not become standardized. One important rule for developing WebApplications is standardization - since this is our portal to a huge customer base. If we excluded some of the most popular browsers, we would certainly lose a lot of potential visitors.
Our basic HTML document looks like the following:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Animations in HTML5 using the canvas element</title>
<script></script>
</head>
<body>
<canvas id="canvas" width="1000" height="600">
Your browser does not support the <code><canvas></code>-element.
Please think about updating your browser!
</canvas>
<div id="controls">
<button type="button" onclick="speed(-0.1);">Slower</button>
<button type="button" onclick="play(this);">Play</button>
<button type="button" onclick="speed(+0.1);">Faster</button>
</div>
</body>
</html>
Here we set the HTML5-Doctype and build a page containing a <canvas> for drawing the animation and some buttons contained in a panel (<div>). We could have shortened the document by omitting certain tags. One of the advantages of HTML5 is that each browser has to implement certain fallbacks, e.g., if a tag is not closed or if a certain tag is missing. The shown (more complete and verbose) form is my personal favorite.
A canvas alone would not make a great painting - nor does it give us some animation. What does the actual drawing? It's some JavaScript! The required <script>-tag is already placed in the <head>-section. In this case, we will not use external JavaScript files to get the required lines of code. This only makes sense if you consider using not many lines of code (small size) and non-repeating JavaScript. Otherwise, you could benefit from the browser's caching as well as multiple (download) connections. Another important point by using external JavaScript files is to consider moving the script-tags to the bottom of the document in order to prevent performance problems.
<script>
<head>
Let's start by declaring some variables:
var dx = 5, // Velocity at rate 1
rate = 1, // The current playback rate
ani, // The current animation loop
c, // (Drawing) Canvas Context
w, // (Car, hidden) Canvas Context
grassHeight = 130, // Height of the background
carAlpha = 0, // Rotation-angle of the tires
carX = -400, // (x-)Position of the car (will move)
carY = 300, // (y-)Position of the car (will stay constant)
carWidth = 400, // Width of the car
carHeight = 130, // Height of the car
tiresDelta = 15, // Distance from one tire to the closest edge of the
//chassis of the car
axisDelta = 20, // Distance from the bottom of the chassis of the car
//to the axis with the tires being attached
radius = 60; // Radius of one tire
// In order to init the car canvas (hidden) we use this anonymous function
(function() {
var car = document.createElement('canvas'); // Creating the element
car.height = carHeight + axisDelta + radius;// Setting the appropriate attributes
car.width = carWidth;
w = car.getContext('2d'); // Now we can set the car canvas
})(); // Executed directly
As you can see, most of the variables are actually used as constants. This means the code will give you some freedom in order to adjust the dimensions of the car as well as some other parameters like the speed of the car. The change in the rotation of the tire can actually be calculated by using the ratio of dx to the radius.
dx
radius
Another interesting property arises by looking at the bottom of the code. Here I use an anonymous function. This can be very useful in some cases. This means that variables that are declared within the scope of the anonymous function like car will be deleted by the browser and most importantly will not cause any conflicts with other existing variables.
car
Why is there a second (invisible) canvas set up? First of all, this will be useful in the transition to CSS3. However, this approach is also very useful in general. By using a canvas for each major object we are animating, we will be able to keep their states as they are, i.e. if we do not have to redraw them we do not have to as supposed to the approach where we will wipe does drawings away with a clean of the main canvas. Another reason is that this model allows us to think more physical. We do not have to animate the chassis (moving) and the tires (moving and rotating) separately, but just as a whole thing meaning the tires (rotating) within the car (moving). This projects the physical model more closely, where the tires are rotating which makes the car moving.
Starting the loop:
function play(s) { // The referenced function, s is the button
if(ani) { // If ani is not NULL we have an animation
clearInterval(ani); // So we clear (stop) the animation
ani = null; // Explicitly setting the variable to NULL
s.innerHTML = 'Play'; // Renaming the button
} else {
ani = setInterval(drawCanvas, 40); // We are starting the animation with 25 fps
s.innerHTML = 'Pause'; // Renaming the button
}
}
This function has already been referenced by the HTML we've written. Here we just start or stop the animation depending on the current state that is displayed using the ani variable. The framerate has a maximum of 25 frames per second - this might not be the best choice. jQuery is using 77 fps (13 ms) as a default for its DOM object animation. In case of this simple animation, it should give a good insight. An important issue is that our logic (dx = 5) will be bound to those 25 fps. This is something to be careful about when building professional animations or even games.
ani
dx = 5
Let's have a look at the main drawing function that will be called in the loop:
function drawCanvas() {
c.clearRect(0, 0, c.canvas.width, c.canvas.height); // Clear the (displayed) canvas
// to avoid errors
c.save(); // Saves the current state of
// properties (coordinates!)
drawGrass(); // Draws the background (grass)
c.translate(carX, 0); // Does some coordinate
// transformation
drawCar(); // Draws the car (redraws
// hidden canvas)
c.drawImage(w.canvas, 0, carY); // Draws the car actually to
// visible canvas
c.restore(); // Restores to last saved state
// (original coordinates!)
carX += dx; // Increases the position by
// the dx we set per time
carAlpha += dx / radius; // Increases the angle of the
// tires by the ratio
if(carX > c.canvas.width) // We keep some periodic
// boundary conditions
carX = -carWidth - 10; // We could also reverse the
// speed dx *= -1;
}
Basically we just redraw the image. The animation is actually coming from two little methods inside. First we use a translation of coordinates to always draw to the same coordinates but being placed on a different location. The second one is the incrementation of the car's current position. Without one of those two calls, the car would not move at all! We also outsourced as much code as possible, making it more maintainable (unfortunately this can also decrease JavaScript code performance).
Why are coordinate transformations so important? They offer us some nice possibilities: Rotating something without writing any mathematical function at all! Or as we have seen: We can just draw to the same coordinates but receive different results. This is the power of coordinate transformation. The translation method is called by using context.translate(dx, dy) and allows us to set a new center (0, 0). The usual center is the upper left corner. If we would rotate without translating at all, we would always just rotate around the upper left corner. In order to rotate around the center of a canvas, we could use something like:
context.translate(dx, dy)
context.translate(context.canvas.width / 2, context.canvas.height / 2)
Now we look at the function for drawing the car itself:
function drawCar() {
w.clearRect(0, 0, w.canvas.width, w.canvas.height); // Now we have to clear
//the hidden canvas
w.strokeStyle = '#FF6600'; // We set the color for the border
w.lineWidth = 2; // And the width of the border (in pixels)
w.fillStyle = '#FF9900'; // We also do set the color of the background
w.beginPath(); // Now we begin some drawing
w.rect(0, 0, carWidth, carHeight); // By sketching a rectangle
w.stroke(); // This should be drawn (border!)
w.fill(); // And filled (background!)
w.closePath(); // Now the close the drawing
drawTire(tiresDelta + radius, carHeight + axisDelta); // And we draw tire #1
drawTire(carWidth - tiresDelta - radius, carHeight + axisDelta);// Same routine,
//different coordinates
}
Here we used some of the possibilities that the <canvas>-element offers us. On the hand we do use paths (very simple - and in this case more or less obsolete since we could have used the drawRect() and fillRect() method. Again we outsourced some code in order to obtain a better maintainability. In this case, this is totally justified since we just have one method to take care of (drawTire()) instead of two identical code blocks that form one big mess.
drawRect()
fillRect()
drawTire()
Finally, let's have a look at the method for drawing one of the tires:
function drawTire(x, y) {
w.save(); // Again we save the state
w.translate(x, y); // And we perform a translation
// (middle of the tire should be centered)
w.rotate(carAlpha); // Now we rotate (around that center)
w.strokeStyle = '#3300FF'; // Setting the draw color
w.lineWidth = 1; // The width of the border (drawline)
w.fillStyle = '#0099FF'; // The filling / background
w.beginPath(); // Another sketching is started
w.arc(0, 0, radius, 0, 2 * Math.PI, false); // With a full circle around the center
w.fill(); // We fill this one
w.closePath(); // And close the figure
w.beginPath(); // Start a new one
w.moveTo(radius, 0); // Where we move to the left center
w.lineTo(-radius, 0); // Sketch a line to the right center
w.stroke(); // Draw the line
w.closePath(); // Close the path
w.beginPath(); // Start another path
w.moveTo(0, radius); // Move to the top center
w.lineTo(0, -radius); // And sketch a line to the bottom center
w.stroke(); // Draw the line
w.closePath(); // Close it
w.restore(); // And restoring the initial state (coordinates, ...)
}
Additionally, I've added a preview image by using the onload-event of the <body>-element. I also included a method to increase the speed of the animation by changing the value of the dx variable. The framerate will not be changed in order to increase or decrease the speed.
onload
<body>
This example can be viewed live at.
The basic HTML document now has the following format:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Animations in HTML5 using CSS3 animations</title>
<style>
</style>
</head>
<body>
<div id="container">
<div id="car">
<div id="chassis"></div>
<div id="backtire" class="tire"><div class="hr"></div><div class="vr"></div></div>
<div id="fronttire" class="tire"><div class="hr"></div><div class="vr"></div></div>
</div>
<div id="grass"></div>
</div>
</body>
</html>
The document looks quite similar to the one before. However, some things can be noted right away:
<style>
While animating something in a canvas is mostly a programming job, we clearly shifted towards a design problem here. We can only manage to animate the scene appropriately if we build a correct model of the scene using HTML-elements (well, <div>s). In this logical scenario, the <div id="container"> represents the canvas from before, <div id="car"> is the HTML-element that is equivalent to the hidden canvas of the previous example and <div id="grass"></div> is exactly the element that has been drawn using drawGrass() before.
<div id="container">
<div id="car">
<div id="grass"></div>
drawGrass()
The basic CSS outline is the following:
#container
{
position: relative; /* Relative pos. - just that we can place absolute
divs in there */
width: 100%; /* Yes this will get the whole page width */
height: 600px; /* and 600px height */
overflow: hidden; /* Really important */
}
#car
{
position: absolute; /* We position the car absolute in the container */
width: 400px; /* The total width */
height: 210px; /* The total height incl. tires and chassis */
z-index: 1; /* car is in front of the grass */
top: 300px; /* distance from the top (y-coordinate) */
left: 50px; /* distance to the left (x-coordinate) */
}
#chassis
{
position: absolute; /* This defines the space of our car w/o tires */
width: 400px; /* The total width */
height: 130px; /* The height of the chassis */
background: #FF9900; /* Some color */
border: 2px solid #FF6600; /* Some thick border */
}
.tire
{
z-index: 1; /* Always in front of the chassis */
position: absolute; /* Absolute positioned */
bottom: 0; /* Will be placed at the bottom of the car */
border-radius: 60px; /* And there is our radius ! */
height: 120px; /* 2 * radius = height */
width: 120px; /* 2 * radius = width */
background: #0099FF; /* The filling color */
border: 1px solid #3300FF; /* And the border color and width */
}
#fronttire
{
right: 20px; /* Positions the right tire with some distance to the edge */
}
#backtire
{
left: 20px; /* Positions the left tire with some distance to the edge */
}
#grass
{
position: absolute; /* Grass is absolute positioned in the container */
width: 100%; /* Takes all the width */
height: 130px; /* And some height */
bottom: 0; /* 0 distance to the bottom */
background: -webkit-linear-gradient(bottom, #33CC00, #66FF22);
background: -moz-linear-gradient(bottom, #33CC00, #66FF22);
background: -ms-linear-gradient(bottom, #33CC00, #66FF22);
background: linear-gradient(bottom, #33CC00, #66FF22); /* Currently we need
all of them */
}
.hr, .vr /* Rules for both: hr and vr */
{
position: absolute; /* Want to position them absolutely */
background: #3300FF; /* The border color */
}
.hr
{
height: 1px; /* Linewidth of 1 Pixel */
width: 100%; /* Just a straight line (horizontal) */
left: 0;
top: 60px; /* Remember 60px was the radius ! */
}
.vr
{
width: 1px; /* Linewidth of 1 Pixel */
height: 100%; /* Just a straight line (vertical) */
left: 60px; /* Remember 60px was the radius ! */
top: 0;
}
Here we use classes and IDs to attach rules one or multiple times. This can be seen best by looking at the code for creating a tire. We do use two different IDs (fronttire and backtire) for distinguishing between different positions. Since both share the rest of their properties (and a rotation!) it was just useful to give them also a class (tire) which attaches some CSS rules to the corresponding elements.
fronttire
backtire
tire
The horizontal and vertical lines will be drawn using the classes hr and vr. We can use the position: absolute; and position: relative; rules to set positions for each child-element within the mother-element. For the grass, we required a gradient to be drawn. This is no problem in CSS3. Well, maybe it is a small problem since the browser vendors are currently using vendor specific prefixes for those rules. This is an annoying fact and will hopefully vanish within the next year.
hr
vr
position: absolute;
position: relative;
A really important rule can be found in the container itself. By setting overflow: hidden; we prevent the car from escaping from our beautiful container-world. This means that the car will behave the same way as in the previous scenario, where it was not possible to draw outside the canvas-area. However, one more really important thing is missing: the animations itself!
overflow: hidden;
Definitions of the keyframes:
@keyframes carAnimation
{
0% { left: -400px; } /* Initial position */
100% { left: 1600px; } /* Final position */
}
@keyframes tyreAnimation
{
0% { transform: rotate(0); } /* Initial angle */
100% { transform: rotate(1800deg); } /* Final angle */
}
The first comment on those lines is a really important one: do not try making this at home! I do not show the real code here for a purpose. This is how it should look like. However, it does not (but it looks similar). The problem is that CSS3 keyframes are quite new and therefore (yes, you guess (or know) it) you require those prefixes again. Also CSS3 transforms do require prefixes. So just copy those lines and add -webkit- and -moz- and others (IE is about to come to the CSS3 animations party with version 10, hopefully Opera is about to follow!) in front of keyframes and transform.
-webkit-
-moz-
keyframes
transform
The next thing you'll notice is that the syntax is really clean and smooth. You just specify some keyframes (in this case just one as an initial frame and one as a final frame) and the browser will calculate the rest. However, we cannot integrate such nice physical considerations like the relation between the angle and the position from the previous example.
Now that we specified some keyframes we need to integrate them! How does that look:
#car
{
animation-name: carAnimation;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
.tire
{
animation-name: tyreAnimation;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
Again - be cautious when trying this at home. You will need some copy and paste plus you'll have to add the appropriate prefixes in front of those entries. So this tells the browser which set of keyframes to take for the element and what kind of frame distribution within which time to consider. We also tell the browser the number of repetitions to perform. In this case, we will end up with an infinite loop.
This example can be viewed live at.
Since the keyframes feature is not well supported, it is obvious that other possibilities have to be explored. One possibility is to combine the power of (available) CSS3 features such as linear gradient, transformations and transitions with the power of JavaScript. This means that we will have the best of both worlds. Even though some CSS3 features might be missing in one or the other browser, it could be possible to do quick replacements in the form of filters (possible in the Internet Explorer), images / scripts or even nested canvas elements.
The hybrid approach I am going to present right now will start off where the CSS3 keyframes example stopped. The only thing that has to be modified are all @keyframes and animation rules in the CSS stylesheet. Once these lines have been removed, we are stuck with a static image. Now we do see the environment, but nothing is happening. This is where JavaScript comes to help.
@keyframes
animation
We could start with a loop as in the canvas example. However, I do want to present a different way. Since we are dealing with DOM objects, i.e. HTML elements like a <div>, we could make use of the very effective (and cross-browser friendly) library jQuery. It is not only one of the fastest libraries - it is also one of the most popular ones. So we have to include a few new lines in the head of the HTML file. The <head> element will be extended in the following way:
<!-- Rest of Head Tag (including style Tag) -->
<script src=""></script>
<script>
//Some Script here
</script>
<!-- Finish Head here -->
Here we use jQuery as a minified version from the Google CDN. The advantage of using popular libraries from public CDN of reliable hosts is that one might need fewer requests due to caching, has less traffic on the (own) server and serves the homepage faster since the client can make more requests in parallel (the number of requests to one host is limited from the browser). Now we will write some script using jQuery's ready method. This method gives us the guarantee that the DOM has finished loading and is ready to be modified from our JavaScript.
ready
$(document).ready(function() {
var rot = 0;
// Find out prefix and set it --- could be done more generally
// but we just need it once!
var prefix = $('.tire').css('-o-transform') ? '-o-transform' : (
$('.tire').css('-ms-transform') ? '-ms-transform' : (
$('.tire').css('-moz-transform') ? '-moz-transform' : (
$('.tire').css('-webkit-transform') ?
'-webkit-transform' : 'transform')));
var origin = { /* The original point that we start from */
left : -400, // from which point do we want to start? integer -->
// value is in pixels
};
var animation = { /* The animation executed by jQuery */
left : 1600, // to which point do we want to move? since
// it is an integer it is in pixels
};
var rotate = function() { /* The function to be called for rotating the tires */
rot += 2;
$('.tire').css(prefix, 'rotate(' + rot + 'deg)');
};
var options = { /* The options to be used by jQuery */
easing: 'linear', // Only a linear easing makes sense here
duration : 10000, // 10 * 1000 ms = 10 sec.
complete : function() { // once the animation is done it should restart
$('#car').css(origin).animate(animation, options);
},
step : rotate, // call a function every step to rotate tire!
};
options.complete();
});
So what are we doing here? First, I introduce two very useful variables. One will be used in order to determine the current status of the tires. It will save the current angle of the rotation. This angle will be incremented and used to set the rotation. The second one is a shame... Actually it is based on the statements I did make with the CSS3 keyframes. At the moment, browser vendors use their own prefixes for a lot of things - even though more and more rules are being standardized, this is required. My statements are a very easy approach to find out the actual statement that will be accepted by the browser as a CSS rule to set the rotation. Another (and more general) way would be to query the navigator object which contains the browser name and more. That information could be used to set a global prefix like -o-, -moz- etc.
navigator
-o-
The next two objects are introduced to give some kind of extensibility to the code. Both will be used in order to determine starting point and end point of the animation. These objects can be extended or modified in order to produce a different animation based on the same basic environment. The rotate function will be used in each frame and will perform the rotation on the tires using jQuery's built in css() modification function.
rotate
Now we do create the options object containing the duration, the step callback and the complete callback. The last one will be used to produce the infinite loop as in the CSS3 example. We actually do set the options variable that is just created as the options reference for the jQuery animate() function. Before we call the animate() method, we use jQuery's CSS method again. This will ensure that we animate from the starting point to the end point. Here we use jQuery's chaining to make to function calls (with the selector even three) in just one JavaScript statement.
animate()
The final step is to execute the animation using our complete callback. This hybrid approach does even work in IE 9 (except the linear gradient for the grass - I did not use a filter or other methods here to guarantee compatibility). It provides a cross-browser experience in Opera, Firefox, Safari and Chrome.
This example can be viewed live at.
Yet there is another possibility that should be included in this list. This possibility is somehow out of the box, since it does not rely on HTML5 techniques like the <canvas> element or CSS3 rules like rotations. However, this is the great advantage of this technique. On the one hand, it is compatible with older browsers and on the other sides it is possible to hardware accelerate it on newer browsers. I talk about the possibility to animate SVG graphics.
SVG is another standard that has been set by the W3C. It has been around for quite a long time and is a very successful file format for seamless vector graphic exchange. Popular programs like Inkscape heavily rely on the SVG format, which is based on XML. Many browser vendors do support including SVG graphics in websites. The advantages are obvious: The graphics scale nicely and do behave like real objects. This means that a hole in graphic does infact represent a hole (cannot be clicked), and not just a bunch of pixels in a different color. With SVG, it is possible to create complex objects which can really be treated like such.
One of the first browsers to support SVG was Opera. The support had only one major drawback: SVG could just be included externally, i.e., not in the same document (HTML), but in an external *.svg file. This drawback has just now (about 3 months ago) been removed. One possible workaround was to use VML in the HTML document. VML is another description language for vectors. It was the language of choice from the Internet Explorer team. Today IE 9 also supports SVG, but former versions of IE just supported VML. How do we get around this mess (VML, SVG, ...)? We pick a JavaScript library that gives us a better cross-browser experience. Something like jQuery for SVG... That one is named RaphaelJS!
How does the basic HTML code look like?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Animations in HTML5 using CSS3 animations</title>
<style>
body
{
padding: 0;
margin: 0;
}
#container
{
position: relative; /* Relative pos. - just that we can place absolute divs
in there */
width: 100%; /* Yes this will get the whole page width */
height: 600px; /* and 600px height */
overflow: hidden; /* Really important */
}
</style>
<script src=""></script>
<script src="raphael.js"></script>
<script></script>
</head>
<body>
<div id="container"></div>
</body>
</html>
The HTML code looks a bit like one from the CSS3 keyframes or hybrid example, except we only make rules for the body and the container <div>. The container will be used for our SVG animation. We note that we include jQuery again (to use jQuery's wonderful $(document).ready() method. We also include the external JavaScript library raphael.js. This one has been downloaded from the website (raphaeljs.com/). The real work has now to be done - in JavaScript (again).
$(document).ready()
$(document).ready(function() {
var radius = 60, //Radius of the tyres
tyreDist = 15, //Distance from the edges of the chassis to the edge of a tyre
carDist = 300, //Distance from the top of the car to the top of the container
carHeight = 130, //Height of the car
carWidth = 400, //Width of the car
axisDist = 20, //Distance from the bottom of the car to the center of the tyre
grassHeight = 130, //Height of the grass
left = -400, //Starting position (left side)
diff = 2000, //Difference from final position to starting position
//(right side = 1600px in this case)
angle = 1800, //Final angle in degrees
time = 10000, //Time for the animation in ms
ease = 'linear'; //Easing mode for the animation
//creates new SVG context
var paper = Raphael('container');
//creates the grass
var grass = paper /* accesses the svg context */
.rect(0, paper.height - grassHeight, paper.width, grassHeight) /* creates the
grass rectangle */
.attr('fill', '90-#33CC00-#66FF22') /* fills the rectangle with a
(linear) gradient */
.attr('stroke-width', 0); /* no stroking for this rectangle */
//creates the chassis of the car
var chassis = paper /* accesses the svg context */
.rect(left, carDist, carWidth, carHeight) /* creates the rectangle for
the chassis of the car */
.attr('fill', '#F90') /* fills the rectangle */
.attr('stroke-width', 2) /* sets the stroke width to 2 pixels */
.attr('stroke', '#F60'); /* and sets the stroke color */
//creates the left tyre of the car
var tyre1 = paper /* accesses the svg context */
.circle(left + tyreDist + radius, carDist +
carHeight + axisDist, radius) /* creates a circle for the tyre */
.attr('fill', '#09F') /* fills the circle */
.attr('stroke', '#30F'); /* and sets the stroke color */
//creates the horizontal line of this tyre
var tyre1_lh = paper /* accesses the svg context */
.path([ /* creates a path (will be a (horizontal) line) */
'M', /* move to origin of line */
left + tyreDist, /* x */
',',
carDist + carHeight + axisDist, /* y */
'L', /* draw line till */
left + tyreDist + radius + radius, /* x */
',',
carDist + carHeight + axisDist /* y */
].join(''))
.attr('stroke', '#30F')
.attr('stroke-width', 1);
//creates the vertical line of this tyre
/* repetition of the horizontal line - just vertical */
//creates the right tyre of the car
/* about the same as with the left tyre */
//put all the stuff for the tyres in one array
var tyres = paper /* accesses the svg context */
.set() /* starts a new grouping */
.push( /* adds elements to the group */
tyre1, tyre1_lh, tyre1_lv, tyre2, tyre2_lh, tyre2_lv
);
//save the various kinds of animation endpoints (transform-tos)
var transformTo = [ 't' + diff + ',0', 'r' + angle ];
//function for the animation loop (resets everything to origin and performs animation)
var animationLoop = function() {
chassis /* accesses the chassis */
.attr('transform', '') /* resets the transformation */
.animate({ transform : transformTo[0] },
time, ease, animationLoop); /* starts the animation */
tyres /* accesses the (part of the) tyre */
.attr('transform', '') /* resets the transformation */
.animate({ transform : transformTo.join('') },
time, ease); /* starts the animation */
}
};
//starts the animation
animationLoop();
});
The code looks like a mixture of the hybrid approach with the canvas example. On the one side, we do have the same pattern; everything has to be initialized in JavaScript and not in CSS. We could write the SVG in HTML directly, however, this would take away the cross-browser advantage that Raphael is offering us. This cross-browser advantage is based on the fact that Raphael can create VML code as well - if that is the only one supported by the executing browser. Anyway: We want to stay on the save side and therefore we have to do everything in JavaScript. After initializing all the objects over the variables we introduced, we have to group them in a way and execute the animation.
As with jQuery, we have to set the callback method for finishing the animation to the animation itself. Therefore we create an infinite loop since the animation is recreated on ending. This also creates the requirement for a reset of the objects' properties. As we do see: The code as not as clean as with the hybrid approach and not as messy as with the canvas approach. After all, SVG should be your first choice if you need scalability. It would also be your first choice if you want rich mouse interaction without any hit detection happening.
This example can be viewed live at.
In my opinion, both of those methods have their benefits. The first one is actually pretty straight forward from a programmer's perspective (however, it took quite long until this was possible in HTML / JavaScript). The second one does offer some really nice features and will most certainly be used in an amazing way to build websites that will certainly have an impact on the web's future.
Pro Canvas-Animations
Pro CSS3-Animations
All in all, it will depend on the project (as usual). Even though I thought about some possible workarounds to actually stop an infinite CSS3-animation (and start again), it would be tedious to actually implement this in a bigger multimedia animation. Here, the interaction possibilities are a clear indicator for a canvas-animation. On the other side, some small (non-interactive) animations could be done by the CSS3 technique. It provides a nice clear syntax that can be GPU accelerated by modern browsers and can be styled to fit everywhere.
Update: Pro Hybrid-Approaches
I really do like the hybrid approach since it gives a lot of flexibility with a lot of comfort. It is one way to work around the CSS3 prefix hell that is going on right now - however, this argument just applies to certain situations and might totally crash in others. Another possible hybrid approach would be to build the separate parts with separate <canvas> elements and perform JavaScript (with or without jQuery) or even keyframe animations on them.
Update: Pro SVG-Animations
I like SVG, but that goes hand in hand with RaphaelJS. I tried to write SVG code by hand - several times. Every element has special attributes, every attribute has its own syntax and there are so many elements. Also you have to consider special namespaces and so on. There is a lot of mess going on and this makes a good library necessary. Since there might be some problems with some browsers a good approach contains VML code as well. Next you want to have the power of chaining (or better: the same approach as in jQuery) plus animations (also jQuery like) and lots of other features. This is all offered by RaphaelJS. I would just make one statement to SVG: I Don't Always Use SVG, but when I do I Use RaphaelJS.
While writing a lot of <canvas>-animations, I never had the opportunity to write an actual CSS3 animation. This was certainly related to the propagation of this really new technique. Now that Firefox implemented the keyframes and with Microsoft up to come we will most certainly see more keyframe rules online. I thought that this technique was quite hard to write and got really surprised how easy it is. I actually had more problems with the linear gradient syntax than the keyframes one.
My only hope is that browser vendors will stop rolling out CSS rules with those prefixes. In nightly builds or such they are acceptable, but having something in a final build that is either not the standard (why rolling it out?) or standardized (why prefixing it?) but with a prefix is just a mess for web. | http://www.codeproject.com/Articles/297741/Animations-in-HTML5 | CC-MAIN-2014-49 | refinedweb | 5,725 | 63.09 |
On 8 February 2010 14:40, Alex Sherwin <alex.sherwin@acadiasoft.com> wrote:
> I'm trying to create a "common" Sql Map XML file that will contain some
> common fragments. In iBatis 2.x this was easy enough, the fragments were
> referenced by other Sql Map files by using <include
>
>
> I assumed the same would be true for iBatis 3.x as well, but doesn't seem to
> be working for me. Right now, the only mapper I have in my config xml in the
> <mappers> element is my common xml fragment, while the rest of my mappers
> are registered with iBatis programatically. I gave my common Sql Map a
> namespace of "common", and tried to reference a statement from another
> SqlMap with <sql refid="common.params"/>, I see this exception:
I'm using something like this, which works fine:
<select id="series" parameterType="map" resultMap="...">
<where>
<include refid="seriesFilter"/>
</where>
<sql id="seriesFilter">
...
N.B. The tag I'm using is 'include', and I didn't need to qualify the sql id.
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org | http://mail-archives.apache.org/mod_mbox/ibatis-user-java/201002.mbox/%3Ca54079f21002080701q1cc8e06apc1adfedb61a7d217@mail.gmail.com%3E | CC-MAIN-2018-34 | refinedweb | 195 | 57.47 |
Java generics, add all int / vectors to the list
I am learning generics in Java from C ++ and am confused how to do math without operator overloading. Let's say I want to write a class
sumList
that is a list with a sum method.
public class sumList<T extends CanAdd<T>> { private List<T> list; public sumList() { list = new List<T>(); } public void addElement(T t) { list.add(t); } public T getSum() { T ans = null; for (T t : list) { if (ans == null) { ans = t; } else { ans = ans.plus(t); } } return ans; } }
and the interface I'm using is just:
public interface CanAdd<T> { // returns a new T that the sum of the object + other public T plus(T other); }
So it's easy enough when I create
sumList
classes that I create, for example,
Vector
or
Point
because I can add a plus method defined by the interface. However, how do I change
sumList
so that I can create
sumList<Double>
or
sumList<Integer>
?
Editing: Minor bugs fixed.
source to share
As Caleb said, if you only need this to work with Java numbers, you don't have to worry about the interface and just use T extends Number.
But if you really want to make it more general and use your canAdd interface, then you need to write a wrapper class around the Number object and use that instead.
EDIT
You may be looking at this the wrong way. Instead of the classes that populate your list have specific behavior (in this case, the sum), you should instead take some useful tricks from functional programming.
You can write methods for displaying, reducing, and filtering in Java. You have some pattern to get you to the point where you can use them, but then you can easily create a reduction function for each type of object you want to sum and then apply it to your list.
source to share
Why not just use the base class Double and Integer, Number?
public class sumList<T extends Number>
Thus, there is no need to implement the canAdd interface or create wrappers to use paired and integers with this interface.
Edit: but if you really need to make this work for custom classes, I think you need to create a wrapper class that will provide the required appAdd interface.
Or use a language like Scala or Groovy that gives you access to mixins!
source to share | https://daily-blog.netlify.app/questions/1895182/index.html | CC-MAIN-2021-43 | refinedweb | 405 | 66.57 |
FeedDemon RSS reader among others things has Watches functions. Instead of specific RSS it searches feeds for keywords and combines found items together into mashup.
It works very well except that manual input of keywords is too troublesome to create complex Watches. I wanted to create Watch integrated with Appnews internals and started to look for external keywords edit.
Watch format
I remembered that when setting up new backup routine for Cobian Backup (inspired by my computer meltdown, yeah I am still talking about that) I saw Watches saved with rest of FeedDemon settings in:
C:\Documents and Settings\[profile]\Local Settings\Application Data \FeedDemon\v1\Watches\
That folder has bunch of files with really cryptic names and .RSSW extensions. Inside each file is XML that holds all setting for a watch, including set of keywords:
Something like this:
<watch xmlns: <title>Appnews</title><fd:state fd: <location title="true" description="false"/><options wholeWords="true" matchCase="false" matchAllWords="false" markReadInSourceFeed="false"/> <keyword>Appnews</keyword></watch>
So after creating Watch in FeedDemon I can find it by <title> and add all <keyword> I need.
AutoIt
As always AutoIt is my first choice for simple programming tasks. I decided to make a function that will:
- Find specific Watch file by Watch name.
- Change keywords in Watch as I need.
Step by step
Start. Array include is needed for some functions down the road. Function declaration – takes two parameters – name of Watch to edit and array of keywords.
#include <Array.au3> Func UpdateWatch($title,$array)
Set up Watches directory and stops if not found. Uses @UserProfileDir macros to include profile of user in path.
$path=@UserProfileDir&"\Local Settings\Application Data \FeedDemon\v1\Watches\" If Not FileExists($path) Then MsgBox(0,"","Watches directory not found") Return EndIf
Set up search for specific Watch. Little tricky to understand but that’s how general file search mechanics in Windows go. Change directory to Watches, try to look for files that fit *.rssw format, stop if not found.
FileChangeDir($path) $search=FileFindFirstFile("*.rssw") If $search=-1 Then MsgBox(0,"","Search error") Return EndIf
Actual search. We are going through all files, looking for the one that has title equal to what was passed to function. If nothing is found we break search and stop function.
$watch=False $pattern="<title>"&$title&"</title>" While Not $watch $file = FileFindNextFile($search) If @error Then ExitLoop If StringInStr(FileRead($file),$pattern) Then $watch=$file WEnd FileClose($search) If Not $watch Then MsgBox(0,"","Watch not found") Return EndIf
Keywords array preparation. For each item in array passed to function content is enclosed in keyword tags.
$s=UBound($array)-1 For $i=0 To $s $array[$i]="<keyword>"&$array[$i]&"</keyword>" Next
File edit. Read Watch file. Replace everything from start of keywords to the end with keywords from array. Write file back (with creating backup copy to be safe).
$xml=FileRead($watch) FileCopy($watch,$watch&".bak") $pattern="(<keyword>.*)" $replace=_ArrayToString($array,"")&"</watch>" $xml=StringRegExpReplace($xml,$pattern,$replace) FileDelete($watch) FileWrite($watch,$xml) EndFunc
And all together:
Script
For results to show up in FeedDemon it must be restarted after running function.
Overall
So instead of tedious manual input now I just feed list of program titles from Appnews managing software into Watch. Ensures that I don’t miss anything and (at times) makes me feel great when I beat software portals at update speed. :)
What would you track with large list of keywords?
1 Comment
FeedDemon gets native tool to filter feed content | Rarst.net #
[…] Filters are very similar to Watches, except they don’t create separate item in feeds tree and are applied to specified feeds […] | https://www.rarst.net/code/feeddemon-update-watch/ | CC-MAIN-2019-30 | refinedweb | 605 | 55.24 |
This section documents all changes and bug fixes that have been applied in MySQL Cluster Manager 1.4.3 since the release of MySQL Cluster Manager version 1.4.2.
Agent: CPU usage during idle time for the mcmd agents has been significantly reduced. (Bug #26227736)
Agent: A new error code,
Error 7030, has been created for failed ndb_mgmd commands and mysqld queries. (Bug #26160968)
Agent: Added support for the
skip_networkingsystem variable for mysqld nodes, allowing mysqld nodes of a managed cluster to communicate with client applications using named pipes or shared memory on Windows platforms, and socket files on Unix-like platforms.
Notice that, however, communication between mcmd agents and mcm clients using named pipes, shared memory, or socket files remain unsupported. (Bug #25992390, Bug #25974499)
Client: The
start cluster
--initialcommand now reinitializes the SQL nodes (if their data directories are empty) as well as the data nodes of an NDB Cluster. A new option,
--skip-init, has been introduced, for specifying a comma-separated list of the SQL nodes for which reinitialization is to be skipped. (Bug #25856285, Bug #85713)
Client: Checksum verification has been added for all cluster reconfiguration plans created by the mcmd agents. Checksums for plans created locally are shared among all agents, and when the checksums do not match, the reconfiguration is aborted. This prevents agents from executing different plans. (Bug #23225839)
Files have been removed from the MySQL Cluster Manager + NDB Cluster bundled package, in order to reduce the package size significantly. (Bug #25916635)
Agent: When the
list nextnodeidscommand was run against a cluster with the maximum number of nodes allowed, the mcmd agent quit unexpectedly. With this fix, the situation is properly handled. (Bug #26286531)
Agent: For a cluster with
NoOfReplicas
=1, trying to stop a data node with the stop process command would cause the agent to quit unexpectedly. (Bug #26259780)
Agent: When a data node was killed by an arbitrator in a situation of network partitioning, an mcmd failed to handle the exit report from the node and quit unexpectedly. It was due to a mishandling of the nodegroup information, which this fix corrects. (Bug #26192412)
Agent: A cluster could not be started if a relative path had been used for the
--manager-directoryoption to set the location of the agent repository. (Bug #26172299)
Agent: When executing a user command, the mcmd agent could hang if the expected reply from another agent never arrived. This fix improves the timeout handling to avoid such hangs. (Bug #26168339)
Agent: While running the
import configcommand, the mcmd agents that were present during the earlier dryrun for the import would become silent and then unavailable. This was due to some hostname resolution issues, which has been addressed by this fix. (Bug #26089906)
Agent: A collect log command sometimes failed at the middle with an ERROR 1003 Internal error: No clients connected. It was because the mcmd agent reset the copy completion marker prematurely; the behavior has been stopped by this fix. (Bug #26086958)
Agent: When the mcmd agents' clocks ran out of sync due to time drifts on virtual machines running Windows operations systems and then the clocks ran in sync again, communications among the agents failed. This fix prevents the problem by making the agents use a monotonic timer for their communication. (Bug #26084090)
Agent: The dropping or recreating of a node group that took place when adding data nodes could sometimes fail with an assertion error (“Polled nodegroup info is inconsistent”). This fix relaxes the assertion, which allows the node group reconfiguration to be completed. (Bug #26051753)
References: See also: Bug #20104357.
Agent: During an execution of a
setcommand, if no mysqld node is available for querying cluster information, an mcmd agent timed out while waiting for the “prepared” message from another agent, even after the message was already sent. This was due to the fact that the two agents had inconsistent plans of execution for the
setcommand. This fix prevents the inconsistency. (Bug #26021616)
References: This issue is a regression of: Bug #14230789, Bug #23148061.
Agent: A
backup cluster
--waitcompletedtimed out sometimes right before the backup was completed when there were a lot of tables to be backed up. This was because the logical backup for the tables' metadata was taking too long in that case. With this fix, the mcmd agent is now sent progress reports of the logical backup, and the backup does not time out unless no more progress reports are received. (Bug #26000482)
Agent: When a
setcommand involved a restart of data nodes of a cluster but one of the data nodes had been stopped, the
setcommand failed with a timeout. With this fix, the
setcommand is carried out successfully with a rolling restart for the data nodes. (Bug #25869325)
Agent: If a mysqld node was configured with the
skip_name_resolvesystem variable enabled, attempts for mcmd to connect to the mysqld node would fail with the error message
Host '127.0.0.1' is not allowed to connect to this MySQL server. This was because the MySQL account used by mcmd had
127.0.0.1as its host name, which is not allowed when
skip_name_resolveis enabled on the mysqld node. This fix corrects the account host name to
localhost. (Bug #25831764, Bug #85620)
Agent: When a host and its mcmd agent were restarted, mcmd might fail to restart a management or mysqld node on the host, and the
show statuscommand continuously returned the status of the node to be
unknown. (Bug #25822822)
Agent: When an mcmd agent was in the process of shutting down, a user command issued then might cause the agent to quit unexpectedly. With this fix, an error message “Agent is shutting down” is returned, and the agent continues with its shutdown. (Bug #25055338)
Agent: When a
setcommand involved a restart of data nodes of a cluster but one of the data nodes was in the
failedstate, mcmd restarted the data node, and then restarted it once more as part of a rolling restart, which was unnecessary. This fix eliminates the second restart. (Bug #23586651)
Client: After an agent was started and a few commands had been executed from the mcm client, the
show settingscommand started returning the wrong value for the
--log-leveloption. (Bug #26189795)
Client: Trying to set the mysqld node option
--validate-passwordresulted in an error complaining that the parameter did not exist, even if the Password Validation Plugin had already been installed on the mysqld node. It was due to some errors with the plug-in activation for
mysqldnodes, which have now been corrected. (Bug #25797125) | https://dev.mysql.com/doc/relnotes/mysql-cluster-manager/1.4/en/news-1-4-3.html | CC-MAIN-2019-47 | refinedweb | 1,095 | 58.52 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.